@cloudscape-design/components 3.0.870 → 3.0.872

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 (159) hide show
  1. package/app-layout/drawer/resizable-drawer.d.ts.map +1 -1
  2. package/app-layout/drawer/resizable-drawer.js +2 -3
  3. package/app-layout/drawer/resizable-drawer.js.map +1 -1
  4. package/app-layout/utils/use-focus-control.d.ts +1 -2
  5. package/app-layout/utils/use-focus-control.d.ts.map +1 -1
  6. package/app-layout/utils/use-focus-control.js +0 -2
  7. package/app-layout/utils/use-focus-control.js.map +1 -1
  8. package/app-layout/utils/use-resize.d.ts.map +1 -1
  9. package/app-layout/utils/use-resize.js +2 -3
  10. package/app-layout/utils/use-resize.js.map +1 -1
  11. package/app-layout/utils/use-split-panel-focus-control.d.ts +1 -2
  12. package/app-layout/utils/use-split-panel-focus-control.d.ts.map +1 -1
  13. package/app-layout/utils/use-split-panel-focus-control.js +0 -1
  14. package/app-layout/utils/use-split-panel-focus-control.js.map +1 -1
  15. package/app-layout/visual-refresh-toolbar/drawer/global-drawer.d.ts.map +1 -1
  16. package/app-layout/visual-refresh-toolbar/drawer/global-drawer.js +2 -3
  17. package/app-layout/visual-refresh-toolbar/drawer/global-drawer.js.map +1 -1
  18. package/app-layout/visual-refresh-toolbar/drawer/local-drawer.d.ts.map +1 -1
  19. package/app-layout/visual-refresh-toolbar/drawer/local-drawer.js +2 -3
  20. package/app-layout/visual-refresh-toolbar/drawer/local-drawer.js.map +1 -1
  21. package/button-group/index.d.ts.map +1 -1
  22. package/button-group/index.js +22 -1
  23. package/button-group/index.js.map +1 -1
  24. package/button-group/interfaces.d.ts +2 -1
  25. package/button-group/interfaces.d.ts.map +1 -1
  26. package/button-group/interfaces.js.map +1 -1
  27. package/collection-preferences/content-display/index.d.ts.map +1 -1
  28. package/collection-preferences/content-display/index.js +8 -5
  29. package/collection-preferences/content-display/index.js.map +1 -1
  30. package/container/styles.css.js +32 -31
  31. package/container/styles.scoped.css +57 -54
  32. package/container/styles.selectors.js +32 -31
  33. package/flashbar/internal/analytics.d.ts.map +1 -1
  34. package/flashbar/internal/analytics.js +1 -3
  35. package/flashbar/internal/analytics.js.map +1 -1
  36. package/internal/components/autosuggest-input/index.d.ts.map +1 -1
  37. package/internal/components/autosuggest-input/index.js +6 -0
  38. package/internal/components/autosuggest-input/index.js.map +1 -1
  39. package/internal/components/drag-handle/index.d.ts +2 -2
  40. package/internal/components/drag-handle/index.d.ts.map +1 -1
  41. package/internal/components/drag-handle/index.js +7 -3
  42. package/internal/components/drag-handle/index.js.map +1 -1
  43. package/internal/components/drag-handle/interfaces.d.ts +1 -1
  44. package/internal/components/drag-handle/interfaces.d.ts.map +1 -1
  45. package/internal/components/drag-handle/interfaces.js.map +1 -1
  46. package/internal/components/panel-resize-handle/icon.d.ts +5 -0
  47. package/internal/components/panel-resize-handle/icon.d.ts.map +1 -0
  48. package/internal/components/panel-resize-handle/icon.js +9 -0
  49. package/internal/components/panel-resize-handle/icon.js.map +1 -0
  50. package/internal/components/panel-resize-handle/index.d.ts +2 -4
  51. package/internal/components/panel-resize-handle/index.d.ts.map +1 -1
  52. package/internal/components/panel-resize-handle/index.js +5 -8
  53. package/internal/components/panel-resize-handle/index.js.map +1 -1
  54. package/internal/components/panel-resize-handle/styles.css.js +5 -2
  55. package/internal/components/panel-resize-handle/styles.scoped.css +191 -3
  56. package/internal/components/panel-resize-handle/styles.selectors.js +5 -2
  57. package/internal/components/sortable-area/index.d.ts +6 -0
  58. package/internal/components/sortable-area/index.d.ts.map +1 -0
  59. package/internal/components/{dnd-area → sortable-area}/index.js +34 -25
  60. package/internal/components/sortable-area/index.js.map +1 -0
  61. package/internal/components/sortable-area/interfaces.d.ts +42 -0
  62. package/internal/components/sortable-area/interfaces.d.ts.map +1 -0
  63. package/internal/components/sortable-area/interfaces.js.map +1 -0
  64. package/internal/components/sortable-area/keyboard-sensor/defaults.d.ts.map +1 -0
  65. package/internal/components/sortable-area/keyboard-sensor/defaults.js.map +1 -0
  66. package/internal/components/sortable-area/keyboard-sensor/index.d.ts.map +1 -0
  67. package/internal/components/sortable-area/keyboard-sensor/index.js.map +1 -0
  68. package/internal/components/sortable-area/keyboard-sensor/utilities/events.d.ts.map +1 -0
  69. package/internal/components/sortable-area/keyboard-sensor/utilities/events.js.map +1 -0
  70. package/internal/components/sortable-area/keyboard-sensor/utilities/listeners.d.ts.map +1 -0
  71. package/internal/components/sortable-area/keyboard-sensor/utilities/listeners.js.map +1 -0
  72. package/internal/components/sortable-area/keyboard-sensor/utilities/scroll.d.ts.map +1 -0
  73. package/internal/components/sortable-area/keyboard-sensor/utilities/scroll.js.map +1 -0
  74. package/internal/components/sortable-area/styles.css.js +13 -0
  75. package/internal/components/{dnd-area → sortable-area}/styles.scoped.css +17 -17
  76. package/internal/components/sortable-area/styles.selectors.js +14 -0
  77. package/internal/components/{dnd-area → sortable-area}/use-drag-and-drop-reorder.d.ts +4 -3
  78. package/internal/components/sortable-area/use-drag-and-drop-reorder.d.ts.map +1 -0
  79. package/internal/components/{dnd-area → sortable-area}/use-drag-and-drop-reorder.js +4 -4
  80. package/internal/components/sortable-area/use-drag-and-drop-reorder.js.map +1 -0
  81. package/internal/components/sortable-area/use-live-announcements.d.ts +13 -0
  82. package/internal/components/sortable-area/use-live-announcements.d.ts.map +1 -0
  83. package/internal/components/{dnd-area → sortable-area}/use-live-announcements.js +6 -6
  84. package/internal/components/sortable-area/use-live-announcements.js.map +1 -0
  85. package/internal/environment.js +1 -1
  86. package/internal/environment.json +1 -1
  87. package/internal/manifest.json +1 -1
  88. package/internal/metrics.d.ts +3 -0
  89. package/internal/metrics.d.ts.map +1 -0
  90. package/internal/metrics.js +6 -0
  91. package/internal/metrics.js.map +1 -0
  92. package/internal/plugins/api.d.ts.map +1 -1
  93. package/internal/plugins/api.js +4 -0
  94. package/internal/plugins/api.js.map +1 -1
  95. package/internal/plugins/controllers/alert-flash-content.d.ts.map +1 -1
  96. package/internal/plugins/controllers/alert-flash-content.js +2 -1
  97. package/internal/plugins/controllers/alert-flash-content.js.map +1 -1
  98. package/internal/plugins/controllers/drawers.d.ts.map +1 -1
  99. package/internal/plugins/controllers/drawers.js +7 -3
  100. package/internal/plugins/controllers/drawers.js.map +1 -1
  101. package/internal/plugins/helpers/metrics.d.ts +3 -0
  102. package/internal/plugins/helpers/metrics.d.ts.map +1 -0
  103. package/internal/plugins/helpers/metrics.js +15 -0
  104. package/internal/plugins/helpers/metrics.js.map +1 -0
  105. package/internal/plugins/helpers/use-discovered-content.d.ts.map +1 -1
  106. package/internal/plugins/helpers/use-discovered-content.js +2 -1
  107. package/internal/plugins/helpers/use-discovered-content.js.map +1 -1
  108. package/internal/utils/dom.d.ts +1 -0
  109. package/internal/utils/dom.d.ts.map +1 -1
  110. package/internal/utils/dom.js +8 -0
  111. package/internal/utils/dom.js.map +1 -1
  112. package/package.json +1 -1
  113. package/split-panel/implementation.d.ts.map +1 -1
  114. package/split-panel/implementation.js +6 -7
  115. package/split-panel/implementation.js.map +1 -1
  116. package/table/header-cell/styles.css.js +28 -26
  117. package/table/header-cell/styles.scoped.css +68 -65
  118. package/table/header-cell/styles.selectors.js +28 -26
  119. package/table/table-role/utils.d.ts.map +1 -1
  120. package/table/table-role/utils.js +4 -5
  121. package/table/table-role/utils.js.map +1 -1
  122. package/app-layout/visual-refresh-toolbar/exports.d.ts +0 -6
  123. package/app-layout/visual-refresh-toolbar/exports.d.ts.map +0 -1
  124. package/app-layout/visual-refresh-toolbar/exports.js +0 -8
  125. package/app-layout/visual-refresh-toolbar/exports.js.map +0 -1
  126. package/internal/components/dnd-area/index.d.ts +0 -4
  127. package/internal/components/dnd-area/index.d.ts.map +0 -1
  128. package/internal/components/dnd-area/index.js.map +0 -1
  129. package/internal/components/dnd-area/interfaces.d.ts +0 -39
  130. package/internal/components/dnd-area/interfaces.d.ts.map +0 -1
  131. package/internal/components/dnd-area/interfaces.js.map +0 -1
  132. package/internal/components/dnd-area/keyboard-sensor/defaults.d.ts.map +0 -1
  133. package/internal/components/dnd-area/keyboard-sensor/defaults.js.map +0 -1
  134. package/internal/components/dnd-area/keyboard-sensor/index.d.ts.map +0 -1
  135. package/internal/components/dnd-area/keyboard-sensor/index.js.map +0 -1
  136. package/internal/components/dnd-area/keyboard-sensor/utilities/events.d.ts.map +0 -1
  137. package/internal/components/dnd-area/keyboard-sensor/utilities/events.js.map +0 -1
  138. package/internal/components/dnd-area/keyboard-sensor/utilities/listeners.d.ts.map +0 -1
  139. package/internal/components/dnd-area/keyboard-sensor/utilities/listeners.js.map +0 -1
  140. package/internal/components/dnd-area/keyboard-sensor/utilities/scroll.d.ts.map +0 -1
  141. package/internal/components/dnd-area/keyboard-sensor/utilities/scroll.js.map +0 -1
  142. package/internal/components/dnd-area/styles.css.js +0 -13
  143. package/internal/components/dnd-area/styles.selectors.js +0 -14
  144. package/internal/components/dnd-area/use-drag-and-drop-reorder.d.ts.map +0 -1
  145. package/internal/components/dnd-area/use-drag-and-drop-reorder.js.map +0 -1
  146. package/internal/components/dnd-area/use-live-announcements.d.ts +0 -12
  147. package/internal/components/dnd-area/use-live-announcements.d.ts.map +0 -1
  148. package/internal/components/dnd-area/use-live-announcements.js.map +0 -1
  149. /package/internal/components/{dnd-area → sortable-area}/interfaces.js +0 -0
  150. /package/internal/components/{dnd-area → sortable-area}/keyboard-sensor/defaults.d.ts +0 -0
  151. /package/internal/components/{dnd-area → sortable-area}/keyboard-sensor/defaults.js +0 -0
  152. /package/internal/components/{dnd-area → sortable-area}/keyboard-sensor/index.d.ts +0 -0
  153. /package/internal/components/{dnd-area → sortable-area}/keyboard-sensor/index.js +0 -0
  154. /package/internal/components/{dnd-area → sortable-area}/keyboard-sensor/utilities/events.d.ts +0 -0
  155. /package/internal/components/{dnd-area → sortable-area}/keyboard-sensor/utilities/events.js +0 -0
  156. /package/internal/components/{dnd-area → sortable-area}/keyboard-sensor/utilities/listeners.d.ts +0 -0
  157. /package/internal/components/{dnd-area → sortable-area}/keyboard-sensor/utilities/listeners.js +0 -0
  158. /package/internal/components/{dnd-area → sortable-area}/keyboard-sensor/utilities/scroll.d.ts +0 -0
  159. /package/internal/components/{dnd-area → sortable-area}/keyboard-sensor/utilities/scroll.js +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../../src/internal/metrics.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,+CAA+C,CAAC;AAIxE,eAAO,MAAM,OAAO,SAA+C,CAAC"}
@@ -0,0 +1,6 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { Metrics } from '@cloudscape-design/component-toolkit/internal';
4
+ import { PACKAGE_SOURCE, PACKAGE_VERSION } from './environment';
5
+ export const metrics = new Metrics(PACKAGE_SOURCE, PACKAGE_VERSION);
6
+ //# sourceMappingURL=metrics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../../src/internal/metrics.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,+CAA+C,CAAC;AAExE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhE,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Metrics } from '@cloudscape-design/component-toolkit/internal';\n\nimport { PACKAGE_SOURCE, PACKAGE_VERSION } from './environment';\n\nexport const metrics = new Metrics(PACKAGE_SOURCE, PACKAGE_VERSION);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../src/internal/plugins/api.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,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AA0B;WACpC,kBAAkB;kBACX,4BAA4B;cAChC,kBAAkB;kBACd,4BAA4B;iBAC7B,uBAAuB,oBAAoB,CAAC;yBACpC,8BAA8B;CAuCQ,CAAC"}
@@ -4,6 +4,7 @@ import { AppLayoutWidgetController } from './controllers/app-layout-widget';
4
4
  import { BreadcrumbsController } from './controllers/breadcrumbs';
5
5
  import { DrawersController } from './controllers/drawers';
6
6
  import { SharedReactContexts } from './controllers/shared-react-contexts';
7
+ import { reportRuntimeApiLoadMetric } from './helpers/metrics';
7
8
  const storageKey = Symbol.for('awsui-plugin-api');
8
9
  function findUpApi(currentWindow) {
9
10
  try {
@@ -27,6 +28,9 @@ export function loadApi() {
27
28
  }
28
29
  const win = window;
29
30
  const existingApi = findUpApi(win);
31
+ if (!existingApi) {
32
+ reportRuntimeApiLoadMetric();
33
+ }
30
34
  win[storageKey] = installApi(existingApi !== null && existingApi !== void 0 ? existingApi : {});
31
35
  return win[storageKey];
32
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../../src/internal/plugins/api.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAwC,MAAM,8BAA8B,CAAC;AAC7G,OAAO,EAGL,2BAA2B,GAC5B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAA8B,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AACxG,OAAO,EAA0B,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,EAAwC,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAE,mBAAmB,EAAkC,MAAM,qCAAqC,CAAC;AAE1G,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;AA0BlD,SAAS,SAAS,CAAC,aAA4B;IAC7C,IAAI;QACF,IAAI,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAG,UAAU,CAAC,EAAE;YAC/B,OAAO,aAAa,CAAC,UAAU,CA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AW,GAAG,IAAI,qBAAqB,EAAwB,CAAC;IACtE,GAAG,CAAC,oBAAoB,CAAC,WAAW,GAAG,WAAW,CAAC,eAAe,CAAC,GAAG,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC;IAEzG,MAAM,mBAAmB,GAAG,IAAI,mBAAmB,EAAE,CAAC;IACtD,GAAG,CAAC,oBAAoB,CAAC,mBAAmB,GAAG,mBAAmB,CAAC,eAAe,CAChF,GAAG,CAAC,oBAAoB,CAAC,mBAAmB,CAC7C,CAAC;IAEF,OAAO,GAAe,CAAC;AACzB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BreadcrumbGroupProps } from '../../breadcrumb-group/interfaces';\nimport { ActionButtonsController, ActionsApiInternal, ActionsApiPublic } from './controllers/action-buttons';\nimport {\n AlertFlashContentApiInternal,\n AlertFlashContentApiPublic,\n AlertFlashContentController,\n} from './controllers/alert-flash-content';\nimport { AppLayoutWidgetApiInternal, AppLayoutWidgetController } from './controllers/app-layout-widget';\nimport { BreadcrumbsApiInternal, BreadcrumbsController } from './controllers/breadcrumbs';\nimport { DrawersApiInternal, DrawersApiPublic, DrawersController } from './controllers/drawers';\nimport { SharedReactContexts, SharedReactContextsApiInternal } from './controllers/shared-react-contexts';\n\nconst storageKey = Symbol.for('awsui-plugin-api');\n\ninterface AwsuiApi {\n awsuiPlugins: {\n appLayout: DrawersApiPublic;\n alert: ActionsApiPublic;\n alertContent: AlertFlashContentApiPublic;\n flashbar: ActionsApiPublic;\n flashContent: AlertFlashContentApiPublic;\n };\n awsuiPluginsInternal: {\n appLayout: DrawersApiInternal;\n appLayoutWidget: AppLayoutWidgetApiInternal;\n alert: ActionsApiInternal;\n alertContent: AlertFlashContentApiInternal;\n flashbar: ActionsApiInternal;\n flashContent: AlertFlashContentApiInternal;\n breadcrumbs: BreadcrumbsApiInternal<BreadcrumbGroupProps>;\n sharedReactContexts: SharedReactContextsApiInternal;\n };\n}\n\ninterface WindowWithApi extends Window {\n [storageKey]: AwsuiApi;\n}\n\nfunction findUpApi(currentWindow: WindowWithApi): AwsuiApi | undefined {\n try {\n if (currentWindow?.[storageKey]) {\n return currentWindow[storageKey];\n }\n\n if (!currentWindow || currentWindow.parent === currentWindow) {\n // When the window has no more parents, it references itself\n return undefined;\n }\n\n return findUpApi(currentWindow.parent as WindowWithApi);\n } catch (ex) {\n // Most likely a cross-origin access error\n return undefined;\n }\n}\n\nexport function loadApi() {\n if (typeof window === 'undefined') {\n return installApi({});\n }\n const win = window as unknown as WindowWithApi;\n const existingApi = findUpApi(win);\n win[storageKey] = installApi(existingApi ?? {});\n return win[storageKey];\n}\n\nexport const { awsuiPlugins, awsuiPluginsInternal } = loadApi();\n\ntype DeepPartial<T> = T extends (...args: any) => any ? T : { [P in keyof T]?: DeepPartial<T[P]> };\n\nfunction installApi(api: DeepPartial<AwsuiApi>): AwsuiApi {\n api.awsuiPlugins ??= {};\n api.awsuiPluginsInternal ??= {};\n\n const appLayoutDrawers = new DrawersController();\n api.awsuiPlugins.appLayout = appLayoutDrawers.installPublic(api.awsuiPlugins.appLayout);\n api.awsuiPluginsInternal.appLayout = appLayoutDrawers.installInternal(api.awsuiPluginsInternal.appLayout);\n\n const appLayoutController = new AppLayoutWidgetController();\n api.awsuiPluginsInternal.appLayoutWidget = appLayoutController.installInternal(\n api.awsuiPluginsInternal.appLayoutWidget\n );\n\n const alertActions = new ActionButtonsController();\n api.awsuiPlugins.alert = alertActions.installPublic(api.awsuiPlugins.alert);\n api.awsuiPluginsInternal.alert = alertActions.installInternal(api.awsuiPluginsInternal.alert);\n\n const alertContent = new AlertFlashContentController();\n api.awsuiPlugins.alertContent = alertContent.installPublic(api.awsuiPlugins.alertContent);\n api.awsuiPluginsInternal.alertContent = alertContent.installInternal(api.awsuiPluginsInternal.alertContent);\n\n const flashContent = new AlertFlashContentController();\n api.awsuiPlugins.flashContent = flashContent.installPublic(api.awsuiPlugins.flashContent);\n api.awsuiPluginsInternal.flashContent = flashContent.installInternal(api.awsuiPluginsInternal.flashContent);\n\n const flashbarActions = new ActionButtonsController();\n api.awsuiPlugins.flashbar = flashbarActions.installPublic(api.awsuiPlugins.flashbar);\n api.awsuiPluginsInternal.flashbar = flashbarActions.installInternal(api.awsuiPluginsInternal.flashbar);\n\n const breadcrumbs = new BreadcrumbsController<BreadcrumbGroupProps>();\n api.awsuiPluginsInternal.breadcrumbs = breadcrumbs.installInternal(api.awsuiPluginsInternal.breadcrumbs);\n\n const sharedReactContexts = new SharedReactContexts();\n api.awsuiPluginsInternal.sharedReactContexts = sharedReactContexts.installInternal(\n api.awsuiPluginsInternal.sharedReactContexts\n );\n\n return api as AwsuiApi;\n}\n"]}
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../../src/internal/plugins/api.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAwC,MAAM,8BAA8B,CAAC;AAC7G,OAAO,EAGL,2BAA2B,GAC5B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAA8B,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AACxG,OAAO,EAA0B,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,EAAwC,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAE,mBAAmB,EAAkC,MAAM,qCAAqC,CAAC;AAC1G,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAE/D,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;AA0BlD,SAAS,SAAS,CAAC,aAA4B;IAC7C,IAAI;QACF,IAAI,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAG,UAAU,CAAC,EAAE;YAC/B,OAAO,aAAa,CAAC,UAAU,CAAC,CAAC;SAClC;QAED,IAAI,CAAC,aAAa,IAAI,aAAa,CAAC,MAAM,KAAK,aAAa,EAAE;YAC5D,4DAA4D;Y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C;IACtE,GAAG,CAAC,oBAAoB,CAAC,WAAW,GAAG,WAAW,CAAC,eAAe,CAAC,GAAG,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC;IAEzG,MAAM,mBAAmB,GAAG,IAAI,mBAAmB,EAAE,CAAC;IACtD,GAAG,CAAC,oBAAoB,CAAC,mBAAmB,GAAG,mBAAmB,CAAC,eAAe,CAChF,GAAG,CAAC,oBAAoB,CAAC,mBAAmB,CAC7C,CAAC;IAEF,OAAO,GAAe,CAAC;AACzB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BreadcrumbGroupProps } from '../../breadcrumb-group/interfaces';\nimport { ActionButtonsController, ActionsApiInternal, ActionsApiPublic } from './controllers/action-buttons';\nimport {\n AlertFlashContentApiInternal,\n AlertFlashContentApiPublic,\n AlertFlashContentController,\n} from './controllers/alert-flash-content';\nimport { AppLayoutWidgetApiInternal, AppLayoutWidgetController } from './controllers/app-layout-widget';\nimport { BreadcrumbsApiInternal, BreadcrumbsController } from './controllers/breadcrumbs';\nimport { DrawersApiInternal, DrawersApiPublic, DrawersController } from './controllers/drawers';\nimport { SharedReactContexts, SharedReactContextsApiInternal } from './controllers/shared-react-contexts';\nimport { reportRuntimeApiLoadMetric } from './helpers/metrics';\n\nconst storageKey = Symbol.for('awsui-plugin-api');\n\ninterface AwsuiApi {\n awsuiPlugins: {\n appLayout: DrawersApiPublic;\n alert: ActionsApiPublic;\n alertContent: AlertFlashContentApiPublic;\n flashbar: ActionsApiPublic;\n flashContent: AlertFlashContentApiPublic;\n };\n awsuiPluginsInternal: {\n appLayout: DrawersApiInternal;\n appLayoutWidget: AppLayoutWidgetApiInternal;\n alert: ActionsApiInternal;\n alertContent: AlertFlashContentApiInternal;\n flashbar: ActionsApiInternal;\n flashContent: AlertFlashContentApiInternal;\n breadcrumbs: BreadcrumbsApiInternal<BreadcrumbGroupProps>;\n sharedReactContexts: SharedReactContextsApiInternal;\n };\n}\n\ninterface WindowWithApi extends Window {\n [storageKey]: AwsuiApi;\n}\n\nfunction findUpApi(currentWindow: WindowWithApi): AwsuiApi | undefined {\n try {\n if (currentWindow?.[storageKey]) {\n return currentWindow[storageKey];\n }\n\n if (!currentWindow || currentWindow.parent === currentWindow) {\n // When the window has no more parents, it references itself\n return undefined;\n }\n\n return findUpApi(currentWindow.parent as WindowWithApi);\n } catch (ex) {\n // Most likely a cross-origin access error\n return undefined;\n }\n}\n\nexport function loadApi() {\n if (typeof window === 'undefined') {\n return installApi({});\n }\n const win = window as unknown as WindowWithApi;\n const existingApi = findUpApi(win);\n if (!existingApi) {\n reportRuntimeApiLoadMetric();\n }\n win[storageKey] = installApi(existingApi ?? {});\n return win[storageKey];\n}\n\nexport const { awsuiPlugins, awsuiPluginsInternal } = loadApi();\n\ntype DeepPartial<T> = T extends (...args: any) => any ? T : { [P in keyof T]?: DeepPartial<T[P]> };\n\nfunction installApi(api: DeepPartial<AwsuiApi>): AwsuiApi {\n api.awsuiPlugins ??= {};\n api.awsuiPluginsInternal ??= {};\n\n const appLayoutDrawers = new DrawersController();\n api.awsuiPlugins.appLayout = appLayoutDrawers.installPublic(api.awsuiPlugins.appLayout);\n api.awsuiPluginsInternal.appLayout = appLayoutDrawers.installInternal(api.awsuiPluginsInternal.appLayout);\n\n const appLayoutController = new AppLayoutWidgetController();\n api.awsuiPluginsInternal.appLayoutWidget = appLayoutController.installInternal(\n api.awsuiPluginsInternal.appLayoutWidget\n );\n\n const alertActions = new ActionButtonsController();\n api.awsuiPlugins.alert = alertActions.installPublic(api.awsuiPlugins.alert);\n api.awsuiPluginsInternal.alert = alertActions.installInternal(api.awsuiPluginsInternal.alert);\n\n const alertContent = new AlertFlashContentController();\n api.awsuiPlugins.alertContent = alertContent.installPublic(api.awsuiPlugins.alertContent);\n api.awsuiPluginsInternal.alertContent = alertContent.installInternal(api.awsuiPluginsInternal.alertContent);\n\n const flashContent = new AlertFlashContentController();\n api.awsuiPlugins.flashContent = flashContent.installPublic(api.awsuiPlugins.flashContent);\n api.awsuiPluginsInternal.flashContent = flashContent.installInternal(api.awsuiPluginsInternal.flashContent);\n\n const flashbarActions = new ActionButtonsController();\n api.awsuiPlugins.flashbar = flashbarActions.installPublic(api.awsuiPlugins.flashbar);\n api.awsuiPluginsInternal.flashbar = flashbarActions.installInternal(api.awsuiPluginsInternal.flashbar);\n\n const breadcrumbs = new BreadcrumbsController<BreadcrumbGroupProps>();\n api.awsuiPluginsInternal.breadcrumbs = breadcrumbs.installInternal(api.awsuiPluginsInternal.breadcrumbs);\n\n const sharedReactContexts = new SharedReactContexts();\n api.awsuiPluginsInternal.sharedReactContexts = sharedReactContexts.installInternal(\n api.awsuiPluginsInternal.sharedReactContexts\n );\n\n return api as AwsuiApi;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"alert-flash-content.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/alert-flash-content.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKlC,UAAU,OAAO,CAAC,CAAC;IACjB,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC;CACnB;AAED,UAAU,wBAAwB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAChC,UAAU,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CAClC;AAED,UAAU,+BAA+B;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEjE,UAAU,cAAc;IACtB,UAAU,IAAI,IAAI,CAAC;IACnB,aAAa,IAAI,IAAI,CAAC;IACtB,aAAa,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,WAAW,KAAK,IAAI,G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G,4BAA4B;CAMvG"}
1
+ {"version":3,"file":"alert-flash-content.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/alert-flash-content.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMlC,UAAU,OAAO,CAAC,CAAC;IACjB,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC;CACnB;AAED,UAAU,wBAAwB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAChC,UAAU,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CAClC;AAED,UAAU,+BAA+B;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEjE,UAAU,cAAc;IACtB,UAAU,IAAI,IAAI,CAAC;IACnB,aAAa,IAAI,IAAI,CAAC;IACtB,aAAa,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,WAAW,KAAK,IAAI,GAAG,IAAI,CAAC;IAChE,WAAW,IAAI,IAAI,CAAC;IACpB,cAAc,IAAI,IAAI,CAAC;IACvB,cAAc,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,WAAW,KAAK,IAAI,GAAG,IAAI,CAAC;CAClE;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,OAAO,EAAE,CAAC,UAAU,EAAE;QAAE,0BAA0B,EAAE,WAAW,CAAC;QAAC,2BAA2B,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,CAAC;CACtH;AAED,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,CAAC,OAAO,EAAE,wBAAwB,EAAE,cAAc,EAAE,cAAc,KAAK,uBAAuB,CAAC;IAC5G,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,+BAA+B,KAAK,OAAO,CAAC;CACtE;AAED,KAAK,qCAAqC,GAAG,CAAC,QAAQ,EAAE,uBAAuB,KAAK,MAAM,IAAI,CAAC;AAE/F,MAAM,WAAW,0BAA0B;IACzC,uBAAuB,CAAC,MAAM,EAAE,uBAAuB,GAAG,IAAI,CAAC;CAChE;AAED,MAAM,WAAW,4BAA4B;IAC3C,uBAAuB,IAAI,IAAI,CAAC;IAChC,mBAAmB,CAAC,QAAQ,EAAE,qCAAqC,GAAG,MAAM,IAAI,CAAC;IACjF,YAAY,CAAC,OAAO,EAAE,+BAA+B,GAAG,OAAO,CAAC;CACjE;AAED,qBAAa,2BAA2B;;IAgBtC,uBAAuB,YAAa,uBAAuB,UAYzD;IAEF,uBAAuB,aAErB;IAEF,YAAY,YAAa,+BAA+B,KAAG,OAAO,CAKhE;IAEF,mBAAmB,aAAc,qCAAqC,gBAapE;IAEF,aAAa,CAAC,GAAG,GAAE,OAAO,CAAC,0BAA0B,CAAM,GAAG,0BAA0B;IAKxF,eAAe,CAAC,WAAW,GAAE,OAAO,CAAC,4BAA4B,CAAM,GAAG,4BAA4B;CAMvG"}
@@ -3,6 +3,7 @@
3
3
  var _AlertFlashContentController_listeners, _AlertFlashContentController_cleanups, _AlertFlashContentController_provider, _AlertFlashContentController_scheduleUpdate;
4
4
  import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
5
5
  import debounce from '../../debounce';
6
+ import { reportRuntimeApiWarning } from '../helpers/metrics';
6
7
  export class AlertFlashContentController {
7
8
  constructor() {
8
9
  _AlertFlashContentController_listeners.set(this, []);
@@ -16,7 +17,7 @@ export class AlertFlashContentController {
16
17
  }), 0));
17
18
  this.registerContentReplacer = (content) => {
18
19
  if (__classPrivateFieldGet(this, _AlertFlashContentController_provider, "f")) {
19
- console.warn(`Cannot call \`registerContentReplacer\` with new provider: provider with id "${__classPrivateFieldGet(this, _AlertFlashContentController_provider, "f").id}" already registered.`);
20
+ reportRuntimeApiWarning('alert-flash-content', `Cannot call \`registerContentReplacer\` with new provider: provider with id "${__classPrivateFieldGet(this, _AlertFlashContentController_provider, "f").id}" already registered.`);
20
21
  return;
21
22
  }
22
23
  __classPrivateFieldSet(this, _AlertFlashContentController_provider, content, "f");
@@ -1 +1 @@
1
- {"version":3,"file":"alert-flash-content.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/alert-flash-content.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;;AAItC,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAqDtC,MAAM,OAAO,2BAA2B;IAAxC;QACE,iDAA2D,EAAE,EAAC;QAC9D,gDAAY,IAAI,GAAG,EAAqD,EAAC;QACzE,wDAAoC;QAEpC,sDAAkB,QAAQ,CACxB,GAAG,EAAE,CACH,uBAAA,IAAI,8CAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YACjC,IAAI,uBAAA,IAAI,6CAAU,EAAE;gBAClB,MAAM,OAAO,GAAG,QAAQ,CAAC,uBAAA,IAAI,6CAAU,CAAC,CAAC;gBACzC,uBAAA,IAAI,6CAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;aACvC;QACH,CAAC,CAAC,EACJ,CAAC,CACF,EAAC;QAEF,4BAAuB,GAAG,CAAC,OAAgC,EAAE,EAAE;YAC7D,IAAI,uBAAA,IAAI,6CAAU,EAAE;gBAClB,OAAO,CAAC,IAAI,CACV,gFAAgF,uBAAA,IAAI,6CAAU,CAAC,EAAE,uBAAuB,CACzH,CAAC;gBACF,OAAO;aACR;YACD,uBAAA,IAAI,yCAAa,OAAO,MAAA,CAAC;YAEzB,wFAAwF;YACxF,uBAAA,IAAI,mDAAgB,MAApB,IAAI,CAAkB,CAAC;QACzB,CAAC,CAAC;QAEF,4BAAuB,GAAG,GAAG,EAAE;YAC7B,uBAAA,IAAI,yCAAa,SAAS,MAAA,CAAC;Q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,CAAC,uBAAuB,EAAC;QACrE,MAAA,WAAW,CAAC,mBAAmB,oCAA/B,WAAW,CAAC,mBAAmB,GAAK,IAAI,CAAC,mBAAmB,EAAC;QAC7D,MAAA,WAAW,CAAC,YAAY,oCAAxB,WAAW,CAAC,YAAY,GAAK,IAAI,CAAC,YAAY,EAAC;QAC/C,OAAO,WAA2C,CAAC;IACrD,CAAC;CACF","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ReactNode } from 'react';\n\nimport debounce from '../../debounce';\n\n// this code should not depend on React typings, because it is portable between major versions\ninterface RefShim<T> {\n current: T | null;\n}\n\ninterface AlertFlashContentContext {\n type: string;\n headerRef: RefShim<HTMLElement>;\n contentRef: RefShim<HTMLElement>;\n}\n\ninterface AlertFlashContentInitialContext {\n type: string;\n header?: ReactNode;\n content?: ReactNode;\n}\n\nexport type ReplacementType = 'original' | 'remove' | 'replaced';\n\ninterface ReplacementApi {\n hideHeader(): void;\n restoreHeader(): void;\n replaceHeader(replacer: (container: HTMLElement) => void): void;\n hideContent(): void;\n restoreContent(): void;\n replaceContent(replacer: (container: HTMLElement) => void): void;\n}\n\nexport interface AlertFlashContentResult {\n update: () => void;\n unmount: (containers: { replacementHeaderContainer: HTMLElement; replacementContentContainer: HTMLElement }) => void;\n}\n\nexport interface AlertFlashContentConfig {\n id: string;\n runReplacer: (context: AlertFlashContentContext, replacementApi: ReplacementApi) => AlertFlashContentResult;\n initialCheck?: (context: AlertFlashContentInitialContext) => boolean;\n}\n\ntype AlertFlashContentRegistrationListener = (provider: AlertFlashContentConfig) => () => void;\n\nexport interface AlertFlashContentApiPublic {\n registerContentReplacer(config: AlertFlashContentConfig): void;\n}\n\nexport interface AlertFlashContentApiInternal {\n clearRegisteredReplacer(): void;\n onContentRegistered(listener: AlertFlashContentRegistrationListener): () => void;\n initialCheck(context: AlertFlashContentInitialContext): boolean;\n}\n\nexport class AlertFlashContentController {\n #listeners: Array<AlertFlashContentRegistrationListener> = [];\n #cleanups = new Map<AlertFlashContentRegistrationListener, () => void>();\n #provider?: AlertFlashContentConfig;\n\n #scheduleUpdate = debounce(\n () =>\n this.#listeners.forEach(listener => {\n if (this.#provider) {\n const cleanup = listener(this.#provider);\n this.#cleanups.set(listener, cleanup);\n }\n }),\n 0\n );\n\n registerContentReplacer = (content: AlertFlashContentConfig) => {\n if (this.#provider) {\n console.warn(\n `Cannot call \\`registerContentReplacer\\` with new provider: provider with id \"${this.#provider.id}\" already registered.`\n );\n return;\n }\n this.#provider = content;\n\n // Notify existing components if registration happens after the components are rendered.\n this.#scheduleUpdate();\n };\n\n clearRegisteredReplacer = () => {\n this.#provider = undefined;\n };\n\n initialCheck = (context: AlertFlashContentInitialContext): boolean => {\n if (this.#provider?.initialCheck) {\n return this.#provider.initialCheck(context);\n }\n return false;\n };\n\n onContentRegistered = (listener: AlertFlashContentRegistrationListener) => {\n if (this.#provider) {\n const cleanup = listener(this.#provider);\n this.#listeners.push(listener);\n this.#cleanups.set(listener, cleanup);\n } else {\n this.#listeners.push(listener);\n }\n return () => {\n this.#cleanups.get(listener)?.();\n this.#listeners = this.#listeners.filter(item => item !== listener);\n this.#cleanups.delete(listener);\n };\n };\n\n installPublic(api: Partial<AlertFlashContentApiPublic> = {}): AlertFlashContentApiPublic {\n api.registerContentReplacer ??= this.registerContentReplacer;\n return api as AlertFlashContentApiPublic;\n }\n\n installInternal(internalApi: Partial<AlertFlashContentApiInternal> = {}): AlertFlashContentApiInternal {\n internalApi.clearRegisteredReplacer ??= this.clearRegisteredReplacer;\n internalApi.onContentRegistered ??= this.onContentRegistered;\n internalApi.initialCheck ??= this.initialCheck;\n return internalApi as AlertFlashContentApiInternal;\n }\n}\n"]}
1
+ {"version":3,"file":"alert-flash-content.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/alert-flash-content.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;;AAItC,OAAO,QAAQ,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SPDX-License-Identifier: Apache-2.0\n\nimport { ReactNode } from 'react';\n\nimport debounce from '../../debounce';\nimport { reportRuntimeApiWarning } from '../helpers/metrics';\n\n// this code should not depend on React typings, because it is portable between major versions\ninterface RefShim<T> {\n current: T | null;\n}\n\ninterface AlertFlashContentContext {\n type: string;\n headerRef: RefShim<HTMLElement>;\n contentRef: RefShim<HTMLElement>;\n}\n\ninterface AlertFlashContentInitialContext {\n type: string;\n header?: ReactNode;\n content?: ReactNode;\n}\n\nexport type ReplacementType = 'original' | 'remove' | 'replaced';\n\ninterface ReplacementApi {\n hideHeader(): void;\n restoreHeader(): void;\n replaceHeader(replacer: (container: HTMLElement) => void): void;\n hideContent(): void;\n restoreContent(): void;\n replaceContent(replacer: (container: HTMLElement) => void): void;\n}\n\nexport interface AlertFlashContentResult {\n update: () => void;\n unmount: (containers: { replacementHeaderContainer: HTMLElement; replacementContentContainer: HTMLElement }) => void;\n}\n\nexport interface AlertFlashContentConfig {\n id: string;\n runReplacer: (context: AlertFlashContentContext, replacementApi: ReplacementApi) => AlertFlashContentResult;\n initialCheck?: (context: AlertFlashContentInitialContext) => boolean;\n}\n\ntype AlertFlashContentRegistrationListener = (provider: AlertFlashContentConfig) => () => void;\n\nexport interface AlertFlashContentApiPublic {\n registerContentReplacer(config: AlertFlashContentConfig): void;\n}\n\nexport interface AlertFlashContentApiInternal {\n clearRegisteredReplacer(): void;\n onContentRegistered(listener: AlertFlashContentRegistrationListener): () => void;\n initialCheck(context: AlertFlashContentInitialContext): boolean;\n}\n\nexport class AlertFlashContentController {\n #listeners: Array<AlertFlashContentRegistrationListener> = [];\n #cleanups = new Map<AlertFlashContentRegistrationListener, () => void>();\n #provider?: AlertFlashContentConfig;\n\n #scheduleUpdate = debounce(\n () =>\n this.#listeners.forEach(listener => {\n if (this.#provider) {\n const cleanup = listener(this.#provider);\n this.#cleanups.set(listener, cleanup);\n }\n }),\n 0\n );\n\n registerContentReplacer = (content: AlertFlashContentConfig) => {\n if (this.#provider) {\n reportRuntimeApiWarning(\n 'alert-flash-content',\n `Cannot call \\`registerContentReplacer\\` with new provider: provider with id \"${this.#provider.id}\" already registered.`\n );\n return;\n }\n this.#provider = content;\n\n // Notify existing components if registration happens after the components are rendered.\n this.#scheduleUpdate();\n };\n\n clearRegisteredReplacer = () => {\n this.#provider = undefined;\n };\n\n initialCheck = (context: AlertFlashContentInitialContext): boolean => {\n if (this.#provider?.initialCheck) {\n return this.#provider.initialCheck(context);\n }\n return false;\n };\n\n onContentRegistered = (listener: AlertFlashContentRegistrationListener) => {\n if (this.#provider) {\n const cleanup = listener(this.#provider);\n this.#listeners.push(listener);\n this.#cleanups.set(listener, cleanup);\n } else {\n this.#listeners.push(listener);\n }\n return () => {\n this.#cleanups.get(listener)?.();\n this.#listeners = this.#listeners.filter(item => item !== listener);\n this.#cleanups.delete(listener);\n };\n };\n\n installPublic(api: Partial<AlertFlashContentApiPublic> = {}): AlertFlashContentApiPublic {\n api.registerContentReplacer ??= this.registerContentReplacer;\n return api as AlertFlashContentApiPublic;\n }\n\n installInternal(internalApi: Partial<AlertFlashContentApiInternal> = {}): AlertFlashContentApiInternal {\n internalApi.clearRegisteredReplacer ??= this.clearRegisteredReplacer;\n internalApi.onContentRegistered ??= this.onContentRegistered;\n internalApi.initialCheck ??= this.initialCheck;\n return internalApi as AlertFlashContentApiInternal;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"drawers.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/drawers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAEzD,KAAK,sBAAsB,GAAG,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,KAAK,IAAI,CAAC;AAE/E,UAAU,mBAAmB;IAC3B,kBAAkB,EAAE,sBAAsB,CAAC;CAC5C;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,OAAO,CAAC;IAChB,qBAA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EAAE,sBAAsB,GAAG,MAAM,IAAI,CAAC;CAC9D;AAED,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,2BAA2B,CAA4C;IAC/E,OAAO,CAAC,oBAAoB,CAAuC;IACnE,OAAO,CAAC,oBAAoB,CAAuC;IAEnE,cAAc,aAER;IAEN,cAAc,WAAY,YAAY,UAMpC;IAEF,YAAY,8BAA+B,kBAAkB,UAgB3D;IAEF,mBAAmB,aAAc,2BAA2B,gBAY1D;IAEF,sBAAsB,aAEpB;IAEF,cAAc,aAAc,sBAAsB,gBAahD;IAEF,cAAc,aAAc,sBAAsB,gBAahD;IAEF,UAAU,aAAc,MAAM,WAAW,qBAAqB,UAE5D;IAEF,WAAW,aAAc,MAAM,WAAW,qBAAqB,UAE7D;IAEF,aAAa,CAAC,GAAG,GAAE,OAAO,CAAC,gBAAgB,CAAM,GAAG,gBAAgB;IAQpE,eAAe,CAAC,WAAW,GAAE,OAAO,CAAC,kBAAkB,CAAM,GAAG,kBAAkB;CAOnF"}
@@ -2,6 +2,7 @@ import { __rest } from "tslib";
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  import debounce from '../../debounce';
5
+ import { reportRuntimeApiWarning } from '../helpers/metrics';
5
6
  const updatableProperties = [
6
7
  'badge',
7
8
  'resizable',
@@ -21,6 +22,9 @@ export class DrawersController {
21
22
  (_a = this.drawersRegistrationListener) === null || _a === void 0 ? void 0 : _a.call(this, this.drawers);
22
23
  }, 0);
23
24
  this.registerDrawer = (config) => {
25
+ if (this.drawers.find(drawer => drawer.id === config.id)) {
26
+ reportRuntimeApiWarning('app-layout-drawers', `drawer with id "${config.id}" is already registered`);
27
+ }
24
28
  this.drawers = this.drawers.concat(config);
25
29
  this.scheduleUpdate();
26
30
  };
@@ -45,7 +49,7 @@ export class DrawersController {
45
49
  };
46
50
  this.onDrawersRegistered = (listener) => {
47
51
  if (this.drawersRegistrationListener !== null) {
48
- console.warn('[AwsUi] [runtime drawers] multiple app layout instances detected');
52
+ reportRuntimeApiWarning('app-layout-drawers', 'multiple app layout instances detected when calling onDrawersRegistered');
49
53
  }
50
54
  this.drawersRegistrationListener = listener;
51
55
  this.scheduleUpdate();
@@ -58,7 +62,7 @@ export class DrawersController {
58
62
  };
59
63
  this.onDrawerOpened = (listener) => {
60
64
  if (this.drawerOpenedListener !== null) {
61
- console.warn('[AwsUi] [runtime drawers] multiple app layout instances detected');
65
+ reportRuntimeApiWarning('app-layout-drawers', 'multiple app layout instances detected when calling onDrawerOpened');
62
66
  }
63
67
  this.drawerOpenedListener = listener;
64
68
  return () => {
@@ -67,7 +71,7 @@ export class DrawersController {
67
71
  };
68
72
  this.onDrawerClosed = (listener) => {
69
73
  if (this.drawerClosedListener !== null) {
70
- console.warn('[AwsUi] [runtime drawers] multiple app layout instances detected');
74
+ reportRuntimeApiWarning('app-layout-drawers', 'multiple app layout instances detected when calling onDrawerClosed');
71
75
  }
72
76
  this.drawerClosedListener = listener;
73
77
  return () => {
@@ -1 +1 @@
1
- {"version":3,"file":"drawers.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/drawers.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAsCtC,MAAM,mBAAmB,GAAG;IAC1B,OAAO;IACP,WAAW;IACX,aAAa;IACb,eAAe;IACf,eAAe;IACf,UAAU;CACF,CAAC;AA4BX,MAAM,OAAO,iBAAiB;IAA9B;QACU,YAAO,GAAwB,EAAE,CAAC;QAClC,gCAA2B,GAAuC,IAAI,CAAC;QACvE,yBAAoB,GAAkC,IAAI,CAAC;QAC3D,yBAAoB,GAAkC,IAAI,CAAC;QAEnE,mBAAc,GAAG,QAAQ,CAAC,GAAG,EAAE;;YAC7B,MAAA,IAAI,CAAC,2BAA2B,qDAAG,IAAI,CAAC,OAAO,CAAC,CAAC;Q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CAAC,cAAc,oCAAlB,GAAG,CAAC,cAAc,GAAK,IAAI,CAAC,cAAc,EAAC;QAC3C,MAAA,GAAG,CAAC,YAAY,oCAAhB,GAAG,CAAC,YAAY,GAAK,IAAI,CAAC,YAAY,EAAC;QACvC,MAAA,GAAG,CAAC,UAAU,oCAAd,GAAG,CAAC,UAAU,GAAK,IAAI,CAAC,UAAU,EAAC;QACnC,MAAA,GAAG,CAAC,WAAW,oCAAf,GAAG,CAAC,WAAW,GAAK,IAAI,CAAC,WAAW,EAAC;QACrC,OAAO,GAAuB,CAAC;IACjC,CAAC;IAED,eAAe,CAAC,cAA2C,EAAE;;QAC3D,MAAA,WAAW,CAAC,sBAAsB,oCAAlC,WAAW,CAAC,sBAAsB,GAAK,IAAI,CAAC,sBAAsB,EAAC;QACnE,MAAA,WAAW,CAAC,mBAAmB,oCAA/B,WAAW,CAAC,mBAAmB,GAAK,IAAI,CAAC,mBAAmB,EAAC;QAC7D,MAAA,WAAW,CAAC,cAAc,oCAA1B,WAAW,CAAC,cAAc,GAAK,IAAI,CAAC,cAAc,EAAC;QACnD,MAAA,WAAW,CAAC,cAAc,oCAA1B,WAAW,CAAC,cAAc,GAAK,IAAI,CAAC,cAAc,EAAC;QACnD,OAAO,WAAiC,CAAC;IAC3C,CAAC;CACF","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport debounce from '../../debounce';\nimport { NonCancelableEventHandler } from '../../events';\n\ntype DrawerVisibilityChange = (callback: (isVisible: boolean) => void) => void;\n\ninterface MountContentContext {\n onVisibilityChange: DrawerVisibilityChange;\n}\n\nexport interface DrawerStateChangeParams {\n isOpen: boolean;\n initiatedByUserAction?: boolean;\n}\n\nexport interface DrawerConfig {\n id: string;\n type?: 'local' | 'global';\n ariaLabels: {\n content?: string;\n closeButton?: string;\n triggerButton?: string;\n resizeHandle?: string;\n };\n badge?: boolean;\n resizable?: boolean;\n defaultSize?: number;\n onResize?: NonCancelableEventHandler<{ size: number; id: string }>;\n orderPriority?: number;\n defaultActive?: boolean;\n trigger?: {\n iconSvg: string;\n };\n mountContent: (container: HTMLElement, mountContext: MountContentContext) => void;\n unmountContent: (container: HTMLElement) => void;\n preserveInactiveContent?: boolean;\n onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;\n}\n\nconst updatableProperties = [\n 'badge',\n 'resizable',\n 'defaultSize',\n 'orderPriority',\n 'defaultActive',\n 'onResize',\n] as const;\n\nexport type UpdateDrawerConfig = { id: DrawerConfig['id'] } & Partial<\n Pick<DrawerConfig, (typeof updatableProperties)[number]>\n>;\n\ntype DrawersRegistrationListener = (drawers: Array<DrawerConfig>) => void;\n\nexport type DrawersToggledListener = (drawerId: string, params?: OpenCloseDrawerParams) => void;\n\ninterface OpenCloseDrawerParams {\n initiatedByUserAction: boolean;\n}\n\nexport interface DrawersApiPublic {\n registerDrawer(config: DrawerConfig): void;\n updateDrawer(config: UpdateDrawerConfig): void;\n openDrawer(drawerId: string, params?: OpenCloseDrawerParams): void;\n closeDrawer(drawerId: string, params?: OpenCloseDrawerParams): void;\n}\n\nexport interface DrawersApiInternal {\n clearRegisteredDrawers(): void;\n onDrawersRegistered(listener: DrawersRegistrationListener): () => void;\n onDrawerOpened(listener: DrawersToggledListener): () => void;\n onDrawerClosed(listener: DrawersToggledListener): () => void;\n}\n\nexport class DrawersController {\n private drawers: Array<DrawerConfig> = [];\n private drawersRegistrationListener: DrawersRegistrationListener | null = null;\n private drawerOpenedListener: DrawersToggledListener | null = null;\n private drawerClosedListener: DrawersToggledListener | null = null;\n\n scheduleUpdate = debounce(() => {\n this.drawersRegistrationListener?.(this.drawers);\n }, 0);\n\n registerDrawer = (config: DrawerConfig) => {\n this.drawers = this.drawers.concat(config);\n this.scheduleUpdate();\n };\n\n updateDrawer = ({ id: drawerId, ...rest }: UpdateDrawerConfig) => {\n const drawerIndex = this.drawers.findIndex(({ id }) => id === drawerId);\n const oldDrawerConfig = this.drawers?.[drawerIndex];\n if (!oldDrawerConfig) {\n throw new Error(`[AwsUi] [runtime drawers] drawer with id ${drawerId} not found`);\n }\n const drawers = this.drawers.slice();\n const updatedDrawer = { ...oldDrawerConfig };\n for (const key of updatableProperties) {\n if (key in rest) {\n updatedDrawer[key] = (rest as any)[key];\n }\n }\n drawers[drawerIndex] = updatedDrawer;\n this.drawers = drawers;\n this.scheduleUpdate();\n };\n\n onDrawersRegistered = (listener: DrawersRegistrationListener) => {\n if (this.drawersRegistrationListener !== null) {\n console.warn('[AwsUi] [runtime drawers] multiple app layout instances detected');\n }\n this.drawersRegistrationListener = listener;\n this.scheduleUpdate();\n return () => {\n this.drawersRegistrationListener = null;\n };\n };\n\n clearRegisteredDrawers = () => {\n this.drawers = [];\n };\n\n onDrawerOpened = (listener: DrawersToggledListener) => {\n if (this.drawerOpenedListener !== null) {\n console.warn('[AwsUi] [runtime drawers] multiple app layout instances detected');\n }\n\n this.drawerOpenedListener = listener;\n\n return () => {\n this.drawerOpenedListener = null;\n };\n };\n\n onDrawerClosed = (listener: DrawersToggledListener) => {\n if (this.drawerClosedListener !== null) {\n console.warn('[AwsUi] [runtime drawers] multiple app layout instances detected');\n }\n\n this.drawerClosedListener = listener;\n\n return () => {\n this.drawerClosedListener = null;\n };\n };\n\n openDrawer = (drawerId: string, params?: OpenCloseDrawerParams) => {\n this.drawerOpenedListener?.(drawerId, params);\n };\n\n closeDrawer = (drawerId: string, params?: OpenCloseDrawerParams) => {\n this.drawerClosedListener?.(drawerId, params);\n };\n\n installPublic(api: Partial<DrawersApiPublic> = {}): DrawersApiPublic {\n api.registerDrawer ??= this.registerDrawer;\n api.updateDrawer ??= this.updateDrawer;\n api.openDrawer ??= this.openDrawer;\n api.closeDrawer ??= this.closeDrawer;\n return api as DrawersApiPublic;\n }\n\n installInternal(internalApi: Partial<DrawersApiInternal> = {}): DrawersApiInternal {\n internalApi.clearRegisteredDrawers ??= this.clearRegisteredDrawers;\n internalApi.onDrawersRegistered ??= this.onDrawersRegistered;\n internalApi.onDrawerOpened ??= this.onDrawerOpened;\n internalApi.onDrawerClosed ??= this.onDrawerClosed;\n return internalApi as DrawersApiInternal;\n }\n}\n"]}
1
+ {"version":3,"file":"drawers.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/drawers.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAqC7D,MAAM,mBAAmB,GAAG;IAC1B,OAAO;IACP,WAAW;IACX,aAAa;IACb,eAAe;IACf,eAAe;IACf,UAAU;CACF,CAAC;AA4BX,MAAM,OAAO,iBAAiB;IAA9B;QACU,YAAO,GAAwB,EAAE,CAAC;QAClC,gCAA2B,GAAuC,IAAI,CAAC;QACvE,yBAAoB,GAAkC,IAAI,CAAC;QAC3D,yBAAoB,GAAkC,IAAI,CAAC;QAEnE,mBAAc,GAAG,QAAQ,CAAC,GAAG,EAAE;;YAC7B,MAAA,IAAI,CAAC,2BAA2B,qDAAG,IAAI,CAAC,OAAO,CAAC,CAAC;QACnD,CAAC,EAAE,CAAC,CAAC,CAAC;QAEN,mBAAc,GAAG,CAAC,MAAoB,EAAE,EAAE;YACxC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,MAAM,CAAC,EAAE,CAAC,EAAE;gBACxD,uBAAuB,CAAC,oBAAoB,EAAE,mBAAmB,MAAM,CAAC,EAAE,yBAAyB,CAAC,CAAC;aACtG;YACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAC3C,IAAI,CAAC,cAAc,EAAE,CAAC;QACxB,CAAC,CAAC;QAEF,iBAAY,GAAG,CAAC,EAA6C,EAAE,EAAE;;gBAAjD,EAAE,EAAE,EAAE,QAAQ,OAA+B,E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W,GAAK,IAAI,CAAC,WAAW,EAAC;QACrC,OAAO,GAAuB,CAAC;IACjC,CAAC;IAED,eAAe,CAAC,cAA2C,EAAE;;QAC3D,MAAA,WAAW,CAAC,sBAAsB,oCAAlC,WAAW,CAAC,sBAAsB,GAAK,IAAI,CAAC,sBAAsB,EAAC;QACnE,MAAA,WAAW,CAAC,mBAAmB,oCAA/B,WAAW,CAAC,mBAAmB,GAAK,IAAI,CAAC,mBAAmB,EAAC;QAC7D,MAAA,WAAW,CAAC,cAAc,oCAA1B,WAAW,CAAC,cAAc,GAAK,IAAI,CAAC,cAAc,EAAC;QACnD,MAAA,WAAW,CAAC,cAAc,oCAA1B,WAAW,CAAC,cAAc,GAAK,IAAI,CAAC,cAAc,EAAC;QACnD,OAAO,WAAiC,CAAC;IAC3C,CAAC;CACF","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport debounce from '../../debounce';\nimport { NonCancelableEventHandler } from '../../events';\nimport { reportRuntimeApiWarning } from '../helpers/metrics';\n\ntype DrawerVisibilityChange = (callback: (isVisible: boolean) => void) => void;\n\ninterface MountContentContext {\n onVisibilityChange: DrawerVisibilityChange;\n}\n\nexport interface DrawerStateChangeParams {\n isOpen: boolean;\n initiatedByUserAction?: boolean;\n}\n\nexport interface DrawerConfig {\n id: string;\n type?: 'local' | 'global';\n ariaLabels: {\n content?: string;\n closeButton?: string;\n triggerButton?: string;\n resizeHandle?: string;\n };\n badge?: boolean;\n resizable?: boolean;\n defaultSize?: number;\n onResize?: NonCancelableEventHandler<{ size: number; id: string }>;\n orderPriority?: number;\n defaultActive?: boolean;\n trigger?: {\n iconSvg: string;\n };\n mountContent: (container: HTMLElement, mountContext: MountContentContext) => void;\n unmountContent: (container: HTMLElement) => void;\n preserveInactiveContent?: boolean;\n onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;\n}\n\nconst updatableProperties = [\n 'badge',\n 'resizable',\n 'defaultSize',\n 'orderPriority',\n 'defaultActive',\n 'onResize',\n] as const;\n\nexport type UpdateDrawerConfig = { id: DrawerConfig['id'] } & Partial<\n Pick<DrawerConfig, (typeof updatableProperties)[number]>\n>;\n\ntype DrawersRegistrationListener = (drawers: Array<DrawerConfig>) => void;\n\nexport type DrawersToggledListener = (drawerId: string, params?: OpenCloseDrawerParams) => void;\n\ninterface OpenCloseDrawerParams {\n initiatedByUserAction: boolean;\n}\n\nexport interface DrawersApiPublic {\n registerDrawer(config: DrawerConfig): void;\n updateDrawer(config: UpdateDrawerConfig): void;\n openDrawer(drawerId: string, params?: OpenCloseDrawerParams): void;\n closeDrawer(drawerId: string, params?: OpenCloseDrawerParams): void;\n}\n\nexport interface DrawersApiInternal {\n clearRegisteredDrawers(): void;\n onDrawersRegistered(listener: DrawersRegistrationListener): () => void;\n onDrawerOpened(listener: DrawersToggledListener): () => void;\n onDrawerClosed(listener: DrawersToggledListener): () => void;\n}\n\nexport class DrawersController {\n private drawers: Array<DrawerConfig> = [];\n private drawersRegistrationListener: DrawersRegistrationListener | null = null;\n private drawerOpenedListener: DrawersToggledListener | null = null;\n private drawerClosedListener: DrawersToggledListener | null = null;\n\n scheduleUpdate = debounce(() => {\n this.drawersRegistrationListener?.(this.drawers);\n }, 0);\n\n registerDrawer = (config: DrawerConfig) => {\n if (this.drawers.find(drawer => drawer.id === config.id)) {\n reportRuntimeApiWarning('app-layout-drawers', `drawer with id \"${config.id}\" is already registered`);\n }\n this.drawers = this.drawers.concat(config);\n this.scheduleUpdate();\n };\n\n updateDrawer = ({ id: drawerId, ...rest }: UpdateDrawerConfig) => {\n const drawerIndex = this.drawers.findIndex(({ id }) => id === drawerId);\n const oldDrawerConfig = this.drawers?.[drawerIndex];\n if (!oldDrawerConfig) {\n throw new Error(`[AwsUi] [runtime drawers] drawer with id ${drawerId} not found`);\n }\n const drawers = this.drawers.slice();\n const updatedDrawer = { ...oldDrawerConfig };\n for (const key of updatableProperties) {\n if (key in rest) {\n updatedDrawer[key] = (rest as any)[key];\n }\n }\n drawers[drawerIndex] = updatedDrawer;\n this.drawers = drawers;\n this.scheduleUpdate();\n };\n\n onDrawersRegistered = (listener: DrawersRegistrationListener) => {\n if (this.drawersRegistrationListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawersRegistered'\n );\n }\n this.drawersRegistrationListener = listener;\n this.scheduleUpdate();\n return () => {\n this.drawersRegistrationListener = null;\n };\n };\n\n clearRegisteredDrawers = () => {\n this.drawers = [];\n };\n\n onDrawerOpened = (listener: DrawersToggledListener) => {\n if (this.drawerOpenedListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawerOpened'\n );\n }\n\n this.drawerOpenedListener = listener;\n\n return () => {\n this.drawerOpenedListener = null;\n };\n };\n\n onDrawerClosed = (listener: DrawersToggledListener) => {\n if (this.drawerClosedListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawerClosed'\n );\n }\n\n this.drawerClosedListener = listener;\n\n return () => {\n this.drawerClosedListener = null;\n };\n };\n\n openDrawer = (drawerId: string, params?: OpenCloseDrawerParams) => {\n this.drawerOpenedListener?.(drawerId, params);\n };\n\n closeDrawer = (drawerId: string, params?: OpenCloseDrawerParams) => {\n this.drawerClosedListener?.(drawerId, params);\n };\n\n installPublic(api: Partial<DrawersApiPublic> = {}): DrawersApiPublic {\n api.registerDrawer ??= this.registerDrawer;\n api.updateDrawer ??= this.updateDrawer;\n api.openDrawer ??= this.openDrawer;\n api.closeDrawer ??= this.closeDrawer;\n return api as DrawersApiPublic;\n }\n\n installInternal(internalApi: Partial<DrawersApiInternal> = {}): DrawersApiInternal {\n internalApi.clearRegisteredDrawers ??= this.clearRegisteredDrawers;\n internalApi.onDrawersRegistered ??= this.onDrawersRegistered;\n internalApi.onDrawerOpened ??= this.onDrawerOpened;\n internalApi.onDrawerClosed ??= this.onDrawerClosed;\n return internalApi as DrawersApiInternal;\n }\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export declare function reportRuntimeApiLoadMetric(): void;
2
+ export declare function reportRuntimeApiWarning(component: string, message: string): void;
3
+ //# sourceMappingURL=metrics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/metrics.ts"],"names":[],"mappings":"AAKA,wBAAgB,0BAA0B,SAEzC;AAED,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,QAMzE"}
@@ -0,0 +1,15 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { PACKAGE_VERSION } from '../../environment';
4
+ import { metrics } from '../../metrics';
5
+ export function reportRuntimeApiLoadMetric() {
6
+ metrics.sendPanoramaMetric({ eventName: 'awsui-runtime-api-loaded', eventDetail: { version: PACKAGE_VERSION } });
7
+ }
8
+ export function reportRuntimeApiWarning(component, message) {
9
+ console.warn('[AwsUi]', `[${component}]`, message);
10
+ metrics.sendPanoramaMetric({
11
+ eventName: 'awsui-runtime-api-warning',
12
+ eventDetail: { version: PACKAGE_VERSION, component, message },
13
+ });
14
+ }
15
+ //# sourceMappingURL=metrics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/metrics.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,UAAU,0BAA0B;IACxC,OAAO,CAAC,kBAAkB,CAAC,EAAE,SAAS,EAAE,0BAA0B,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE,EAAE,CAAC,CAAC;AACnH,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,SAAiB,EAAE,OAAe;IACxE,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,SAAS,GAAG,EAAE,OAAO,CAAC,CAAC;IACnD,OAAO,CAAC,kBAAkB,CAAC;QACzB,SAAS,EAAE,2BAA2B;QACtC,WAAW,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE;KAC9D,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { PACKAGE_VERSION } from '../../environment';\nimport { metrics } from '../../metrics';\n\nexport function reportRuntimeApiLoadMetric() {\n metrics.sendPanoramaMetric({ eventName: 'awsui-runtime-api-loaded', eventDetail: { version: PACKAGE_VERSION } });\n}\n\nexport function reportRuntimeApiWarning(component: string, message: string) {\n console.warn('[AwsUi]', `[${component}]`, message);\n metrics.sendPanoramaMetric({\n eventName: 'awsui-runtime-api-warning',\n eventDetail: { version: PACKAGE_VERSION, component, message },\n });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"use-discovered-content.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/use-discovered-content.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAA+B,MAAM,OAAO,CAAC;AAE/D,OAAO,EACL,4BAA4B,EAE5B,eAAe,EAChB,MAAM,oCAAoC,CAAC;AAE5C,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,4BAA4B;UAMhG,MAAM;YACJ,SAAS;cACP,SAAS;;;;;;;;;EA8FtB"}
1
+ {"version":3,"file":"use-discovered-content.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/use-discovered-content.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAA+B,MAAM,OAAO,CAAC;AAE/D,OAAO,EACL,4BAA4B,EAE5B,eAAe,EAChB,MAAM,oCAAoC,CAAC;AAG5C,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,4BAA4B;UAMhG,MAAM;YACJ,SAAS;cACP,SAAS;;;;;;;;;EA+FtB"}
@@ -1,6 +1,7 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { useEffect, useRef, useState } from 'react';
4
+ import { reportRuntimeApiWarning } from './metrics';
4
5
  export function createUseDiscoveredContent(componentName, controller) {
5
6
  return function useDiscoveredContent({ type, header, children, }) {
6
7
  const headerRef = useRef(null);
@@ -22,7 +23,7 @@ export function createUseDiscoveredContent(componentName, controller) {
22
23
  let mounted = true;
23
24
  function checkMounted(methodName) {
24
25
  if (!mounted) {
25
- console.warn(`[AwsUi] [Runtime ${componentName} content] \`${methodName}\` called after component unmounted`);
26
+ reportRuntimeApiWarning(`${componentName}-content-replacer`, `"${methodName}" called after component unmounted`);
26
27
  return false;
27
28
  }
28
29
  return true;
@@ -1 +1 @@
1
- {"version":3,"file":"use-discovered-content.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/use-discovered-content.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAa,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAQ/D,MAAM,UAAU,0BAA0B,CAAC,aAAqB,EAAE,UAAwC;IACxG,OAAO,SAAS,oBAAoB,CAAC,EACnC,IAAI,EACJ,MAAM,EACN,QAAQ,GAKT;QACC,MAAM,SAAS,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;QAC/C,MAAM,UAAU,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;QAChD,MAAM,oBAAoB,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;QAC1D,MAAM,qBAAqB,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;QAC3D,MAAM,CAAC,aAAa,EAAE,gB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ReactNode, useEffect, useRef, useState } from 'react';\n\nimport {\n AlertFlashContentApiInternal,\n AlertFlashContentResult,\n ReplacementType,\n} from '../controllers/alert-flash-content';\n\nexport function createUseDiscoveredContent(componentName: string, controller: AlertFlashContentApiInternal) {\n return function useDiscoveredContent({\n type,\n header,\n children,\n }: {\n type: string;\n header: ReactNode;\n children: ReactNode;\n }) {\n const headerRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const replacementHeaderRef = useRef<HTMLDivElement>(null);\n const replacementContentRef = useRef<HTMLDivElement>(null);\n const [initialHidden, setInitialHidden] = useState(() =>\n controller.initialCheck({\n type,\n header,\n content: children,\n })\n );\n const [headerReplacementType, setFoundHeaderReplacement] = useState<ReplacementType>('original');\n const [contentReplacementType, setFoundContentReplacement] = useState<ReplacementType>('original');\n const mountedProvider = useRef<AlertFlashContentResult | undefined>();\n\n useEffect(() => {\n const context = { type, headerRef, contentRef };\n\n setInitialHidden(false);\n\n return controller.onContentRegistered(provider => {\n let mounted = true;\n\n function checkMounted(methodName: string) {\n if (!mounted) {\n console.warn(\n `[AwsUi] [Runtime ${componentName} content] \\`${methodName}\\` called after component unmounted`\n );\n return false;\n }\n return true;\n }\n\n mountedProvider.current = provider.runReplacer(context, {\n hideHeader() {\n if (checkMounted('hideHeader')) {\n setFoundHeaderReplacement('remove');\n }\n },\n restoreHeader() {\n if (checkMounted('restoreHeader')) {\n setFoundHeaderReplacement('original');\n }\n },\n replaceHeader(replacer: (container: HTMLElement) => void) {\n if (checkMounted('replaceHeader')) {\n replacer(replacementHeaderRef.current!);\n setFoundHeaderReplacement('replaced');\n }\n },\n hideContent() {\n if (checkMounted('hideContent')) {\n setFoundContentReplacement('remove');\n }\n },\n restoreContent() {\n if (checkMounted('restoreContent')) {\n setFoundContentReplacement('original');\n }\n },\n replaceContent(replacer: (container: HTMLElement) => void) {\n if (checkMounted('replaceContent')) {\n replacer(replacementContentRef.current!);\n setFoundContentReplacement('replaced');\n }\n },\n });\n\n return () => {\n mountedProvider.current?.unmount({\n replacementHeaderContainer: replacementHeaderRef.current!,\n replacementContentContainer: replacementContentRef.current!,\n });\n mounted = false;\n };\n });\n }, [type]);\n\n useEffect(() => {\n mountedProvider.current?.update();\n }, [type, header, children]);\n\n return {\n initialHidden,\n headerReplacementType,\n contentReplacementType,\n headerRef: headerRef as React.Ref<HTMLDivElement>,\n replacementHeaderRef: replacementHeaderRef as React.Ref<HTMLDivElement>,\n contentRef: contentRef as React.Ref<HTMLDivElement>,\n replacementContentRef: replacementContentRef as React.Ref<HTMLDivElement>,\n };\n };\n}\n"]}
1
+ {"version":3,"file":"use-discovered-content.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/helpers/use-discovered-content.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAa,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAO/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAEpD,MAAM,UAAU,0BAA0B,CAAC,aAAqB,EAAE,UAAwC;IACxG,OAAO,SAAS,oBAAoB,CAAC,EACnC,IAAI,EACJ,MAAM,EACN,QAAQ,GAKT;QACC,MAAM,SAAS,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;QAC/C,MAAM,UAAU,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;QAChD,MAAM,oBAAoB,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;QAC1D,MAAM,qBAAqB,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;QAC3D,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CACtD,UAAU,CAAC,YAAY,CAAC;YACtB,IAAI;YACJ,MAAM;YACN,OAAO,EAAE,QAAQ;SAClB,CAAC,CACH,CAAC;QACF,MAAM,CAAC,qBAAqB,EAAE,yBAAyB,CAAC,GAAG,QAAQ,CAAkB,UAAU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CAAC,EAAE;4BAClC,0BAA0B,CAAC,UAAU,CAAC,CAAC;yBACxC;oBACH,CAAC;oBACD,cAAc,CAAC,QAA0C;wBACvD,IAAI,YAAY,CAAC,gBAAgB,CAAC,EAAE;4BAClC,QAAQ,CAAC,qBAAqB,CAAC,OAAQ,CAAC,CAAC;4BACzC,0BAA0B,CAAC,UAAU,CAAC,CAAC;yBACxC;oBACH,CAAC;iBACF,CAAC,CAAC;gBAEH,OAAO,GAAG,EAAE;;oBACV,MAAA,eAAe,CAAC,OAAO,0CAAE,OAAO,CAAC;wBAC/B,0BAA0B,EAAE,oBAAoB,CAAC,OAAQ;wBACzD,2BAA2B,EAAE,qBAAqB,CAAC,OAAQ;qBAC5D,CAAC,CAAC;oBACH,OAAO,GAAG,KAAK,CAAC;gBAClB,CAAC,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;QAEX,SAAS,CAAC,GAAG,EAAE;;YACb,MAAA,eAAe,CAAC,OAAO,0CAAE,MAAM,EAAE,CAAC;QACpC,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;QAE7B,OAAO;YACL,aAAa;YACb,qBAAqB;YACrB,sBAAsB;YACtB,SAAS,EAAE,SAAsC;YACjD,oBAAoB,EAAE,oBAAiD;YACvE,UAAU,EAAE,UAAuC;YACnD,qBAAqB,EAAE,qBAAkD;SAC1E,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ReactNode, useEffect, useRef, useState } from 'react';\n\nimport {\n AlertFlashContentApiInternal,\n AlertFlashContentResult,\n ReplacementType,\n} from '../controllers/alert-flash-content';\nimport { reportRuntimeApiWarning } from './metrics';\n\nexport function createUseDiscoveredContent(componentName: string, controller: AlertFlashContentApiInternal) {\n return function useDiscoveredContent({\n type,\n header,\n children,\n }: {\n type: string;\n header: ReactNode;\n children: ReactNode;\n }) {\n const headerRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const replacementHeaderRef = useRef<HTMLDivElement>(null);\n const replacementContentRef = useRef<HTMLDivElement>(null);\n const [initialHidden, setInitialHidden] = useState(() =>\n controller.initialCheck({\n type,\n header,\n content: children,\n })\n );\n const [headerReplacementType, setFoundHeaderReplacement] = useState<ReplacementType>('original');\n const [contentReplacementType, setFoundContentReplacement] = useState<ReplacementType>('original');\n const mountedProvider = useRef<AlertFlashContentResult | undefined>();\n\n useEffect(() => {\n const context = { type, headerRef, contentRef };\n\n setInitialHidden(false);\n\n return controller.onContentRegistered(provider => {\n let mounted = true;\n\n function checkMounted(methodName: string) {\n if (!mounted) {\n reportRuntimeApiWarning(\n `${componentName}-content-replacer`,\n `\"${methodName}\" called after component unmounted`\n );\n return false;\n }\n return true;\n }\n\n mountedProvider.current = provider.runReplacer(context, {\n hideHeader() {\n if (checkMounted('hideHeader')) {\n setFoundHeaderReplacement('remove');\n }\n },\n restoreHeader() {\n if (checkMounted('restoreHeader')) {\n setFoundHeaderReplacement('original');\n }\n },\n replaceHeader(replacer: (container: HTMLElement) => void) {\n if (checkMounted('replaceHeader')) {\n replacer(replacementHeaderRef.current!);\n setFoundHeaderReplacement('replaced');\n }\n },\n hideContent() {\n if (checkMounted('hideContent')) {\n setFoundContentReplacement('remove');\n }\n },\n restoreContent() {\n if (checkMounted('restoreContent')) {\n setFoundContentReplacement('original');\n }\n },\n replaceContent(replacer: (container: HTMLElement) => void) {\n if (checkMounted('replaceContent')) {\n replacer(replacementContentRef.current!);\n setFoundContentReplacement('replaced');\n }\n },\n });\n\n return () => {\n mountedProvider.current?.unmount({\n replacementHeaderContainer: replacementHeaderRef.current!,\n replacementContentContainer: replacementContentRef.current!,\n });\n mounted = false;\n };\n });\n }, [type]);\n\n useEffect(() => {\n mountedProvider.current?.update();\n }, [type, header, children]);\n\n return {\n initialHidden,\n headerReplacementType,\n contentReplacementType,\n headerRef: headerRef as React.Ref<HTMLDivElement>,\n replacementHeaderRef: replacementHeaderRef as React.Ref<HTMLDivElement>,\n contentRef: contentRef as React.Ref<HTMLDivElement>,\n replacementContentRef: replacementContentRef as React.Ref<HTMLDivElement>,\n };\n };\n}\n"]}
@@ -18,4 +18,5 @@ export declare function parseCssVariable(value: string): string;
18
18
  export declare function isNode(target: unknown): target is Node;
19
19
  export declare function isHTMLElement(target: unknown): target is HTMLElement;
20
20
  export declare function isSVGElement(target: unknown): target is SVGElement;
21
+ export declare function documentHasFocus(): boolean;
21
22
  //# sourceMappingURL=dom.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../../../src/internal/utils/dom.ts"],"names":[],"mappings":"AAOA,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAQ/D;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,WAAW,GAAG,WAAW,GAAG,IAAI,CAMhF;AAOD,wBAAgB,mBAAmB,CAAC,EAClC,YAAY,EACZ,KAAK,GACN,EAAE;IACD,YAAY,EAAE,WAAW,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC;CACrD,+BAmBA;AAID;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,UAqB7C;AAKD,wBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,IAAI,CAYtD;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,WAAW,CAUpE;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,UAAU,CAQlE"}
1
+ {"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../../../src/internal/utils/dom.ts"],"names":[],"mappings":"AAOA,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAQ/D;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,WAAW,GAAG,WAAW,GAAG,IAAI,CAMhF;AAOD,wBAAgB,mBAAmB,CAAC,EAClC,YAAY,EACZ,KAAK,GACN,EAAE;IACD,YAAY,EAAE,WAAW,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC;CACrD,+BAmBA;AAID;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,UAqB7C;AAKD,wBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,IAAI,CAYtD;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,WAAW,CAUpE;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,UAAU,CAQlE;AAED,wBAAgB,gBAAgB,YAM/B"}
@@ -99,4 +99,12 @@ export function isSVGElement(target) {
99
99
  'ownerSVGElement' in target &&
100
100
  typeof target.ownerSVGElement === 'object'));
101
101
  }
102
+ export function documentHasFocus() {
103
+ var _a;
104
+ // In JSDOM the hasFocus() always returns false which differs from the in-browser experience, see: https://github.com/jsdom/jsdom/issues/3794.
105
+ // Thus, when detecting JSDOM environment we return true here explicitly for the tests to work expectedly.
106
+ // The detection depends on the default userAgent set in JSDOM, see: https://github.com/jsdom/jsdom?tab=readme-ov-file#advanced-configuration.
107
+ const isJSDOM = typeof navigator !== 'undefined' && ((_a = navigator.userAgent) === null || _a === void 0 ? void 0 : _a.includes('jsdom'));
108
+ return isJSDOM || (typeof document !== undefined && document.hasFocus());
109
+ }
102
110
  //# sourceMappingURL=dom.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dom.js","sourceRoot":"","sources":["../../../../src/internal/utils/dom.ts"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,CAAC,CAAC,KAAK,CAAC;AAClC,CAAC;AAED,mFAAmF;AACnF,0DAA0D;AAE1D,MAAM,UAAU,MAAM,CAAC,MAAe;IACpC,OAAO,CACL,MAAM,YAAY,IAAI;QACtB,CAAC,MAAM,KAAK,IAAI;YACd,OAAO,MAAM,KAAK,QAAQ;YAC1B,UAAU,IAAI,MAAM;YACpB,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ;YACnC,UAAU,IAAI,MAAM;YACpB,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ;YACnC,YAAY,IAAI,MAAM;YACtB,OAAO,MAAM,CAAC,UAAU,KAAK,QAAQ,CAAC,CACzC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,MAAe;IAC3C,OAAO,CACL,MAAM,YAAY,WAAW;QAC7B,CAAC,MAAM,CAAC,MAAM,CAAC;YACb,MAAM,CAAC,QAAQ,KAAK,IAAI,CAAC,YAAY;YACrC,OAAO,IAAI,MAAM;YACjB,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ;YAChC,OAAO,MAAM,CAAC,aAAa,KAAK,QAAQ;YACxC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CACzB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAAe;IAC1C,OAAO,CACL,MAAM,YAAY,UAAU;QAC5B,CAAC,MAAM,CAAC,MAAM,CAAC;YACb,MAAM,CAAC,QAAQ,KAAK,IAAI,CAAC,YAAY;YACrC,iBAAiB,IAAI,MAAM;YAC3B,OAAO,MAAM,CAAC,eAAe,KAAK,QAAQ,CAAC,CAC9C,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport balanced from 'balanced-match';\n\nimport { findUpUntil } from '@cloudscape-design/component-toolkit/dom';\n\nexport function isContainingBlock(element: HTMLElement): boolean {\n const computedStyle = getComputedStyle(element);\n return (\n (!!computedStyle.transform && computedStyle.transform !== 'none') ||\n (!!computedStyle.perspective && computedStyle.perspective !== 'none') ||\n (!!computedStyle.containerType && computedStyle.containerType !== 'normal') ||\n computedStyle.contain?.split(' ').some(s => ['layout', 'paint', 'strict', 'content'].includes(s))\n );\n}\n\n/**\n * Returns an element that is used to position the given element.\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block\n */\nexport function getContainingBlock(startElement: HTMLElement): HTMLElement | null {\n if (!startElement.parentElement) {\n return null;\n }\n\n return findUpUntil(startElement.parentElement, isContainingBlock) as HTMLElement;\n}\n\n/*\n * Allows to find multiple elements in the page each according to a specific test function,\n * but traversing the DOM only once.\n */\n\nexport function findUpUntilMultiple({\n startElement,\n tests,\n}: {\n startElement: HTMLElement;\n tests: Record<string, (el: HTMLElement) => boolean>;\n}) {\n const keys = Object.keys(tests);\n const elements: Record<string, HTMLElement> = {};\n let current: HTMLElement | null = startElement;\n while (current && Object.keys(elements).length < keys.length) {\n current = current.parentElement;\n // If a component is used within an svg (i.e. as foreignObject), then it will\n // have some ancestor nodes that are SVGElement. We want to skip those,\n // as they have very different properties to HTMLElements.\n while (current && !isHTMLElement(current)) {\n current = (current as Element).parentElement;\n }\n for (const key of keys) {\n if (!elements[key] && current && tests[key](current)) {\n elements[key] = current;\n }\n }\n }\n return elements;\n}\n\nconst cssVariableExpression = /--.+?\\s*,\\s*(.+)/;\n\n/**\n * Parses a CSS color value that might contain CSS Custom Properties\n * and returns a value that will be understood by the browser, no matter of support level.\n * If the browser support CSS Custom Properties, the value will be return as is. Otherwise,\n * the fallback value will be extracted and returned instead.\n */\nexport function parseCssVariable(value: string) {\n if (typeof window === 'undefined') {\n return value;\n }\n\n if (window.CSS?.supports?.('color', 'var(--dummy, #000)') ?? false) {\n return value;\n }\n\n const varIndex = value.lastIndexOf('var(');\n if (varIndex === -1) {\n return value;\n }\n\n const expr = balanced('(', ')', value.substr(varIndex));\n if (!expr) {\n return value;\n }\n\n const match = expr.body.match(cssVariableExpression);\n return match ? match[1] : value;\n}\n\n// The instanceof Node/HTMLElement/SVGElement checks can fail if the target element\n// belongs to a different window than the respective type.\n\nexport function isNode(target: unknown): target is Node {\n return (\n target instanceof Node ||\n (target !== null &&\n typeof target === 'object' &&\n 'nodeType' in target &&\n typeof target.nodeType === 'number' &&\n 'nodeName' in target &&\n typeof target.nodeName === 'string' &&\n 'parentNode' in target &&\n typeof target.parentNode === 'object')\n );\n}\n\nexport function isHTMLElement(target: unknown): target is HTMLElement {\n return (\n target instanceof HTMLElement ||\n (isNode(target) &&\n target.nodeType === Node.ELEMENT_NODE &&\n 'style' in target &&\n typeof target.style === 'object' &&\n typeof target.ownerDocument === 'object' &&\n !isSVGElement(target))\n );\n}\n\nexport function isSVGElement(target: unknown): target is SVGElement {\n return (\n target instanceof SVGElement ||\n (isNode(target) &&\n target.nodeType === Node.ELEMENT_NODE &&\n 'ownerSVGElement' in target &&\n typeof target.ownerSVGElement === 'object')\n );\n}\n"]}
1
+ {"version":3,"file":"dom.js","sourceRoot":"","sources":["../../../../src/internal/utils/dom.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAEvE,MAAM,UAAU,iBAAiB,CAAC,OAAoB;;IACpD,MAAM,aAAa,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAChD,OAAO,CACL,CAAC,CAAC,CAAC,aAAa,CAAC,SAAS,IAAI,aAAa,CAAC,SAAS,KAAK,MAAM,CAAC;QACjE,CAAC,CAAC,CAAC,aAAa,CAAC,WAAW,IAAI,aAAa,CAAC,WAAW,KAAK,MAAM,CAAC;QACrE,CAAC,CAAC,CAAC,aAAa,CAAC,aAAa,IAAI,aAAa,CAAC,aAAa,KAAK,QAAQ,CAAC;SAC3E,MAAA,aAAa,CAAC,OAAO,0CAAE,KAAK,CAAC,GAAG,EAAE,IAAI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AAK,IAAI,CAAC,YAAY;YACrC,OAAO,IAAI,MAAM;YACjB,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ;YAChC,OAAO,MAAM,CAAC,aAAa,KAAK,QAAQ;YACxC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CACzB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAAe;IAC1C,OAAO,CACL,MAAM,YAAY,UAAU;QAC5B,CAAC,MAAM,CAAC,MAAM,CAAC;YACb,MAAM,CAAC,QAAQ,KAAK,IAAI,CAAC,YAAY;YACrC,iBAAiB,IAAI,MAAM;YAC3B,OAAO,MAAM,CAAC,eAAe,KAAK,QAAQ,CAAC,CAC9C,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gBAAgB;;IAC9B,8IAA8I;IAC9I,0GAA0G;IAC1G,8IAA8I;IAC9I,MAAM,OAAO,GAAG,OAAO,SAAS,KAAK,WAAW,KAAI,MAAA,SAAS,CAAC,SAAS,0CAAE,QAAQ,CAAC,OAAO,CAAC,CAAA,CAAC;IAC3F,OAAO,OAAO,IAAI,CAAC,OAAO,QAAQ,KAAK,SAAS,IAAI,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;AAC3E,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport balanced from 'balanced-match';\n\nimport { findUpUntil } from '@cloudscape-design/component-toolkit/dom';\n\nexport function isContainingBlock(element: HTMLElement): boolean {\n const computedStyle = getComputedStyle(element);\n return (\n (!!computedStyle.transform && computedStyle.transform !== 'none') ||\n (!!computedStyle.perspective && computedStyle.perspective !== 'none') ||\n (!!computedStyle.containerType && computedStyle.containerType !== 'normal') ||\n computedStyle.contain?.split(' ').some(s => ['layout', 'paint', 'strict', 'content'].includes(s))\n );\n}\n\n/**\n * Returns an element that is used to position the given element.\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block\n */\nexport function getContainingBlock(startElement: HTMLElement): HTMLElement | null {\n if (!startElement.parentElement) {\n return null;\n }\n\n return findUpUntil(startElement.parentElement, isContainingBlock) as HTMLElement;\n}\n\n/*\n * Allows to find multiple elements in the page each according to a specific test function,\n * but traversing the DOM only once.\n */\n\nexport function findUpUntilMultiple({\n startElement,\n tests,\n}: {\n startElement: HTMLElement;\n tests: Record<string, (el: HTMLElement) => boolean>;\n}) {\n const keys = Object.keys(tests);\n const elements: Record<string, HTMLElement> = {};\n let current: HTMLElement | null = startElement;\n while (current && Object.keys(elements).length < keys.length) {\n current = current.parentElement;\n // If a component is used within an svg (i.e. as foreignObject), then it will\n // have some ancestor nodes that are SVGElement. We want to skip those,\n // as they have very different properties to HTMLElements.\n while (current && !isHTMLElement(current)) {\n current = (current as Element).parentElement;\n }\n for (const key of keys) {\n if (!elements[key] && current && tests[key](current)) {\n elements[key] = current;\n }\n }\n }\n return elements;\n}\n\nconst cssVariableExpression = /--.+?\\s*,\\s*(.+)/;\n\n/**\n * Parses a CSS color value that might contain CSS Custom Properties\n * and returns a value that will be understood by the browser, no matter of support level.\n * If the browser support CSS Custom Properties, the value will be return as is. Otherwise,\n * the fallback value will be extracted and returned instead.\n */\nexport function parseCssVariable(value: string) {\n if (typeof window === 'undefined') {\n return value;\n }\n\n if (window.CSS?.supports?.('color', 'var(--dummy, #000)') ?? false) {\n return value;\n }\n\n const varIndex = value.lastIndexOf('var(');\n if (varIndex === -1) {\n return value;\n }\n\n const expr = balanced('(', ')', value.substr(varIndex));\n if (!expr) {\n return value;\n }\n\n const match = expr.body.match(cssVariableExpression);\n return match ? match[1] : value;\n}\n\n// The instanceof Node/HTMLElement/SVGElement checks can fail if the target element\n// belongs to a different window than the respective type.\n\nexport function isNode(target: unknown): target is Node {\n return (\n target instanceof Node ||\n (target !== null &&\n typeof target === 'object' &&\n 'nodeType' in target &&\n typeof target.nodeType === 'number' &&\n 'nodeName' in target &&\n typeof target.nodeName === 'string' &&\n 'parentNode' in target &&\n typeof target.parentNode === 'object')\n );\n}\n\nexport function isHTMLElement(target: unknown): target is HTMLElement {\n return (\n target instanceof HTMLElement ||\n (isNode(target) &&\n target.nodeType === Node.ELEMENT_NODE &&\n 'style' in target &&\n typeof target.style === 'object' &&\n typeof target.ownerDocument === 'object' &&\n !isSVGElement(target))\n );\n}\n\nexport function isSVGElement(target: unknown): target is SVGElement {\n return (\n target instanceof SVGElement ||\n (isNode(target) &&\n target.nodeType === Node.ELEMENT_NODE &&\n 'ownerSVGElement' in target &&\n typeof target.ownerSVGElement === 'object')\n );\n}\n\nexport function documentHasFocus() {\n // In JSDOM the hasFocus() always returns false which differs from the in-browser experience, see: https://github.com/jsdom/jsdom/issues/3794.\n // Thus, when detecting JSDOM environment we return true here explicitly for the tests to work expectedly.\n // The detection depends on the default userAgent set in JSDOM, see: https://github.com/jsdom/jsdom?tab=readme-ov-file#advanced-configuration.\n const isJSDOM = typeof navigator !== 'undefined' && navigator.userAgent?.includes('jsdom');\n return isJSDOM || (typeof document !== undefined && document.hasFocus());\n}\n"]}
package/package.json CHANGED
@@ -132,7 +132,7 @@
132
132
  "./internal/base-component/index.js",
133
133
  "./internal/base-component/styles.css.js"
134
134
  ],
135
- "version": "3.0.870",
135
+ "version": "3.0.872",
136
136
  "repository": {
137
137
  "type": "git",
138
138
  "url": "https://github.com/cloudscape-design/components.git"
@@ -1 +1 @@
1
- {"version":3,"file":"implementation.d.ts","sourceRoot":"","sources":["../../../src/split-panel/implementation.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAKlF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAO/C,MAAM,MAAM,6BAA6B,GAAG,YAAY,CAAC,eAAe,EAAE,uBAAuB,GAAG,eAAe,CAAC,GAClH,0BAA0B,CAAC;AAE7B,wBAAgB,wBAAwB,CAAC,EACvC,iBAAiB,EACjB,MAAM,EACN,QAAQ,EACR,qBAAqB,EACrB,aAAa,EACb,WAAgB,EAChB,GAAG,SAAS,EACb,EAAE,6BAA6B,eA4N/B;AAED,eAAO,MAAM,0BAA0B,2FAAsD,CAAC"}
1
+ {"version":3,"file":"implementation.d.ts","sourceRoot":"","sources":["../../../src/split-panel/implementation.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAKlF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAO/C,MAAM,MAAM,6BAA6B,GAAG,YAAY,CAAC,eAAe,EAAE,uBAAuB,GAAG,eAAe,CAAC,GAClH,0BAA0B,CAAC;AAE7B,wBAAgB,wBAAwB,CAAC,EACvC,iBAAiB,EACjB,MAAM,EACN,QAAQ,EACR,qBAAqB,EACrB,aAAa,EACb,WAAgB,EAChB,GAAG,SAAS,EACb,EAAE,6BAA6B,eA0N/B;AAED,eAAO,MAAM,0BAA0B,2FAAsD,CAAC"}
@@ -39,7 +39,7 @@ export function SplitPanelImplementation(_a) {
39
39
  const sizeControlProps = {
40
40
  position,
41
41
  panelRef: splitPanelRefObject,
42
- handleRef: refs.handle,
42
+ handleRef: refs.slider,
43
43
  onResize,
44
44
  };
45
45
  const onSliderPointerDown = usePointerEvents(sizeControlProps);
@@ -56,12 +56,11 @@ export function SplitPanelImplementation(_a) {
56
56
  React.createElement(InternalButton, { className: testUtilStyles['preferences-button'], iconName: "settings", variant: "icon", onClick: () => setPreferencesOpen(true), formAction: "none", ariaLabel: i18nStrings.preferencesTitle, ref: refs.preferences }),
57
57
  React.createElement("span", { className: styles.divider }))),
58
58
  isOpen ? (React.createElement(InternalButton, { className: testUtilStyles['close-button'], iconName: isRefresh && closeBehavior === 'collapse' ? (position === 'side' ? 'angle-right' : 'angle-down') : 'close', variant: "icon", onClick: onToggle, formAction: "none", ariaLabel: i18nStrings.closeButtonAriaLabel, ariaExpanded: isOpen })) : position === 'side' ? null : (React.createElement(InternalButton, { className: testUtilStyles['open-button'], iconName: "angle-up", variant: "icon", formAction: "none", ariaLabel: i18nStrings.openButtonAriaLabel, ref: refs.toggle, ariaExpanded: isOpen })))));
59
- const resizeHandle = (React.createElement("div", { ref: refs.handle },
60
- React.createElement(PanelResizeHandle, { ref: refs.slider, className: testUtilStyles.slider, ariaLabel: i18nStrings.resizeHandleAriaLabel,
61
- // Allows us to use the logical left/right keys to move the slider left/right,
62
- // but match aria keyboard behavior of using left/right to decrease/increase
63
- // the slider value.
64
- ariaValuenow: position === 'bottom' ? relativeSize : 100 - relativeSize, position: position, onKeyDown: onKeyDown, onPointerDown: onSliderPointerDown })));
59
+ const resizeHandle = (React.createElement(PanelResizeHandle, { ref: refs.slider, className: testUtilStyles.slider, ariaLabel: i18nStrings.resizeHandleAriaLabel,
60
+ // Allows us to use the logical left/right keys to move the slider left/right,
61
+ // but match aria keyboard behavior of using left/right to decrease/increase
62
+ // the slider value.
63
+ ariaValuenow: position === 'bottom' ? relativeSize : 100 - relativeSize, position: position, onKeyDown: onKeyDown, onPointerDown: onSliderPointerDown }));
65
64
  /*
66
65
  This effect forces the browser to recalculate the layout
67
66
  whenever the split panel might have moved.
@@ -1 +1 @@
1
- {"version":3,"file":"implementation.js","sourceRoot":"","sources":["../../../src/split-panel/implementation.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5E,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAA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AAC,uBAAuB;aAClD,EACD,SAAS,EAAE,WAAW,CAAC,EAAE;gBACvB,mBAAmB,mBAAM,WAAW,EAAG,CAAC;gBACxC,kBAAkB,CAAC,KAAK,CAAC,CAAC;YAC5B,CAAC,EACD,SAAS,EAAE,GAAG,EAAE;gBACd,kBAAkB,CAAC,KAAK,CAAC,CAAC;YAC5B,CAAC,GACD,CACH,CACA,CACJ,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,0BAA0B,GAAG,yBAAyB,CAAC,wBAAwB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useAppLayoutToolbarEnabled } from '../app-layout/utils/feature-flags';\nimport { SizeControlProps } from '../app-layout/utils/interfaces';\nimport { useKeyboardEvents } from '../app-layout/utils/use-keyboard-events';\nimport { usePointerEvents } from '../app-layout/utils/use-pointer-events';\nimport { InternalButton } from '../button/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport PanelResizeHandle from '../internal/components/panel-resize-handle';\nimport { useSplitPanelContext } from '../internal/context/split-panel-context';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport globalVars from '../internal/styles/global-vars';\nimport { SomeRequired } from '../internal/types';\nimport { createWidgetizedComponent } from '../internal/widgets';\nimport { SplitPanelContentBottom } from './bottom';\nimport { SplitPanelProps } from './interfaces';\nimport PreferencesModal from './preferences-modal';\nimport { SplitPanelContentSide } from './side';\n\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\nexport type SplitPanelImplementationProps = SomeRequired<SplitPanelProps, 'hidePreferencesButton' | 'closeBehavior'> &\n InternalBaseComponentProps;\n\nexport function SplitPanelImplementation({\n __internalRootRef,\n header,\n children,\n hidePreferencesButton,\n closeBehavior,\n i18nStrings = {},\n ...restProps\n}: SplitPanelImplementationProps) {\n const isRefresh = useVisualRefresh();\n const isToolbar = useAppLayoutToolbarEnabled();\n\n const {\n position,\n topOffset,\n bottomOffset,\n rightOffset,\n contentWidthStyles,\n isOpen,\n isForcedPosition,\n onPreferencesChange,\n onResize,\n onToggle,\n size,\n relativeSize,\n setSplitPanelToggle,\n refs,\n } = useSplitPanelContext();\n const baseProps = getBaseProps(restProps);\n const [isPreferencesOpen, setPreferencesOpen] = useState<boolean>(false);\n\n const appLayoutMaxWidth = isRefresh && position === 'bottom' ? contentWidthStyles : undefined;\n\n const openButtonAriaLabel = i18nStrings.openButtonAriaLabel;\n useEffect(() => {\n setSplitPanelToggle({ displayed: closeBehavior === 'collapse', ariaLabel: openButtonAriaLabel });\n\n return () => {\n setSplitPanelToggle({ displayed: false, ariaLabel: undefined });\n };\n }, [setSplitPanelToggle, openButtonAriaLabel, closeBehavior]);\n\n const splitPanelRefObject = useRef<HTMLDivElement>(null);\n\n const sizeControlProps: SizeControlProps = {\n position,\n panelRef: splitPanelRefObject,\n handleRef: refs.handle,\n onResize,\n };\n const onSliderPointerDown = usePointerEvents(sizeControlProps);\n const onKeyDown = useKeyboardEvents(sizeControlProps);\n\n const contentStyle = {\n [globalVars.stickyVerticalTopOffset]: topOffset,\n [globalVars.stickyVerticalBottomOffset]: bottomOffset,\n };\n\n const panelHeaderId = useUniqueId('split-panel-header');\n\n const wrappedHeader = (\n <div className={clsx(styles.header, isToolbar && styles['with-toolbar'])} style={appLayoutMaxWidth}>\n <h2 className={clsx(styles['header-text'], testUtilStyles['header-text'])} id={panelHeaderId}>\n {header}\n </h2>\n <div className={styles['header-actions']}>\n {!hidePreferencesButton && isOpen && (\n <>\n <InternalButton\n className={testUtilStyles['preferences-button']}\n iconName=\"settings\"\n variant=\"icon\"\n onClick={() => setPreferencesOpen(true)}\n formAction=\"none\"\n ariaLabel={i18nStrings.preferencesTitle}\n ref={refs.preferences}\n />\n <span className={styles.divider} />\n </>\n )}\n\n {isOpen ? (\n <InternalButton\n className={testUtilStyles['close-button']}\n iconName={\n isRefresh && closeBehavior === 'collapse' ? (position === 'side' ? 'angle-right' : 'angle-down') : 'close'\n }\n variant=\"icon\"\n onClick={onToggle}\n formAction=\"none\"\n ariaLabel={i18nStrings.closeButtonAriaLabel}\n ariaExpanded={isOpen}\n />\n ) : position === 'side' ? null : (\n <InternalButton\n className={testUtilStyles['open-button']}\n iconName=\"angle-up\"\n variant=\"icon\"\n formAction=\"none\"\n ariaLabel={i18nStrings.openButtonAriaLabel}\n ref={refs.toggle}\n ariaExpanded={isOpen}\n />\n )}\n </div>\n </div>\n );\n\n const resizeHandle = (\n <div ref={refs.handle}>\n <PanelResizeHandle\n ref={refs.slider}\n className={testUtilStyles.slider}\n ariaLabel={i18nStrings.resizeHandleAriaLabel}\n // Allows us to use the logical left/right keys to move the slider left/right,\n // but match aria keyboard behavior of using left/right to decrease/increase\n // the slider value.\n ariaValuenow={position === 'bottom' ? relativeSize : 100 - relativeSize}\n position={position}\n onKeyDown={onKeyDown}\n onPointerDown={onSliderPointerDown}\n />\n </div>\n );\n\n /*\n This effect forces the browser to recalculate the layout\n whenever the split panel might have moved.\n\n This is needed as a workaround for a bug in Safari, which does\n not automatically calculate the new position of the split panel\n _content_ when the split panel moves.\n */\n useLayoutEffect(() => {\n const root = splitPanelRefObject.current;\n\n if (root) {\n const property = 'transform';\n const temporaryValue = 'translateZ(0)';\n\n const valueBefore = root.style[property];\n root.style[property] = temporaryValue;\n\n // This line forces the browser to recalculate the layout\n void root.offsetHeight;\n\n root.style[property] = valueBefore;\n }\n }, [rightOffset, __internalRootRef]);\n\n const mergedRef = useMergeRefs(splitPanelRefObject, __internalRootRef);\n\n if (closeBehavior === 'hide' && !isOpen) {\n return <></>;\n }\n\n /**\n * The AppLayout factor moved the circular buttons out of the\n * SplitPanel and into the Tools component. This conditional\n * is still needed for the early return to prevent execution\n * of the following code.\n */\n if (isRefresh && !isToolbar && !isOpen && position === 'side') {\n return <></>;\n }\n\n return (\n <>\n {position === 'side' && (\n <SplitPanelContentSide\n style={contentStyle}\n resizeHandle={resizeHandle}\n baseProps={baseProps}\n isOpen={isOpen}\n splitPanelRef={mergedRef}\n cappedSize={size}\n onToggle={onToggle}\n openButtonAriaLabel={openButtonAriaLabel}\n toggleRef={refs.toggle}\n header={wrappedHeader}\n panelHeaderId={panelHeaderId}\n >\n {children}\n </SplitPanelContentSide>\n )}\n\n {position === 'bottom' && (\n <SplitPanelContentBottom\n style={contentStyle}\n resizeHandle={resizeHandle}\n baseProps={baseProps}\n isOpen={isOpen}\n splitPanelRef={mergedRef}\n cappedSize={size}\n onToggle={onToggle}\n header={wrappedHeader}\n panelHeaderId={panelHeaderId}\n appLayoutMaxWidth={appLayoutMaxWidth}\n >\n {children}\n </SplitPanelContentBottom>\n )}\n {isPreferencesOpen && (\n <PreferencesModal\n visible={true}\n preferences={{ position }}\n disabledSidePosition={position === 'bottom' && isForcedPosition}\n isRefresh={isRefresh}\n i18nStrings={{\n header: i18nStrings.preferencesTitle,\n confirm: i18nStrings.preferencesConfirm,\n cancel: i18nStrings.preferencesCancel,\n positionLabel: i18nStrings.preferencesPositionLabel,\n positionDescription: i18nStrings.preferencesPositionDescription,\n positionBottom: i18nStrings.preferencesPositionBottom,\n positionSide: i18nStrings.preferencesPositionSide,\n }}\n onConfirm={preferences => {\n onPreferencesChange({ ...preferences });\n setPreferencesOpen(false);\n }}\n onDismiss={() => {\n setPreferencesOpen(false);\n }}\n />\n )}\n </>\n );\n}\n\nexport const createWidgetizedSplitPanel = createWidgetizedComponent(SplitPanelImplementation);\n"]}
1
+ {"version":3,"file":"implementation.js","sourceRoot":"","sources":["../../../src/split-panel/implementation.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,M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BACpC,OAAO,EAAE,WAAW,CAAC,kBAAkB;gBACvC,MAAM,EAAE,WAAW,CAAC,iBAAiB;gBACrC,aAAa,EAAE,WAAW,CAAC,wBAAwB;gBACnD,mBAAmB,EAAE,WAAW,CAAC,8BAA8B;gBAC/D,cAAc,EAAE,WAAW,CAAC,yBAAyB;gBACrD,YAAY,EAAE,WAAW,CAAC,uBAAuB;aAClD,EACD,SAAS,EAAE,WAAW,CAAC,EAAE;gBACvB,mBAAmB,mBAAM,WAAW,EAAG,CAAC;gBACxC,kBAAkB,CAAC,KAAK,CAAC,CAAC;YAC5B,CAAC,EACD,SAAS,EAAE,GAAG,EAAE;gBACd,kBAAkB,CAAC,KAAK,CAAC,CAAC;YAC5B,CAAC,GACD,CACH,CACA,CACJ,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,0BAA0B,GAAG,yBAAyB,CAAC,wBAAwB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useAppLayoutToolbarEnabled } from '../app-layout/utils/feature-flags';\nimport { SizeControlProps } from '../app-layout/utils/interfaces';\nimport { useKeyboardEvents } from '../app-layout/utils/use-keyboard-events';\nimport { usePointerEvents } from '../app-layout/utils/use-pointer-events';\nimport { InternalButton } from '../button/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport PanelResizeHandle from '../internal/components/panel-resize-handle';\nimport { useSplitPanelContext } from '../internal/context/split-panel-context';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport globalVars from '../internal/styles/global-vars';\nimport { SomeRequired } from '../internal/types';\nimport { createWidgetizedComponent } from '../internal/widgets';\nimport { SplitPanelContentBottom } from './bottom';\nimport { SplitPanelProps } from './interfaces';\nimport PreferencesModal from './preferences-modal';\nimport { SplitPanelContentSide } from './side';\n\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\nexport type SplitPanelImplementationProps = SomeRequired<SplitPanelProps, 'hidePreferencesButton' | 'closeBehavior'> &\n InternalBaseComponentProps;\n\nexport function SplitPanelImplementation({\n __internalRootRef,\n header,\n children,\n hidePreferencesButton,\n closeBehavior,\n i18nStrings = {},\n ...restProps\n}: SplitPanelImplementationProps) {\n const isRefresh = useVisualRefresh();\n const isToolbar = useAppLayoutToolbarEnabled();\n\n const {\n position,\n topOffset,\n bottomOffset,\n rightOffset,\n contentWidthStyles,\n isOpen,\n isForcedPosition,\n onPreferencesChange,\n onResize,\n onToggle,\n size,\n relativeSize,\n setSplitPanelToggle,\n refs,\n } = useSplitPanelContext();\n const baseProps = getBaseProps(restProps);\n const [isPreferencesOpen, setPreferencesOpen] = useState<boolean>(false);\n\n const appLayoutMaxWidth = isRefresh && position === 'bottom' ? contentWidthStyles : undefined;\n\n const openButtonAriaLabel = i18nStrings.openButtonAriaLabel;\n useEffect(() => {\n setSplitPanelToggle({ displayed: closeBehavior === 'collapse', ariaLabel: openButtonAriaLabel });\n\n return () => {\n setSplitPanelToggle({ displayed: false, ariaLabel: undefined });\n };\n }, [setSplitPanelToggle, openButtonAriaLabel, closeBehavior]);\n\n const splitPanelRefObject = useRef<HTMLDivElement>(null);\n\n const sizeControlProps: SizeControlProps = {\n position,\n panelRef: splitPanelRefObject,\n handleRef: refs.slider,\n onResize,\n };\n const onSliderPointerDown = usePointerEvents(sizeControlProps);\n const onKeyDown = useKeyboardEvents(sizeControlProps);\n\n const contentStyle = {\n [globalVars.stickyVerticalTopOffset]: topOffset,\n [globalVars.stickyVerticalBottomOffset]: bottomOffset,\n };\n\n const panelHeaderId = useUniqueId('split-panel-header');\n\n const wrappedHeader = (\n <div className={clsx(styles.header, isToolbar && styles['with-toolbar'])} style={appLayoutMaxWidth}>\n <h2 className={clsx(styles['header-text'], testUtilStyles['header-text'])} id={panelHeaderId}>\n {header}\n </h2>\n <div className={styles['header-actions']}>\n {!hidePreferencesButton && isOpen && (\n <>\n <InternalButton\n className={testUtilStyles['preferences-button']}\n iconName=\"settings\"\n variant=\"icon\"\n onClick={() => setPreferencesOpen(true)}\n formAction=\"none\"\n ariaLabel={i18nStrings.preferencesTitle}\n ref={refs.preferences}\n />\n <span className={styles.divider} />\n </>\n )}\n\n {isOpen ? (\n <InternalButton\n className={testUtilStyles['close-button']}\n iconName={\n isRefresh && closeBehavior === 'collapse' ? (position === 'side' ? 'angle-right' : 'angle-down') : 'close'\n }\n variant=\"icon\"\n onClick={onToggle}\n formAction=\"none\"\n ariaLabel={i18nStrings.closeButtonAriaLabel}\n ariaExpanded={isOpen}\n />\n ) : position === 'side' ? null : (\n <InternalButton\n className={testUtilStyles['open-button']}\n iconName=\"angle-up\"\n variant=\"icon\"\n formAction=\"none\"\n ariaLabel={i18nStrings.openButtonAriaLabel}\n ref={refs.toggle}\n ariaExpanded={isOpen}\n />\n )}\n </div>\n </div>\n );\n\n const resizeHandle = (\n <PanelResizeHandle\n ref={refs.slider}\n className={testUtilStyles.slider}\n ariaLabel={i18nStrings.resizeHandleAriaLabel}\n // Allows us to use the logical left/right keys to move the slider left/right,\n // but match aria keyboard behavior of using left/right to decrease/increase\n // the slider value.\n ariaValuenow={position === 'bottom' ? relativeSize : 100 - relativeSize}\n position={position}\n onKeyDown={onKeyDown}\n onPointerDown={onSliderPointerDown}\n />\n );\n\n /*\n This effect forces the browser to recalculate the layout\n whenever the split panel might have moved.\n\n This is needed as a workaround for a bug in Safari, which does\n not automatically calculate the new position of the split panel\n _content_ when the split panel moves.\n */\n useLayoutEffect(() => {\n const root = splitPanelRefObject.current;\n\n if (root) {\n const property = 'transform';\n const temporaryValue = 'translateZ(0)';\n\n const valueBefore = root.style[property];\n root.style[property] = temporaryValue;\n\n // This line forces the browser to recalculate the layout\n void root.offsetHeight;\n\n root.style[property] = valueBefore;\n }\n }, [rightOffset, __internalRootRef]);\n\n const mergedRef = useMergeRefs(splitPanelRefObject, __internalRootRef);\n\n if (closeBehavior === 'hide' && !isOpen) {\n return <></>;\n }\n\n /**\n * The AppLayout factor moved the circular buttons out of the\n * SplitPanel and into the Tools component. This conditional\n * is still needed for the early return to prevent execution\n * of the following code.\n */\n if (isRefresh && !isToolbar && !isOpen && position === 'side') {\n return <></>;\n }\n\n return (\n <>\n {position === 'side' && (\n <SplitPanelContentSide\n style={contentStyle}\n resizeHandle={resizeHandle}\n baseProps={baseProps}\n isOpen={isOpen}\n splitPanelRef={mergedRef}\n cappedSize={size}\n onToggle={onToggle}\n openButtonAriaLabel={openButtonAriaLabel}\n toggleRef={refs.toggle}\n header={wrappedHeader}\n panelHeaderId={panelHeaderId}\n >\n {children}\n </SplitPanelContentSide>\n )}\n\n {position === 'bottom' && (\n <SplitPanelContentBottom\n style={contentStyle}\n resizeHandle={resizeHandle}\n baseProps={baseProps}\n isOpen={isOpen}\n splitPanelRef={mergedRef}\n cappedSize={size}\n onToggle={onToggle}\n header={wrappedHeader}\n panelHeaderId={panelHeaderId}\n appLayoutMaxWidth={appLayoutMaxWidth}\n >\n {children}\n </SplitPanelContentBottom>\n )}\n {isPreferencesOpen && (\n <PreferencesModal\n visible={true}\n preferences={{ position }}\n disabledSidePosition={position === 'bottom' && isForcedPosition}\n isRefresh={isRefresh}\n i18nStrings={{\n header: i18nStrings.preferencesTitle,\n confirm: i18nStrings.preferencesConfirm,\n cancel: i18nStrings.preferencesCancel,\n positionLabel: i18nStrings.preferencesPositionLabel,\n positionDescription: i18nStrings.preferencesPositionDescription,\n positionBottom: i18nStrings.preferencesPositionBottom,\n positionSide: i18nStrings.preferencesPositionSide,\n }}\n onConfirm={preferences => {\n onPreferencesChange({ ...preferences });\n setPreferencesOpen(false);\n }}\n onDismiss={() => {\n setPreferencesOpen(false);\n }}\n />\n )}\n </>\n );\n}\n\nexport const createWidgetizedSplitPanel = createWidgetizedComponent(SplitPanelImplementation);\n"]}