@internetarchive/modal-manager 2.0.4 → 2.0.5-webdev-8155.2

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 (101) hide show
  1. package/.editorconfig +29 -29
  2. package/.github/workflows/ci.yml +40 -30
  3. package/.github/workflows/gh-pages-main.yml +42 -42
  4. package/.github/workflows/pr-preview.yml +40 -40
  5. package/.prettierrc +4 -0
  6. package/.vscode/extensions.json +10 -0
  7. package/.vscode/tasks.json +12 -0
  8. package/LICENSE +661 -661
  9. package/README.md +139 -139
  10. package/custom-elements.json +170 -170
  11. package/demo/app-root.ts +366 -0
  12. package/dist/demo/app-root.d.ts +22 -0
  13. package/dist/demo/app-root.js +338 -0
  14. package/dist/demo/app-root.js.map +1 -0
  15. package/dist/index.d.ts +7 -7
  16. package/dist/index.js +5 -5
  17. package/dist/src/assets/arrow-left-icon.d.ts +2 -2
  18. package/dist/src/assets/arrow-left-icon.js +2 -2
  19. package/dist/src/assets/ia-logo-icon.d.ts +2 -2
  20. package/dist/src/assets/ia-logo-icon.js +2 -2
  21. package/dist/src/modal-config.d.ts +104 -104
  22. package/dist/src/modal-config.js +23 -24
  23. package/dist/src/modal-config.js.map +1 -1
  24. package/dist/src/modal-manager-host-bridge-interface.d.ts +12 -12
  25. package/dist/src/modal-manager-host-bridge-interface.js +1 -1
  26. package/dist/src/modal-manager-host-bridge.d.ts +34 -34
  27. package/dist/src/modal-manager-host-bridge.js +62 -62
  28. package/dist/src/modal-manager-host-bridge.js.map +1 -1
  29. package/dist/src/modal-manager-interface.d.ts +27 -27
  30. package/dist/src/modal-manager-interface.js +1 -1
  31. package/dist/src/modal-manager-mode.d.ts +10 -10
  32. package/dist/src/modal-manager-mode.js +11 -11
  33. package/dist/src/modal-manager.d.ts +137 -137
  34. package/dist/src/modal-manager.js +243 -249
  35. package/dist/src/modal-manager.js.map +1 -1
  36. package/dist/src/modal-template.d.ts +41 -41
  37. package/dist/src/modal-template.js +119 -118
  38. package/dist/src/modal-template.js.map +1 -1
  39. package/dist/src/shoelace/active-elements.d.ts +15 -15
  40. package/dist/src/shoelace/active-elements.js +28 -27
  41. package/dist/src/shoelace/active-elements.js.map +1 -1
  42. package/dist/src/shoelace/modal.d.ts +24 -24
  43. package/dist/src/shoelace/modal.js +130 -131
  44. package/dist/src/shoelace/modal.js.map +1 -1
  45. package/dist/src/shoelace/tabbable.d.ts +9 -9
  46. package/dist/src/shoelace/tabbable.js +168 -169
  47. package/dist/src/shoelace/tabbable.js.map +1 -1
  48. package/dist/test/modal-config.test.d.ts +1 -1
  49. package/dist/test/modal-config.test.js +68 -69
  50. package/dist/test/modal-config.test.js.map +1 -1
  51. package/dist/test/modal-manager.test.d.ts +1 -1
  52. package/dist/test/modal-manager.test.js +306 -309
  53. package/dist/test/modal-manager.test.js.map +1 -1
  54. package/dist/test/modal-template.test.d.ts +1 -1
  55. package/dist/test/modal-template.test.js +158 -167
  56. package/dist/test/modal-template.test.js.map +1 -1
  57. package/dist/vite.config.d.ts +2 -2
  58. package/dist/vite.config.js +22 -22
  59. package/dist/vitest.config.ci.d.ts +2 -0
  60. package/dist/vitest.config.ci.js +24 -0
  61. package/dist/vitest.config.ci.js.map +1 -0
  62. package/docs/assets/css/main.css +2678 -2678
  63. package/docs/classes/_src_modal_config_.modalconfig.html +429 -429
  64. package/docs/classes/_src_modal_manager_.modalmanager.html +7702 -7702
  65. package/docs/classes/_src_modal_manager_host_bridge_.modalmanagerhostbridge.html +409 -409
  66. package/docs/classes/_src_modal_template_.modaltemplate.html +7096 -7096
  67. package/docs/enums/_src_modal_manager_mode_.modalmanagermode.html +196 -196
  68. package/docs/globals.html +150 -150
  69. package/docs/index.html +252 -252
  70. package/docs/interfaces/_src_modal_manager_host_bridge_interface_.modalmanagerhostbridgeinterface.html +210 -210
  71. package/docs/interfaces/_src_modal_manager_interface_.modalmanagerinterface.html +7095 -7095
  72. package/docs/modules/_index_.html +208 -208
  73. package/docs/modules/_src_modal_config_.html +146 -146
  74. package/docs/modules/_src_modal_manager_.html +146 -146
  75. package/docs/modules/_src_modal_manager_host_bridge_.html +146 -146
  76. package/docs/modules/_src_modal_manager_host_bridge_interface_.html +146 -146
  77. package/docs/modules/_src_modal_manager_interface_.html +146 -146
  78. package/docs/modules/_src_modal_manager_mode_.html +146 -146
  79. package/docs/modules/_src_modal_template_.html +146 -146
  80. package/docs/modules/_test_modal_config_test_.html +106 -106
  81. package/docs/modules/_test_modal_manager_test_.html +106 -106
  82. package/docs/modules/_test_modal_template_test_.html +106 -106
  83. package/eslint.config.mjs +53 -0
  84. package/index.html +33 -300
  85. package/package.json +73 -85
  86. package/renovate.json +7 -7
  87. package/src/modal-config.ts +14 -14
  88. package/src/modal-manager-host-bridge.ts +2 -2
  89. package/src/modal-manager.ts +305 -305
  90. package/src/modal-template.ts +4 -2
  91. package/src/shoelace/LICENSE.md +6 -6
  92. package/src/shoelace/active-elements.ts +3 -2
  93. package/src/shoelace/modal.ts +5 -5
  94. package/src/shoelace/tabbable.ts +4 -3
  95. package/test/modal-config.test.ts +4 -4
  96. package/test/modal-manager.test.ts +402 -393
  97. package/test/modal-template.test.ts +42 -35
  98. package/tsconfig.json +25 -21
  99. package/vitest.config.ci.ts +27 -0
  100. package/.eslintrc.js +0 -14
  101. package/karma.conf.js +0 -24
@@ -1,4 +1,4 @@
1
- /* istanbul ignore file */
1
+ /* c8 ignore start */
2
2
  import { activeElements, getDeepestActiveElement } from './active-elements.js';
3
3
  import { getTabbableElements } from './tabbable.js';
4
4
 
@@ -28,7 +28,7 @@ export default class Modal {
28
28
 
29
29
  /** Deactivates focus trapping. */
30
30
  deactivate() {
31
- activeModals = activeModals.filter(modal => modal !== this.element);
31
+ activeModals = activeModals.filter((modal) => modal !== this.element);
32
32
  this.currentFocus = null;
33
33
  document.removeEventListener('focusin', this.handleFocusIn);
34
34
  document.removeEventListener('keydown', this.handleKeyDown);
@@ -75,7 +75,7 @@ export default class Modal {
75
75
  private possiblyHasTabbableChildren(element: HTMLElement) {
76
76
  return (
77
77
  this.elementsWithTabbableControls.includes(
78
- element.tagName.toLowerCase()
78
+ element.tagName.toLowerCase(),
79
79
  ) || element.hasAttribute('controls')
80
80
  // Should we add a data-attribute for people to set just in case they have an element where we don't know if it has possibly tabbable elements?
81
81
  );
@@ -107,14 +107,13 @@ export default class Modal {
107
107
  const tabbableElements = getTabbableElements(this.element);
108
108
 
109
109
  let currentFocusIndex = tabbableElements.findIndex(
110
- el => el === currentActiveElement
110
+ (el) => el === currentActiveElement,
111
111
  );
112
112
 
113
113
  this.previousFocus = this.currentFocus;
114
114
 
115
115
  const addition = this.tabDirection === 'forward' ? 1 : -1;
116
116
 
117
- // eslint-disable-next-line
118
117
  while (true) {
119
118
  if (currentFocusIndex + addition >= tabbableElements.length) {
120
119
  currentFocusIndex = 0;
@@ -164,3 +163,4 @@ export default class Modal {
164
163
  this.tabDirection = 'forward';
165
164
  };
166
165
  }
166
+ /* c8 ignore end */
@@ -1,4 +1,4 @@
1
- /* istanbul ignore file */
1
+ /* c8 ignore start */
2
2
  // Cached compute style calls. This is specifically for browsers that dont support `checkVisibility()`.
3
3
  // computedStyle calls are "live" so they only need to be retrieved once for an element.
4
4
  const computedStyleMap = new WeakMap<Element, CSSStyleDeclaration>();
@@ -160,7 +160,7 @@ export function getTabbableBoundary(root: HTMLElement | ShadowRoot) {
160
160
  */
161
161
  function getSlottedChildrenOutsideRootElement(
162
162
  slotElement: HTMLSlotElement,
163
- root: HTMLElement | ShadowRoot
163
+ root: HTMLElement | ShadowRoot,
164
164
  ) {
165
165
  return (
166
166
  (slotElement.getRootNode({ composed: true }) as ShadowRoot | null)?.host !==
@@ -195,7 +195,7 @@ export function getTabbableElements(root: HTMLElement | ShadowRoot) {
195
195
  el.assignedElements({ flatten: true }).forEach(
196
196
  (assignedEl: Element) => {
197
197
  walk(assignedEl as HTMLElement | ShadowRoot);
198
- }
198
+ },
199
199
  );
200
200
  }
201
201
 
@@ -221,3 +221,4 @@ export function getTabbableElements(root: HTMLElement | ShadowRoot) {
221
221
  return bTabindex - aTabindex;
222
222
  });
223
223
  }
224
+ /* c8 ignore end */
@@ -1,10 +1,10 @@
1
- import { expect } from '@open-wc/testing';
1
+ import { describe, test, expect } from 'vitest';
2
2
  import { html } from 'lit';
3
3
 
4
4
  import { ModalConfig } from '../src/modal-config';
5
5
 
6
6
  describe('Modal Config', () => {
7
- it('can be instantiated properly', async () => {
7
+ test('can be instantiated properly', async () => {
8
8
  const config = new ModalConfig();
9
9
  const title = html`Foo`;
10
10
  config.title = title;
@@ -14,7 +14,7 @@ describe('Modal Config', () => {
14
14
  expect(config.headerColor).to.equal('green');
15
15
  });
16
16
 
17
- it('can be instantiated properly with constructor', async () => {
17
+ test('can be instantiated properly with constructor', async () => {
18
18
  const title = html`Foo`;
19
19
  const subtitle = html`Bar`;
20
20
  const headline = html`Baz`;
@@ -59,7 +59,7 @@ describe('Modal Config', () => {
59
59
  expect(config.closeOnBackdropClick).to.equal(closeOnBackdropClick);
60
60
  });
61
61
 
62
- it('instantiates properly with defaults', async () => {
62
+ test('instantiates properly with defaults', async () => {
63
63
  const config = new ModalConfig();
64
64
  expect(config.title).to.equal(undefined);
65
65
  expect(config.subtitle).to.equal(undefined);