@spectrum-web-components/reactive-controllers 0.2.4 → 0.2.5-devmode.79

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.
@@ -1 +1,7 @@
1
- {"version":3,"file":"MatchMedia.js","sourceRoot":"","sources":["MatchMedia.ts"],"names":[],"mappings":"AAaA,MAAM,CAAC,MAAM,SAAS,GAAG,8BAA8B,CAAC;AACxD,MAAM,CAAC,MAAM,SAAS,GAClB,yHAAyH,CAAC;AAE9H,MAAM,OAAO,oBAAoB;IAS7B,YAAY,IAAqB,EAAE,KAAa;QARhD,QAAG,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAEhC,YAAO,GAAG,KAAK,CAAC;QAOZ,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;QAClC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAEM,aAAa;QAChB,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACzD,CAAC;IAEM,gBAAgB;QACnB,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC5D,CAAC;IAES,QAAQ,CAAC,KAA0B;QACzC,IAAI,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,OAAO;YAAE,OAAO;QAC3C,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC7B,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrD,CAAC;CACJ","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport type { ReactiveController, ReactiveElement } from 'lit';\n\nexport const DARK_MODE = '(prefers-color-scheme: dark)';\nexport const IS_MOBILE =\n '(max-width: 700px) and (hover: none) and (pointer: coarse), (max-height: 700px) and (hover: none) and (pointer: coarse)';\n\nexport class MatchMediaController implements ReactiveController {\n key = Symbol('match-media-key');\n\n matches = false;\n\n protected host: ReactiveElement;\n\n protected media: MediaQueryList;\n\n constructor(host: ReactiveElement, query: string) {\n this.host = host;\n this.media = window.matchMedia(query);\n this.matches = this.media.matches;\n this.onChange = this.onChange.bind(this);\n host.addController(this);\n }\n\n public hostConnected(): void {\n this.media.addEventListener('change', this.onChange);\n }\n\n public hostDisconnected(): void {\n this.media.removeEventListener('change', this.onChange);\n }\n\n protected onChange(event: MediaQueryListEvent): void {\n if (this.matches === event.matches) return;\n this.matches = event.matches;\n this.host.requestUpdate(this.key, !this.matches);\n }\n}\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["MatchMedia.ts"],
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport type { ReactiveController, ReactiveElement } from 'lit';\n\nexport const DARK_MODE = '(prefers-color-scheme: dark)';\nexport const IS_MOBILE =\n '(max-width: 700px) and (hover: none) and (pointer: coarse), (max-height: 700px) and (hover: none) and (pointer: coarse)';\n\nexport class MatchMediaController implements ReactiveController {\n key = Symbol('match-media-key');\n\n matches = false;\n\n protected host: ReactiveElement;\n\n protected media: MediaQueryList;\n\n constructor(host: ReactiveElement, query: string) {\n this.host = host;\n this.media = window.matchMedia(query);\n this.matches = this.media.matches;\n this.onChange = this.onChange.bind(this);\n host.addController(this);\n }\n\n public hostConnected(): void {\n this.media.addEventListener('change', this.onChange);\n }\n\n public hostDisconnected(): void {\n this.media.removeEventListener('change', this.onChange);\n }\n\n protected onChange(event: MediaQueryListEvent): void {\n if (this.matches === event.matches) return;\n this.matches = event.matches;\n this.host.requestUpdate(this.key, !this.matches);\n }\n}\n"],
5
+ "mappings": "AAaO,aAAM,YAAY;AAClB,aAAM,YACT;AAEG,aAAM,qBAAmD;AAAA,EAS5D,YAAY,MAAuB,OAAe;AARlD,eAAM,OAAO,iBAAiB;AAE9B,mBAAU;AAON,SAAK,OAAO;AACZ,SAAK,QAAQ,OAAO,WAAW,KAAK;AACpC,SAAK,UAAU,KAAK,MAAM;AAC1B,SAAK,WAAW,KAAK,SAAS,KAAK,IAAI;AACvC,SAAK,cAAc,IAAI;AAAA,EAC3B;AAAA,EAEO,gBAAsB;AACzB,SAAK,MAAM,iBAAiB,UAAU,KAAK,QAAQ;AAAA,EACvD;AAAA,EAEO,mBAAyB;AAC5B,SAAK,MAAM,oBAAoB,UAAU,KAAK,QAAQ;AAAA,EAC1D;AAAA,EAEU,SAAS,OAAkC;AACjD,QAAI,KAAK,YAAY,MAAM;AAAS;AACpC,SAAK,UAAU,MAAM;AACrB,SAAK,KAAK,cAAc,KAAK,KAAK,CAAC,KAAK,OAAO;AAAA,EACnD;AACJ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,65 @@
1
+ import { FocusGroupController } from "./FocusGroup.dev.js";
2
+ export class RovingTabindexController extends FocusGroupController {
3
+ constructor() {
4
+ super(...arguments);
5
+ this.managed = true;
6
+ this.manageIndexesAnimationFrame = 0;
7
+ }
8
+ set focused(focused) {
9
+ if (focused === this.focused)
10
+ return;
11
+ super.focused = focused;
12
+ this.manageTabindexes();
13
+ }
14
+ get focused() {
15
+ return super.focused;
16
+ }
17
+ clearElementCache(offset = 0) {
18
+ cancelAnimationFrame(this.manageIndexesAnimationFrame);
19
+ super.clearElementCache(offset);
20
+ if (!this.managed)
21
+ return;
22
+ this.manageIndexesAnimationFrame = requestAnimationFrame(() => this.manageTabindexes());
23
+ }
24
+ manageTabindexes() {
25
+ if (this.focused) {
26
+ this.updateTabindexes(() => ({ tabIndex: -1 }));
27
+ } else {
28
+ this.updateTabindexes((el) => {
29
+ return {
30
+ removeTabIndex: el.contains(this.focusInElement) && el !== this.focusInElement,
31
+ tabIndex: el === this.focusInElement ? 0 : -1
32
+ };
33
+ });
34
+ }
35
+ }
36
+ updateTabindexes(getTabIndex) {
37
+ this.elements.forEach((el) => {
38
+ const { tabIndex, removeTabIndex } = getTabIndex(el);
39
+ if (!removeTabIndex) {
40
+ el.tabIndex = tabIndex;
41
+ return;
42
+ }
43
+ el.removeAttribute("tabindex");
44
+ const updatable = el;
45
+ if (updatable.requestUpdate)
46
+ updatable.requestUpdate();
47
+ });
48
+ }
49
+ manage() {
50
+ this.managed = true;
51
+ this.manageTabindexes();
52
+ super.manage();
53
+ }
54
+ unmanage() {
55
+ this.managed = false;
56
+ this.updateTabindexes(() => ({ tabIndex: 0 }));
57
+ super.unmanage();
58
+ }
59
+ hostUpdated() {
60
+ if (!this.host.hasUpdated) {
61
+ this.manageTabindexes();
62
+ }
63
+ }
64
+ }
65
+ //# sourceMappingURL=RovingTabindex.dev.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["RovingTabindex.ts"],
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { FocusGroupConfig, FocusGroupController } from './FocusGroup.dev.js'\n\nexport type RovingTabindexConfig<T> = FocusGroupConfig<T>;\ninterface UpdateTabIndexes {\n tabIndex: number;\n removeTabIndex?: boolean;\n}\n\nexport class RovingTabindexController<\n T extends HTMLElement\n> extends FocusGroupController<T> {\n protected override set focused(focused: boolean) {\n if (focused === this.focused) return;\n super.focused = focused;\n this.manageTabindexes();\n }\n\n protected override get focused(): boolean {\n return super.focused;\n }\n\n private managed = true;\n\n private manageIndexesAnimationFrame = 0;\n\n override clearElementCache(offset = 0): void {\n cancelAnimationFrame(this.manageIndexesAnimationFrame);\n super.clearElementCache(offset);\n if (!this.managed) return;\n\n this.manageIndexesAnimationFrame = requestAnimationFrame(() =>\n this.manageTabindexes()\n );\n }\n\n manageTabindexes(): void {\n if (this.focused) {\n this.updateTabindexes(() => ({ tabIndex: -1 }));\n } else {\n this.updateTabindexes((el: HTMLElement): UpdateTabIndexes => {\n return {\n removeTabIndex:\n el.contains(this.focusInElement) &&\n el !== this.focusInElement,\n tabIndex: el === this.focusInElement ? 0 : -1,\n };\n });\n }\n }\n\n updateTabindexes(getTabIndex: (el: HTMLElement) => UpdateTabIndexes): void {\n this.elements.forEach((el) => {\n const { tabIndex, removeTabIndex } = getTabIndex(el);\n if (!removeTabIndex) {\n el.tabIndex = tabIndex;\n return;\n }\n el.removeAttribute('tabindex');\n const updatable = el as unknown as {\n requestUpdate?: () => void;\n };\n if (updatable.requestUpdate) updatable.requestUpdate();\n });\n }\n\n override manage(): void {\n this.managed = true;\n this.manageTabindexes();\n super.manage();\n }\n\n override unmanage(): void {\n this.managed = false;\n this.updateTabindexes(() => ({ tabIndex: 0 }));\n super.unmanage();\n }\n\n hostUpdated(): void {\n if (!this.host.hasUpdated) {\n this.manageTabindexes();\n }\n }\n}\n"],
5
+ "mappings": "AAWA;AAQO,aAAM,iCAEH,qBAAwB;AAAA,EAF3B;AAAA;AAaK,mBAAU;AAEV,uCAA8B;AAAA;AAAA,MAZf,QAAQ,SAAkB;AAC7C,QAAI,YAAY,KAAK;AAAS;AAC9B,UAAM,UAAU;AAChB,SAAK,iBAAiB;AAAA,EAC1B;AAAA,MAEuB,UAAmB;AACtC,WAAO,MAAM;AAAA,EACjB;AAAA,EAMS,kBAAkB,SAAS,GAAS;AACzC,yBAAqB,KAAK,2BAA2B;AACrD,UAAM,kBAAkB,MAAM;AAC9B,QAAI,CAAC,KAAK;AAAS;AAEnB,SAAK,8BAA8B,sBAAsB,MACrD,KAAK,iBAAiB,CAC1B;AAAA,EACJ;AAAA,EAEA,mBAAyB;AACrB,QAAI,KAAK,SAAS;AACd,WAAK,iBAAiB,MAAO,GAAE,UAAU,GAAG,EAAE;AAAA,IAClD,OAAO;AACH,WAAK,iBAAiB,CAAC,OAAsC;AACzD,eAAO;AAAA,UACH,gBACI,GAAG,SAAS,KAAK,cAAc,KAC/B,OAAO,KAAK;AAAA,UAChB,UAAU,OAAO,KAAK,iBAAiB,IAAI;AAAA,QAC/C;AAAA,MACJ,CAAC;AAAA,IACL;AAAA,EACJ;AAAA,EAEA,iBAAiB,aAA0D;AACvE,SAAK,SAAS,QAAQ,CAAC,OAAO;AAC1B,YAAM,EAAE,UAAU,mBAAmB,YAAY,EAAE;AACnD,UAAI,CAAC,gBAAgB;AACjB,WAAG,WAAW;AACd;AAAA,MACJ;AACA,SAAG,gBAAgB,UAAU;AAC7B,YAAM,YAAY;AAGlB,UAAI,UAAU;AAAe,kBAAU,cAAc;AAAA,IACzD,CAAC;AAAA,EACL;AAAA,EAES,SAAe;AACpB,SAAK,UAAU;AACf,SAAK,iBAAiB;AACtB,UAAM,OAAO;AAAA,EACjB;AAAA,EAES,WAAiB;AACtB,SAAK,UAAU;AACf,SAAK,iBAAiB,MAAO,GAAE,UAAU,EAAE,EAAE;AAC7C,UAAM,SAAS;AAAA,EACnB;AAAA,EAEA,cAAoB;AAChB,QAAI,CAAC,KAAK,KAAK,YAAY;AACvB,WAAK,iBAAiB;AAAA,IAC1B;AAAA,EACJ;AACJ;",
6
+ "names": []
7
+ }
@@ -1,78 +1,65 @@
1
- /*
2
- Copyright 2020 Adobe. All rights reserved.
3
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License. You may obtain a copy
5
- of the License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- Unless required by applicable law or agreed to in writing, software distributed under
8
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- OF ANY KIND, either express or implied. See the License for the specific language
10
- governing permissions and limitations under the License.
11
- */
12
- import { FocusGroupController } from './FocusGroup.js';
1
+ import { FocusGroupController } from "./FocusGroup.js";
13
2
  export class RovingTabindexController extends FocusGroupController {
14
- constructor() {
15
- super(...arguments);
16
- this.managed = true;
17
- this.manageIndexesAnimationFrame = 0;
3
+ constructor() {
4
+ super(...arguments);
5
+ this.managed = true;
6
+ this.manageIndexesAnimationFrame = 0;
7
+ }
8
+ set focused(focused) {
9
+ if (focused === this.focused)
10
+ return;
11
+ super.focused = focused;
12
+ this.manageTabindexes();
13
+ }
14
+ get focused() {
15
+ return super.focused;
16
+ }
17
+ clearElementCache(offset = 0) {
18
+ cancelAnimationFrame(this.manageIndexesAnimationFrame);
19
+ super.clearElementCache(offset);
20
+ if (!this.managed)
21
+ return;
22
+ this.manageIndexesAnimationFrame = requestAnimationFrame(() => this.manageTabindexes());
23
+ }
24
+ manageTabindexes() {
25
+ if (this.focused) {
26
+ this.updateTabindexes(() => ({ tabIndex: -1 }));
27
+ } else {
28
+ this.updateTabindexes((el) => {
29
+ return {
30
+ removeTabIndex: el.contains(this.focusInElement) && el !== this.focusInElement,
31
+ tabIndex: el === this.focusInElement ? 0 : -1
32
+ };
33
+ });
18
34
  }
19
- set focused(focused) {
20
- if (focused === this.focused)
21
- return;
22
- super.focused = focused;
23
- this.manageTabindexes();
24
- }
25
- get focused() {
26
- return super.focused;
27
- }
28
- clearElementCache(offset = 0) {
29
- cancelAnimationFrame(this.manageIndexesAnimationFrame);
30
- super.clearElementCache(offset);
31
- if (!this.managed)
32
- return;
33
- this.manageIndexesAnimationFrame = requestAnimationFrame(() => this.manageTabindexes());
34
- }
35
- manageTabindexes() {
36
- if (this.focused) {
37
- this.updateTabindexes(() => ({ tabIndex: -1 }));
38
- }
39
- else {
40
- this.updateTabindexes((el) => {
41
- return {
42
- removeTabIndex: el.contains(this.focusInElement) &&
43
- el !== this.focusInElement,
44
- tabIndex: el === this.focusInElement ? 0 : -1,
45
- };
46
- });
47
- }
48
- }
49
- updateTabindexes(getTabIndex) {
50
- this.elements.forEach((el) => {
51
- const { tabIndex, removeTabIndex } = getTabIndex(el);
52
- if (!removeTabIndex) {
53
- el.tabIndex = tabIndex;
54
- return;
55
- }
56
- el.removeAttribute('tabindex');
57
- const updatable = el;
58
- if (updatable.requestUpdate)
59
- updatable.requestUpdate();
60
- });
61
- }
62
- manage() {
63
- this.managed = true;
64
- this.manageTabindexes();
65
- super.manage();
66
- }
67
- unmanage() {
68
- this.managed = false;
69
- this.updateTabindexes(() => ({ tabIndex: 0 }));
70
- super.unmanage();
71
- }
72
- hostUpdated() {
73
- if (!this.host.hasUpdated) {
74
- this.manageTabindexes();
75
- }
35
+ }
36
+ updateTabindexes(getTabIndex) {
37
+ this.elements.forEach((el) => {
38
+ const { tabIndex, removeTabIndex } = getTabIndex(el);
39
+ if (!removeTabIndex) {
40
+ el.tabIndex = tabIndex;
41
+ return;
42
+ }
43
+ el.removeAttribute("tabindex");
44
+ const updatable = el;
45
+ if (updatable.requestUpdate)
46
+ updatable.requestUpdate();
47
+ });
48
+ }
49
+ manage() {
50
+ this.managed = true;
51
+ this.manageTabindexes();
52
+ super.manage();
53
+ }
54
+ unmanage() {
55
+ this.managed = false;
56
+ this.updateTabindexes(() => ({ tabIndex: 0 }));
57
+ super.unmanage();
58
+ }
59
+ hostUpdated() {
60
+ if (!this.host.hasUpdated) {
61
+ this.manageTabindexes();
76
62
  }
63
+ }
77
64
  }
78
- //# sourceMappingURL=RovingTabindex.js.map
65
+ //# sourceMappingURL=RovingTabindex.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"RovingTabindex.js","sourceRoot":"","sources":["RovingTabindex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAoB,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAQzE,MAAM,OAAO,wBAEX,SAAQ,oBAAuB;IAFjC;;QAaY,YAAO,GAAG,IAAI,CAAC;QAEf,gCAA2B,GAAG,CAAC,CAAC;IA2D5C,CAAC;IAvEG,IAAuB,OAAO,CAAC,OAAgB;QAC3C,IAAI,OAAO,KAAK,IAAI,CAAC,OAAO;YAAE,OAAO;QACrC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC5B,CAAC;IAED,IAAuB,OAAO;QAC1B,OAAO,KAAK,CAAC,OAAO,CAAC;IACzB,CAAC;IAMQ,iBAAiB,CAAC,MAAM,GAAG,CAAC;QACjC,oBAAoB,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;QACvD,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;QAChC,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO;QAE1B,IAAI,CAAC,2BAA2B,GAAG,qBAAqB,CAAC,GAAG,EAAE,CAC1D,IAAI,CAAC,gBAAgB,EAAE,CAC1B,CAAC;IACN,CAAC;IAED,gBAAgB;QACZ,IAAI,IAAI,CAAC,OAAO,EAAE;YACd,IAAI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E,CAAC;IACrB,CAAC;IAED,WAAW;QACP,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YACvB,IAAI,CAAC,gBAAgB,EAAE,CAAC;SAC3B;IACL,CAAC;CACJ","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { FocusGroupConfig, FocusGroupController } from './FocusGroup.js';\n\nexport type RovingTabindexConfig<T> = FocusGroupConfig<T>;\ninterface UpdateTabIndexes {\n tabIndex: number;\n removeTabIndex?: boolean;\n}\n\nexport class RovingTabindexController<\n T extends HTMLElement\n> extends FocusGroupController<T> {\n protected override set focused(focused: boolean) {\n if (focused === this.focused) return;\n super.focused = focused;\n this.manageTabindexes();\n }\n\n protected override get focused(): boolean {\n return super.focused;\n }\n\n private managed = true;\n\n private manageIndexesAnimationFrame = 0;\n\n override clearElementCache(offset = 0): void {\n cancelAnimationFrame(this.manageIndexesAnimationFrame);\n super.clearElementCache(offset);\n if (!this.managed) return;\n\n this.manageIndexesAnimationFrame = requestAnimationFrame(() =>\n this.manageTabindexes()\n );\n }\n\n manageTabindexes(): void {\n if (this.focused) {\n this.updateTabindexes(() => ({ tabIndex: -1 }));\n } else {\n this.updateTabindexes((el: HTMLElement): UpdateTabIndexes => {\n return {\n removeTabIndex:\n el.contains(this.focusInElement) &&\n el !== this.focusInElement,\n tabIndex: el === this.focusInElement ? 0 : -1,\n };\n });\n }\n }\n\n updateTabindexes(getTabIndex: (el: HTMLElement) => UpdateTabIndexes): void {\n this.elements.forEach((el) => {\n const { tabIndex, removeTabIndex } = getTabIndex(el);\n if (!removeTabIndex) {\n el.tabIndex = tabIndex;\n return;\n }\n el.removeAttribute('tabindex');\n const updatable = el as unknown as {\n requestUpdate?: () => void;\n };\n if (updatable.requestUpdate) updatable.requestUpdate();\n });\n }\n\n override manage(): void {\n this.managed = true;\n this.manageTabindexes();\n super.manage();\n }\n\n override unmanage(): void {\n this.managed = false;\n this.updateTabindexes(() => ({ tabIndex: 0 }));\n super.unmanage();\n }\n\n hostUpdated(): void {\n if (!this.host.hasUpdated) {\n this.manageTabindexes();\n }\n }\n}\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["RovingTabindex.ts"],
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { FocusGroupConfig, FocusGroupController } from './FocusGroup.js';\n\nexport type RovingTabindexConfig<T> = FocusGroupConfig<T>;\ninterface UpdateTabIndexes {\n tabIndex: number;\n removeTabIndex?: boolean;\n}\n\nexport class RovingTabindexController<\n T extends HTMLElement\n> extends FocusGroupController<T> {\n protected override set focused(focused: boolean) {\n if (focused === this.focused) return;\n super.focused = focused;\n this.manageTabindexes();\n }\n\n protected override get focused(): boolean {\n return super.focused;\n }\n\n private managed = true;\n\n private manageIndexesAnimationFrame = 0;\n\n override clearElementCache(offset = 0): void {\n cancelAnimationFrame(this.manageIndexesAnimationFrame);\n super.clearElementCache(offset);\n if (!this.managed) return;\n\n this.manageIndexesAnimationFrame = requestAnimationFrame(() =>\n this.manageTabindexes()\n );\n }\n\n manageTabindexes(): void {\n if (this.focused) {\n this.updateTabindexes(() => ({ tabIndex: -1 }));\n } else {\n this.updateTabindexes((el: HTMLElement): UpdateTabIndexes => {\n return {\n removeTabIndex:\n el.contains(this.focusInElement) &&\n el !== this.focusInElement,\n tabIndex: el === this.focusInElement ? 0 : -1,\n };\n });\n }\n }\n\n updateTabindexes(getTabIndex: (el: HTMLElement) => UpdateTabIndexes): void {\n this.elements.forEach((el) => {\n const { tabIndex, removeTabIndex } = getTabIndex(el);\n if (!removeTabIndex) {\n el.tabIndex = tabIndex;\n return;\n }\n el.removeAttribute('tabindex');\n const updatable = el as unknown as {\n requestUpdate?: () => void;\n };\n if (updatable.requestUpdate) updatable.requestUpdate();\n });\n }\n\n override manage(): void {\n this.managed = true;\n this.manageTabindexes();\n super.manage();\n }\n\n override unmanage(): void {\n this.managed = false;\n this.updateTabindexes(() => ({ tabIndex: 0 }));\n super.unmanage();\n }\n\n hostUpdated(): void {\n if (!this.host.hasUpdated) {\n this.manageTabindexes();\n }\n }\n}\n"],
5
+ "mappings": "AAWA;AAQO,aAAM,iCAEH,qBAAwB;AAAA,EAF3B;AAAA;AAaK,mBAAU;AAEV,uCAA8B;AAAA;AAAA,MAZf,QAAQ,SAAkB;AAC7C,QAAI,YAAY,KAAK;AAAS;AAC9B,UAAM,UAAU;AAChB,SAAK,iBAAiB;AAAA,EAC1B;AAAA,MAEuB,UAAmB;AACtC,WAAO,MAAM;AAAA,EACjB;AAAA,EAMS,kBAAkB,SAAS,GAAS;AACzC,yBAAqB,KAAK,2BAA2B;AACrD,UAAM,kBAAkB,MAAM;AAC9B,QAAI,CAAC,KAAK;AAAS;AAEnB,SAAK,8BAA8B,sBAAsB,MACrD,KAAK,iBAAiB,CAC1B;AAAA,EACJ;AAAA,EAEA,mBAAyB;AACrB,QAAI,KAAK,SAAS;AACd,WAAK,iBAAiB,MAAO,GAAE,UAAU,GAAG,EAAE;AAAA,IAClD,OAAO;AACH,WAAK,iBAAiB,CAAC,OAAsC;AACzD,eAAO;AAAA,UACH,gBACI,GAAG,SAAS,KAAK,cAAc,KAC/B,OAAO,KAAK;AAAA,UAChB,UAAU,OAAO,KAAK,iBAAiB,IAAI;AAAA,QAC/C;AAAA,MACJ,CAAC;AAAA,IACL;AAAA,EACJ;AAAA,EAEA,iBAAiB,aAA0D;AACvE,SAAK,SAAS,QAAQ,CAAC,OAAO;AAC1B,YAAM,EAAE,UAAU,mBAAmB,YAAY,EAAE;AACnD,UAAI,CAAC,gBAAgB;AACjB,WAAG,WAAW;AACd;AAAA,MACJ;AACA,SAAG,gBAAgB,UAAU;AAC7B,YAAM,YAAY;AAGlB,UAAI,UAAU;AAAe,kBAAU,cAAc;AAAA,IACzD,CAAC;AAAA,EACL;AAAA,EAES,SAAe;AACpB,SAAK,UAAU;AACf,SAAK,iBAAiB;AACtB,UAAM,OAAO;AAAA,EACjB;AAAA,EAES,WAAiB;AACtB,SAAK,UAAU;AACf,SAAK,iBAAiB,MAAO,GAAE,UAAU,EAAE,EAAE;AAC7C,UAAM,SAAS;AAAA,EACnB;AAAA,EAEA,cAAoB;AAChB,QAAI,CAAC,KAAK,KAAK,YAAY;AACvB,WAAK,iBAAiB;AAAA,IAC1B;AAAA,EACJ;AACJ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./MatchMedia.dev.js";
2
+ export * from "./RovingTabindex.dev.js";
3
+ //# sourceMappingURL=index.dev.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["index.ts"],
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nexport * from './MatchMedia.dev.js'\nexport * from './RovingTabindex.dev.js'\n"],
5
+ "mappings": "AAYA;AACA;",
6
+ "names": []
7
+ }
package/src/index.js CHANGED
@@ -1,14 +1,3 @@
1
- /*
2
- Copyright 2020 Adobe. All rights reserved.
3
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License. You may obtain a copy
5
- of the License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- Unless required by applicable law or agreed to in writing, software distributed under
8
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- OF ANY KIND, either express or implied. See the License for the specific language
10
- governing permissions and limitations under the License.
11
- */
12
- export * from './MatchMedia.js';
13
- export * from './RovingTabindex.js';
14
- //# sourceMappingURL=index.js.map
1
+ export * from "./MatchMedia.js";
2
+ export * from "./RovingTabindex.js";
3
+ //# sourceMappingURL=index.js.map
package/src/index.js.map CHANGED
@@ -1 +1,7 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nexport * from './MatchMedia.js';\nexport * from './RovingTabindex.js';\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["index.ts"],
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nexport * from './MatchMedia.js';\nexport * from './RovingTabindex.js';\n"],
5
+ "mappings": "AAYA;AACA;",
6
+ "names": []
7
+ }
@@ -1,32 +1,20 @@
1
- /*
2
- Copyright 2020 Adobe. All rights reserved.
3
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License. You may obtain a copy
5
- of the License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- Unless required by applicable law or agreed to in writing, software distributed under
8
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- OF ANY KIND, either express or implied. See the License for the specific language
10
- governing permissions and limitations under the License.
11
- */
12
- import { html, LitElement } from 'lit';
13
- import { expect, fixture, nextFrame } from '@open-wc/testing';
14
- import { setViewport } from '@web/test-runner-commands';
15
- import { MatchMediaController } from '../';
16
- describe('Match Media', () => {
17
- it('responds to media changes', async () => {
18
- class TestEl extends LitElement {
19
- }
20
- customElements.define('test-match-media-el', TestEl);
21
- const el = await fixture(html `
1
+ import { html, LitElement } from "lit";
2
+ import { expect, fixture, nextFrame } from "@open-wc/testing";
3
+ import { setViewport } from "@web/test-runner-commands";
4
+ import { MatchMediaController } from "@spectrum-web-components/reactive-controllers/src/MatchMedia.js";
5
+ describe("Match Media", () => {
6
+ it("responds to media changes", async () => {
7
+ class TestEl extends LitElement {
8
+ }
9
+ customElements.define("test-match-media-el", TestEl);
10
+ const el = await fixture(html`
22
11
  <test-match-media-el></test-match-media-el>
23
12
  `);
24
- const controller = new MatchMediaController(el, '(min-width: 500px)');
25
- expect(controller.matches).to.be.true;
26
- await setViewport({ width: 360, height: 640 });
27
- // Allow viewport update to propagate.
28
- await nextFrame();
29
- expect(controller.matches).to.be.false;
30
- });
13
+ const controller = new MatchMediaController(el, "(min-width: 500px)");
14
+ expect(controller.matches).to.be.true;
15
+ await setViewport({ width: 360, height: 640 });
16
+ await nextFrame();
17
+ expect(controller.matches).to.be.false;
18
+ });
31
19
  });
32
- //# sourceMappingURL=match-media.test.js.map
20
+ //# sourceMappingURL=match-media.test.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"match-media.test.js","sourceRoot":"","sources":["match-media.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,KAAK,CAAC;AAE3C,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IACzB,EAAE,CAAC,2BAA2B,EAAE,KAAK,IAAI,EAAE;QACvC,MAAM,MAAO,SAAQ,UAAU;SAAG;QAClC,cAAc,CAAC,MAAM,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;QACrD,MAAM,EAAE,GAAG,MAAM,OAAO,CACpB,IAAI,CAAA;;aAEH,CACJ,CAAC;QACF,MAAM,UAAU,GAAG,IAAI,oBAAoB,CACvC,EAA6C,EAC7C,oBAAoB,CACvB,CAAC;QACF,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QACtC,MAAM,WAAW,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QAC/C,sCAAsC;QACtC,MAAM,SAAS,EAAE,CAAC;QAClB,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;IAC3C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { html, LitElement } from 'lit';\nimport { expect, fixture, nextFrame } from '@open-wc/testing';\nimport { setViewport } from '@web/test-runner-commands';\nimport { MatchMediaController } from '../';\n\ndescribe('Match Media', () => {\n it('responds to media changes', async () => {\n class TestEl extends LitElement {}\n customElements.define('test-match-media-el', TestEl);\n const el = await fixture(\n html`\n <test-match-media-el></test-match-media-el>\n `\n );\n const controller = new MatchMediaController(\n el as LitElement & { shadowRoot: ShadowRoot },\n '(min-width: 500px)'\n );\n expect(controller.matches).to.be.true;\n await setViewport({ width: 360, height: 640 });\n // Allow viewport update to propagate.\n await nextFrame();\n expect(controller.matches).to.be.false;\n });\n});\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["match-media.test.ts"],
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { html, LitElement } from 'lit';\nimport { expect, fixture, nextFrame } from '@open-wc/testing';\nimport { setViewport } from '@web/test-runner-commands';\nimport { MatchMediaController } from '@spectrum-web-components/reactive-controllers/src/MatchMedia.js';\n\ndescribe('Match Media', () => {\n it('responds to media changes', async () => {\n class TestEl extends LitElement {}\n customElements.define('test-match-media-el', TestEl);\n const el = await fixture(\n html`\n <test-match-media-el></test-match-media-el>\n `\n );\n const controller = new MatchMediaController(\n el as LitElement & { shadowRoot: ShadowRoot },\n '(min-width: 500px)'\n );\n expect(controller.matches).to.be.true;\n await setViewport({ width: 360, height: 640 });\n // Allow viewport update to propagate.\n await nextFrame();\n expect(controller.matches).to.be.false;\n });\n});\n"],
5
+ "mappings": "AAYA;AACA;AACA;AACA;AAEA,SAAS,eAAe,MAAM;AAC1B,KAAG,6BAA6B,YAAY;AACxC,UAAM,eAAe,WAAW;AAAA,IAAC;AACjC,mBAAe,OAAO,uBAAuB,MAAM;AACnD,UAAM,KAAK,MAAM,QACb;AAAA;AAAA,aAGJ;AACA,UAAM,aAAa,IAAI,qBACnB,IACA,oBACJ;AACA,WAAO,WAAW,OAAO,EAAE,GAAG,GAAG;AACjC,UAAM,YAAY,EAAE,OAAO,KAAK,QAAQ,IAAI,CAAC;AAE7C,UAAM,UAAU;AAChB,WAAO,WAAW,OAAO,EAAE,GAAG,GAAG;AAAA,EACrC,CAAC;AACL,CAAC;",
6
+ "names": []
7
+ }
@@ -1,25 +1,14 @@
1
- /*
2
- Copyright 2020 Adobe. All rights reserved.
3
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License. You may obtain a copy
5
- of the License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- Unless required by applicable law or agreed to in writing, software distributed under
8
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- OF ANY KIND, either express or implied. See the License for the specific language
10
- governing permissions and limitations under the License.
11
- */
12
- import '@spectrum-web-components/action-button/sp-action-button.js';
13
- import '@spectrum-web-components/action-group/sp-action-group.js';
14
- import '@spectrum-web-components/tabs/sp-tab-panel.js';
15
- import '@spectrum-web-components/tabs/sp-tab.js';
16
- import '@spectrum-web-components/tabs/sp-tabs.js';
17
- import { elementUpdated, expect, fixture, nextFrame } from '@open-wc/testing';
18
- import { html } from '@spectrum-web-components/base';
19
- import { sendKeys } from '@web/test-runner-commands';
20
- import { sendMouse } from '../../../test/plugins/browser.js';
1
+ import "@spectrum-web-components/action-button/sp-action-button.js";
2
+ import "@spectrum-web-components/action-group/sp-action-group.js";
3
+ import "@spectrum-web-components/tabs/sp-tab-panel.js";
4
+ import "@spectrum-web-components/tabs/sp-tab.js";
5
+ import "@spectrum-web-components/tabs/sp-tabs.js";
6
+ import { elementUpdated, expect, fixture, nextFrame } from "@open-wc/testing";
7
+ import { html } from "@spectrum-web-components/base";
8
+ import { sendKeys } from "@web/test-runner-commands";
9
+ import { sendMouse } from "../../../test/plugins/browser.js";
21
10
  const createTabs = async () => {
22
- const tabs = await fixture(html `
11
+ const tabs = await fixture(html`
23
12
  <sp-tabs selected="second">
24
13
  <sp-tab label="Tab 1" value="first"></sp-tab>
25
14
  <sp-tab label="Tab 2" value="second"></sp-tab>
@@ -65,73 +54,72 @@ const createTabs = async () => {
65
54
  </sp-tab-panel>
66
55
  </sp-tabs>
67
56
  `);
68
- await elementUpdated(tabs);
69
- return tabs;
57
+ await elementUpdated(tabs);
58
+ return tabs;
70
59
  };
71
- describe('Action Group inside of Tabs', () => {
72
- it('accurately navigates the desired element', async () => {
73
- const el = await createTabs();
74
- const tab1 = el.querySelector('sp-tab[value="first"]');
75
- const tab2 = el.querySelector('sp-tab[value="second"]');
76
- const tab3 = el.querySelector('sp-tab[value="third"]');
77
- const tabPanel1 = el.querySelector('sp-tab-panel[value="first"]');
78
- const tabPanel2 = el.querySelector('sp-tab-panel[value="second"]');
79
- const tabPanel3 = el.querySelector('sp-tab-panel[value="third"]');
80
- const actionGroup1 = tabPanel1.querySelector('sp-action-group');
81
- const actionGroup2 = tabPanel2.querySelector('sp-action-group');
82
- const actionGroup3 = tabPanel3.querySelector('sp-action-group');
83
- const actionButton1 = actionGroup1.querySelector('[selected]');
84
- const actionButton2 = actionGroup2.querySelector('[selected]');
85
- const actionButton3 = actionGroup3.querySelector('[selected]');
86
- el.focus();
87
- expect(el.contains(document.activeElement)).to.be.true;
88
- expect(document.activeElement === tab2).to.be.true;
89
- actionGroup2.focus();
90
- expect(document.activeElement === actionButton2).to.be.true;
91
- await nextFrame();
92
- await sendKeys({
93
- press: 'ArrowLeft',
94
- });
95
- expect(document.activeElement === tab1).to.be.false;
96
- expect(actionGroup2.contains(document.activeElement)).to.be.true;
97
- el.focus();
98
- expect(document.activeElement === tab2).to.be.true;
99
- await sendKeys({
100
- press: 'ArrowRight',
101
- });
102
- expect(document.activeElement === tab3).to.be.true;
103
- await sendKeys({
104
- press: 'Enter',
105
- });
106
- expect(document.activeElement === tab3).to.be.true;
107
- actionGroup3.focus();
108
- expect(document.activeElement === actionButton3).to.be.true;
109
- await sendKeys({
110
- press: 'ArrowLeft',
111
- });
112
- expect(document.activeElement === tab2).to.be.false;
113
- expect(actionGroup3.contains(document.activeElement)).to.be.true;
114
- const boundingRect = tab1.getBoundingClientRect();
115
- // tab1.click() doesn't current reach into the focus management here.
116
- await sendMouse({
117
- steps: [
118
- {
119
- type: 'click',
120
- position: [
121
- boundingRect.left + boundingRect.width / 2,
122
- boundingRect.top + boundingRect.height / 2,
123
- ],
124
- },
125
- ],
126
- });
127
- expect(document.activeElement === tab1).to.be.true;
128
- actionGroup1.focus();
129
- expect(document.activeElement === actionButton1).to.be.true;
130
- await sendKeys({
131
- press: 'ArrowRight',
132
- });
133
- expect(document.activeElement === tab2).to.be.false;
134
- expect(actionGroup1.contains(document.activeElement)).to.be.true;
60
+ describe("Action Group inside of Tabs", () => {
61
+ it("accurately navigates the desired element", async () => {
62
+ const el = await createTabs();
63
+ const tab1 = el.querySelector('sp-tab[value="first"]');
64
+ const tab2 = el.querySelector('sp-tab[value="second"]');
65
+ const tab3 = el.querySelector('sp-tab[value="third"]');
66
+ const tabPanel1 = el.querySelector('sp-tab-panel[value="first"]');
67
+ const tabPanel2 = el.querySelector('sp-tab-panel[value="second"]');
68
+ const tabPanel3 = el.querySelector('sp-tab-panel[value="third"]');
69
+ const actionGroup1 = tabPanel1.querySelector("sp-action-group");
70
+ const actionGroup2 = tabPanel2.querySelector("sp-action-group");
71
+ const actionGroup3 = tabPanel3.querySelector("sp-action-group");
72
+ const actionButton1 = actionGroup1.querySelector("[selected]");
73
+ const actionButton2 = actionGroup2.querySelector("[selected]");
74
+ const actionButton3 = actionGroup3.querySelector("[selected]");
75
+ el.focus();
76
+ expect(el.contains(document.activeElement)).to.be.true;
77
+ expect(document.activeElement === tab2).to.be.true;
78
+ actionGroup2.focus();
79
+ expect(document.activeElement === actionButton2).to.be.true;
80
+ await nextFrame();
81
+ await sendKeys({
82
+ press: "ArrowLeft"
135
83
  });
84
+ expect(document.activeElement === tab1).to.be.false;
85
+ expect(actionGroup2.contains(document.activeElement)).to.be.true;
86
+ el.focus();
87
+ expect(document.activeElement === tab2).to.be.true;
88
+ await sendKeys({
89
+ press: "ArrowRight"
90
+ });
91
+ expect(document.activeElement === tab3).to.be.true;
92
+ await sendKeys({
93
+ press: "Enter"
94
+ });
95
+ expect(document.activeElement === tab3).to.be.true;
96
+ actionGroup3.focus();
97
+ expect(document.activeElement === actionButton3).to.be.true;
98
+ await sendKeys({
99
+ press: "ArrowLeft"
100
+ });
101
+ expect(document.activeElement === tab2).to.be.false;
102
+ expect(actionGroup3.contains(document.activeElement)).to.be.true;
103
+ const boundingRect = tab1.getBoundingClientRect();
104
+ await sendMouse({
105
+ steps: [
106
+ {
107
+ type: "click",
108
+ position: [
109
+ boundingRect.left + boundingRect.width / 2,
110
+ boundingRect.top + boundingRect.height / 2
111
+ ]
112
+ }
113
+ ]
114
+ });
115
+ expect(document.activeElement === tab1).to.be.true;
116
+ actionGroup1.focus();
117
+ expect(document.activeElement === actionButton1).to.be.true;
118
+ await sendKeys({
119
+ press: "ArrowRight"
120
+ });
121
+ expect(document.activeElement === tab2).to.be.false;
122
+ expect(actionGroup1.contains(document.activeElement)).to.be.true;
123
+ });
136
124
  });
137
- //# sourceMappingURL=roving-tabindex-integration.test.js.map
125
+ //# sourceMappingURL=roving-tabindex-integration.test.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"roving-tabindex-integration.test.js","sourceRoot":"","sources":["roving-tabindex-integration.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,4DAA4D,CAAC;AAEpE,OAAO,0DAA0D,CAAC;AAElE,OAAO,+CAA+C,CAAC;AACvD,OAAO,yCAAyC,CAAC;AACjD,OAAO,0CAA0C,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,MAAM,UAAU,GAAG,KAAK,IAAmB,EAAE;IACzC,MAAM,IAAI,GAAG,MAAM,OAAO,CACtB,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SA6CH,CACJ,CAAC;IACF,MAAM,cAAc,CAAC,IAAI,CAAC,CAAC;IAC3B,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAEF,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IACzC,EAAE,CAAC,0CAA0C,EAAE,KAAK,IAAI,EAAE;QACtD,MAAM,EAAE,GAAG,MAAM,UAAU,EAAE,CAAC;QAC9B,MAAM,IAAI,GAAG,EAAE,CAAC,aAAa,CAAC,uBAAuB,CAAQ,CAAC;QAC9D,MAAM,IAAI,GAAG,EAAE,CAAC,aAAa,CAAC,wBAAwB,CAAC,CAAC;QACxD,MAAM,IAAI,GAAG,EAAE,CAAC,aAAa,CAAC,uBAAuB,CAAQ,CAAC;QAC9D,MAAM,SAAS,GAAG,EAAE,CAAC,aAAa,CAC9B,6BAA6B,CACpB,CAAC;QACd,MAAM,SAAS,GAAG,EAAE,CAAC,aAAa,CA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C,EAAE,CAAC,IAAI,CAAC;QAEnD,YAAY,CAAC,KAAK,EAAE,CAAC;QACrB,MAAM,CAAC,QAAQ,CAAC,aAAa,KAAK,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QAE5D,MAAM,QAAQ,CAAC;YACX,KAAK,EAAE,YAAY;SACtB,CAAC,CAAC;QAEH,MAAM,CAAC,QAAQ,CAAC,aAAa,KAAK,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;QACpD,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;IACrE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport '@spectrum-web-components/action-button/sp-action-button.js';\nimport { ActionButton } from '@spectrum-web-components/action-button';\nimport '@spectrum-web-components/action-group/sp-action-group.js';\nimport { ActionGroup } from '@spectrum-web-components/action-group';\nimport '@spectrum-web-components/tabs/sp-tab-panel.js';\nimport '@spectrum-web-components/tabs/sp-tab.js';\nimport '@spectrum-web-components/tabs/sp-tabs.js';\nimport { Tab, TabPanel, Tabs } from '@spectrum-web-components/tabs';\nimport { elementUpdated, expect, fixture, nextFrame } from '@open-wc/testing';\nimport { html } from '@spectrum-web-components/base';\nimport { sendKeys } from '@web/test-runner-commands';\nimport { sendMouse } from '../../../test/plugins/browser.js';\n\nconst createTabs = async (): Promise<Tabs> => {\n const tabs = await fixture<Tabs>(\n html`\n <sp-tabs selected=\"second\">\n <sp-tab label=\"Tab 1\" value=\"first\"></sp-tab>\n <sp-tab label=\"Tab 2\" value=\"second\"></sp-tab>\n <sp-tab label=\"Tab 3\" value=\"third\"></sp-tab>\n <sp-tab-panel value=\"first\">\n <sp-action-group selects=\"single\">\n <sp-action-button selected value=\"1\">\n Single Button 1\n </sp-action-button>\n <sp-action-button value=\"2\">\n Single Button 2\n </sp-action-button>\n <sp-action-button value=\"3\">\n Single Button 3\n </sp-action-button>\n </sp-action-group>\n </sp-tab-panel>\n <sp-tab-panel value=\"second\">\n <sp-action-group selects=\"multiple\">\n <sp-action-button value=\"1\">\n Multiple Button 1\n </sp-action-button>\n <sp-action-button selected value=\"2\">\n Multiple Button 2\n </sp-action-button>\n <sp-action-button selected value=\"3\">\n Multiple Button 3\n </sp-action-button>\n </sp-action-group>\n </sp-tab-panel>\n <sp-tab-panel value=\"third\">\n <sp-action-group>\n <sp-action-button value=\"1\">\n None Button 1\n </sp-action-button>\n <sp-action-button value=\"2\">\n None Button 2\n </sp-action-button>\n <sp-action-button selected value=\"3\">\n None Button 3\n </sp-action-button>\n </sp-action-group>\n </sp-tab-panel>\n </sp-tabs>\n `\n );\n await elementUpdated(tabs);\n return tabs;\n};\n\ndescribe('Action Group inside of Tabs', () => {\n it('accurately navigates the desired element', async () => {\n const el = await createTabs();\n const tab1 = el.querySelector('sp-tab[value=\"first\"]') as Tab;\n const tab2 = el.querySelector('sp-tab[value=\"second\"]');\n const tab3 = el.querySelector('sp-tab[value=\"third\"]') as Tab;\n const tabPanel1 = el.querySelector(\n 'sp-tab-panel[value=\"first\"]'\n ) as TabPanel;\n const tabPanel2 = el.querySelector(\n 'sp-tab-panel[value=\"second\"]'\n ) as TabPanel;\n const tabPanel3 = el.querySelector(\n 'sp-tab-panel[value=\"third\"]'\n ) as TabPanel;\n const actionGroup1 = tabPanel1.querySelector(\n 'sp-action-group'\n ) as ActionGroup;\n const actionGroup2 = tabPanel2.querySelector(\n 'sp-action-group'\n ) as ActionGroup;\n const actionGroup3 = tabPanel3.querySelector(\n 'sp-action-group'\n ) as ActionGroup;\n const actionButton1 = actionGroup1.querySelector(\n '[selected]'\n ) as ActionButton;\n const actionButton2 = actionGroup2.querySelector(\n '[selected]'\n ) as ActionButton;\n const actionButton3 = actionGroup3.querySelector(\n '[selected]'\n ) as ActionButton;\n\n el.focus();\n expect(el.contains(document.activeElement)).to.be.true;\n expect(document.activeElement === tab2).to.be.true;\n\n actionGroup2.focus();\n expect(document.activeElement === actionButton2).to.be.true;\n\n await nextFrame();\n await sendKeys({\n press: 'ArrowLeft',\n });\n\n expect(document.activeElement === tab1).to.be.false;\n expect(actionGroup2.contains(document.activeElement)).to.be.true;\n\n el.focus();\n expect(document.activeElement === tab2).to.be.true;\n\n await sendKeys({\n press: 'ArrowRight',\n });\n\n expect(document.activeElement === tab3).to.be.true;\n\n await sendKeys({\n press: 'Enter',\n });\n\n expect(document.activeElement === tab3).to.be.true;\n\n actionGroup3.focus();\n expect(document.activeElement === actionButton3).to.be.true;\n\n await sendKeys({\n press: 'ArrowLeft',\n });\n\n expect(document.activeElement === tab2).to.be.false;\n expect(actionGroup3.contains(document.activeElement)).to.be.true;\n\n const boundingRect = tab1.getBoundingClientRect();\n // tab1.click() doesn't current reach into the focus management here.\n await sendMouse({\n steps: [\n {\n type: 'click',\n position: [\n boundingRect.left + boundingRect.width / 2,\n boundingRect.top + boundingRect.height / 2,\n ],\n },\n ],\n });\n expect(document.activeElement === tab1).to.be.true;\n\n actionGroup1.focus();\n expect(document.activeElement === actionButton1).to.be.true;\n\n await sendKeys({\n press: 'ArrowRight',\n });\n\n expect(document.activeElement === tab2).to.be.false;\n expect(actionGroup1.contains(document.activeElement)).to.be.true;\n });\n});\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["roving-tabindex-integration.test.ts"],
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport '@spectrum-web-components/action-button/sp-action-button.js';\nimport { ActionButton } from '@spectrum-web-components/action-button';\nimport '@spectrum-web-components/action-group/sp-action-group.js';\nimport { ActionGroup } from '@spectrum-web-components/action-group';\nimport '@spectrum-web-components/tabs/sp-tab-panel.js';\nimport '@spectrum-web-components/tabs/sp-tab.js';\nimport '@spectrum-web-components/tabs/sp-tabs.js';\nimport { Tab, TabPanel, Tabs } from '@spectrum-web-components/tabs';\nimport { elementUpdated, expect, fixture, nextFrame } from '@open-wc/testing';\nimport { html } from '@spectrum-web-components/base';\nimport { sendKeys } from '@web/test-runner-commands';\nimport { sendMouse } from '../../../test/plugins/browser.js';\n\nconst createTabs = async (): Promise<Tabs> => {\n const tabs = await fixture<Tabs>(\n html`\n <sp-tabs selected=\"second\">\n <sp-tab label=\"Tab 1\" value=\"first\"></sp-tab>\n <sp-tab label=\"Tab 2\" value=\"second\"></sp-tab>\n <sp-tab label=\"Tab 3\" value=\"third\"></sp-tab>\n <sp-tab-panel value=\"first\">\n <sp-action-group selects=\"single\">\n <sp-action-button selected value=\"1\">\n Single Button 1\n </sp-action-button>\n <sp-action-button value=\"2\">\n Single Button 2\n </sp-action-button>\n <sp-action-button value=\"3\">\n Single Button 3\n </sp-action-button>\n </sp-action-group>\n </sp-tab-panel>\n <sp-tab-panel value=\"second\">\n <sp-action-group selects=\"multiple\">\n <sp-action-button value=\"1\">\n Multiple Button 1\n </sp-action-button>\n <sp-action-button selected value=\"2\">\n Multiple Button 2\n </sp-action-button>\n <sp-action-button selected value=\"3\">\n Multiple Button 3\n </sp-action-button>\n </sp-action-group>\n </sp-tab-panel>\n <sp-tab-panel value=\"third\">\n <sp-action-group>\n <sp-action-button value=\"1\">\n None Button 1\n </sp-action-button>\n <sp-action-button value=\"2\">\n None Button 2\n </sp-action-button>\n <sp-action-button selected value=\"3\">\n None Button 3\n </sp-action-button>\n </sp-action-group>\n </sp-tab-panel>\n </sp-tabs>\n `\n );\n await elementUpdated(tabs);\n return tabs;\n};\n\ndescribe('Action Group inside of Tabs', () => {\n it('accurately navigates the desired element', async () => {\n const el = await createTabs();\n const tab1 = el.querySelector('sp-tab[value=\"first\"]') as Tab;\n const tab2 = el.querySelector('sp-tab[value=\"second\"]');\n const tab3 = el.querySelector('sp-tab[value=\"third\"]') as Tab;\n const tabPanel1 = el.querySelector(\n 'sp-tab-panel[value=\"first\"]'\n ) as TabPanel;\n const tabPanel2 = el.querySelector(\n 'sp-tab-panel[value=\"second\"]'\n ) as TabPanel;\n const tabPanel3 = el.querySelector(\n 'sp-tab-panel[value=\"third\"]'\n ) as TabPanel;\n const actionGroup1 = tabPanel1.querySelector(\n 'sp-action-group'\n ) as ActionGroup;\n const actionGroup2 = tabPanel2.querySelector(\n 'sp-action-group'\n ) as ActionGroup;\n const actionGroup3 = tabPanel3.querySelector(\n 'sp-action-group'\n ) as ActionGroup;\n const actionButton1 = actionGroup1.querySelector(\n '[selected]'\n ) as ActionButton;\n const actionButton2 = actionGroup2.querySelector(\n '[selected]'\n ) as ActionButton;\n const actionButton3 = actionGroup3.querySelector(\n '[selected]'\n ) as ActionButton;\n\n el.focus();\n expect(el.contains(document.activeElement)).to.be.true;\n expect(document.activeElement === tab2).to.be.true;\n\n actionGroup2.focus();\n expect(document.activeElement === actionButton2).to.be.true;\n\n await nextFrame();\n await sendKeys({\n press: 'ArrowLeft',\n });\n\n expect(document.activeElement === tab1).to.be.false;\n expect(actionGroup2.contains(document.activeElement)).to.be.true;\n\n el.focus();\n expect(document.activeElement === tab2).to.be.true;\n\n await sendKeys({\n press: 'ArrowRight',\n });\n\n expect(document.activeElement === tab3).to.be.true;\n\n await sendKeys({\n press: 'Enter',\n });\n\n expect(document.activeElement === tab3).to.be.true;\n\n actionGroup3.focus();\n expect(document.activeElement === actionButton3).to.be.true;\n\n await sendKeys({\n press: 'ArrowLeft',\n });\n\n expect(document.activeElement === tab2).to.be.false;\n expect(actionGroup3.contains(document.activeElement)).to.be.true;\n\n const boundingRect = tab1.getBoundingClientRect();\n // tab1.click() doesn't current reach into the focus management here.\n await sendMouse({\n steps: [\n {\n type: 'click',\n position: [\n boundingRect.left + boundingRect.width / 2,\n boundingRect.top + boundingRect.height / 2,\n ],\n },\n ],\n });\n expect(document.activeElement === tab1).to.be.true;\n\n actionGroup1.focus();\n expect(document.activeElement === actionButton1).to.be.true;\n\n await sendKeys({\n press: 'ArrowRight',\n });\n\n expect(document.activeElement === tab2).to.be.false;\n expect(actionGroup1.contains(document.activeElement)).to.be.true;\n });\n});\n"],
5
+ "mappings": "AAWA;AAEA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA,MAAM,aAAa,YAA2B;AAC1C,QAAM,OAAO,MAAM,QACf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SA8CJ;AACA,QAAM,eAAe,IAAI;AACzB,SAAO;AACX;AAEA,SAAS,+BAA+B,MAAM;AAC1C,KAAG,4CAA4C,YAAY;AACvD,UAAM,KAAK,MAAM,WAAW;AAC5B,UAAM,OAAO,GAAG,cAAc,uBAAuB;AACrD,UAAM,OAAO,GAAG,cAAc,wBAAwB;AACtD,UAAM,OAAO,GAAG,cAAc,uBAAuB;AACrD,UAAM,YAAY,GAAG,cACjB,6BACJ;AACA,UAAM,YAAY,GAAG,cACj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