@cloudscape-design/components 3.0.616 → 3.0.618
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/app-layout/classic.d.ts +5 -5
- package/app-layout/classic.d.ts.map +1 -1
- package/app-layout/classic.js +17 -16
- package/app-layout/classic.js.map +1 -1
- package/app-layout/implementation.d.ts +5 -5
- package/app-layout/interfaces.d.ts +5 -5
- package/app-layout/interfaces.d.ts.map +1 -1
- package/app-layout/interfaces.js.map +1 -1
- package/app-layout/internal.d.ts +5 -5
- package/app-layout/utils/use-app-layout-placement.d.ts +5 -5
- package/app-layout/utils/use-app-layout-placement.d.ts.map +1 -1
- package/app-layout/utils/use-app-layout-placement.js +10 -5
- package/app-layout/utils/use-app-layout-placement.js.map +1 -1
- package/app-layout/utils/use-keyboard-events.d.ts +1 -1
- package/app-layout/utils/use-keyboard-events.d.ts.map +1 -1
- package/app-layout/utils/use-keyboard-events.js +24 -29
- package/app-layout/utils/use-keyboard-events.js.map +1 -1
- package/app-layout/utils/use-pointer-events.d.ts.map +1 -1
- package/app-layout/utils/use-pointer-events.js +6 -5
- package/app-layout/utils/use-pointer-events.js.map +1 -1
- package/app-layout/visual-refresh/context.d.ts.map +1 -1
- package/app-layout/visual-refresh/context.js +10 -9
- package/app-layout/visual-refresh/context.js.map +1 -1
- package/app-layout/visual-refresh/index.d.ts +5 -5
- package/app-layout/visual-refresh/styles.css.js +81 -81
- package/app-layout/visual-refresh/styles.scoped.css +170 -167
- package/app-layout/visual-refresh/styles.selectors.js +81 -81
- package/internal/direction.d.ts +8 -1
- package/internal/direction.d.ts.map +1 -1
- package/internal/direction.js +17 -4
- package/internal/direction.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/generated/styles/tokens.d.ts +346 -1
- package/internal/generated/styles/tokens.js +346 -1
- package/internal/manifest.json +1 -1
- package/internal/utils/handle-key.d.ts +2 -1
- package/internal/utils/handle-key.d.ts.map +1 -1
- package/internal/utils/handle-key.js +7 -4
- package/internal/utils/handle-key.js.map +1 -1
- package/package.json +1 -1
- package/split-panel/bottom.js +4 -4
- package/split-panel/bottom.js.map +1 -1
- package/split-panel/icons/bottom-icon-refresh.d.ts.map +1 -1
- package/split-panel/icons/bottom-icon-refresh.js +1 -1
- package/split-panel/icons/bottom-icon-refresh.js.map +1 -1
- package/split-panel/icons/bottom-icon.d.ts.map +1 -1
- package/split-panel/icons/bottom-icon.js +1 -1
- package/split-panel/icons/bottom-icon.js.map +1 -1
- package/split-panel/icons/side-position-refresh.d.ts.map +1 -1
- package/split-panel/icons/side-position-refresh.js +1 -1
- package/split-panel/icons/side-position-refresh.js.map +1 -1
- package/split-panel/icons/side-position.d.ts.map +1 -1
- package/split-panel/icons/side-position.js +1 -1
- package/split-panel/icons/side-position.js.map +1 -1
- package/split-panel/styles.css.js +57 -55
- package/split-panel/styles.scoped.css +171 -75
- package/split-panel/styles.selectors.js +57 -55
- package/table/resizer/index.js +2 -2
- package/table/resizer/index.js.map +1 -1
- package/tabs/scroll-utils.js +2 -2
- package/tabs/scroll-utils.js.map +1 -1
|
@@ -2,86 +2,86 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"background": "
|
|
6
|
-
"scrolling-background": "awsui_scrolling-
|
|
7
|
-
"sticky-background": "awsui_sticky-
|
|
8
|
-
"has-sticky-notifications": "awsui_has-sticky-
|
|
9
|
-
"breadcrumbs": "
|
|
10
|
-
"has-sticky-background": "awsui_has-sticky-
|
|
11
|
-
"drawers-container": "awsui_drawers-
|
|
12
|
-
"has-open-drawer": "awsui_has-open-
|
|
13
|
-
"disable-body-scroll": "awsui_disable-body-
|
|
14
|
-
"drawers-desktop-triggers-container": "awsui_drawers-desktop-triggers-
|
|
15
|
-
"has-multiple-triggers": "awsui_has-multiple-
|
|
16
|
-
"drawers-mobile-triggers-container": "awsui_drawers-mobile-triggers-
|
|
17
|
-
"drawers-trigger-content": "awsui_drawers-trigger-
|
|
18
|
-
"drawers-trigger-overflow": "awsui_drawers-trigger-
|
|
19
|
-
"drawers-trigger": "awsui_drawers-
|
|
20
|
-
"drawer": "
|
|
21
|
-
"drawer-content-container": "awsui_drawer-content-
|
|
22
|
-
"drawer-close-button": "awsui_drawer-close-
|
|
23
|
-
"drawer-content": "awsui_drawer-
|
|
24
|
-
"drawer-content-hidden": "awsui_drawer-content-
|
|
25
|
-
"drawer-slider": "awsui_drawer-
|
|
26
|
-
"is-drawer-open": "awsui_is-drawer-
|
|
27
|
-
"content": "
|
|
28
|
-
"layout": "
|
|
29
|
-
"has-max-content-width": "awsui_has-max-content-
|
|
30
|
-
"content-type-dashboard": "awsui_content-type-
|
|
31
|
-
"content-type-table": "awsui_content-type-
|
|
32
|
-
"content-type-cards": "awsui_content-type-
|
|
33
|
-
"is-overlap-disabled": "awsui_is-overlap-
|
|
34
|
-
"is-hide-mobile-toolbar": "awsui_is-hide-mobile-
|
|
35
|
-
"has-content-gap-left": "awsui_has-content-gap-
|
|
36
|
-
"has-content-gap-right": "awsui_has-content-gap-
|
|
37
|
-
"content-first-child-notifications": "awsui_content-first-child-
|
|
38
|
-
"has-breadcrumbs": "awsui_has-
|
|
39
|
-
"content-first-child-header": "awsui_content-first-child-
|
|
40
|
-
"has-header": "awsui_has-
|
|
41
|
-
"content-first-child-main": "awsui_content-first-child-
|
|
42
|
-
"disable-content-paddings": "awsui_disable-content-
|
|
43
|
-
"has-split-panel": "awsui_has-split-
|
|
44
|
-
"split-panel-position-bottom": "awsui_split-panel-position-
|
|
45
|
-
"block-body-scroll": "awsui_block-body-
|
|
46
|
-
"unfocusable": "
|
|
47
|
-
"container": "
|
|
48
|
-
"is-navigation-open": "awsui_is-navigation-
|
|
49
|
-
"is-tools-open": "awsui_is-tools-
|
|
50
|
-
"is-split-panel-open": "awsui_is-split-panel-
|
|
51
|
-
"split-panel-position-side": "awsui_split-panel-position-
|
|
52
|
-
"has-active-drawer": "awsui_has-active-
|
|
53
|
-
"mobile-toolbar": "awsui_mobile-
|
|
54
|
-
"remove-high-contrast-header": "awsui_remove-high-contrast-
|
|
55
|
-
"mobile-toolbar-nav": "awsui_mobile-toolbar-
|
|
56
|
-
"mobile-toolbar-breadcrumbs": "awsui_mobile-toolbar-
|
|
57
|
-
"mobile-toolbar-tools": "awsui_mobile-toolbar-
|
|
58
|
-
"navigation-container": "awsui_navigation-
|
|
59
|
-
"show-navigation": "awsui_show-
|
|
60
|
-
"animating": "
|
|
61
|
-
"showButtons": "
|
|
62
|
-
"navigation": "
|
|
63
|
-
"openNavigation": "
|
|
64
|
-
"animated-content": "awsui_animated-
|
|
65
|
-
"hide-navigation": "awsui_hide-
|
|
66
|
-
"notifications": "
|
|
67
|
-
"sticky-notifications": "awsui_sticky-
|
|
68
|
-
"split-panel-bottom": "awsui_split-panel-
|
|
69
|
-
"position-bottom": "awsui_position-
|
|
70
|
-
"openSplitPanelBottom": "
|
|
71
|
-
"split-panel-side": "awsui_split-panel-
|
|
72
|
-
"position-side": "awsui_position-
|
|
73
|
-
"tools-container": "awsui_tools-
|
|
74
|
-
"tools": "
|
|
75
|
-
"openTools": "
|
|
76
|
-
"has-tools-form-persistence": "awsui_has-tools-form-
|
|
77
|
-
"hide-tools": "awsui_hide-
|
|
78
|
-
"show-tools": "awsui_show-
|
|
79
|
-
"has-tools-form": "awsui_has-tools-
|
|
80
|
-
"trigger-badge-wrapper": "awsui_trigger-badge-
|
|
81
|
-
"trigger": "
|
|
82
|
-
"selected": "
|
|
83
|
-
"badge": "
|
|
84
|
-
"trigger-wrapper": "awsui_trigger-
|
|
85
|
-
"dot": "
|
|
5
|
+
"background": "awsui_background_hyvsj_oarcx_99",
|
|
6
|
+
"scrolling-background": "awsui_scrolling-background_hyvsj_oarcx_102",
|
|
7
|
+
"sticky-background": "awsui_sticky-background_hyvsj_oarcx_108",
|
|
8
|
+
"has-sticky-notifications": "awsui_has-sticky-notifications_hyvsj_oarcx_116",
|
|
9
|
+
"breadcrumbs": "awsui_breadcrumbs_hyvsj_oarcx_129",
|
|
10
|
+
"has-sticky-background": "awsui_has-sticky-background_hyvsj_oarcx_139",
|
|
11
|
+
"drawers-container": "awsui_drawers-container_hyvsj_oarcx_151",
|
|
12
|
+
"has-open-drawer": "awsui_has-open-drawer_hyvsj_oarcx_162",
|
|
13
|
+
"disable-body-scroll": "awsui_disable-body-scroll_hyvsj_oarcx_185",
|
|
14
|
+
"drawers-desktop-triggers-container": "awsui_drawers-desktop-triggers-container_hyvsj_oarcx_190",
|
|
15
|
+
"has-multiple-triggers": "awsui_has-multiple-triggers_hyvsj_oarcx_231",
|
|
16
|
+
"drawers-mobile-triggers-container": "awsui_drawers-mobile-triggers-container_hyvsj_oarcx_241",
|
|
17
|
+
"drawers-trigger-content": "awsui_drawers-trigger-content_hyvsj_oarcx_245",
|
|
18
|
+
"drawers-trigger-overflow": "awsui_drawers-trigger-overflow_hyvsj_oarcx_259",
|
|
19
|
+
"drawers-trigger": "awsui_drawers-trigger_hyvsj_oarcx_245",
|
|
20
|
+
"drawer": "awsui_drawer_hyvsj_oarcx_151",
|
|
21
|
+
"drawer-content-container": "awsui_drawer-content-container_hyvsj_oarcx_290",
|
|
22
|
+
"drawer-close-button": "awsui_drawer-close-button_hyvsj_oarcx_299",
|
|
23
|
+
"drawer-content": "awsui_drawer-content_hyvsj_oarcx_290",
|
|
24
|
+
"drawer-content-hidden": "awsui_drawer-content-hidden_hyvsj_oarcx_307",
|
|
25
|
+
"drawer-slider": "awsui_drawer-slider_hyvsj_oarcx_310",
|
|
26
|
+
"is-drawer-open": "awsui_is-drawer-open_hyvsj_oarcx_317",
|
|
27
|
+
"content": "awsui_content_hyvsj_oarcx_343",
|
|
28
|
+
"layout": "awsui_layout_hyvsj_oarcx_364",
|
|
29
|
+
"has-max-content-width": "awsui_has-max-content-width_hyvsj_oarcx_445",
|
|
30
|
+
"content-type-dashboard": "awsui_content-type-dashboard_hyvsj_oarcx_460",
|
|
31
|
+
"content-type-table": "awsui_content-type-table_hyvsj_oarcx_474",
|
|
32
|
+
"content-type-cards": "awsui_content-type-cards_hyvsj_oarcx_474",
|
|
33
|
+
"is-overlap-disabled": "awsui_is-overlap-disabled_hyvsj_oarcx_480",
|
|
34
|
+
"is-hide-mobile-toolbar": "awsui_is-hide-mobile-toolbar_hyvsj_oarcx_483",
|
|
35
|
+
"has-content-gap-left": "awsui_has-content-gap-left_hyvsj_oarcx_515",
|
|
36
|
+
"has-content-gap-right": "awsui_has-content-gap-right_hyvsj_oarcx_518",
|
|
37
|
+
"content-first-child-notifications": "awsui_content-first-child-notifications_hyvsj_oarcx_528",
|
|
38
|
+
"has-breadcrumbs": "awsui_has-breadcrumbs_hyvsj_oarcx_531",
|
|
39
|
+
"content-first-child-header": "awsui_content-first-child-header_hyvsj_oarcx_534",
|
|
40
|
+
"has-header": "awsui_has-header_hyvsj_oarcx_534",
|
|
41
|
+
"content-first-child-main": "awsui_content-first-child-main_hyvsj_oarcx_552",
|
|
42
|
+
"disable-content-paddings": "awsui_disable-content-paddings_hyvsj_oarcx_552",
|
|
43
|
+
"has-split-panel": "awsui_has-split-panel_hyvsj_oarcx_589",
|
|
44
|
+
"split-panel-position-bottom": "awsui_split-panel-position-bottom_hyvsj_oarcx_589",
|
|
45
|
+
"block-body-scroll": "awsui_block-body-scroll_hyvsj_oarcx_605",
|
|
46
|
+
"unfocusable": "awsui_unfocusable_hyvsj_oarcx_610",
|
|
47
|
+
"container": "awsui_container_hyvsj_oarcx_620",
|
|
48
|
+
"is-navigation-open": "awsui_is-navigation-open_hyvsj_oarcx_646",
|
|
49
|
+
"is-tools-open": "awsui_is-tools-open_hyvsj_oarcx_649",
|
|
50
|
+
"is-split-panel-open": "awsui_is-split-panel-open_hyvsj_oarcx_649",
|
|
51
|
+
"split-panel-position-side": "awsui_split-panel-position-side_hyvsj_oarcx_649",
|
|
52
|
+
"has-active-drawer": "awsui_has-active-drawer_hyvsj_oarcx_649",
|
|
53
|
+
"mobile-toolbar": "awsui_mobile-toolbar_hyvsj_oarcx_658",
|
|
54
|
+
"remove-high-contrast-header": "awsui_remove-high-contrast-header_hyvsj_oarcx_675",
|
|
55
|
+
"mobile-toolbar-nav": "awsui_mobile-toolbar-nav_hyvsj_oarcx_679",
|
|
56
|
+
"mobile-toolbar-breadcrumbs": "awsui_mobile-toolbar-breadcrumbs_hyvsj_oarcx_683",
|
|
57
|
+
"mobile-toolbar-tools": "awsui_mobile-toolbar-tools_hyvsj_oarcx_687",
|
|
58
|
+
"navigation-container": "awsui_navigation-container_hyvsj_oarcx_696",
|
|
59
|
+
"show-navigation": "awsui_show-navigation_hyvsj_oarcx_734",
|
|
60
|
+
"animating": "awsui_animating_hyvsj_oarcx_757",
|
|
61
|
+
"showButtons": "awsui_showButtons_hyvsj_oarcx_1",
|
|
62
|
+
"navigation": "awsui_navigation_hyvsj_oarcx_696",
|
|
63
|
+
"openNavigation": "awsui_openNavigation_hyvsj_oarcx_1",
|
|
64
|
+
"animated-content": "awsui_animated-content_hyvsj_oarcx_819",
|
|
65
|
+
"hide-navigation": "awsui_hide-navigation_hyvsj_oarcx_828",
|
|
66
|
+
"notifications": "awsui_notifications_hyvsj_oarcx_838",
|
|
67
|
+
"sticky-notifications": "awsui_sticky-notifications_hyvsj_oarcx_844",
|
|
68
|
+
"split-panel-bottom": "awsui_split-panel-bottom_hyvsj_oarcx_861",
|
|
69
|
+
"position-bottom": "awsui_position-bottom_hyvsj_oarcx_908",
|
|
70
|
+
"openSplitPanelBottom": "awsui_openSplitPanelBottom_hyvsj_oarcx_1",
|
|
71
|
+
"split-panel-side": "awsui_split-panel-side_hyvsj_oarcx_937",
|
|
72
|
+
"position-side": "awsui_position-side_hyvsj_oarcx_950",
|
|
73
|
+
"tools-container": "awsui_tools-container_hyvsj_oarcx_972",
|
|
74
|
+
"tools": "awsui_tools_hyvsj_oarcx_972",
|
|
75
|
+
"openTools": "awsui_openTools_hyvsj_oarcx_1",
|
|
76
|
+
"has-tools-form-persistence": "awsui_has-tools-form-persistence_hyvsj_oarcx_1063",
|
|
77
|
+
"hide-tools": "awsui_hide-tools_hyvsj_oarcx_1073",
|
|
78
|
+
"show-tools": "awsui_show-tools_hyvsj_oarcx_1085",
|
|
79
|
+
"has-tools-form": "awsui_has-tools-form_hyvsj_oarcx_1063",
|
|
80
|
+
"trigger-badge-wrapper": "awsui_trigger-badge-wrapper_hyvsj_oarcx_1168",
|
|
81
|
+
"trigger": "awsui_trigger_hyvsj_oarcx_1168",
|
|
82
|
+
"selected": "awsui_selected_hyvsj_oarcx_1245",
|
|
83
|
+
"badge": "awsui_badge_hyvsj_oarcx_1265",
|
|
84
|
+
"trigger-wrapper": "awsui_trigger-wrapper_hyvsj_oarcx_1269",
|
|
85
|
+
"dot": "awsui_dot_hyvsj_oarcx_1280"
|
|
86
86
|
};
|
|
87
87
|
|
package/internal/direction.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export declare function
|
|
1
|
+
export declare function getIsRtl(element: HTMLElement | SVGElement): boolean;
|
|
2
|
+
export declare function getOffsetInlineStart(element: HTMLElement): number;
|
|
2
3
|
/**
|
|
3
4
|
* The scrollLeft value will be a negative number if the direction is RTL and
|
|
4
5
|
* needs to be converted to a positive value for direction independent scroll
|
|
@@ -6,6 +7,12 @@ export declare function isRtl(element: HTMLElement | SVGElement): boolean;
|
|
|
6
7
|
* systems using display scaling requiring the floor and ceiling calls.
|
|
7
8
|
*/
|
|
8
9
|
export declare function getScrollInlineStart(element: HTMLElement): number;
|
|
10
|
+
/**
|
|
11
|
+
* The clientX position needs to be converted so it is relative to the right of
|
|
12
|
+
* the document in order for computations to yield the same result in both
|
|
13
|
+
* element directions.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getLogicalClientX(event: PointerEvent, IsRtl: boolean): number;
|
|
9
16
|
/**
|
|
10
17
|
* The getBoundingClientRect() function returns values relative to the top left
|
|
11
18
|
* corner of the document regardless of document direction. The left/right position
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"direction.d.ts","sourceRoot":"","sources":["../../../src/internal/direction.ts"],"names":[],"mappings":"AAGA,wBAAgB,
|
|
1
|
+
{"version":3,"file":"direction.d.ts","sourceRoot":"","sources":["../../../src/internal/direction.ts"],"names":[],"mappings":"AAGA,wBAAgB,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,UAAU,WAEzD;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,WAAW,UAGxD;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,WAAW,UAExD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,UAEpE;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,WAAW,GAAG,UAAU;;;;;;;EAoB7E;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,UAIhD"}
|
package/internal/direction.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
export function
|
|
3
|
+
export function getIsRtl(element) {
|
|
4
4
|
return getComputedStyle(element).direction === 'rtl';
|
|
5
5
|
}
|
|
6
|
+
export function getOffsetInlineStart(element) {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
const offsetParentWidth = (_b = (_a = element.offsetParent) === null || _a === void 0 ? void 0 : _a.clientWidth) !== null && _b !== void 0 ? _b : 0;
|
|
9
|
+
return getIsRtl(element) ? offsetParentWidth - element.offsetWidth - element.offsetLeft : element.offsetLeft;
|
|
10
|
+
}
|
|
6
11
|
/**
|
|
7
12
|
* The scrollLeft value will be a negative number if the direction is RTL and
|
|
8
13
|
* needs to be converted to a positive value for direction independent scroll
|
|
@@ -10,7 +15,15 @@ export function isRtl(element) {
|
|
|
10
15
|
* systems using display scaling requiring the floor and ceiling calls.
|
|
11
16
|
*/
|
|
12
17
|
export function getScrollInlineStart(element) {
|
|
13
|
-
return
|
|
18
|
+
return getIsRtl(element) ? Math.floor(element.scrollLeft) * -1 : Math.ceil(element.scrollLeft);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The clientX position needs to be converted so it is relative to the right of
|
|
22
|
+
* the document in order for computations to yield the same result in both
|
|
23
|
+
* element directions.
|
|
24
|
+
*/
|
|
25
|
+
export function getLogicalClientX(event, IsRtl) {
|
|
26
|
+
return IsRtl ? document.documentElement.clientWidth - event.clientX : event.clientX;
|
|
14
27
|
}
|
|
15
28
|
/**
|
|
16
29
|
* The getBoundingClientRect() function returns values relative to the top left
|
|
@@ -24,7 +37,7 @@ export function getLogicalBoundingClientRect(element) {
|
|
|
24
37
|
const inlineSize = boundingClientRect.width;
|
|
25
38
|
const insetBlockStart = boundingClientRect.top;
|
|
26
39
|
const insetBlockEnd = boundingClientRect.bottom;
|
|
27
|
-
const insetInlineStart =
|
|
40
|
+
const insetInlineStart = getIsRtl(element)
|
|
28
41
|
? document.documentElement.clientWidth - boundingClientRect.right
|
|
29
42
|
: boundingClientRect.left;
|
|
30
43
|
const insetInlineEnd = insetInlineStart + inlineSize;
|
|
@@ -43,7 +56,7 @@ export function getLogicalBoundingClientRect(element) {
|
|
|
43
56
|
* element directions.
|
|
44
57
|
*/
|
|
45
58
|
export function getLogicalPageX(event) {
|
|
46
|
-
return event.target instanceof HTMLElement &&
|
|
59
|
+
return event.target instanceof HTMLElement && getIsRtl(event.target)
|
|
47
60
|
? document.documentElement.clientWidth - event.pageX
|
|
48
61
|
: event.pageX;
|
|
49
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"direction.js","sourceRoot":"","sources":["../../../src/internal/direction.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"direction.js","sourceRoot":"","sources":["../../../src/internal/direction.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,MAAM,UAAU,QAAQ,CAAC,OAAiC;IACxD,OAAO,gBAAgB,CAAC,OAAO,CAAC,CAAC,SAAS,KAAK,KAAK,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,OAAoB;;IACvD,MAAM,iBAAiB,GAAG,MAAA,MAAA,OAAO,CAAC,YAAY,0CAAE,WAAW,mCAAI,CAAC,CAAC;IACjE,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,iBAAiB,GAAG,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;AAC/G,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAoB;IACvD,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AACjG,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAmB,EAAE,KAAc;IACnE,OAAO,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAC,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;AACtF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,4BAA4B,CAAC,OAAiC;IAC5E,MAAM,kBAAkB,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAE3D,MAAM,SAAS,GAAG,kBAAkB,CAAC,MAAM,CAAC;IAC5C,MAAM,UAAU,GAAG,kBAAkB,CAAC,KAAK,CAAC;IAC5C,MAAM,eAAe,GAAG,kBAAkB,CAAC,GAAG,CAAC;IAC/C,MAAM,aAAa,GAAG,kBAAkB,CAAC,MAAM,CAAC;IAChD,MAAM,gBAAgB,GAAG,QAAQ,CAAC,OAAO,CAAC;QACxC,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAC,WAAW,GAAG,kBAAkB,CAAC,KAAK;QACjE,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC;IAC5B,MAAM,cAAc,GAAG,gBAAgB,GAAG,UAAU,CAAC;IAErD,OAAO;QACL,SAAS;QACT,UAAU;QACV,eAAe;QACf,aAAa;QACb,gBAAgB;QAChB,cAAc;KACf,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,KAAiB;IAC/C,OAAO,KAAK,CAAC,MAAM,YAAY,WAAW,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC;QAClE,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAC,WAAW,GAAG,KAAK,CAAC,KAAK;QACpD,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC;AAClB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport function getIsRtl(element: HTMLElement | SVGElement) {\n return getComputedStyle(element).direction === 'rtl';\n}\n\nexport function getOffsetInlineStart(element: HTMLElement) {\n const offsetParentWidth = element.offsetParent?.clientWidth ?? 0;\n return getIsRtl(element) ? offsetParentWidth - element.offsetWidth - element.offsetLeft : element.offsetLeft;\n}\n\n/**\n * The scrollLeft value will be a negative number if the direction is RTL and\n * needs to be converted to a positive value for direction independent scroll\n * computations. Additionally, the scrollLeft value can be a decimal value on\n * systems using display scaling requiring the floor and ceiling calls.\n */\nexport function getScrollInlineStart(element: HTMLElement) {\n return getIsRtl(element) ? Math.floor(element.scrollLeft) * -1 : Math.ceil(element.scrollLeft);\n}\n\n/**\n * The clientX position needs to be converted so it is relative to the right of\n * the document in order for computations to yield the same result in both\n * element directions.\n */\nexport function getLogicalClientX(event: PointerEvent, IsRtl: boolean) {\n return IsRtl ? document.documentElement.clientWidth - event.clientX : event.clientX;\n}\n\n/**\n * The getBoundingClientRect() function returns values relative to the top left\n * corner of the document regardless of document direction. The left/right position\n * will be transformed to insetInlineStart based on element direction in order to\n * support direction agnostic position computation.\n */\nexport function getLogicalBoundingClientRect(element: HTMLElement | SVGElement) {\n const boundingClientRect = element.getBoundingClientRect();\n\n const blockSize = boundingClientRect.height;\n const inlineSize = boundingClientRect.width;\n const insetBlockStart = boundingClientRect.top;\n const insetBlockEnd = boundingClientRect.bottom;\n const insetInlineStart = getIsRtl(element)\n ? document.documentElement.clientWidth - boundingClientRect.right\n : boundingClientRect.left;\n const insetInlineEnd = insetInlineStart + inlineSize;\n\n return {\n blockSize,\n inlineSize,\n insetBlockStart,\n insetBlockEnd,\n insetInlineStart,\n insetInlineEnd,\n };\n}\n\n/**\n * The pageX position needs to be converted so it is relative to the right of\n * the document in order for computations to yield the same result in both\n * element directions.\n */\nexport function getLogicalPageX(event: MouseEvent) {\n return event.target instanceof HTMLElement && getIsRtl(event.target)\n ? document.documentElement.clientWidth - event.pageX\n : event.pageX;\n}\n"]}
|
package/internal/environment.js
CHANGED