@cloudscape-design/board-components 3.0.31 → 3.0.33

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 (35) hide show
  1. package/board/interfaces.d.ts +2 -0
  2. package/board/internal.js +2 -4
  3. package/board/styles.css.js +5 -5
  4. package/board/styles.scoped.css +10 -10
  5. package/board/styles.selectors.js +5 -5
  6. package/board/transition.js +2 -1
  7. package/board/utils/layout.js +4 -8
  8. package/board-item/styles.css.js +11 -11
  9. package/board-item/styles.scoped.css +25 -25
  10. package/board-item/styles.selectors.js +11 -11
  11. package/internal/debug-tools/generators.js +1 -1
  12. package/internal/environment.js +1 -1
  13. package/internal/environment.json +1 -1
  14. package/internal/handle/styles.css.js +1 -1
  15. package/internal/handle/styles.scoped.css +5 -5
  16. package/internal/handle/styles.selectors.js +1 -1
  17. package/internal/layout-engine/engine-cache.d.ts +32 -0
  18. package/internal/layout-engine/engine-cache.js +43 -0
  19. package/internal/layout-engine/engine-solution.d.ts +25 -0
  20. package/internal/layout-engine/engine-solution.js +205 -0
  21. package/internal/layout-engine/engine-state.d.ts +17 -0
  22. package/internal/layout-engine/engine-state.js +13 -0
  23. package/internal/layout-engine/engine-step.d.ts +8 -10
  24. package/internal/layout-engine/engine-step.js +184 -348
  25. package/internal/layout-engine/engine.d.ts +17 -13
  26. package/internal/layout-engine/engine.js +67 -59
  27. package/internal/layout-engine/grid.d.ts +8 -19
  28. package/internal/layout-engine/grid.js +36 -98
  29. package/internal/layout-engine/interfaces.d.ts +6 -2
  30. package/internal/layout-engine/utils.d.ts +8 -3
  31. package/internal/layout-engine/utils.js +48 -9
  32. package/internal/manifest.json +1 -1
  33. package/package.json +1 -1
  34. package/internal/utils/stack-set.d.ts +0 -8
  35. package/internal/utils/stack-set.js +0 -23
@@ -1,6 +1,7 @@
1
1
  import { ReactNode } from "react";
2
2
  import { InteractionType, Operation } from "../internal/dnd-controller/controller";
3
3
  import { BoardItemDefinition, BoardItemDefinitionBase, DataFallbackType, Direction, GridLayout, GridLayoutItem, ItemId, Rect } from "../internal/interfaces";
4
+ import { LayoutEngine } from "../internal/layout-engine/engine";
4
5
  import { LayoutShift } from "../internal/layout-engine/interfaces";
5
6
  import { NonCancelableEventHandler } from "../internal/utils/events";
6
7
  import { Position } from "../internal/utils/position";
@@ -127,6 +128,7 @@ export interface Transition<D> {
127
128
  operation: Operation;
128
129
  interactionType: InteractionType;
129
130
  itemsLayout: GridLayout;
131
+ layoutEngine: LayoutEngine;
130
132
  insertionDirection: null | Direction;
131
133
  draggableItem: BoardItemDefinitionBase<D>;
132
134
  draggableRect: Rect;
package/board/internal.js CHANGED
@@ -10,7 +10,6 @@ import { useDragSubscription } from "../internal/dnd-controller/controller";
10
10
  import { useGlobalDragStateStyles } from "../internal/global-drag-state-styles";
11
11
  import Grid from "../internal/grid";
12
12
  import { ItemContainer } from "../internal/item-container";
13
- import { LayoutEngine } from "../internal/layout-engine/engine";
14
13
  import LiveRegion from "../internal/live-region";
15
14
  import { ScreenReaderGridNavigation } from "../internal/screenreader-grid-navigation";
16
15
  import { createPlaceholdersLayout, getDefaultColumnSpan, getDefaultRowSpan, getMinColumnSpan, getMinRowSpan, interpretItems, } from "../internal/utils/layout";
@@ -72,9 +71,10 @@ export function InternalBoard({ items, renderItem, onItemsChange, empty, i18nStr
72
71
  const removedItemIndex = items.findIndex((it) => it.id === removeTransition.removedItem.id);
73
72
  const nextIndexToFocus = removedItemIndex !== items.length - 1 ? removedItemIndex : items.length - 2;
74
73
  focusNextRenderIndexRef.current = nextIndexToFocus;
74
+ onItemsChange(createItemsChangeEvent(items, removeTransition.layoutShift));
75
75
  }, TRANSITION_DURATION_MS);
76
76
  return () => clearTimeout(timeoutId);
77
- }, [removeTransition, items]);
77
+ }, [removeTransition, items, onItemsChange]);
78
78
  const rows = selectTransitionRows(transitionState) || itemsLayout.rows;
79
79
  const placeholdersLayout = createPlaceholdersLayout(rows, itemsLayout.columns);
80
80
  function isElementOverBoard(rect) {
@@ -148,8 +148,6 @@ export function InternalBoard({ items, renderItem, onItemsChange, empty, i18nStr
148
148
  });
149
149
  const removeItemAction = (removedItem) => {
150
150
  dispatch({ type: "init-remove", items, itemsLayout, removedItem });
151
- const layoutShift = new LayoutEngine(itemsLayout).remove(removedItem.id).getLayoutShift();
152
- onItemsChange(createItemsChangeEvent(items, layoutShift));
153
151
  };
154
152
  function focusItem(itemId) {
155
153
  itemContainerRef.current[itemId].focusDragHandle();
@@ -1,10 +1,10 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "placeholder": "awsui_placeholder_1h7dk_1yaxu_1",
5
- "placeholder--active": "awsui_placeholder--active_1h7dk_1yaxu_5",
6
- "placeholder--hover": "awsui_placeholder--hover_1h7dk_1yaxu_8",
7
- "root": "awsui_root_1h7dk_1yaxu_12",
8
- "empty": "awsui_empty_1h7dk_1yaxu_16"
4
+ "placeholder": "awsui_placeholder_1h7dk_inx8o_1",
5
+ "placeholder--active": "awsui_placeholder--active_1h7dk_inx8o_5",
6
+ "placeholder--hover": "awsui_placeholder--hover_1h7dk_inx8o_8",
7
+ "root": "awsui_root_1h7dk_inx8o_12",
8
+ "empty": "awsui_empty_1h7dk_inx8o_16"
9
9
  };
10
10
 
@@ -1,23 +1,23 @@
1
- .awsui_placeholder_1h7dk_1yaxu_1:not(#\9) {
2
- border-radius: var(--border-radius-container-pmtq2d, 16px);
1
+ .awsui_placeholder_1h7dk_inx8o_1:not(#\9) {
2
+ border-radius: var(--border-radius-container-wqv1zi, 16px);
3
3
  height: 100%;
4
4
  }
5
- .awsui_placeholder--active_1h7dk_1yaxu_5:not(#\9) {
6
- background-color: var(--color-board-placeholder-active-kxfgmn, #e9ebed);
5
+ .awsui_placeholder--active_1h7dk_inx8o_5:not(#\9) {
6
+ background-color: var(--color-board-placeholder-active-jh49z8, #e9ebed);
7
7
  }
8
- .awsui_placeholder--hover_1h7dk_1yaxu_8:not(#\9) {
9
- background-color: var(--color-board-placeholder-hover-8tcom5, #d3e7f9);
8
+ .awsui_placeholder--hover_1h7dk_inx8o_8:not(#\9) {
9
+ background-color: var(--color-board-placeholder-hover-ombmcs, #d3e7f9);
10
10
  }
11
11
 
12
- .awsui_root_1h7dk_1yaxu_12:not(#\9) {
12
+ .awsui_root_1h7dk_inx8o_12:not(#\9) {
13
13
  /* used in test-utils */
14
14
  }
15
15
 
16
- .awsui_empty_1h7dk_1yaxu_16:not(#\9) {
16
+ .awsui_empty_1h7dk_inx8o_16:not(#\9) {
17
17
  box-sizing: border-box;
18
18
  width: 100%;
19
- padding: var(--space-scaled-m-gxhdpl, 16px) var(--space-scaled-l-2rs0gk, 20px) var(--space-scaled-l-2rs0gk, 20px);
20
- color: var(--color-text-empty-v5xueo, #5f6b7a);
19
+ padding: var(--space-scaled-m-mo5yse, 16px) var(--space-scaled-l-0hpmd7, 20px) var(--space-scaled-l-0hpmd7, 20px);
20
+ color: var(--color-text-empty-2wfcyr, #5f6b7a);
21
21
  display: flex;
22
22
  justify-content: center;
23
23
  }
@@ -2,10 +2,10 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "placeholder": "awsui_placeholder_1h7dk_1yaxu_1",
6
- "placeholder--active": "awsui_placeholder--active_1h7dk_1yaxu_5",
7
- "placeholder--hover": "awsui_placeholder--hover_1h7dk_1yaxu_8",
8
- "root": "awsui_root_1h7dk_1yaxu_12",
9
- "empty": "awsui_empty_1h7dk_1yaxu_16"
5
+ "placeholder": "awsui_placeholder_1h7dk_inx8o_1",
6
+ "placeholder--active": "awsui_placeholder--active_1h7dk_inx8o_5",
7
+ "placeholder--hover": "awsui_placeholder--hover_1h7dk_inx8o_8",
8
+ "root": "awsui_root_1h7dk_inx8o_12",
9
+ "empty": "awsui_empty_1h7dk_inx8o_16"
10
10
  };
11
11
 
@@ -38,6 +38,7 @@ function initTransition({ operation, interactionType, itemsLayout, draggableItem
38
38
  operation,
39
39
  interactionType,
40
40
  itemsLayout,
41
+ layoutEngine: new LayoutEngine(itemsLayout),
41
42
  insertionDirection: null,
42
43
  draggableItem,
43
44
  draggableRect,
@@ -67,7 +68,7 @@ function initTransition({ operation, interactionType, itemsLayout, draggableItem
67
68
  };
68
69
  }
69
70
  function initRemoveTransition({ items, removedItem, itemsLayout }) {
70
- const layoutShift = new LayoutEngine(itemsLayout).remove(removedItem.id).refloat().getLayoutShift();
71
+ const layoutShift = new LayoutEngine(itemsLayout).remove(removedItem.id);
71
72
  const removeTransition = { items, removedItem, layoutShift };
72
73
  return { transition: null, removeTransition, announcement: null };
73
74
  }
@@ -1,6 +1,5 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- import { LayoutEngine } from "../../internal/layout-engine/engine";
4
3
  import { createPlaceholdersLayout, getDefaultColumnSpan, getDefaultRowSpan } from "../../internal/utils/layout";
5
4
  import { normalizeInsertionPath } from "./path";
6
5
  export function getLayoutColumns(transition) {
@@ -54,24 +53,21 @@ export function getLayoutShift(transition, path, insertionDirection) {
54
53
  if (path.length === 0) {
55
54
  return null;
56
55
  }
57
- const engine = new LayoutEngine(transition.itemsLayout);
58
56
  const width = getDefaultColumnSpan(transition.draggableItem, getLayoutColumns(transition));
59
57
  const height = getDefaultRowSpan(transition.draggableItem);
60
58
  const rows = getLayoutRows(transition);
61
59
  const columns = getLayoutColumns(transition);
62
60
  switch (transition.operation) {
63
61
  case "resize":
64
- return engine.resize({ itemId: transition.draggableItem.id, path }).getLayoutShift();
62
+ return transition.layoutEngine.resize({ itemId: transition.draggableItem.id, path });
65
63
  case "reorder":
66
- return engine.move({ itemId: transition.draggableItem.id, path }).getLayoutShift();
64
+ return transition.layoutEngine.move({ itemId: transition.draggableItem.id, path });
67
65
  case "insert":
68
- return engine
69
- .insert({
66
+ return transition.layoutEngine.insert({
70
67
  itemId: transition.draggableItem.id,
71
68
  width,
72
69
  height,
73
70
  path: normalizeInsertionPath(path, insertionDirection !== null && insertionDirection !== void 0 ? insertionDirection : "right", columns, rows),
74
- })
75
- .getLayoutShift();
71
+ });
76
72
  }
77
73
  }
@@ -1,16 +1,16 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "root": "awsui_root_9ckv7_h85wa_1",
5
- "container-override": "awsui_container-override_9ckv7_h85wa_6",
6
- "active": "awsui_active_9ckv7_h85wa_6",
7
- "header": "awsui_header_9ckv7_h85wa_31",
8
- "flexible": "awsui_flexible_9ckv7_h85wa_37",
9
- "handle": "awsui_handle_9ckv7_h85wa_41",
10
- "refresh": "awsui_refresh_9ckv7_h85wa_44",
11
- "header-content": "awsui_header-content_9ckv7_h85wa_48",
12
- "settings": "awsui_settings_9ckv7_h85wa_52",
13
- "fixed": "awsui_fixed_9ckv7_h85wa_60",
14
- "resizer": "awsui_resizer_9ckv7_h85wa_64"
4
+ "root": "awsui_root_9ckv7_1p0lm_1",
5
+ "container-override": "awsui_container-override_9ckv7_1p0lm_6",
6
+ "active": "awsui_active_9ckv7_1p0lm_6",
7
+ "header": "awsui_header_9ckv7_1p0lm_31",
8
+ "flexible": "awsui_flexible_9ckv7_1p0lm_37",
9
+ "handle": "awsui_handle_9ckv7_1p0lm_41",
10
+ "refresh": "awsui_refresh_9ckv7_1p0lm_44",
11
+ "header-content": "awsui_header-content_9ckv7_1p0lm_48",
12
+ "settings": "awsui_settings_9ckv7_1p0lm_52",
13
+ "fixed": "awsui_fixed_9ckv7_1p0lm_60",
14
+ "resizer": "awsui_resizer_9ckv7_1p0lm_64"
15
15
  };
16
16
 
@@ -1,21 +1,21 @@
1
- .awsui_root_9ckv7_h85wa_1:not(#\9) {
1
+ .awsui_root_9ckv7_1p0lm_1:not(#\9) {
2
2
  display: contents;
3
3
  }
4
4
 
5
5
  /* TODO: use container API instead of styles override */
6
- .awsui_container-override_9ckv7_h85wa_6.awsui_active_9ckv7_h85wa_6:not(#\9) {
7
- box-shadow: var(--shadow-container-active-x0fzbz, 0px 1px 1px 1px #e9ebed, 0px 6px 36px rgba(0, 7, 22, 0.1019607843));
6
+ .awsui_container-override_9ckv7_1p0lm_6.awsui_active_9ckv7_1p0lm_6:not(#\9) {
7
+ box-shadow: var(--shadow-container-active-7yvi6w, 0px 1px 1px 1px #e9ebed, 0px 6px 36px rgba(0, 7, 22, 0.1019607843));
8
8
  }
9
- [data-awsui-focus-visible] .awsui_container-override_9ckv7_h85wa_6.awsui_active_9ckv7_h85wa_6:not(#\9) {
9
+ [data-awsui-focus-visible] .awsui_container-override_9ckv7_1p0lm_6.awsui_active_9ckv7_1p0lm_6:not(#\9) {
10
10
  position: relative;
11
11
  box-sizing: border-box;
12
12
  outline: none;
13
13
  }
14
- [data-awsui-focus-visible] .awsui_container-override_9ckv7_h85wa_6.awsui_active_9ckv7_h85wa_6:not(#\9) {
14
+ [data-awsui-focus-visible] .awsui_container-override_9ckv7_1p0lm_6.awsui_active_9ckv7_1p0lm_6:not(#\9) {
15
15
  outline: 2px dotted transparent;
16
16
  outline-offset: -1px;
17
17
  }
18
- [data-awsui-focus-visible] .awsui_container-override_9ckv7_h85wa_6.awsui_active_9ckv7_h85wa_6:not(#\9)::before {
18
+ [data-awsui-focus-visible] .awsui_container-override_9ckv7_1p0lm_6.awsui_active_9ckv7_1p0lm_6:not(#\9)::before {
19
19
  content: " ";
20
20
  display: block;
21
21
  position: absolute;
@@ -24,45 +24,45 @@
24
24
  top: calc(-1 * 0px);
25
25
  width: calc(100% + 2 * 0px);
26
26
  height: calc(100% + 2 * 0px);
27
- border-radius: var(--border-radius-container-pmtq2d, 16px);
28
- border: 2px solid var(--color-border-item-focused-4t19h5, #0972d3);
27
+ border-radius: var(--border-radius-container-wqv1zi, 16px);
28
+ border: 2px solid var(--color-border-item-focused-b2ntyl, #0972d3);
29
29
  }
30
30
 
31
- .awsui_header_9ckv7_h85wa_31:not(#\9) {
31
+ .awsui_header_9ckv7_1p0lm_31:not(#\9) {
32
32
  display: flex;
33
33
  justify-items: center;
34
- padding: var(--space-scaled-s-913kwi, 12px) calc(var(--space-container-horizontal-jxdgil, 20px) - var(--space-scaled-xs-wbfgrv, 8px));
34
+ padding: var(--space-scaled-s-aqzyko, 12px) calc(var(--space-container-horizontal-wfukh3, 20px) - var(--space-scaled-xs-26e2du, 8px));
35
35
  }
36
36
 
37
- .awsui_flexible_9ckv7_h85wa_37:not(#\9) {
37
+ .awsui_flexible_9ckv7_1p0lm_37:not(#\9) {
38
38
  flex: 1 1 min-content;
39
39
  }
40
40
 
41
- .awsui_handle_9ckv7_h85wa_41:not(#\9) {
42
- margin-top: calc(var(--space-scaled-xxs-t2t62i, 4px) + 1px);
41
+ .awsui_handle_9ckv7_1p0lm_41:not(#\9) {
42
+ margin-top: calc(var(--space-scaled-xxs-7597g1, 4px) + 1px);
43
43
  }
44
- .awsui_refresh_9ckv7_h85wa_44 > .awsui_handle_9ckv7_h85wa_41:not(#\9) {
45
- margin-top: calc(var(--space-static-xxxs-b6tgp7, 2px) + 1px);
44
+ .awsui_refresh_9ckv7_1p0lm_44 > .awsui_handle_9ckv7_1p0lm_41:not(#\9) {
45
+ margin-top: calc(var(--space-static-xxxs-3gu9os, 2px) + 1px);
46
46
  }
47
47
 
48
- .awsui_header-content_9ckv7_h85wa_48:not(#\9) {
49
- margin-left: var(--space-scaled-xxs-t2t62i, 4px);
48
+ .awsui_header-content_9ckv7_1p0lm_48:not(#\9) {
49
+ margin-left: var(--space-scaled-xxs-7597g1, 4px);
50
50
  }
51
51
 
52
- .awsui_settings_9ckv7_h85wa_52:not(#\9) {
53
- margin-top: calc(var(--space-scaled-xxxs-jdgipl, 2px) + 1px);
54
- margin-left: var(--space-static-xs-zgeph4, 8px);
52
+ .awsui_settings_9ckv7_1p0lm_52:not(#\9) {
53
+ margin-top: calc(var(--space-scaled-xxxs-27y4hv, 2px) + 1px);
54
+ margin-left: var(--space-static-xs-7sfb63, 8px);
55
55
  }
56
- .awsui_refresh_9ckv7_h85wa_44 > .awsui_settings_9ckv7_h85wa_52:not(#\9) {
56
+ .awsui_refresh_9ckv7_1p0lm_44 > .awsui_settings_9ckv7_1p0lm_52:not(#\9) {
57
57
  margin-top: 0px;
58
58
  }
59
59
 
60
- .awsui_fixed_9ckv7_h85wa_60:not(#\9) {
60
+ .awsui_fixed_9ckv7_1p0lm_60:not(#\9) {
61
61
  flex: 0 0 auto;
62
62
  }
63
63
 
64
- .awsui_resizer_9ckv7_h85wa_64:not(#\9) {
64
+ .awsui_resizer_9ckv7_1p0lm_64:not(#\9) {
65
65
  position: absolute;
66
- bottom: calc(var(--space-static-xs-zgeph4, 8px) - var(--space-static-xxxs-b6tgp7, 2px));
67
- right: calc(var(--space-static-xs-zgeph4, 8px) - var(--space-static-xxxs-b6tgp7, 2px));
66
+ bottom: calc(var(--space-static-xs-7sfb63, 8px) - var(--space-static-xxxs-3gu9os, 2px));
67
+ right: calc(var(--space-static-xs-7sfb63, 8px) - var(--space-static-xxxs-3gu9os, 2px));
68
68
  }
@@ -2,16 +2,16 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "root": "awsui_root_9ckv7_h85wa_1",
6
- "container-override": "awsui_container-override_9ckv7_h85wa_6",
7
- "active": "awsui_active_9ckv7_h85wa_6",
8
- "header": "awsui_header_9ckv7_h85wa_31",
9
- "flexible": "awsui_flexible_9ckv7_h85wa_37",
10
- "handle": "awsui_handle_9ckv7_h85wa_41",
11
- "refresh": "awsui_refresh_9ckv7_h85wa_44",
12
- "header-content": "awsui_header-content_9ckv7_h85wa_48",
13
- "settings": "awsui_settings_9ckv7_h85wa_52",
14
- "fixed": "awsui_fixed_9ckv7_h85wa_60",
15
- "resizer": "awsui_resizer_9ckv7_h85wa_64"
5
+ "root": "awsui_root_9ckv7_1p0lm_1",
6
+ "container-override": "awsui_container-override_9ckv7_1p0lm_6",
7
+ "active": "awsui_active_9ckv7_1p0lm_6",
8
+ "header": "awsui_header_9ckv7_1p0lm_31",
9
+ "flexible": "awsui_flexible_9ckv7_1p0lm_37",
10
+ "handle": "awsui_handle_9ckv7_1p0lm_41",
11
+ "refresh": "awsui_refresh_9ckv7_1p0lm_44",
12
+ "header-content": "awsui_header-content_9ckv7_1p0lm_48",
13
+ "settings": "awsui_settings_9ckv7_1p0lm_52",
14
+ "fixed": "awsui_fixed_9ckv7_1p0lm_60",
15
+ "resizer": "awsui_resizer_9ckv7_1p0lm_64"
16
16
  };
17
17
 
@@ -218,7 +218,7 @@ export function generateInsert(grid, insertId = "X", options) {
218
218
  const textGrid = toMatrix(grid);
219
219
  const y = getRandomIndex(textGrid);
220
220
  const x = getRandomIndex(textGrid[y]);
221
- const width = getRandomInt(1, maxWidth + 1 - x);
221
+ const width = getRandomInt(1, Math.max(1, maxWidth + 1 - x));
222
222
  const height = getRandomInt(1, maxHeight + 1);
223
223
  return { itemId: insertId, width, height, path: [new Position({ x, y })] };
224
224
  }
@@ -1,4 +1,4 @@
1
1
  export var PACKAGE_SOURCE = "board-components";
2
- export var PACKAGE_VERSION = "3.0.0 (222f89e3)";
2
+ export var PACKAGE_VERSION = "3.0.0 (99e2db90)";
3
3
  export var THEME = "open-source-visual-refresh";
4
4
  export var ALWAYS_VISUAL_REFRESH = true;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "board-components",
3
- "PACKAGE_VERSION": "3.0.0 (222f89e3)",
3
+ "PACKAGE_VERSION": "3.0.0 (99e2db90)",
4
4
  "THEME": "open-source-visual-refresh",
5
5
  "ALWAYS_VISUAL_REFRESH": true
6
6
  }
@@ -1,6 +1,6 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "handle": "awsui_handle_cc1pu_1yi9f_1"
4
+ "handle": "awsui_handle_cc1pu_y0i9t_1"
5
5
  };
6
6
 
@@ -1,11 +1,11 @@
1
- .awsui_handle_cc1pu_1yi9f_1:not(#\9) {
1
+ .awsui_handle_cc1pu_y0i9t_1:not(#\9) {
2
2
  -webkit-appearance: none;
3
3
  appearance: none;
4
4
  background: transparent;
5
5
  border: none;
6
- padding: var(--space-scaled-xxs-t2t62i, 4px);
7
- color: var(--color-text-interactive-default-2sml2m, #414d5c);
6
+ padding: var(--space-scaled-xxs-7597g1, 4px);
7
+ color: var(--color-text-interactive-default-lnx6lk, #414d5c);
8
8
  }
9
- .awsui_handle_cc1pu_1yi9f_1:not(#\9):hover {
10
- color: var(--color-text-interactive-hover-8bpozs, #000716);
9
+ .awsui_handle_cc1pu_y0i9t_1:not(#\9):hover {
10
+ color: var(--color-text-interactive-hover-mj8add, #000716);
11
11
  }
@@ -2,6 +2,6 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "handle": "awsui_handle_cc1pu_1yi9f_1"
5
+ "handle": "awsui_handle_cc1pu_y0i9t_1"
6
6
  };
7
7
 
@@ -0,0 +1,32 @@
1
+ import { Position } from "../utils/position";
2
+ import { LayoutEngineState } from "./engine-state";
3
+ /**
4
+ * The cache is used to avoid duplicate computations for the same initial state and path.
5
+ * The cache must be invalidated once the items layout has changed e.g. as result of the operation commit.
6
+ * The cache is a tree of nodes with the root node representing the initial state and empty path. The
7
+ * rest of the tree store all previous state computations per path.
8
+ */
9
+ export declare class LayoutEngineCacheNode {
10
+ position: null | Position;
11
+ state: LayoutEngineState;
12
+ private next;
13
+ constructor(state: LayoutEngineState);
14
+ /**
15
+ * The function takes path position and the callback to compute the corresponding state if not yet cached.
16
+ * It returns the next cache node to take the next path position if available:
17
+ *
18
+ * const root = new LayoutEngineCacheNode(state)
19
+ *
20
+ * const x1y0 = root
21
+ * .matches({ x: 0, y: 0 }, () => compute({ x: 0, y: 0 })) // computes
22
+ * .matches({ x: 1, y: 0 }, () => compute({ x: 1, y: 0 })) // computes
23
+ * .state;
24
+ *
25
+ * const x2y0 = root
26
+ * .matches({ x: 0, y: 0 }, () => compute({ x: 0, y: 0 }))
27
+ * .matches({ x: 1, y: 0 }, () => compute({ x: 1, y: 0 }))
28
+ * .matches({ x: 2, y: 0 }, () => compute({ x: 2, y: 0 })) // computes
29
+ * .state;
30
+ */
31
+ matches(position: Position, compute: () => LayoutEngineState): LayoutEngineCacheNode;
32
+ }
@@ -0,0 +1,43 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ /**
4
+ * The cache is used to avoid duplicate computations for the same initial state and path.
5
+ * The cache must be invalidated once the items layout has changed e.g. as result of the operation commit.
6
+ * The cache is a tree of nodes with the root node representing the initial state and empty path. The
7
+ * rest of the tree store all previous state computations per path.
8
+ */
9
+ export class LayoutEngineCacheNode {
10
+ constructor(state) {
11
+ this.position = null;
12
+ this.next = new Array();
13
+ this.state = state;
14
+ }
15
+ /**
16
+ * The function takes path position and the callback to compute the corresponding state if not yet cached.
17
+ * It returns the next cache node to take the next path position if available:
18
+ *
19
+ * const root = new LayoutEngineCacheNode(state)
20
+ *
21
+ * const x1y0 = root
22
+ * .matches({ x: 0, y: 0 }, () => compute({ x: 0, y: 0 })) // computes
23
+ * .matches({ x: 1, y: 0 }, () => compute({ x: 1, y: 0 })) // computes
24
+ * .state;
25
+ *
26
+ * const x2y0 = root
27
+ * .matches({ x: 0, y: 0 }, () => compute({ x: 0, y: 0 }))
28
+ * .matches({ x: 1, y: 0 }, () => compute({ x: 1, y: 0 }))
29
+ * .matches({ x: 2, y: 0 }, () => compute({ x: 2, y: 0 })) // computes
30
+ * .state;
31
+ */
32
+ matches(position, compute) {
33
+ for (const nextNode of this.next) {
34
+ if (nextNode.position.x === position.x && nextNode.position.y === position.y) {
35
+ return nextNode;
36
+ }
37
+ }
38
+ const nextNode = new LayoutEngineCacheNode(compute());
39
+ nextNode.position = position;
40
+ this.next.push(nextNode);
41
+ return nextNode;
42
+ }
43
+ }
@@ -0,0 +1,25 @@
1
+ import { Conflicts } from "./engine-state";
2
+ import { LayoutEngineGrid, ReadonlyLayoutEngineGrid } from "./grid";
3
+ import { CommittedMove } from "./interfaces";
4
+ export type MoveSolution = [state: MoveSolutionState, nextMove: CommittedMove];
5
+ export declare class MoveSolutionState {
6
+ grid: LayoutEngineGrid;
7
+ moves: CommittedMove[];
8
+ moveIndex: number;
9
+ conflicts: null | Conflicts;
10
+ overlaps: Map<string, string>;
11
+ score: number;
12
+ constructor(grid: ReadonlyLayoutEngineGrid, moves: readonly CommittedMove[], conflicts: null | Conflicts);
13
+ static clone({ grid, moves, moveIndex, conflicts, overlaps, score }: MoveSolutionState): {
14
+ grid: LayoutEngineGrid;
15
+ moves: CommittedMove[];
16
+ moveIndex: number;
17
+ conflicts: Conflicts | null;
18
+ overlaps: Map<string, string>;
19
+ score: number;
20
+ };
21
+ }
22
+ /**
23
+ * Given a solution state finds a set of all possible moves each resolving a particular overlap.
24
+ */
25
+ export declare function findNextSolutions(state: MoveSolutionState): MoveSolution[];