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

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,11 +1,15 @@
1
- import { fixture, expect, oneEvent } from '@open-wc/testing';
1
+ import { fixture, oneEvent } from '@open-wc/testing-helpers';
2
+ import { describe, test, expect } from 'vitest';
2
3
  import { html } from 'lit';
3
4
  import '../src/modal-template';
4
5
  import { ModalConfig } from '../src/modal-config';
6
+ import type { ModalTemplate } from '../src/modal-template';
5
7
 
6
8
  describe('Modal Template', () => {
7
- it('has correct default configuration', async () => {
8
- const el = await fixture(html` <modal-template></modal-template> `);
9
+ test('has correct default configuration', async () => {
10
+ const el = await fixture<ModalTemplate>(html`
11
+ <modal-template></modal-template>
12
+ `);
9
13
 
10
14
  const processingLogo = el.shadowRoot?.querySelector('.processing-logo');
11
15
  const headline = el.shadowRoot?.querySelector('.headline');
@@ -15,15 +19,15 @@ describe('Modal Template', () => {
15
19
  expect(headline).to.not.exist;
16
20
  expect(message).to.not.exist;
17
21
  expect(title).to.not.exist;
18
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
22
+
19
23
  expect('hidden' in processingLogo!.classList);
20
24
  });
21
25
 
22
- it('does not show the title if one not provided', async () => {
26
+ test('does not show the title if one not provided', async () => {
23
27
  const config = new ModalConfig();
24
28
  config.title = undefined;
25
29
 
26
- const el = await fixture(html`
30
+ const el = await fixture<ModalTemplate>(html`
27
31
  <modal-template .config=${config}></modal-template>
28
32
  `);
29
33
 
@@ -31,21 +35,24 @@ describe('Modal Template', () => {
31
35
  expect(title).to.not.exist;
32
36
  });
33
37
 
34
- it('emits closeButtonPressed event when close button is pressed', async () => {
35
- const el = await fixture(html` <modal-template></modal-template> `);
36
-
38
+ test('emits closeButtonPressed event when close button is pressed', async () => {
39
+ const el = await fixture<ModalTemplate>(html`
40
+ <modal-template></modal-template>
41
+ `);
37
42
  const closeButton = el.shadowRoot?.querySelector('.close-button');
38
43
  const clickEvent = new MouseEvent('click');
39
44
 
40
45
  setTimeout(() => {
41
46
  closeButton?.dispatchEvent(clickEvent);
42
47
  });
43
- const response = await oneEvent(el, 'closeButtonPressed', false);
48
+ const response = await oneEvent(el, 'closeButtonPressed');
44
49
  expect(response).to.exist;
45
50
  });
46
51
 
47
- it('emits closeButtonPressed event when close button gets spacebar pressed', async () => {
48
- const el = await fixture(html` <modal-template></modal-template> `);
52
+ test('emits closeButtonPressed event when close button gets spacebar pressed', async () => {
53
+ const el = await fixture<ModalTemplate>(html`
54
+ <modal-template></modal-template>
55
+ `);
49
56
 
50
57
  const closeButton = el.shadowRoot?.querySelector('.close-button');
51
58
  const clickEvent = new KeyboardEvent('keydown', { key: ' ' });
@@ -53,14 +60,14 @@ describe('Modal Template', () => {
53
60
  setTimeout(() => {
54
61
  closeButton?.dispatchEvent(clickEvent);
55
62
  });
56
- const response = await oneEvent(el, 'closeButtonPressed', false);
63
+ const response = await oneEvent(el, 'closeButtonPressed');
57
64
  expect(response).to.exist;
58
65
  });
59
66
 
60
- it('emits leftNavButtonPressed event when left nav button is pressed', async () => {
67
+ test('emits leftNavButtonPressed event when left nav button is pressed', async () => {
61
68
  const config = new ModalConfig();
62
69
  config.showLeftNavButton = true;
63
- const el = await fixture(html`
70
+ const el = await fixture<ModalTemplate>(html`
64
71
  <modal-template .config=${config}></modal-template>
65
72
  `);
66
73
 
@@ -70,14 +77,14 @@ describe('Modal Template', () => {
70
77
  setTimeout(() => {
71
78
  leftNavButton?.dispatchEvent(clickEvent);
72
79
  });
73
- const response = await oneEvent(el, 'leftNavButtonPressed', false);
80
+ const response = await oneEvent(el, 'leftNavButtonPressed');
74
81
  expect(response).to.exist;
75
82
  });
76
83
 
77
- it('emits leftNavButtonPressed event when left nav button gets spacebar pressed', async () => {
84
+ test('emits leftNavButtonPressed event when left nav button gets spacebar pressed', async () => {
78
85
  const config = new ModalConfig();
79
86
  config.showLeftNavButton = true;
80
- const el = await fixture(html`
87
+ const el = await fixture<ModalTemplate>(html`
81
88
  <modal-template .config=${config}></modal-template>
82
89
  `);
83
90
 
@@ -87,15 +94,15 @@ describe('Modal Template', () => {
87
94
  setTimeout(() => {
88
95
  leftNavButton?.dispatchEvent(clickEvent);
89
96
  });
90
- const response = await oneEvent(el, 'leftNavButtonPressed', false);
97
+ const response = await oneEvent(el, 'leftNavButtonPressed');
91
98
  expect(response).to.exist;
92
99
  });
93
100
 
94
- it('shows the processing indicator if configured to', async () => {
101
+ test('shows the processing indicator if configured to', async () => {
95
102
  const config = new ModalConfig();
96
103
  config.showProcessingIndicator = true;
97
104
 
98
- const el = await fixture(html`
105
+ const el = await fixture<ModalTemplate>(html`
99
106
  <modal-template .config=${config}></modal-template>
100
107
  `);
101
108
 
@@ -104,10 +111,10 @@ describe('Modal Template', () => {
104
111
  expect('hidden' in classList).to.equal(false);
105
112
  });
106
113
 
107
- it('shows the left nav button if configured to', async () => {
114
+ test('shows the left nav button if configured to', async () => {
108
115
  const config = new ModalConfig();
109
116
  config.showLeftNavButton = true;
110
- const el = await fixture(html`
117
+ const el = await fixture<ModalTemplate>(html`
111
118
  <modal-template .config=${config}></modal-template>
112
119
  `);
113
120
 
@@ -115,10 +122,10 @@ describe('Modal Template', () => {
115
122
  expect(leftNavButton).to.exist;
116
123
  });
117
124
 
118
- it('hides the left nav button if configured to', async () => {
125
+ test('hides the left nav button if configured to', async () => {
119
126
  const config = new ModalConfig();
120
127
  config.showCloseButton = false;
121
- const el = await fixture(html`
128
+ const el = await fixture<ModalTemplate>(html`
122
129
  <modal-template .config=${config}></modal-template>
123
130
  `);
124
131
 
@@ -126,11 +133,11 @@ describe('Modal Template', () => {
126
133
  expect(closeButton).to.not.exist;
127
134
  });
128
135
 
129
- it('uses custom text for the left nav button if configured to', async () => {
136
+ test('uses custom text for the left nav button if configured to', async () => {
130
137
  const config = new ModalConfig();
131
138
  config.showLeftNavButton = true;
132
139
  config.leftNavButtonText = 'Previous';
133
- const el = await fixture(html`
140
+ const el = await fixture<ModalTemplate>(html`
134
141
  <modal-template .config=${config}></modal-template>
135
142
  `);
136
143
 
@@ -140,11 +147,11 @@ describe('Modal Template', () => {
140
147
  expect(leftNavButton?.innerHTML).to.contain('Previous');
141
148
  });
142
149
 
143
- it('does not use any text for the left nav button if not configured to', async () => {
150
+ test('does not use any text for the left nav button if not configured to', async () => {
144
151
  const config = new ModalConfig();
145
152
  config.showLeftNavButton = true;
146
153
 
147
- const el = await fixture(html`
154
+ const el = await fixture<ModalTemplate>(html`
148
155
  <modal-template .config=${config}></modal-template>
149
156
  `);
150
157
 
@@ -152,10 +159,10 @@ describe('Modal Template', () => {
152
159
  expect(leftNavButton?.innerHTML).not.to.contain('Previous');
153
160
  });
154
161
 
155
- it('shows the close button if configured to', async () => {
162
+ test('shows the close button if configured to', async () => {
156
163
  const config = new ModalConfig();
157
164
  config.showCloseButton = true;
158
- const el = await fixture(html`
165
+ const el = await fixture<ModalTemplate>(html`
159
166
  <modal-template .config=${config}></modal-template>
160
167
  `);
161
168
 
@@ -163,10 +170,10 @@ describe('Modal Template', () => {
163
170
  expect(closeButton).to.exist;
164
171
  });
165
172
 
166
- it('hides the close button if configured to', async () => {
173
+ test('hides the close button if configured to', async () => {
167
174
  const config = new ModalConfig();
168
175
  config.showCloseButton = false;
169
- const el = await fixture(html`
176
+ const el = await fixture<ModalTemplate>(html`
170
177
  <modal-template .config=${config}></modal-template>
171
178
  `);
172
179
 
@@ -174,14 +181,14 @@ describe('Modal Template', () => {
174
181
  expect(closeButton).to.not.exist;
175
182
  });
176
183
 
177
- it('shows the properties from the config', async () => {
184
+ test('shows the properties from the config', async () => {
178
185
  const config = new ModalConfig();
179
186
  config.title = html`Boop`;
180
187
  config.subtitle = html`Bop`;
181
188
  config.headline = html`Foo`;
182
189
  config.message = html`Bar`;
183
190
 
184
- const el = await fixture(html`
191
+ const el = await fixture<ModalTemplate>(html`
185
192
  <modal-template .config=${config}></modal-template>
186
193
  `);
187
194
 
package/tsconfig.json CHANGED
@@ -1,21 +1,25 @@
1
- {
2
- "compilerOptions": {
3
- "target": "es6",
4
- "module": "esnext",
5
- "moduleResolution": "node",
6
- "noEmitOnError": true,
7
- "lib": ["es2017", "dom"],
8
- "strict": true,
9
- "esModuleInterop": false,
10
- "allowSyntheticDefaultImports": true,
11
- "experimentalDecorators": true,
12
- "importHelpers": true,
13
- "outDir": "dist",
14
- "sourceMap": true,
15
- "inlineSources": true,
16
- "declaration": true,
17
- "rootDir": "./",
18
- "skipLibCheck": true
19
- },
20
- "include": ["**/*.ts"]
21
- }
1
+ {
2
+ "compilerOptions": {
3
+ "target": "esnext",
4
+ "module": "esnext",
5
+ "moduleResolution": "bundler",
6
+ "noEmitOnError": true,
7
+ "lib": [
8
+ "esnext",
9
+ "dom"
10
+ ],
11
+ "strict": true,
12
+ "esModuleInterop": false,
13
+ "allowSyntheticDefaultImports": true,
14
+ "experimentalDecorators": true,
15
+ "importHelpers": true,
16
+ "outDir": "dist",
17
+ "sourceMap": true,
18
+ "inlineSources": true,
19
+ "declaration": true,
20
+ "rootDir": "./",
21
+ "skipLibCheck": true,
22
+ "useDefineForClassFields": false,
23
+ },
24
+ "include": ["**/*.ts"]
25
+ }
@@ -0,0 +1,27 @@
1
+ /// <reference types="vitest" />
2
+ import { defineConfig, mergeConfig } from 'vitest/config';
3
+ import { playwright } from '@vitest/browser-playwright'
4
+ import viteConfig from './vite.config';
5
+
6
+ // https://vitest.dev/config
7
+ export default mergeConfig(
8
+ viteConfig,
9
+ defineConfig({
10
+ server: {
11
+ host: '0.0.0.0',
12
+ port: 8080,
13
+ },
14
+ test: {
15
+ browser: {
16
+ headless: true,
17
+ enabled: true,
18
+ provider: playwright(),
19
+ instances: [{ browser: 'chromium' }],
20
+ },
21
+ watch: false,
22
+ coverage: {
23
+ include: ['src/**/*.ts'],
24
+ },
25
+ },
26
+ }),
27
+ );
package/.eslintrc.js DELETED
@@ -1,14 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- parser: '@typescript-eslint/parser',
4
- plugins: ['@typescript-eslint', 'html'],
5
- extends: ['plugin:@typescript-eslint/recommended'],
6
- settings: {
7
- 'import/resolver': {
8
- node: {
9
- extensions: ['.js', '.jsx', '.ts', '.tsx'],
10
- moduleDirectory: ['node_modules', 'src', 'demo'],
11
- },
12
- },
13
- },
14
- };
package/karma.conf.js DELETED
@@ -1,24 +0,0 @@
1
- /* eslint-disable import/no-extraneous-dependencies */
2
- const { createDefaultConfig } = require('@open-wc/testing-karma');
3
- const merge = require('deepmerge');
4
-
5
- module.exports = config => {
6
- config.set(
7
- merge(createDefaultConfig(config), {
8
- files: [
9
- // runs all files ending with .test in the test folder,
10
- // can be overwritten by passing a --grep flag. examples:
11
- //
12
- // npm run test -- --grep test/foo/bar.test.js
13
- // npm run test -- --grep test/bar/*
14
- { pattern: config.grep ? config.grep : 'dist/**/test/**/*.test.js', type: 'module' },
15
- ],
16
-
17
- esm: {
18
- nodeResolve: true,
19
- },
20
- // you can overwrite/extend the config further
21
- }),
22
- );
23
- return config;
24
- };