@eui/core 18.0.0-rc.35 → 18.0.0-rc.37
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.
- package/docs/classes/CssUtils.html +31 -0
- package/docs/dependencies.html +1 -1
- package/docs/js/search/search_index.js +2 -2
- package/docs/miscellaneous/variables.html +6 -10
- package/esm2022/lib/helpers/css-utils.mjs +54 -43
- package/esm2022/lib/helpers/dom-helpers.mjs +3 -9
- package/esm2022/lib/services/eui-app-shell.service.mjs +9 -9
- package/fesm2022/eui-core.mjs +63 -58
- package/fesm2022/eui-core.mjs.map +1 -1
- package/lib/helpers/css-utils.d.ts +18 -12
- package/lib/helpers/css-utils.d.ts.map +1 -1
- package/lib/helpers/dom-helpers.d.ts +1 -1
- package/lib/helpers/dom-helpers.d.ts.map +1 -1
- package/package.json +2 -2
package/fesm2022/eui-core.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import { merge, fromEvent, throwError, of, forkJoin, from, BehaviorSubject, defe
|
|
|
10
10
|
import { mapTo, map, mergeMap, tap, debounceTime, distinctUntilChanged, take, switchMap, catchError, concatMap, filter, takeUntil } from 'rxjs/operators';
|
|
11
11
|
import * as i1$2 from '@ngx-translate/core';
|
|
12
12
|
import { TranslateLoader } from '@ngx-translate/core';
|
|
13
|
-
import { isPlatformBrowser, LOCATION_INITIALIZED, DOCUMENT, getLocaleId, registerLocaleData } from '@angular/common';
|
|
13
|
+
import { isPlatformBrowser, LOCATION_INITIALIZED, DOCUMENT, isPlatformServer, getLocaleId, registerLocaleData } from '@angular/common';
|
|
14
14
|
import * as i1$3 from '@ngrx/store';
|
|
15
15
|
import { createSelector } from '@ngrx/store';
|
|
16
16
|
import { DateAdapter, MAT_DATE_LOCALE } from '@angular/material/core';
|
|
@@ -2123,16 +2123,10 @@ const offset = (nativeEl) => {
|
|
|
2123
2123
|
};
|
|
2124
2124
|
};
|
|
2125
2125
|
// PRIVATE FUNCTIONS
|
|
2126
|
-
// TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
|
|
2127
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2128
2126
|
const getStyle = (nativeEl, cssProp) => {
|
|
2129
|
-
// IE
|
|
2130
2127
|
/* istanbul ignore if */
|
|
2131
|
-
if (nativeEl
|
|
2132
|
-
return nativeEl
|
|
2133
|
-
}
|
|
2134
|
-
if (window.getComputedStyle) {
|
|
2135
|
-
return window.getComputedStyle(nativeEl)[cssProp];
|
|
2128
|
+
if (getComputedStyle(nativeEl)) {
|
|
2129
|
+
return getComputedStyle(nativeEl)[cssProp];
|
|
2136
2130
|
}
|
|
2137
2131
|
// finally try and get inline style
|
|
2138
2132
|
/* istanbul ignore next */
|
|
@@ -2324,46 +2318,57 @@ const handleError = (error) => {
|
|
|
2324
2318
|
const isDefined = (value) => value !== undefined && value !== null;
|
|
2325
2319
|
|
|
2326
2320
|
class CssUtils {
|
|
2327
|
-
|
|
2328
|
-
|
|
2321
|
+
/**
|
|
2322
|
+
* Get the value of a CSS variable. Using getComputedStyle to get the value of the CSS variable (Browser Specific API)
|
|
2323
|
+
* @param inputProperty
|
|
2324
|
+
* @param document
|
|
2325
|
+
* @param platform
|
|
2326
|
+
*/
|
|
2327
|
+
static { this.getCssVarValue = (inputProperty, document, platform) => {
|
|
2328
|
+
if (isPlatformServer(platform)) {
|
|
2329
|
+
return document.documentElement.style.getPropertyValue(inputProperty);
|
|
2330
|
+
}
|
|
2331
|
+
else {
|
|
2332
|
+
return getComputedStyle(document.documentElement).getPropertyValue(inputProperty);
|
|
2333
|
+
}
|
|
2329
2334
|
}; }
|
|
2330
2335
|
static { this.setCssVarValue = (propertyName, propertyValue, document) => {
|
|
2331
2336
|
document.documentElement.style.setProperty(propertyName, propertyValue);
|
|
2332
2337
|
}; }
|
|
2333
|
-
static { this.setCssVar = (inputProperty, outputProperty, document) => {
|
|
2334
|
-
const cssVarValue = this.getCssVarValue(inputProperty, document);
|
|
2338
|
+
static { this.setCssVar = (inputProperty, outputProperty, document, platform) => {
|
|
2339
|
+
const cssVarValue = this.getCssVarValue(inputProperty, document, platform);
|
|
2335
2340
|
this.setCssVarValue(outputProperty, cssVarValue, document);
|
|
2336
2341
|
}; }
|
|
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);
|
|
2342
|
+
static { this.initCssVars = (document, platform) => {
|
|
2343
|
+
this.setCssVar('--eui-app-header-height-default', '--eui-app-header-height', document, platform);
|
|
2344
|
+
this.setCssVar('--eui-app-breadcrumb-height-default', '--eui-app-breadcrumb-height', document, platform);
|
|
2345
|
+
this.setCssVar('--eui-app-top-message-height-default', '--eui-app-top-message-height', document, platform);
|
|
2346
|
+
this.setCssVar('--eui-app-toolbar-height-default', '--eui-app-toolbar-height', document, platform);
|
|
2347
|
+
this.setCssVar('--eui-app-sidebar-width-default', '--eui-app-sidebar-width', document, platform);
|
|
2348
|
+
this.setCssVar('--eui-app-sidebar-width-close-default', '--eui-app-sidebar-width-close', document, platform);
|
|
2349
|
+
this.setCssVar('--eui-app-sidebar-header-height-default', '--eui-app-sidebar-header-height', document, platform);
|
|
2350
|
+
this.setCssVar('--eui-app-sidebar-footer-height-default', '--eui-app-sidebar-footer-height', document, platform);
|
|
2346
2351
|
}; }
|
|
2347
2352
|
// eslint-disable-next-line
|
|
2348
|
-
static { this.getBreakpointValues = (document) => {
|
|
2353
|
+
static { this.getBreakpointValues = (document, platform) => {
|
|
2349
2354
|
const breakpoints = [];
|
|
2350
|
-
const xs = this.getCssVarValue('--eui-bp-xs', document);
|
|
2355
|
+
const xs = this.getCssVarValue('--eui-bp-xs', document, platform);
|
|
2351
2356
|
breakpoints.push({ bkp: 'xs', pxValue: xs, value: xs.replace('px', '') });
|
|
2352
|
-
const sm = this.getCssVarValue('--eui-bp-sm', document);
|
|
2357
|
+
const sm = this.getCssVarValue('--eui-bp-sm', document, platform);
|
|
2353
2358
|
breakpoints.push({ bkp: 'sm', pxValue: sm, value: sm.replace('px', '') });
|
|
2354
|
-
const md = this.getCssVarValue('--eui-bp-md', document);
|
|
2359
|
+
const md = this.getCssVarValue('--eui-bp-md', document, platform);
|
|
2355
2360
|
breakpoints.push({ bkp: 'md', pxValue: md, value: md.replace('px', '') });
|
|
2356
|
-
const lg = this.getCssVarValue('--eui-bp-lg', document);
|
|
2361
|
+
const lg = this.getCssVarValue('--eui-bp-lg', document, platform);
|
|
2357
2362
|
breakpoints.push({ bkp: 'lg', pxValue: lg, value: lg.replace('px', '') });
|
|
2358
|
-
const xl = this.getCssVarValue('--eui-bp-xl', document);
|
|
2363
|
+
const xl = this.getCssVarValue('--eui-bp-xl', document, platform);
|
|
2359
2364
|
breakpoints.push({ bkp: 'xl', pxValue: xl, value: xl.replace('px', '') });
|
|
2360
|
-
const xxl = this.getCssVarValue('--eui-bp-xxl', document);
|
|
2365
|
+
const xxl = this.getCssVarValue('--eui-bp-xxl', document, platform);
|
|
2361
2366
|
breakpoints.push({ bkp: 'xxl', pxValue: xxl, value: xxl.replace('px', '') });
|
|
2362
|
-
const fhd = this.getCssVarValue('--eui-bp-fhd', document);
|
|
2367
|
+
const fhd = this.getCssVarValue('--eui-bp-fhd', document, platform);
|
|
2363
2368
|
breakpoints.push({ bkp: 'fhd', pxValue: fhd, value: fhd.replace('px', '') });
|
|
2364
|
-
const twok = this.getCssVarValue('--eui-bp-2k', document);
|
|
2369
|
+
const twok = this.getCssVarValue('--eui-bp-2k', document, platform);
|
|
2365
2370
|
breakpoints.push({ bkp: '2k', pxValue: twok, value: twok.replace('px', '') });
|
|
2366
|
-
const fourk = this.getCssVarValue('--eui-bp-4k', document);
|
|
2371
|
+
const fourk = this.getCssVarValue('--eui-bp-4k', document, platform);
|
|
2367
2372
|
breakpoints.push({ bkp: '4k', pxValue: fourk, value: fourk.replace('px', '') });
|
|
2368
2373
|
return breakpoints;
|
|
2369
2374
|
}; }
|
|
@@ -2379,32 +2384,32 @@ class CssUtils {
|
|
|
2379
2384
|
this.setCssVarValue('--eui-z-index-root', '1', document); // Restore eui-app-main-content z-index
|
|
2380
2385
|
}
|
|
2381
2386
|
}; }
|
|
2382
|
-
static { this.activateHeaderCssVars = (document) => {
|
|
2383
|
-
this.setCssVar('--eui-app-header-height-active', '--eui-app-header-height', document);
|
|
2387
|
+
static { this.activateHeaderCssVars = (document, platform) => {
|
|
2388
|
+
this.setCssVar('--eui-app-header-height-active', '--eui-app-header-height', document, platform);
|
|
2384
2389
|
}; }
|
|
2385
|
-
static { this.activateBreadcrumbCssVars = (document) => {
|
|
2386
|
-
this.setCssVar('--eui-app-breadcrumb-height-active', '--eui-app-breadcrumb-height', document);
|
|
2390
|
+
static { this.activateBreadcrumbCssVars = (document, platform) => {
|
|
2391
|
+
this.setCssVar('--eui-app-breadcrumb-height-active', '--eui-app-breadcrumb-height', document, platform);
|
|
2387
2392
|
}; }
|
|
2388
2393
|
static { this.activateTopMessageCssVars = (height, document) => {
|
|
2389
2394
|
this.setCssVarValue('--eui-app-top-message-height', `${height}px`, document);
|
|
2390
2395
|
}; }
|
|
2391
|
-
static { this.activateToolbarCssVars = (document) => {
|
|
2392
|
-
this.setCssVar('--eui-app-toolbar-height-active', '--eui-app-toolbar-height', document);
|
|
2396
|
+
static { this.activateToolbarCssVars = (document, platform) => {
|
|
2397
|
+
this.setCssVar('--eui-app-toolbar-height-active', '--eui-app-toolbar-height', document, platform);
|
|
2393
2398
|
}; }
|
|
2394
|
-
static { this.activateFooterCssVars = (document) => {
|
|
2395
|
-
this.setCssVar('--eui-app-footer-height-active', '--eui-app-footer-height', document);
|
|
2399
|
+
static { this.activateFooterCssVars = (document, platform) => {
|
|
2400
|
+
this.setCssVar('--eui-app-footer-height-active', '--eui-app-footer-height', document, platform);
|
|
2396
2401
|
}; }
|
|
2397
|
-
static { this.setHeaderShrinkCssVar = (active, document) => {
|
|
2402
|
+
static { this.setHeaderShrinkCssVar = (active, document, platform) => {
|
|
2398
2403
|
if (active) {
|
|
2399
|
-
this.setCssVar('--eui-app-header-height-shrink', '--eui-app-header-height', document);
|
|
2404
|
+
this.setCssVar('--eui-app-header-height-shrink', '--eui-app-header-height', document, platform);
|
|
2400
2405
|
}
|
|
2401
2406
|
else {
|
|
2402
|
-
this.setCssVar('--eui-app-header-height-active', '--eui-app-header-height', document);
|
|
2407
|
+
this.setCssVar('--eui-app-header-height-active', '--eui-app-header-height', document, platform);
|
|
2403
2408
|
}
|
|
2404
2409
|
}; }
|
|
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);
|
|
2410
|
+
static { this.activateSidebarCssVars = (document, platform) => {
|
|
2411
|
+
this.setCssVar('--eui-app-sidebar-width-active', '--eui-app-sidebar-width', document, platform);
|
|
2412
|
+
this.setCssVar('--eui-app-sidebar-width-close-active', '--eui-app-sidebar-width-close', document, platform);
|
|
2408
2413
|
}; }
|
|
2409
2414
|
static { this.removeSidebarCssVars = (document) => {
|
|
2410
2415
|
document.documentElement.style.removeProperty('--eui-app-sidebar-header-height');
|
|
@@ -2412,11 +2417,11 @@ class CssUtils {
|
|
|
2412
2417
|
document.documentElement.style.removeProperty('--eui-app-sidebar-width');
|
|
2413
2418
|
document.documentElement.style.removeProperty('--eui-app-sidebar-width-close');
|
|
2414
2419
|
}; }
|
|
2415
|
-
static { this.activateSidebarHeaderCssVars = (document) => {
|
|
2416
|
-
this.setCssVar('--eui-app-sidebar-header-height-active', '--eui-app-sidebar-header-height', document);
|
|
2420
|
+
static { this.activateSidebarHeaderCssVars = (document, platform) => {
|
|
2421
|
+
this.setCssVar('--eui-app-sidebar-header-height-active', '--eui-app-sidebar-header-height', document, platform);
|
|
2417
2422
|
}; }
|
|
2418
|
-
static { this.activateSidebarFooterCssVars = (document) => {
|
|
2419
|
-
this.setCssVar('--eui-app-sidebar-footer-height-active', '--eui-app-sidebar-footer-height', document);
|
|
2423
|
+
static { this.activateSidebarFooterCssVars = (document, platform) => {
|
|
2424
|
+
this.setCssVar('--eui-app-sidebar-footer-height-active', '--eui-app-sidebar-footer-height', document, platform);
|
|
2420
2425
|
}; }
|
|
2421
2426
|
/**
|
|
2422
2427
|
* Gets the viewport height and width and multiply it by 1% to get a value for a vh/vw unit
|
|
@@ -3035,28 +3040,28 @@ class EuiAppShellService {
|
|
|
3035
3040
|
hasSidebar: true,
|
|
3036
3041
|
});
|
|
3037
3042
|
if (!this.state.isSidebarHidden) {
|
|
3038
|
-
CssUtils.activateSidebarCssVars(this.document);
|
|
3043
|
+
CssUtils.activateSidebarCssVars(this.document, this.platformId);
|
|
3039
3044
|
}
|
|
3040
3045
|
}
|
|
3041
3046
|
activateSidebarHeader() {
|
|
3042
|
-
CssUtils.activateSidebarHeaderCssVars(this.document);
|
|
3047
|
+
CssUtils.activateSidebarHeaderCssVars(this.document, this.platformId);
|
|
3043
3048
|
}
|
|
3044
3049
|
activateSidebarFooter() {
|
|
3045
|
-
CssUtils.activateSidebarFooterCssVars(this.document);
|
|
3050
|
+
CssUtils.activateSidebarFooterCssVars(this.document, this.platformId);
|
|
3046
3051
|
}
|
|
3047
3052
|
activateHeader() {
|
|
3048
3053
|
this.setState({
|
|
3049
3054
|
...this.state,
|
|
3050
3055
|
hasHeader: true,
|
|
3051
3056
|
});
|
|
3052
|
-
CssUtils.activateHeaderCssVars(this.document);
|
|
3057
|
+
CssUtils.activateHeaderCssVars(this.document, this.platformId);
|
|
3053
3058
|
}
|
|
3054
3059
|
activateBreadcrumb() {
|
|
3055
3060
|
this.setState({
|
|
3056
3061
|
...this.state,
|
|
3057
3062
|
hasBreadcrumb: true,
|
|
3058
3063
|
});
|
|
3059
|
-
CssUtils.activateBreadcrumbCssVars(this.document);
|
|
3064
|
+
CssUtils.activateBreadcrumbCssVars(this.document, this.platformId);
|
|
3060
3065
|
}
|
|
3061
3066
|
activateTopMessage(height) {
|
|
3062
3067
|
this.setState({
|
|
@@ -3070,7 +3075,7 @@ class EuiAppShellService {
|
|
|
3070
3075
|
...this.state,
|
|
3071
3076
|
hasToolbar: true,
|
|
3072
3077
|
});
|
|
3073
|
-
CssUtils.activateToolbarCssVars(this.document);
|
|
3078
|
+
CssUtils.activateToolbarCssVars(this.document, this.platformId);
|
|
3074
3079
|
}
|
|
3075
3080
|
activateToolbarMenu() {
|
|
3076
3081
|
this.setState({
|
|
@@ -3082,7 +3087,7 @@ class EuiAppShellService {
|
|
|
3082
3087
|
* Returns the current value of --eui-f-size-base CSS variable
|
|
3083
3088
|
*/
|
|
3084
3089
|
getBaseFontSize() {
|
|
3085
|
-
return this.state.appBaseFontSize || CssUtils.getCssVarValue('--eui-f-size-base', this.document);
|
|
3090
|
+
return this.state.appBaseFontSize || CssUtils.getCssVarValue('--eui-f-size-base', this.document, this.platformId);
|
|
3086
3091
|
}
|
|
3087
3092
|
/**
|
|
3088
3093
|
* Updates the current value of --eui-f-size-base CSS variable and the UIState appBaseFontSize
|
|
@@ -3127,7 +3132,7 @@ class EuiAppShellService {
|
|
|
3127
3132
|
if (this.state.breakpointValues.length === 0) {
|
|
3128
3133
|
this.setState({
|
|
3129
3134
|
...this.state,
|
|
3130
|
-
breakpointValues: CssUtils.getBreakpointValues(this.document),
|
|
3135
|
+
breakpointValues: CssUtils.getBreakpointValues(this.document, this.platformId),
|
|
3131
3136
|
});
|
|
3132
3137
|
}
|
|
3133
3138
|
this.state.breakpointValues.forEach((b, i) => {
|