@eui/core 18.0.0-rc.34 → 18.0.0-rc.35

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.
@@ -2324,113 +2324,115 @@ const handleError = (error) => {
2324
2324
  const isDefined = (value) => value !== undefined && value !== null;
2325
2325
 
2326
2326
  class CssUtils {
2327
- static { this.getCssVarValue = (inputProperty) => {
2327
+ static { this.getCssVarValue = (inputProperty, document) => {
2328
2328
  return getComputedStyle(document.documentElement).getPropertyValue(inputProperty);
2329
2329
  }; }
2330
- static { this.setCssVarValue = (propertyName, propertyValue) => {
2330
+ static { this.setCssVarValue = (propertyName, propertyValue, document) => {
2331
2331
  document.documentElement.style.setProperty(propertyName, propertyValue);
2332
2332
  }; }
2333
- static { this.setCssVar = (inputProperty, outputProperty) => {
2334
- const cssVarValue = this.getCssVarValue(inputProperty);
2335
- this.setCssVarValue(outputProperty, cssVarValue);
2333
+ static { this.setCssVar = (inputProperty, outputProperty, document) => {
2334
+ const cssVarValue = this.getCssVarValue(inputProperty, document);
2335
+ this.setCssVarValue(outputProperty, cssVarValue, document);
2336
2336
  }; }
2337
- static { this.initCssVars = () => {
2338
- this.setCssVar('--eui-app-header-height-default', '--eui-app-header-height');
2339
- this.setCssVar('--eui-app-breadcrumb-height-default', '--eui-app-breadcrumb-height');
2340
- this.setCssVar('--eui-app-top-message-height-default', '--eui-app-top-message-height');
2341
- this.setCssVar('--eui-app-toolbar-height-default', '--eui-app-toolbar-height');
2342
- this.setCssVar('--eui-app-sidebar-width-default', '--eui-app-sidebar-width');
2343
- this.setCssVar('--eui-app-sidebar-width-close-default', '--eui-app-sidebar-width-close');
2344
- this.setCssVar('--eui-app-sidebar-header-height-default', '--eui-app-sidebar-header-height');
2345
- this.setCssVar('--eui-app-sidebar-footer-height-default', '--eui-app-sidebar-footer-height');
2337
+ static { this.initCssVars = (document) => {
2338
+ this.setCssVar('--eui-app-header-height-default', '--eui-app-header-height', document);
2339
+ this.setCssVar('--eui-app-breadcrumb-height-default', '--eui-app-breadcrumb-height', document);
2340
+ this.setCssVar('--eui-app-top-message-height-default', '--eui-app-top-message-height', document);
2341
+ this.setCssVar('--eui-app-toolbar-height-default', '--eui-app-toolbar-height', document);
2342
+ this.setCssVar('--eui-app-sidebar-width-default', '--eui-app-sidebar-width', document);
2343
+ this.setCssVar('--eui-app-sidebar-width-close-default', '--eui-app-sidebar-width-close', document);
2344
+ this.setCssVar('--eui-app-sidebar-header-height-default', '--eui-app-sidebar-header-height', document);
2345
+ this.setCssVar('--eui-app-sidebar-footer-height-default', '--eui-app-sidebar-footer-height', document);
2346
2346
  }; }
2347
2347
  // eslint-disable-next-line
2348
- static { this.getBreakpointValues = () => {
2348
+ static { this.getBreakpointValues = (document) => {
2349
2349
  const breakpoints = [];
2350
- const xs = this.getCssVarValue('--eui-bp-xs');
2350
+ const xs = this.getCssVarValue('--eui-bp-xs', document);
2351
2351
  breakpoints.push({ bkp: 'xs', pxValue: xs, value: xs.replace('px', '') });
2352
- const sm = this.getCssVarValue('--eui-bp-sm');
2352
+ const sm = this.getCssVarValue('--eui-bp-sm', document);
2353
2353
  breakpoints.push({ bkp: 'sm', pxValue: sm, value: sm.replace('px', '') });
2354
- const md = this.getCssVarValue('--eui-bp-md');
2354
+ const md = this.getCssVarValue('--eui-bp-md', document);
2355
2355
  breakpoints.push({ bkp: 'md', pxValue: md, value: md.replace('px', '') });
2356
- const lg = this.getCssVarValue('--eui-bp-lg');
2356
+ const lg = this.getCssVarValue('--eui-bp-lg', document);
2357
2357
  breakpoints.push({ bkp: 'lg', pxValue: lg, value: lg.replace('px', '') });
2358
- const xl = this.getCssVarValue('--eui-bp-xl');
2358
+ const xl = this.getCssVarValue('--eui-bp-xl', document);
2359
2359
  breakpoints.push({ bkp: 'xl', pxValue: xl, value: xl.replace('px', '') });
2360
- const xxl = this.getCssVarValue('--eui-bp-xxl');
2360
+ const xxl = this.getCssVarValue('--eui-bp-xxl', document);
2361
2361
  breakpoints.push({ bkp: 'xxl', pxValue: xxl, value: xxl.replace('px', '') });
2362
- const fhd = this.getCssVarValue('--eui-bp-fhd');
2362
+ const fhd = this.getCssVarValue('--eui-bp-fhd', document);
2363
2363
  breakpoints.push({ bkp: 'fhd', pxValue: fhd, value: fhd.replace('px', '') });
2364
- const twok = this.getCssVarValue('--eui-bp-2k');
2364
+ const twok = this.getCssVarValue('--eui-bp-2k', document);
2365
2365
  breakpoints.push({ bkp: '2k', pxValue: twok, value: twok.replace('px', '') });
2366
- const fourk = this.getCssVarValue('--eui-bp-4k');
2366
+ const fourk = this.getCssVarValue('--eui-bp-4k', document);
2367
2367
  breakpoints.push({ bkp: '4k', pxValue: fourk, value: fourk.replace('px', '') });
2368
2368
  return breakpoints;
2369
2369
  }; }
2370
- static { this.activateEditModeCssVars = (isActive) => {
2370
+ static { this.activateEditModeCssVars = (isActive, document) => {
2371
2371
  if (isActive) {
2372
- this.setCssVarValue('--eui-docpage-navigation-z-index', 'inherit'); // Reset doc-page-navigation-column z-index
2373
- this.setCssVarValue('--eui-z-index-sidebar', 'inherit'); // Reset eui-app-sidebar z-index
2374
- this.setCssVarValue('--eui-z-index-root', 'inherit'); // Reset eui-app-main-content z-index
2372
+ this.setCssVarValue('--eui-docpage-navigation-z-index', 'inherit', document); // Reset doc-page-navigation-column z-index
2373
+ this.setCssVarValue('--eui-z-index-sidebar', 'inherit', document); // Reset eui-app-sidebar z-index
2374
+ this.setCssVarValue('--eui-z-index-root', 'inherit', document); // Reset eui-app-main-content z-index
2375
2375
  }
2376
2376
  else {
2377
- this.setCssVarValue('--eui-docpage-navigation-z-index', '2'); // Restore doc-page-navigation-column z-index
2378
- this.setCssVarValue('--eui-z-index-sidebar', '1044'); // Restore eui-app-sidebar z-index
2379
- this.setCssVarValue('--eui-z-index-root', '1'); // Restore eui-app-main-content z-index
2377
+ this.setCssVarValue('--eui-docpage-navigation-z-index', '2', document); // Restore doc-page-navigation-column z-index
2378
+ this.setCssVarValue('--eui-z-index-sidebar', '1044', document); // Restore eui-app-sidebar z-index
2379
+ this.setCssVarValue('--eui-z-index-root', '1', document); // Restore eui-app-main-content z-index
2380
2380
  }
2381
2381
  }; }
2382
- static { this.activateHeaderCssVars = () => {
2383
- this.setCssVar('--eui-app-header-height-active', '--eui-app-header-height');
2382
+ static { this.activateHeaderCssVars = (document) => {
2383
+ this.setCssVar('--eui-app-header-height-active', '--eui-app-header-height', document);
2384
2384
  }; }
2385
- static { this.activateBreadcrumbCssVars = () => {
2386
- this.setCssVar('--eui-app-breadcrumb-height-active', '--eui-app-breadcrumb-height');
2385
+ static { this.activateBreadcrumbCssVars = (document) => {
2386
+ this.setCssVar('--eui-app-breadcrumb-height-active', '--eui-app-breadcrumb-height', document);
2387
2387
  }; }
2388
- static { this.activateTopMessageCssVars = (height) => {
2389
- this.setCssVarValue('--eui-app-top-message-height', `${height}px`);
2388
+ static { this.activateTopMessageCssVars = (height, document) => {
2389
+ this.setCssVarValue('--eui-app-top-message-height', `${height}px`, document);
2390
2390
  }; }
2391
- static { this.activateToolbarCssVars = () => {
2392
- this.setCssVar('--eui-app-toolbar-height-active', '--eui-app-toolbar-height');
2391
+ static { this.activateToolbarCssVars = (document) => {
2392
+ this.setCssVar('--eui-app-toolbar-height-active', '--eui-app-toolbar-height', document);
2393
2393
  }; }
2394
- static { this.activateFooterCssVars = () => {
2395
- this.setCssVar('--eui-app-footer-height-active', '--eui-app-footer-height');
2394
+ static { this.activateFooterCssVars = (document) => {
2395
+ this.setCssVar('--eui-app-footer-height-active', '--eui-app-footer-height', document);
2396
2396
  }; }
2397
- static { this.setHeaderShrinkCssVar = (active) => {
2397
+ static { this.setHeaderShrinkCssVar = (active, document) => {
2398
2398
  if (active) {
2399
- this.setCssVar('--eui-app-header-height-shrink', '--eui-app-header-height');
2399
+ this.setCssVar('--eui-app-header-height-shrink', '--eui-app-header-height', document);
2400
2400
  }
2401
2401
  else {
2402
- this.setCssVar('--eui-app-header-height-active', '--eui-app-header-height');
2402
+ this.setCssVar('--eui-app-header-height-active', '--eui-app-header-height', document);
2403
2403
  }
2404
2404
  }; }
2405
- static { this.activateSidebarCssVars = () => {
2406
- this.setCssVar('--eui-app-sidebar-width-active', '--eui-app-sidebar-width');
2407
- this.setCssVar('--eui-app-sidebar-width-close-active', '--eui-app-sidebar-width-close');
2405
+ static { this.activateSidebarCssVars = (document) => {
2406
+ this.setCssVar('--eui-app-sidebar-width-active', '--eui-app-sidebar-width', document);
2407
+ this.setCssVar('--eui-app-sidebar-width-close-active', '--eui-app-sidebar-width-close', document);
2408
2408
  }; }
2409
- static { this.removeSidebarCssVars = () => {
2409
+ static { this.removeSidebarCssVars = (document) => {
2410
2410
  document.documentElement.style.removeProperty('--eui-app-sidebar-header-height');
2411
2411
  document.documentElement.style.removeProperty('--eui-app-sidebar-footer-height');
2412
2412
  document.documentElement.style.removeProperty('--eui-app-sidebar-width');
2413
2413
  document.documentElement.style.removeProperty('--eui-app-sidebar-width-close');
2414
2414
  }; }
2415
- static { this.activateSidebarHeaderCssVars = () => {
2416
- this.setCssVar('--eui-app-sidebar-header-height-active', '--eui-app-sidebar-header-height');
2415
+ static { this.activateSidebarHeaderCssVars = (document) => {
2416
+ this.setCssVar('--eui-app-sidebar-header-height-active', '--eui-app-sidebar-header-height', document);
2417
2417
  }; }
2418
- static { this.activateSidebarFooterCssVars = () => {
2419
- this.setCssVar('--eui-app-sidebar-footer-height-active', '--eui-app-sidebar-footer-height');
2418
+ static { this.activateSidebarFooterCssVars = (document) => {
2419
+ this.setCssVar('--eui-app-sidebar-footer-height-active', '--eui-app-sidebar-footer-height', document);
2420
2420
  }; }
2421
2421
  /**
2422
- * Gets the viewport height and width and multiple it by 1% to get a value for a vh/vw unit
2422
+ * Gets the viewport height and width and multiply it by 1% to get a value for a vh/vw unit
2423
2423
  * Sets the value in the --eui-app-vh custom property to the root of the document
2424
2424
  * Sets the value in the --eui-app-vw custom property to the root of the document
2425
2425
  * Example for 100% height: calc(var(--eui-app-vh, 1vh) * 100);
2426
2426
  * Example for 50% height: calc(var(--eui-app-vh, 1vh) * 50);
2427
2427
  * Example for 50% width: calc(var(--eui-app-vw, 1vw) * 50);
2428
2428
  */
2429
- static setAppViewportCssVars() {
2430
- const vh = window.innerHeight * 0.01;
2431
- const vw = window.innerWidth * 0.01;
2432
- this.setCssVarValue('--eui-app-vh', `${vh}px`);
2433
- this.setCssVarValue('--eui-app-vw', `${vw}px`);
2429
+ static setAppViewportCssVars(platform) {
2430
+ if (isPlatformBrowser(platform)) {
2431
+ const vh = window.innerHeight * 0.01;
2432
+ const vw = window.innerWidth * 0.01;
2433
+ this.setCssVarValue('--eui-app-vh', `${vh}px`, document);
2434
+ this.setCssVarValue('--eui-app-vw', `${vw}px`, document);
2435
+ }
2434
2436
  }
2435
2437
  }
2436
2438
 
@@ -2913,10 +2915,11 @@ class EuiAppShellService {
2913
2915
  isDimmerActive: isActive,
2914
2916
  });
2915
2917
  }
2916
- constructor(config, http, platformId, router, storeService, i18nService) {
2918
+ constructor(config, http, platformId, document, router, storeService, i18nService) {
2917
2919
  this.config = config;
2918
2920
  this.http = http;
2919
2921
  this.platformId = platformId;
2922
+ this.document = document;
2920
2923
  this.router = router;
2921
2924
  this.storeService = storeService;
2922
2925
  this.i18nService = i18nService;
@@ -3006,14 +3009,14 @@ class EuiAppShellService {
3006
3009
  ...this.state,
3007
3010
  isDimmerActive: !isActive,
3008
3011
  });
3009
- CssUtils.activateEditModeCssVars(!isActive);
3012
+ CssUtils.activateEditModeCssVars(!isActive, this.document);
3010
3013
  }
3011
3014
  setDimmerActiveState(activeState) {
3012
3015
  this.setState({
3013
3016
  ...this.state,
3014
3017
  isDimmerActive: activeState,
3015
3018
  });
3016
- CssUtils.activateEditModeCssVars(activeState);
3019
+ CssUtils.activateEditModeCssVars(activeState, this.document);
3017
3020
  }
3018
3021
  // --------------
3019
3022
  // public methods
@@ -3032,42 +3035,42 @@ class EuiAppShellService {
3032
3035
  hasSidebar: true,
3033
3036
  });
3034
3037
  if (!this.state.isSidebarHidden) {
3035
- CssUtils.activateSidebarCssVars();
3038
+ CssUtils.activateSidebarCssVars(this.document);
3036
3039
  }
3037
3040
  }
3038
3041
  activateSidebarHeader() {
3039
- CssUtils.activateSidebarHeaderCssVars();
3042
+ CssUtils.activateSidebarHeaderCssVars(this.document);
3040
3043
  }
3041
3044
  activateSidebarFooter() {
3042
- CssUtils.activateSidebarFooterCssVars();
3045
+ CssUtils.activateSidebarFooterCssVars(this.document);
3043
3046
  }
3044
3047
  activateHeader() {
3045
3048
  this.setState({
3046
3049
  ...this.state,
3047
3050
  hasHeader: true,
3048
3051
  });
3049
- CssUtils.activateHeaderCssVars();
3052
+ CssUtils.activateHeaderCssVars(this.document);
3050
3053
  }
3051
3054
  activateBreadcrumb() {
3052
3055
  this.setState({
3053
3056
  ...this.state,
3054
3057
  hasBreadcrumb: true,
3055
3058
  });
3056
- CssUtils.activateBreadcrumbCssVars();
3059
+ CssUtils.activateBreadcrumbCssVars(this.document);
3057
3060
  }
3058
3061
  activateTopMessage(height) {
3059
3062
  this.setState({
3060
3063
  ...this.state,
3061
3064
  hasTopMessage: true,
3062
3065
  });
3063
- CssUtils.activateTopMessageCssVars(height);
3066
+ CssUtils.activateTopMessageCssVars(height, this.document);
3064
3067
  }
3065
3068
  activateToolbar() {
3066
3069
  this.setState({
3067
3070
  ...this.state,
3068
3071
  hasToolbar: true,
3069
3072
  });
3070
- CssUtils.activateToolbarCssVars();
3073
+ CssUtils.activateToolbarCssVars(this.document);
3071
3074
  }
3072
3075
  activateToolbarMenu() {
3073
3076
  this.setState({
@@ -3079,7 +3082,7 @@ class EuiAppShellService {
3079
3082
  * Returns the current value of --eui-f-size-base CSS variable
3080
3083
  */
3081
3084
  getBaseFontSize() {
3082
- return this.state.appBaseFontSize || CssUtils.getCssVarValue('--eui-f-size-base');
3085
+ return this.state.appBaseFontSize || CssUtils.getCssVarValue('--eui-f-size-base', this.document);
3083
3086
  }
3084
3087
  /**
3085
3088
  * Updates the current value of --eui-f-size-base CSS variable and the UIState appBaseFontSize
@@ -3089,7 +3092,7 @@ class EuiAppShellService {
3089
3092
  ...this.state,
3090
3093
  appBaseFontSize: newsize,
3091
3094
  }, false);
3092
- CssUtils.setCssVarValue('--eui-f-size-base', newsize);
3095
+ CssUtils.setCssVarValue('--eui-f-size-base', newsize, this.document);
3093
3096
  }
3094
3097
  // ---------------
3095
3098
  // private getters
@@ -3124,7 +3127,7 @@ class EuiAppShellService {
3124
3127
  if (this.state.breakpointValues.length === 0) {
3125
3128
  this.setState({
3126
3129
  ...this.state,
3127
- breakpointValues: CssUtils.getBreakpointValues(),
3130
+ breakpointValues: CssUtils.getBreakpointValues(this.document),
3128
3131
  });
3129
3132
  }
3130
3133
  this.state.breakpointValues.forEach((b, i) => {
@@ -3175,7 +3178,7 @@ class EuiAppShellService {
3175
3178
  }
3176
3179
  });
3177
3180
  }
3178
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: EuiAppShellService, deps: [{ token: GLOBAL_CONFIG_TOKEN, optional: true }, { token: i1$5.HttpClient }, { token: PLATFORM_ID }, { token: i1$4.Router }, { token: StoreService }, { token: I18nService, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
3181
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: EuiAppShellService, deps: [{ token: GLOBAL_CONFIG_TOKEN, optional: true }, { token: i1$5.HttpClient }, { token: PLATFORM_ID }, { token: DOCUMENT }, { token: i1$4.Router }, { token: StoreService }, { token: I18nService, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
3179
3182
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: EuiAppShellService, providedIn: 'root' }); }
3180
3183
  }
3181
3184
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: EuiAppShellService, decorators: [{
@@ -3191,6 +3194,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImpor
3191
3194
  }] }, { type: i1$5.HttpClient }, { type: undefined, decorators: [{
3192
3195
  type: Inject,
3193
3196
  args: [PLATFORM_ID]
3197
+ }] }, { type: Document, decorators: [{
3198
+ type: Inject,
3199
+ args: [DOCUMENT]
3194
3200
  }] }, { type: i1$4.Router }, { type: StoreService }, { type: I18nService, decorators: [{
3195
3201
  type: Optional
3196
3202
  }] }] });