@spectrum-web-components/grid 0.1.0-devmode.0 → 0.1.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/grid",
3
- "version": "0.1.0-devmode.0+7b0ea531e",
3
+ "version": "0.1.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -64,8 +64,8 @@
64
64
  "dependencies": {
65
65
  "@lit-labs/observers": "^1.0.1",
66
66
  "@lit-labs/virtualizer": "0.7.1",
67
- "@spectrum-web-components/base": "^0.6.0",
68
- "@spectrum-web-components/reactive-controllers": "^0.2.5",
67
+ "@spectrum-web-components/base": "^0.7.0",
68
+ "@spectrum-web-components/reactive-controllers": "^0.3.0",
69
69
  "tslib": "^2.0.0"
70
70
  },
71
71
  "types": "./src/index.d.ts",
@@ -74,5 +74,5 @@
74
74
  "./sp-*.js",
75
75
  "./**/*.dev.js"
76
76
  ],
77
- "gitHead": "7b0ea531e9c7225c8964c5429bc5fd005618b80e"
77
+ "gitHead": "05c81318844160db3f8156144106e643507fef97"
78
78
  }
package/sp-grid.js CHANGED
@@ -1,3 +1,2 @@
1
- import { Grid } from "./src/Grid.js";
2
- customElements.define("sp-grid", Grid);
1
+ import{Grid as e}from"./src/Grid.js";customElements.define("sp-grid",e);
3
2
  //# sourceMappingURL=sp-grid.js.map
package/sp-grid.js.map CHANGED
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["sp-grid.ts"],
4
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 { Grid } from './src/Grid.js';\n\ncustomElements.define('sp-grid', Grid);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-grid': Grid;\n }\n}\n"],
5
- "mappings": "AAYA;AAEA,eAAe,OAAO,WAAW,IAAI;",
5
+ "mappings": "AAYA,qCAEA,eAAe,OAAO,UAAW,CAAI",
6
6
  "names": []
7
7
  }
package/src/Grid.js CHANGED
@@ -1,106 +1,2 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __decorateClass = (decorators, target, key, kind) => {
4
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
- if (decorator = decorators[i])
7
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
- if (kind && result)
9
- __defProp(target, key, result);
10
- return result;
11
- };
12
- import { property } from "@spectrum-web-components/base/src/decorators.js";
13
- import { LitVirtualizer } from "@lit-labs/virtualizer/LitVirtualizer.js";
14
- import { grid } from "@lit-labs/virtualizer/layouts/grid.js";
15
- import styles from "./grid.css.js";
16
- import { GridController } from "./GridController.js";
17
- export class Grid extends LitVirtualizer {
18
- constructor() {
19
- super(...arguments);
20
- this.gap = "0";
21
- this.items = [];
22
- this.itemSize = {
23
- width: 200,
24
- height: 200
25
- };
26
- this.selected = [];
27
- this.gridController = new GridController(this, {
28
- elements: () => [],
29
- itemSize: () => this.itemSize,
30
- gap: () => this.gap
31
- });
32
- }
33
- static get styles() {
34
- return [styles];
35
- }
36
- get renderItem() {
37
- return super.renderItem;
38
- }
39
- set renderItem(fn) {
40
- super.renderItem = (item, index) => {
41
- const selected = this.selected.includes(item);
42
- return fn(item, index, selected);
43
- };
44
- }
45
- handleChange(event) {
46
- const target = event.target;
47
- const value = this.items[parseFloat(target.getAttribute("key") || "")];
48
- const selected = [...this.selected];
49
- if (!selected.includes(value)) {
50
- selected.push(value);
51
- } else {
52
- const index = selected.indexOf(value);
53
- if (index > -1) {
54
- selected.splice(index, 1);
55
- }
56
- }
57
- this.selected = selected;
58
- }
59
- update(changes) {
60
- if (changes.has("itemSize") || changes.has("gap") || changes.has("focusableSelector")) {
61
- this.updateComplete.then(() => {
62
- this.gridController.update({
63
- elements: () => [
64
- ...this.querySelectorAll(this.focusableSelector)
65
- ],
66
- itemSize: () => this.itemSize,
67
- gap: () => this.gap
68
- });
69
- });
70
- this.layout = grid({
71
- itemSize: {
72
- width: `${this.itemSize.width}px`,
73
- height: `${this.itemSize.height}px`
74
- },
75
- gap: this.gap
76
- });
77
- }
78
- super.update(changes);
79
- }
80
- connectedCallback() {
81
- super.connectedCallback();
82
- this.addEventListener("change", this.handleChange, { capture: true });
83
- }
84
- disconnectedCallback() {
85
- this.removeEventListener("change", this.handleChange, {
86
- capture: true
87
- });
88
- super.disconnectedCallback();
89
- }
90
- }
91
- __decorateClass([
92
- property({ type: String })
93
- ], Grid.prototype, "focusableSelector", 2);
94
- __decorateClass([
95
- property({ type: String })
96
- ], Grid.prototype, "gap", 2);
97
- __decorateClass([
98
- property({ type: Array })
99
- ], Grid.prototype, "items", 2);
100
- __decorateClass([
101
- property({ type: Object })
102
- ], Grid.prototype, "itemSize", 2);
103
- __decorateClass([
104
- property({ type: Array })
105
- ], Grid.prototype, "selected", 2);
1
+ var d=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var s=(o,t,i,r)=>{for(var e=r>1?void 0:r?p(t,i):t,n=o.length-1,a;n>=0;n--)(a=o[n])&&(e=(r?a(t,i,e):a(e))||e);return r&&e&&d(t,i,e),e};import{property as l}from"@spectrum-web-components/base/src/decorators.js";import{LitVirtualizer as u}from"@lit-labs/virtualizer/LitVirtualizer.js";import{grid as c}from"@lit-labs/virtualizer/layouts/grid.js";import m from"./grid.css.js";import{GridController as h}from"./GridController.js";export class Grid extends u{constructor(){super(...arguments);this.gap="0";this.items=[];this.itemSize={width:200,height:200};this.selected=[];this.gridController=new h(this,{elements:()=>[],itemSize:()=>this.itemSize,gap:()=>this.gap})}static get styles(){return[m]}get renderItem(){return super.renderItem}set renderItem(t){super.renderItem=(i,r)=>{const e=this.selected.includes(i);return t(i,r,e)}}handleChange(t){const i=t.target,r=this.items[parseFloat(i.getAttribute("key")||"")],e=[...this.selected];if(!e.includes(r))e.push(r);else{const n=e.indexOf(r);n>-1&&e.splice(n,1)}this.selected=e}update(t){(t.has("itemSize")||t.has("gap")||t.has("focusableSelector"))&&(this.updateComplete.then(()=>{this.gridController.update({elements:()=>[...this.querySelectorAll(this.focusableSelector)],itemSize:()=>this.itemSize,gap:()=>this.gap})}),this.layout=c({itemSize:{width:`${this.itemSize.width}px`,height:`${this.itemSize.height}px`},gap:this.gap})),super.update(t)}connectedCallback(){super.connectedCallback(),this.addEventListener("change",this.handleChange,{capture:!0})}disconnectedCallback(){this.removeEventListener("change",this.handleChange,{capture:!0}),super.disconnectedCallback()}}s([l({type:String})],Grid.prototype,"focusableSelector",2),s([l({type:String})],Grid.prototype,"gap",2),s([l({type:Array})],Grid.prototype,"items",2),s([l({type:Object})],Grid.prototype,"itemSize",2),s([l({type:Array})],Grid.prototype,"selected",2);
106
2
  //# sourceMappingURL=Grid.js.map
package/src/Grid.js.map CHANGED
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["Grid.ts"],
4
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 {\n CSSResultArray,\n PropertyValues,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { LitVirtualizer } from '@lit-labs/virtualizer/LitVirtualizer.js';\nimport { grid } from '@lit-labs/virtualizer/layouts/grid.js';\nimport styles from './grid.css.js';\nimport { GridController } from './GridController.js';\n\n/**\n * @element sp-grid\n *\n * @fires change - Announces that the value of `selected` has changed\n */\nexport class Grid extends LitVirtualizer {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: String })\n public focusableSelector!: string;\n\n @property({ type: String })\n public gap: `${'0' | `${number}px`}` = '0';\n\n @property({ type: Array })\n public override items: Record<string, unknown>[] = [];\n\n @property({ type: Object })\n public itemSize: {\n width: number;\n height: number;\n } = {\n width: 200,\n height: 200,\n };\n\n /* c8 ignore next 3 */\n override get renderItem(): (\n item: unknown,\n index: number\n ) => TemplateResult {\n return super.renderItem;\n }\n\n override set renderItem(\n fn: (item: unknown, index: number, selected: boolean) => TemplateResult\n ) {\n super.renderItem = (item, index: number): TemplateResult => {\n const selected = this.selected.includes(\n item as Record<string, unknown>\n );\n return fn(item, index, selected);\n };\n }\n\n @property({ type: Array })\n public selected: Record<string, unknown>[] = [];\n\n gridController = new GridController<HTMLElement>(this, {\n elements: () => [],\n itemSize: () => this.itemSize,\n /* c8 ignore next 1 */\n gap: () => this.gap,\n });\n\n protected handleChange(event: Event): void {\n const target = event.target as HTMLElement;\n const value = this.items[\n parseFloat(target.getAttribute('key') || '')\n ] as Record<string, unknown>;\n const selected: Record<string, unknown>[] = [...this.selected];\n if (!selected.includes(value)) {\n selected.push(value);\n } else {\n const index = selected.indexOf(value);\n if (index > -1) {\n selected.splice(index, 1);\n }\n }\n this.selected = selected;\n }\n\n protected override update(changes: PropertyValues<this>): void {\n if (\n changes.has('itemSize') ||\n changes.has('gap') ||\n changes.has('focusableSelector')\n ) {\n this.updateComplete.then(() => {\n this.gridController.update({\n elements: () => [\n ...this.querySelectorAll<HTMLElement>(\n this.focusableSelector\n ),\n ],\n itemSize: () => this.itemSize,\n gap: () => this.gap,\n });\n });\n\n this.layout = grid({\n itemSize: {\n width: `${this.itemSize.width}px`,\n height: `${this.itemSize.height}px`,\n },\n gap: this.gap,\n });\n }\n\n super.update(changes);\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('change', this.handleChange, { capture: true });\n }\n\n override disconnectedCallback(): void {\n this.removeEventListener('change', this.handleChange, {\n capture: true,\n });\n super.disconnectedCallback();\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;AAiBA;AACA;AACA;AACA;AACA;AAOO,aAAM,aAAa,eAAe;AAAA,EAAlC;AAAA;AASI,eAAgC;AAGvB,iBAAmC,CAAC;AAG7C,oBAGH;AAAA,MACA,OAAO;AAAA,MACP,QAAQ;AAAA,IACZ;AAsBO,oBAAsC,CAAC;AAE9C,0BAAiB,IAAI,eAA4B,MAAM;AAAA,MACnD,UAAU,MAAM,CAAC;AAAA,MACjB,UAAU,MAAM,KAAK;AAAA,MAErB,KAAK,MAAM,KAAK;AAAA,IACpB,CAAC;AAAA;AAAA,aAjD0B,SAAyB;AAChD,WAAO,CAAC,MAAM;AAAA,EAClB;AAAA,MAqBa,aAGO;AAChB,WAAO,MAAM;AAAA,EACjB;AAAA,MAEa,WACT,IACF;AACE,UAAM,aAAa,CAAC,MAAM,UAAkC;AACxD,YAAM,WAAW,KAAK,SAAS,SAC3B,IACJ;AACA,aAAO,GAAG,MAAM,OAAO,QAAQ;AAAA,IACnC;AAAA,EACJ;AAAA,EAYU,aAAa,OAAoB;AACvC,UAAM,SAAS,MAAM;AACrB,UAAM,QAAQ,KAAK,MACf,WAAW,OAAO,aAAa,KAAK,KAAK,EAAE;AAE/C,UAAM,WAAsC,CAAC,GAAG,KAAK,QAAQ;AAC7D,QAAI,CAAC,SAAS,SAAS,KAAK,GAAG;AAC3B,eAAS,KAAK,KAAK;AAAA,IACvB,OAAO;AACH,YAAM,QAAQ,SAAS,QAAQ,KAAK;AACpC,UAAI,QAAQ,IAAI;AACZ,iBAAS,OAAO,OAAO,C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,GAAG,KAAK,SAAS,UAC7B,EACA,IAAK,KAAK,GACd,CAAC,GAGL,MAAM,OAAO,CAAO,CACxB,CAES,mBAA0B,CAC/B,MAAM,kBAAkB,EACxB,KAAK,iBAAiB,SAAU,KAAK,aAAc,CAAE,QAAS,EAAK,CAAC,CACxE,CAES,sBAA6B,CAClC,KAAK,oBAAoB,SAAU,KAAK,aAAc,CAClD,QAAS,EACb,CAAC,EACD,MAAM,qBAAqB,CAC/B,CACJ,CAxGW,GADP,AAAC,EAAS,CAAE,KAAM,MAAO,CAAC,GACnB,AANJ,KAMI,iCAGA,GADP,AAAC,EAAS,CAAE,KAAM,MAAO,CAAC,GACnB,AATJ,KASI,mBAGS,GADhB,AAAC,EAAS,CAAE,KAAM,KAAM,CAAC,GACT,AAZb,KAYa,qBAGT,GADP,AAAC,EAAS,CAAE,KAAM,MAAO,CAAC,GACnB,AAfJ,KAeI,wBA4BA,GADP,AAAC,EAAS,CAAE,KAAM,KAAM,CAAC,GAClB,AA3CJ,KA2CI",
6
6
  "names": []
7
7
  }
@@ -1,125 +1,2 @@
1
- import { ResizeController } from "@lit-labs/observers/resize_controller.js";
2
- import { RovingTabindexController } from "@spectrum-web-components/reactive-controllers/src/RovingTabindex.js";
3
- export class GridController {
4
- constructor(host, {
5
- elements,
6
- itemSize,
7
- gap
8
- }) {
9
- this._first = 0;
10
- this._last = 0;
11
- this.handleFocusin = (event) => {
12
- const doCallbackAfterPaint = (cb) => {
13
- requestAnimationFrame(() => {
14
- requestAnimationFrame(() => {
15
- cb();
16
- });
17
- });
18
- };
19
- const scrollToFirst = () => this.host.scrollToIndex(0);
20
- const focusIntoGrid = () => {
21
- this.focus();
22
- this.host.tabIndex = -1;
23
- };
24
- if (event.target === this.host) {
25
- if (this._first > 0) {
26
- doCallbackAfterPaint(() => {
27
- scrollToFirst();
28
- doCallbackAfterPaint(focusIntoGrid);
29
- });
30
- } else {
31
- doCallbackAfterPaint(focusIntoGrid);
32
- }
33
- }
34
- };
35
- this.handleFocusout = (event) => {
36
- if (event.relatedTarget && !this.host.contains(event.relatedTarget)) {
37
- this.host.tabIndex = 0;
38
- }
39
- };
40
- this.handleRangeChanged = (event) => {
41
- this.rovingTabindexController.clearElementCache(event.first);
42
- };
43
- this.handleVisibleChanged = (event) => {
44
- this._first = event.first;
45
- this._last = event.last;
46
- };
47
- this.host = host;
48
- this.host.addController(this);
49
- this.applyLayout(itemSize, gap);
50
- this.resizeController = new ResizeController(this.host, {
51
- callback: (entries) => {
52
- entries.forEach((entry) => {
53
- this.measureDirectionLength(entry.contentRect);
54
- });
55
- }
56
- });
57
- this.rovingTabindexController = new RovingTabindexController(this.host, {
58
- direction: "grid",
59
- elements,
60
- focusInIndex: () => {
61
- const activeElement = this.host.getRootNode().activeElement;
62
- return activeElement === this.host ? 0 : -1;
63
- }
64
- });
65
- }
66
- get itemSize() {
67
- return this._itemSize();
68
- }
69
- _itemSize() {
70
- return {
71
- width: 100,
72
- height: 100
73
- };
74
- }
75
- get gap() {
76
- return this._gap();
77
- }
78
- _gap() {
79
- return void 0;
80
- }
81
- focus(options) {
82
- this.rovingTabindexController.focus(options);
83
- }
84
- applyLayout(itemSize, gap) {
85
- if (typeof itemSize === "object") {
86
- this._itemSize = () => itemSize;
87
- } else if (typeof itemSize === "function" && typeof itemSize() !== "undefined") {
88
- this._itemSize = itemSize;
89
- }
90
- if (typeof gap === "string") {
91
- this._gap = () => gap;
92
- } else if (typeof gap === "function") {
93
- this._gap = gap;
94
- }
95
- }
96
- update({
97
- elements,
98
- itemSize,
99
- gap
100
- }) {
101
- this.rovingTabindexController.update({ elements });
102
- this.applyLayout(itemSize, gap);
103
- const contentRect = this.host.getBoundingClientRect();
104
- this.measureDirectionLength(contentRect);
105
- }
106
- measureDirectionLength(contentRect) {
107
- const gap = this.gap ? parseFloat(this.gap) : 0;
108
- this.rovingTabindexController.directionLength = Math.floor((contentRect.width - gap) / (this.itemSize.width + gap));
109
- }
110
- hostConnected() {
111
- this.host.addEventListener("rangeChanged", this.handleRangeChanged);
112
- this.host.addEventListener("visibilityChanged", this.handleVisibleChanged);
113
- this.host.addEventListener("focusin", this.handleFocusin);
114
- this.host.addEventListener("focusout", this.handleFocusout);
115
- this.host.tabIndex = 0;
116
- this.host.style.setProperty("outline", "none", "important");
117
- }
118
- hostDisconnected() {
119
- this.host.removeEventListener("rangeChanged", this.handleRangeChanged);
120
- this.host.removeEventListener("visibilityChanged", this.handleVisibleChanged);
121
- this.host.removeEventListener("focusin", this.handleFocusin);
122
- this.host.removeEventListener("focusout", this.handleFocusout);
123
- }
124
- }
1
+ import{ResizeController as r}from"@lit-labs/observers/resize_controller.js";import{RovingTabindexController as h}from"@spectrum-web-components/reactive-controllers/src/RovingTabindex.js";export class GridController{constructor(e,{elements:t,itemSize:n,gap:i}){this._first=0;this._last=0;this.handleFocusin=e=>{const t=o=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{o()})})},n=()=>this.host.scrollToIndex(0),i=()=>{this.focus(),this.host.tabIndex=-1};e.target===this.host&&(this._first>0?t(()=>{n(),t(i)}):t(i))};this.handleFocusout=e=>{e.relatedTarget&&!this.host.contains(e.relatedTarget)&&(this.host.tabIndex=0)};this.handleRangeChanged=e=>{this.rovingTabindexController.clearElementCache(e.first)};this.handleVisibleChanged=e=>{this._first=e.first,this._last=e.last};this.host=e,this.host.addController(this),this.applyLayout(n,i),this.resizeController=new r(this.host,{callback:o=>{o.forEach(s=>{this.measureDirectionLength(s.contentRect)})}}),this.rovingTabindexController=new h(this.host,{direction:"grid",elements:t,focusInIndex:()=>this.host.getRootNode().activeElement===this.host?0:-1})}get itemSize(){return this._itemSize()}_itemSize(){return{width:100,height:100}}get gap(){return this._gap()}_gap(){}focus(e){this.rovingTabindexController.focus(e)}applyLayout(e,t){typeof e=="object"?this._itemSize=()=>e:typeof e=="function"&&typeof e()!="undefined"&&(this._itemSize=e),typeof t=="string"?this._gap=()=>t:typeof t=="function"&&(this._gap=t)}update({elements:e,itemSize:t,gap:n}){this.rovingTabindexController.update({elements:e}),this.applyLayout(t,n);const i=this.host.getBoundingClientRect();this.measureDirectionLength(i)}measureDirectionLength(e){const t=this.gap?parseFloat(this.gap):0;this.rovingTabindexController.directionLength=Math.floor((e.width-t)/(this.itemSize.width+t))}hostConnected(){this.host.addEventListener("rangeChanged",this.handleRangeChanged),this.host.addEventListener("visibilityChanged",this.handleVisibleChanged),this.host.addEventListener("focusin",this.handleFocusin),this.host.addEventListener("focusout",this.handleFocusout),this.host.tabIndex=0,this.host.style.setProperty("outline","none","important")}hostDisconnected(){this.host.removeEventListener("rangeChanged",this.handleRangeChanged),this.host.removeEventListener("visibilityChanged",this.handleVisibleChanged),this.host.removeEventListener("focusin",this.handleFocusin),this.host.removeEventListener("focusout",this.handleFocusout)}}
125
2
  //# sourceMappingURL=GridController.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["GridController.ts"],
4
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\nimport { ResizeController } from '@lit-labs/observers/resize_controller.js';\nimport { RovingTabindexController } from '@spectrum-web-components/reactive-controllers/src/RovingTabindex.js';\nimport {\n RangeChangedEvent,\n VisibilityChangedEvent,\n} from '@lit-labs/virtualizer/Virtualizer.js';\n\ninterface ItemSize {\n width: number;\n height: number;\n}\n\nexport class GridController<T extends HTMLElement>\n implements ReactiveController\n{\n host!: ReactiveElement;\n\n resizeController!: ResizeController;\n\n rovingTabindexController!: RovingTabindexController<T>;\n\n get itemSize(): ItemSize {\n return this._itemSize();\n }\n\n /* c8 ignore next 6 */\n private _itemSize(): ItemSize {\n return {\n width: 100,\n height: 100,\n };\n }\n\n // First visible element\n _first = 0;\n\n get gap(): string | undefined {\n return this._gap();\n }\n\n /* c8 ignore next 3 */\n private _gap(): string | undefined {\n return undefined;\n }\n\n // Last visible element\n _last = 0;\n\n constructor(\n host: ReactiveElement,\n {\n elements,\n itemSize,\n gap,\n }: {\n elements: () => T[];\n itemSize: ItemSize | (() => ItemSize);\n gap?: string | (() => string);\n }\n ) {\n this.host = host;\n this.host.addController(this);\n this.applyLayout(itemSize, gap);\n this.resizeController = new ResizeController(this.host, {\n callback: (entries: ResizeObserverEntry[]): void => {\n entries.forEach((entry) => {\n this.measureDirectionLength(entry.contentRect);\n });\n },\n });\n this.rovingTabindexController = new RovingTabindexController<T>(\n this.host,\n {\n direction: 'grid',\n elements,\n focusInIndex: () => {\n const activeElement = (this.host.getRootNode() as Document)\n .activeElement as HTMLElement;\n return activeElement === this.host ? 0 : -1;\n },\n }\n );\n }\n\n public focus(options?: FocusOptions): void {\n this.rovingTabindexController.focus(options);\n }\n\n protected applyLayout(\n itemSize: ItemSize | (() => ItemSize),\n gap?: string | (() => string)\n ): void {\n /* c8 ignore next 2 */\n if (typeof itemSize === 'object') {\n this._itemSize = () => itemSize;\n } else if (\n typeof itemSize === 'function' &&\n typeof itemSize() !== 'undefined'\n ) {\n this._itemSize = itemSize;\n }\n /* c8 ignore next 2 */\n if (typeof gap === 'string') {\n this._gap = () => gap;\n } else if (typeof gap === 'function') {\n this._gap = gap;\n }\n }\n\n public update({\n elements,\n itemSize,\n gap,\n }: {\n elements: () => T[];\n itemSize: ItemSize | (() => ItemSize);\n gap?: string | (() => string);\n }): void {\n this.rovingTabindexController.update({ elements });\n this.applyLayout(itemSize, gap);\n const contentRect = this.host.getBoundingClientRect();\n this.measureDirectionLength(contentRect);\n }\n\n protected measureDirectionLength(contentRect: DOMRect): void {\n const gap = this.gap ? parseFloat(this.gap) : 0;\n this.rovingTabindexController.directionLength = Math.floor(\n (contentRect.width - gap) / (this.itemSize.width + gap)\n );\n }\n\n protected handleFocusin = (event: FocusEvent): void => {\n const doCallbackAfterPaint = (cb: () => void): void => {\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n cb();\n });\n });\n };\n const scrollToFirst = (): void => (this.host as any).scrollToIndex(0);\n const focusIntoGrid = (): void => {\n this.focus();\n this.host.tabIndex = -1;\n };\n if ((event.target as HTMLElement) === this.host) {\n if (this._first > 0) {\n doCallbackAfterPaint(() => {\n scrollToFirst();\n doCallbackAfterPaint(focusIntoGrid);\n });\n } else {\n doCallbackAfterPaint(focusIntoGrid);\n }\n }\n };\n\n protected handleFocusout = (event: FocusEvent): void => {\n if (\n event.relatedTarget &&\n !this.host.contains(event.relatedTarget as HTMLElement)\n ) {\n this.host.tabIndex = 0;\n }\n };\n\n protected handleRangeChanged = (event: RangeChangedEvent): void => {\n this.rovingTabindexController.clearElementCache(event.first);\n };\n\n protected handleVisibleChanged = (event: VisibilityChangedEvent): void => {\n this._first = event.first;\n this._last = event.last;\n };\n\n public hostConnected(): void {\n this.host.addEventListener('rangeChanged', this.handleRangeChanged);\n this.host.addEventListener(\n 'visibilityChanged',\n this.handleVisibleChanged\n );\n this.host.addEventListener('focusin', this.handleFocusin);\n this.host.addEventListener('focusout', this.handleFocusout);\n this.host.tabIndex = 0;\n this.host.style.setProperty('outline', 'none', 'important');\n }\n\n public hostDisconnected(): void {\n this.host.removeEventListener('rangeChanged', this.handleRangeChanged);\n this.host.removeEventListener(\n 'visibilityChanged',\n this.handleVisibleChanged\n );\n this.host.removeEventListener('focusin', this.handleFocusin);\n this.host.removeEventListener('focusout', this.handleFocusout);\n }\n}\n"],
5
- "mappings": "AAaA;AACA;AAWO,aAAM,eAEb;AAAA,EAkCI,YACI,MACA;AAAA,IACI;AAAA,IACA;AAAA,IACA;AAAA,KAMN;AAzBF,kBAAS;AAYT,iBAAQ;AAqFE,yBAAgB,CAAC,UAA4B;AACnD,YAAM,uB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Aa,EACxD,KAAK,KAAK,iBAAiB,WAAY,KAAK,cAAc,EAC1D,KAAK,KAAK,SAAW,EACrB,KAAK,KAAK,MAAM,YAAY,UAAW,OAAQ,WAAW,CAC9D,CAEO,kBAAyB,CAC5B,KAAK,KAAK,oBAAoB,eAAgB,KAAK,kBAAkB,EACrE,KAAK,KAAK,oBACN,oBACA,KAAK,oBACT,EACA,KAAK,KAAK,oBAAoB,UAAW,KAAK,aAAa,EAC3D,KAAK,KAAK,oBAAoB,WAAY,KAAK,cAAc,CACjE,CACJ",
6
6
  "names": []
7
7
  }
package/src/grid.css.js CHANGED
@@ -1,6 +1,4 @@
1
- import { css } from "@spectrum-web-components/base";
2
- const styles = css`
1
+ import{css as t}from"@spectrum-web-components/base";const o=t`
3
2
  :host{contain:strict;display:block;position:relative}
4
- `;
5
- export default styles;
3
+ `;export default o;
6
4
  //# sourceMappingURL=grid.css.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["grid.css.ts"],
4
4
  "sourcesContent": ["/*\nCopyright 2022 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 { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{contain:strict;display:block;position:relative}\n`;\nexport default styles;"],
5
- "mappings": "AAWA;AACA,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
5
+ "mappings": "AAWA,oDACA,KAAM,GAAS;AAAA;AAAA,EAGf,cAAe",
6
6
  "names": []
7
7
  }
package/src/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export * from "./Grid.js";
1
+ export*from"./Grid.js";
2
2
  //# sourceMappingURL=index.js.map
package/src/index.js.map CHANGED
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["index.ts"],
4
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 './Grid.js';\n"],
5
- "mappings": "AAYA;",
5
+ "mappings": "AAYA",
6
6
  "names": []
7
7
  }
@@ -1,76 +1,34 @@
1
- import { html } from "@spectrum-web-components/base";
2
- import "@spectrum-web-components/grid/sp-grid.js";
3
- import "@spectrum-web-components/action-bar/sp-action-bar.js";
4
- import "@spectrum-web-components/card/sp-card.js";
5
- import "@spectrum-web-components/checkbox/sp-checkbox.js";
6
- import "@spectrum-web-components/action-button/sp-action-button.js";
7
- import "@spectrum-web-components/action-group/sp-action-group.js";
8
- import "@spectrum-web-components/icons-workflow/icons/sp-icon-edit.js";
9
- import "@spectrum-web-components/icons-workflow/icons/sp-icon-more.js";
10
- export default {
11
- title: "Grid",
12
- component: "sp-grid"
13
- };
14
- function generateItems(count) {
15
- const items = [];
16
- while (count) {
17
- count -= 1;
18
- items.unshift({ id: count });
19
- }
20
- return items;
21
- }
22
- export const Default = () => {
23
- const items = generateItems(1e3);
24
- const renderItem = (item, index, selected) => {
25
- return html`
1
+ import{html as r}from"@spectrum-web-components/base";import"@spectrum-web-components/grid/sp-grid.js";import"@spectrum-web-components/action-bar/sp-action-bar.js";import"@spectrum-web-components/card/sp-card.js";import"@spectrum-web-components/checkbox/sp-checkbox.js";import"@spectrum-web-components/action-button/sp-action-button.js";import"@spectrum-web-components/action-group/sp-action-group.js";import"@spectrum-web-components/icons-workflow/icons/sp-icon-edit.js";import"@spectrum-web-components/icons-workflow/icons/sp-icon-more.js";export default{title:"Grid",component:"sp-grid"};function a(o){const s=[];for(;o;)o-=1,s.unshift({id:o});return s}export const Default=()=>{const o=a(1e3);return r`
2
+ <h1>Random before content that is focusable</h1>
3
+ <input id="first-input" />
4
+ <sp-grid
5
+ @change=${e=>{const t=document.querySelector("sp-action-bar"),n=document.querySelector(".selected"),i=document.querySelector(".ids");t.open=!!e.currentTarget.selected.length,t.style.setProperty("display",e.currentTarget.selected.length?"flex":"none"),n.textContent=""+e.currentTarget.selected.length,i.textContent=""+e.currentTarget.selected.map(c=>c.id).join(", ")}}
6
+ .items=${o}
7
+ .focusableSelector=${"sp-card"}
8
+ .renderItem=${(e,t,n)=>r`
26
9
  <sp-card
27
10
  toggles
28
11
  variant="quiet"
29
- heading="Card Heading ${item.id}"
12
+ heading="Card Heading ${e.id}"
30
13
  subheading="JPG Photo"
31
14
  style="contain: strict; padding: 1px;"
32
- value="card-${item.id}"
33
- .selected=${selected}
34
- key=${index}
15
+ value="card-${e.id}"
16
+ .selected=${n}
17
+ key=${t}
35
18
  >
36
19
  <img
37
20
  alt=""
38
21
  slot="preview"
39
- src="https://picsum.photos/id/${item.id}/200/300"
22
+ src="https://picsum.photos/id/${e.id}/200/300"
40
23
  decoding="async"
41
24
  />
42
25
  <div slot="description">10/15/18</div>
43
26
  <div slot="footer">Footer</div>
44
27
  </sp-card>
45
- `;
46
- };
47
- const handleChange = (event) => {
48
- const actionbar = document.querySelector("sp-action-bar");
49
- const selected = document.querySelector(".selected");
50
- const ids = document.querySelector(".ids");
51
- actionbar.open = !!event.currentTarget.selected.length;
52
- actionbar.style.setProperty("display", !!event.currentTarget.selected.length ? "flex" : "none");
53
- selected.textContent = "" + event.currentTarget.selected.length;
54
- ids.textContent = "" + event.currentTarget.selected.map((selection) => selection.id).join(", ");
55
- };
56
- const handleActionBarChange = (event) => {
57
- event.preventDefault();
58
- const grid = document.querySelector("sp-grid");
59
- const actionbar = document.querySelector("sp-action-bar");
60
- actionbar.open = false;
61
- grid.selected = [];
62
- };
63
- return html`
64
- <h1>Random before content that is focusable</h1>
65
- <input id="first-input" />
66
- <sp-grid
67
- @change=${handleChange}
68
- .items=${items}
69
- .focusableSelector=${"sp-card"}
70
- .renderItem=${renderItem}
28
+ `}
71
29
  ></sp-grid>
72
30
  <sp-action-bar variant="fixed" style="display: none">
73
- <sp-checkbox @click=${handleActionBarChange} checked>
31
+ <sp-checkbox @click=${e=>{e.preventDefault();const t=document.querySelector("sp-grid"),n=document.querySelector("sp-action-bar");n.open=!1,t.selected=[]}} checked>
74
32
  <span class="selected"></span>
75
33
  Selected
76
34
  <span class="ids"></span>
@@ -86,65 +44,39 @@ export const Default = () => {
86
44
  </sp-action-bar>
87
45
  <h2>Random after content that is focusable</h2>
88
46
  <input id="last-input" />
89
- `;
90
- };
91
- export const sized = () => {
92
- const items = generateItems(1e3);
93
- const renderItem = (item, index, selected) => {
94
- return html`
47
+ `},sized=()=>{const o=a(1e3);return r`
48
+ <h1>Random before content that is focusable</h1>
49
+ <input id="first-input" />
50
+ <sp-grid
51
+ @change=${e=>{const t=document.querySelector("sp-action-bar"),n=document.querySelector(".selected"),i=document.querySelector(".ids");t.open=!!e.currentTarget.selected.length,t.style.setProperty("display",e.currentTarget.selected.length?"flex":"none"),n.textContent=""+e.currentTarget.selected.length,i.textContent=""+e.currentTarget.selected.map(c=>c.id).join(", ")}}
52
+ .items=${o}
53
+ .focusableSelector=${"sp-card"}
54
+ .renderItem=${(e,t,n)=>r`
95
55
  <sp-card
96
56
  toggles
97
57
  variant="quiet"
98
- heading="Card Heading ${item.id}"
58
+ heading="Card Heading ${e.id}"
99
59
  subheading="JPG Photo"
100
60
  style="contain: strict; padding: 1px;"
101
- value="card-${item.id}"
102
- .selected=${selected}
103
- key=${index}
61
+ value="card-${e.id}"
62
+ .selected=${n}
63
+ key=${t}
104
64
  >
105
65
  <img
106
66
  alt=""
107
67
  slot="preview"
108
- src="https://picsum.photos/id/${item.id}/200/300"
68
+ src="https://picsum.photos/id/${e.id}/200/300"
109
69
  decoding="async"
110
70
  />
111
71
  <div slot="description">10/15/18</div>
112
72
  <div slot="footer">Footer</div>
113
73
  </sp-card>
114
- `;
115
- };
116
- const handleChange = (event) => {
117
- const actionbar = document.querySelector("sp-action-bar");
118
- const selected = document.querySelector(".selected");
119
- const ids = document.querySelector(".ids");
120
- actionbar.open = !!event.currentTarget.selected.length;
121
- actionbar.style.setProperty("display", !!event.currentTarget.selected.length ? "flex" : "none");
122
- selected.textContent = "" + event.currentTarget.selected.length;
123
- ids.textContent = "" + event.currentTarget.selected.map((selection) => selection.id).join(", ");
124
- };
125
- const handleActionBarChange = (event) => {
126
- event.preventDefault();
127
- const grid = document.querySelector("sp-grid");
128
- const actionbar = document.querySelector("sp-action-bar");
129
- actionbar.open = false;
130
- grid.selected = [];
131
- };
132
- return html`
133
- <h1>Random before content that is focusable</h1>
134
- <input id="first-input" />
135
- <sp-grid
136
- @change=${handleChange}
137
- .items=${items}
138
- .focusableSelector=${"sp-card"}
139
- .renderItem=${renderItem}
140
- .itemSize=${{
141
- width: 200,
142
- height: 300
143
- }}
74
+ `}
75
+ .itemSize=${{width:200,height:300}}
144
76
  .gap=${"10px"}
145
77
  ></sp-grid>
146
78
  <sp-action-bar variant="fixed" style="display: none">
147
- <sp-checkbox @click=${handleActionBarChange} checked>
79
+ <sp-checkbox @click=${e=>{e.preventDefault();const t=document.querySelector("sp-grid"),n=document.querySelector("sp-action-bar");n.open=!1,t.selected=[]}} checked>
148
80
  <span class="selected"></span>
149
81
  Selected
150
82
  <span class="ids"></span>
@@ -160,6 +92,5 @@ export const sized = () => {
160
92
  </sp-action-bar>
161
93
  <h2>Random after content that is focusable</h2>
162
94
  <input id="last-input" />
163
- `;
164
- };
95
+ `};
165
96
  //# sourceMappingURL=grid.stories.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["grid.stories.ts"],
4
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, TemplateResult } from '@spectrum-web-components/base';\n\nimport '@spectrum-web-components/grid/sp-grid.js';\nimport '@spectrum-web-components/action-bar/sp-action-bar.js';\nimport '@spectrum-web-components/card/sp-card.js';\nimport '@spectrum-web-components/checkbox/sp-checkbox.js';\nimport '@spectrum-web-components/action-button/sp-action-button.js';\nimport '@spectrum-web-components/action-group/sp-action-group.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-edit.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-more.js';\nimport type { ActionBar } from '@spectrum-web-components/action-bar';\nimport type { Grid } from '@spectrum-web-components/grid';\n\nexport default {\n title: 'Grid',\n component: 'sp-grid',\n};\n\ninterface Item extends Record<string, unknown> {\n id: number;\n}\n\nfunction generateItems(count: number): Item[] {\n const items: Item[] = [];\n while (count) {\n count -= 1;\n items.unshift({ id: count });\n }\n return items;\n}\n\nexport const Default = (): TemplateResult => {\n const items = generateItems(1000);\n\n const renderItem = (\n item: Item,\n index: number,\n selected: boolean\n ): TemplateResult => {\n return html`\n <sp-card\n toggles\n variant=\"quiet\"\n heading=\"Card Heading ${item.id}\"\n subheading=\"JPG Photo\"\n style=\"contain: strict; padding: 1px;\"\n value=\"card-${item.id}\"\n .selected=${selected}\n key=${index}\n >\n <img\n alt=\"\"\n slot=\"preview\"\n src=\"https://picsum.photos/id/${item.id}/200/300\"\n decoding=\"async\"\n />\n <div slot=\"description\">10/15/18</div>\n <div slot=\"footer\">Footer</div>\n </sp-card>\n `;\n };\n const handleChange = (event: Event & { currentTarget: Grid }): void => {\n const actionbar = document.querySelector('sp-action-bar') as ActionBar;\n const selected = document.querySelector('.selected') as HTMLElement;\n const ids = document.querySelector('.ids') as HTMLElement;\n actionbar.open = !!event.currentTarget.selected.length;\n actionbar.style.setProperty(\n 'display',\n !!event.currentTarget.selected.length ? 'flex' : 'none'\n );\n selected.textContent = '' + event.currentTarget.selected.length;\n ids.textContent =\n '' +\n event.currentTarget.selected\n .map((selection) => selection.id)\n .join(', ');\n };\n const handleActionBarChange = (event: Event): void => {\n event.preventDefault();\n const grid = document.querySelector('sp-grid') as Grid;\n const actionbar = document.querySelector('sp-action-bar') as ActionBar;\n actionbar.open = false;\n grid.selected = [];\n };\n return html`\n <h1>Random before content that is focusable</h1>\n <input id=\"first-input\" />\n <sp-grid\n @change=${handleChange}\n .items=${items}\n .focusableSelector=${'sp-card'}\n .renderItem=${renderItem}\n ></sp-grid>\n <sp-action-bar variant=\"fixed\" style=\"display: none\">\n <sp-checkbox @click=${handleActionBarChange} checked>\n <span class=\"selected\"></span>\n Selected\n <span class=\"ids\"></span>\n </sp-checkbox>\n <sp-action-group quiet>\n <sp-action-button>\n <sp-icon-edit slot=\"icon\" label=\"Edit\"></sp-icon-edit>\n </sp-action-button>\n <sp-action-button>\n <sp-icon-more slot=\"icon\" label=\"More\"></sp-icon-more>\n </sp-action-button>\n </sp-action-group>\n </sp-action-bar>\n <h2>Random after content that is focusable</h2>\n <input id=\"last-input\" />\n `;\n};\n\nexport const sized = (): TemplateResult => {\n const items = generateItems(1000);\n\n const renderItem = (\n item: Item,\n index: number,\n selected: boolean\n ): TemplateResult => {\n return html`\n <sp-card\n toggles\n variant=\"quiet\"\n heading=\"Card Heading ${item.id}\"\n subheading=\"JPG Photo\"\n style=\"contain: strict; padding: 1px;\"\n value=\"card-${item.id}\"\n .selected=${selected}\n key=${index}\n >\n <img\n alt=\"\"\n slot=\"preview\"\n src=\"https://picsum.photos/id/${item.id}/200/300\"\n decoding=\"async\"\n />\n <div slot=\"description\">10/15/18</div>\n <div slot=\"footer\">Footer</div>\n </sp-card>\n `;\n };\n const handleChange = (event: Event & { currentTarget: Grid }): void => {\n const actionbar = document.querySelector('sp-action-bar') as ActionBar;\n const selected = document.querySelector('.selected') as HTMLElement;\n const ids = document.querySelector('.ids') as HTMLElement;\n actionbar.open = !!event.currentTarget.selected.length;\n actionbar.style.setProperty(\n 'display',\n !!event.currentTarget.selected.length ? 'flex' : 'none'\n );\n selected.textContent = '' + event.currentTarget.selected.length;\n ids.textContent =\n '' +\n event.currentTarget.selected\n .map((selection) => selection.id)\n .join(', ');\n };\n const handleActionBarChange = (event: Event): void => {\n event.preventDefault();\n const grid = document.querySelector('sp-grid') as Grid;\n const actionbar = document.querySelector('sp-action-bar') as ActionBar;\n actionbar.open = false;\n grid.selected = [];\n };\n return html`\n <h1>Random before content that is focusable</h1>\n <input id=\"first-input\" />\n <sp-grid\n @change=${handleChange}\n .items=${items}\n .focusableSelector=${'sp-card'}\n .renderItem=${renderItem}\n .itemSize=${{\n width: 200,\n height: 300,\n }}\n .gap=${'10px'}\n ></sp-grid>\n <sp-action-bar variant=\"fixed\" style=\"display: none\">\n <sp-checkbox @click=${handleActionBarChange} checked>\n <span class=\"selected\"></span>\n Selected\n <span class=\"ids\"></span>\n </sp-checkbox>\n <sp-action-group quiet>\n <sp-action-button>\n <sp-icon-edit slot=\"icon\" label=\"Edit\"></sp-icon-edit>\n </sp-action-button>\n <sp-action-button>\n <sp-icon-more slot=\"icon\" label=\"More\"></sp-icon-more>\n </sp-action-button>\n </sp-action-group>\n </sp-action-bar>\n <h2>Random after content that is focusable</h2>\n <input id=\"last-input\" />\n `;\n};\n"],
5
- "mappings": "AAYA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA,eAAe;AAAA,EACX,OAAO;AAAA,EACP,WAAW;AACf;AAMA,uBAAuB,OAAuB;AAC1C,QAAM,QAAgB,CAAC;AACvB,SAAO,OAAO;AACV,aAAS;AACT,UAAM,QAAQ,EAAE,I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C,EAAM,SAAS,cAAc,MAAM,EACzC,EAAU,KAAO,CAAC,CAAC,EAAM,cAAc,SAAS,OAChD,EAAU,MAAM,YACZ,UACA,AAAE,EAAM,cAAc,SAAS,OAAS,OAAS,MACrD,EACA,EAAS,YAAc,GAAK,EAAM,cAAc,SAAS,OACzD,EAAI,YACA,GACA,EAAM,cAAc,SACf,IAAI,AAAC,GAAc,EAAU,EAAE,EAC/B,KAAK,IAAI,CACtB;AAAA,qBAaiB;AAAA,iCACY;AAAA,0BAxDV,CACf,EACA,EACA,IAEO;AAAA;AAAA;AAAA;AAAA,wCAIyB,EAAK;AAAA;AAAA;AAAA,8BAGf,EAAK;AAAA,4BACP;AAAA,sBACN;AAAA;AAAA;AAAA;AAAA;AAAA,oDAK8B,EAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAuCjC,CACR,MAAO,IACP,OAAQ,GACZ;AAAA,mBACO;AAAA;AAAA;AAAA,kCAnBe,AAAC,GAAuB,CAClD,EAAM,eAAe,EACrB,KAAM,GAAO,SAAS,cAAc,SAAS,EACvC,EAAY,SAAS,cAAc,eAAe,EACxD,EAAU,KAAO,GACjB,EAAK,SAAW,CAAC,CACrB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAiCJ",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,4 @@
1
- import "@spectrum-web-components/grid/sp-grid.js";
2
- import { html } from "@spectrum-web-components/base";
3
- import { measureFixtureCreation } from "../../../../test/benchmark/helpers.js";
4
- measureFixtureCreation(html`
1
+ import"@spectrum-web-components/grid/sp-grid.js";import{html as r}from"@spectrum-web-components/base";import{measureFixtureCreation as i}from"../../../../test/benchmark/helpers.js";i(r`
5
2
  <sp-grid></sp-grid>
6
3
  `);
7
4
  //# sourceMappingURL=basic-test.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["basic-test.ts"],
4
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 '@spectrum-web-components/grid/sp-grid.js';\nimport { html } from '@spectrum-web-components/base';\nimport { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';\n\nmeasureFixtureCreation(html`\n <sp-grid></sp-grid>\n`);\n"],
5
- "mappings": "AAYA;AACA;AACA;AAEA,uBAAuB;AAAA;AAAA,CAEtB;",
5
+ "mappings": "AAYA,iDACA,qDACA,+EAEA,EAAuB;AAAA;AAAA,CAEtB",
6
6
  "names": []
7
7
  }
package/test/grid.test.js CHANGED
@@ -1,176 +1,16 @@
1
- import { elementUpdated, expect, fixture, nextFrame } from "@open-wc/testing";
2
- import { html } from "@spectrum-web-components/base";
3
- import "@spectrum-web-components/grid/sp-grid.js";
4
- import { Default } from "../stories/grid.stories.js";
5
- import { sendKeys } from "@web/test-runner-commands";
6
- import { testForLitDevWarnings } from "../../../test/testing-helpers.js";
7
- describe("Grid", () => {
8
- testForLitDevWarnings(async () => await fixture(html`
9
- <div>${Default()}</div>
10
- `));
11
- it("loads default grid accessibly", async () => {
12
- const test = await fixture(html`
13
- <div>${Default()}</div>
14
- `);
15
- const el = test.querySelector("sp-grid");
16
- await elementUpdated(el);
17
- await expect(el).to.be.accessible();
18
- });
19
- it("accepts focus", async () => {
20
- const test = await fixture(html`
21
- <div>${Default()}</div>
22
- `);
23
- const el = test.querySelector("sp-grid");
24
- await elementUpdated(el);
25
- expect(el.tabIndex).to.equal(0);
26
- el.focus();
27
- await nextFrame();
28
- await nextFrame();
29
- expect(el.querySelector(el.focusableSelector) === document.activeElement).to.be.true;
30
- });
31
- it("allows to tab in and out", async () => {
32
- const test = await fixture(html`
33
- <div>${Default()}</div>
34
- `);
35
- const el = test.querySelector("sp-grid");
36
- const firstInput = test.querySelector("#first-input");
37
- const lastInput = test.querySelector("#last-input");
38
- await elementUpdated(el);
39
- expect(el.tabIndex).to.equal(0);
40
- firstInput.focus();
41
- expect(firstInput === document.activeElement).to.be.true;
42
- expect(el.tabIndex).to.equal(0);
43
- await sendKeys({
44
- press: "Tab"
45
- });
46
- await nextFrame();
47
- await nextFrame();
48
- expect(el.querySelector(el.focusableSelector) === document.activeElement).to.be.true;
49
- expect(el.tabIndex).to.equal(-1);
50
- await sendKeys({
51
- press: "Tab"
52
- });
53
- await nextFrame();
54
- await nextFrame();
55
- await elementUpdated(el);
56
- expect(lastInput === document.activeElement).to.be.true;
57
- expect(el.tabIndex).to.equal(0);
58
- await sendKeys({
59
- press: "Shift+Tab"
60
- });
61
- await nextFrame();
62
- await nextFrame();
63
- await nextFrame();
64
- await nextFrame();
65
- expect(el.querySelector(el.focusableSelector) === document.activeElement).to.be.true;
66
- expect(el.tabIndex).to.equal(-1);
67
- });
68
- it("manages roving tabindex", async () => {
69
- const test = await fixture(html`
70
- <div>${Default()}</div>
71
- `);
72
- const el = test.querySelector("sp-grid");
73
- await elementUpdated(el);
74
- expect(el.tabIndex).to.equal(0);
75
- el.focus();
76
- await nextFrame();
77
- await nextFrame();
78
- let focused = el.querySelector(el.focusableSelector);
79
- await elementUpdated(focused);
80
- expect(focused === document.activeElement).to.be.true;
81
- expect(focused.focused).to.be.true;
82
- await sendKeys({
83
- press: "ArrowRight"
84
- });
85
- focused = el.querySelector(`${el.focusableSelector}:nth-child(2)`);
86
- await elementUpdated(focused);
87
- expect(focused === document.activeElement).to.be.true;
88
- expect(focused.focused).to.be.true;
89
- await sendKeys({
90
- press: "ArrowDown"
91
- });
92
- focused = el.querySelector(`${el.focusableSelector}:nth-child(5)`);
93
- await elementUpdated(focused);
94
- expect(focused === document.activeElement).to.be.true;
95
- expect(focused.focused).to.be.true;
96
- await sendKeys({
97
- press: "ArrowLeft"
98
- });
99
- focused = el.querySelector(`${el.focusableSelector}:nth-child(4)`);
100
- await elementUpdated(focused);
101
- expect(focused === document.activeElement).to.be.true;
102
- expect(focused.focused).to.be.true;
103
- await sendKeys({
104
- press: "ArrowUp"
105
- });
106
- focused = el.querySelector(`${el.focusableSelector}`);
107
- await elementUpdated(focused);
108
- expect(focused === document.activeElement).to.be.true;
109
- expect(focused.focused).to.be.true;
110
- });
111
- it("manages selection", async () => {
112
- const test = await fixture(html`
113
- <div>${Default()}</div>
114
- `);
115
- const el = test.querySelector("sp-grid");
116
- await elementUpdated(el);
117
- expect(el.tabIndex).to.equal(0);
118
- el.focus();
119
- await nextFrame();
120
- await nextFrame();
121
- let focused = el.querySelector(el.focusableSelector);
122
- await elementUpdated(focused);
123
- expect(focused === document.activeElement).to.be.true;
124
- expect(focused.focused).to.be.true;
125
- await sendKeys({
126
- press: "ArrowRight"
127
- });
128
- focused = el.querySelector(`${el.focusableSelector}:nth-child(2)`);
129
- await elementUpdated(focused);
130
- expect(focused === document.activeElement).to.be.true;
131
- expect(focused.focused).to.be.true;
132
- await sendKeys({
133
- press: "Space"
134
- });
135
- await elementUpdated(el);
136
- expect(el.selected).to.deep.equal([{ id: 1 }]);
137
- await sendKeys({
138
- press: "ArrowDown"
139
- });
140
- focused = el.querySelector(`${el.focusableSelector}:nth-child(5)`);
141
- await elementUpdated(focused);
142
- expect(focused === document.activeElement).to.be.true;
143
- expect(focused.focused).to.be.true;
144
- await sendKeys({
145
- press: "Space"
146
- });
147
- await elementUpdated(el);
148
- expect(el.selected).to.deep.equal([{ id: 1 }, { id: 4 }]);
149
- await sendKeys({
150
- press: "ArrowUp"
151
- });
152
- focused = el.querySelector(`${el.focusableSelector}:nth-child(2)`);
153
- await elementUpdated(focused);
154
- expect(focused === document.activeElement).to.be.true;
155
- expect(focused.focused).to.be.true;
156
- await sendKeys({
157
- press: "Space"
158
- });
159
- await elementUpdated(el);
160
- expect(el.selected).to.deep.equal([{ id: 4 }]);
161
- });
162
- it("does not claim lit-virtualizer on the global registry", async () => {
163
- const test = await fixture(html`
164
- <div>${Default()}</div>
165
- `);
166
- const el = test.querySelector("sp-grid");
167
- await elementUpdated(el);
168
- customElements.define("lit-virtualizer", class extends HTMLElement {
169
- });
170
- expect(() => {
171
- customElements.define("lit-virtualizer", class extends HTMLElement {
172
- });
173
- }).to.throw();
174
- });
175
- });
1
+ import{elementUpdated as o,expect as a,fixture as c,nextFrame as r}from"@open-wc/testing";import{html as l}from"@spectrum-web-components/base";import"@spectrum-web-components/grid/sp-grid.js";import{Default as u}from"../stories/grid.stories.js";import{sendKeys as i}from"@web/test-runner-commands";import{testForLitDevWarnings as n}from"../../../test/testing-helpers.js";describe("Grid",()=>{n(async()=>await c(l`
2
+ <div>${u()}</div>
3
+ `)),it("loads default grid accessibly",async()=>{const e=(await c(l`
4
+ <div>${u()}</div>
5
+ `)).querySelector("sp-grid");await o(e),await a(e).to.be.accessible()}),it("accepts focus",async()=>{const e=(await c(l`
6
+ <div>${u()}</div>
7
+ `)).querySelector("sp-grid");await o(e),a(e.tabIndex).to.equal(0),e.focus(),await r(),await r(),a(e.querySelector(e.focusableSelector)===document.activeElement).to.be.true}),it("allows to tab in and out",async()=>{const s=await c(l`
8
+ <div>${u()}</div>
9
+ `),e=s.querySelector("sp-grid"),t=s.querySelector("#first-input"),d=s.querySelector("#last-input");await o(e),a(e.tabIndex).to.equal(0),t.focus(),a(t===document.activeElement).to.be.true,a(e.tabIndex).to.equal(0),await i({press:"Tab"}),await r(),await r(),a(e.querySelector(e.focusableSelector)===document.activeElement).to.be.true,a(e.tabIndex).to.equal(-1),await i({press:"Tab"}),await r(),await r(),await o(e),a(d===document.activeElement).to.be.true,a(e.tabIndex).to.equal(0),await i({press:"Shift+Tab"}),await r(),await r(),await r(),await r(),a(e.querySelector(e.focusableSelector)===document.activeElement).to.be.true,a(e.tabIndex).to.equal(-1)}),it("manages roving tabindex",async()=>{const e=(await c(l`
10
+ <div>${u()}</div>
11
+ `)).querySelector("sp-grid");await o(e),a(e.tabIndex).to.equal(0),e.focus(),await r(),await r();let t=e.querySelector(e.focusableSelector);await o(t),a(t===document.activeElement).to.be.true,a(t.focused).to.be.true,await i({press:"ArrowRight"}),t=e.querySelector(`${e.focusableSelector}:nth-child(2)`),await o(t),a(t===document.activeElement).to.be.true,a(t.focused).to.be.true,await i({press:"ArrowDown"}),t=e.querySelector(`${e.focusableSelector}:nth-child(5)`),await o(t),a(t===document.activeElement).to.be.true,a(t.focused).to.be.true,await i({press:"ArrowLeft"}),t=e.querySelector(`${e.focusableSelector}:nth-child(4)`),await o(t),a(t===document.activeElement).to.be.true,a(t.focused).to.be.true,await i({press:"ArrowUp"}),t=e.querySelector(`${e.focusableSelector}`),await o(t),a(t===document.activeElement).to.be.true,a(t.focused).to.be.true}),it("manages selection",async()=>{const e=(await c(l`
12
+ <div>${u()}</div>
13
+ `)).querySelector("sp-grid");await o(e),a(e.tabIndex).to.equal(0),e.focus(),await r(),await r();let t=e.querySelector(e.focusableSelector);await o(t),a(t===document.activeElement).to.be.true,a(t.focused).to.be.true,await i({press:"ArrowRight"}),t=e.querySelector(`${e.focusableSelector}:nth-child(2)`),await o(t),a(t===document.activeElement).to.be.true,a(t.focused).to.be.true,await i({press:"Space"}),await o(e),a(e.selected).to.deep.equal([{id:1}]),await i({press:"ArrowDown"}),t=e.querySelector(`${e.focusableSelector}:nth-child(5)`),await o(t),a(t===document.activeElement).to.be.true,a(t.focused).to.be.true,await i({press:"Space"}),await o(e),a(e.selected).to.deep.equal([{id:1},{id:4}]),await i({press:"ArrowUp"}),t=e.querySelector(`${e.focusableSelector}:nth-child(2)`),await o(t),a(t===document.activeElement).to.be.true,a(t.focused).to.be.true,await i({press:"Space"}),await o(e),a(e.selected).to.deep.equal([{id:4}])}),it("does not claim lit-virtualizer on the global registry",async()=>{const e=(await c(l`
14
+ <div>${u()}</div>
15
+ `)).querySelector("sp-grid");await o(e),customElements.define("lit-virtualizer",class extends HTMLElement{}),a(()=>{customElements.define("lit-virtualizer",class extends HTMLElement{})}).to.throw()})});
176
16
  //# sourceMappingURL=grid.test.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["grid.test.ts"],
4
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 { elementUpdated, expect, fixture, nextFrame } from '@open-wc/testing';\nimport { html } from '@spectrum-web-components/base';\nimport { Card } from '@spectrum-web-components/card';\n\nimport '@spectrum-web-components/grid/sp-grid.js';\nimport { Grid } from '@spectrum-web-components/grid';\nimport { Default } from '../stories/grid.stories.js';\nimport { sendKeys } from '@web/test-runner-commands';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers.js';\n\ndescribe('Grid', () => {\n testForLitDevWarnings(\n async () =>\n await fixture<HTMLDivElement>(\n html`\n <div>${Default()}</div>\n `\n )\n );\n it('loads default grid accessibly', async () => {\n const test = await fixture<HTMLDivElement>(\n html`\n <div>${Default()}</div>\n `\n );\n const el = test.querySelector('sp-grid') as Grid;\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('accepts focus', async () => {\n const test = await fixture<HTMLDivElement>(\n html`\n <div>${Default()}</div>\n `\n );\n const el = test.querySelector('sp-grid') as Grid;\n\n await elementUpdated(el);\n\n expect(el.tabIndex).to.equal(0);\n\n el.focus();\n\n await nextFrame();\n await nextFrame();\n\n expect(\n el.querySelector(el.focusableSelector) === document.activeElement\n ).to.be.true;\n });\n it('allows to tab in and out', async () => {\n const test = await fixture<HTMLDivElement>(\n html`\n <div>${Default()}</div>\n `\n );\n const el = test.querySelector('sp-grid') as Grid;\n const firstInput = test.querySelector('#first-input') as HTMLElement;\n const lastInput = test.querySelector('#last-input') as HTMLElement;\n\n await elementUpdated(el);\n\n expect(el.tabIndex).to.equal(0);\n\n firstInput.focus();\n expect(firstInput === document.activeElement).to.be.true;\n expect(el.tabIndex).to.equal(0);\n\n await sendKeys({\n press: 'Tab',\n });\n\n await nextFrame();\n await nextFrame();\n\n expect(\n el.querySelector(el.focusableSelector) === document.activeElement\n ).to.be.true;\n expect(el.tabIndex).to.equal(-1);\n\n await sendKeys({\n press: 'Tab',\n });\n\n await nextFrame();\n await nextFrame();\n\n await elementUpdated(el);\n expect(lastInput === document.activeElement).to.be.true;\n expect(el.tabIndex).to.equal(0);\n\n await sendKeys({\n press: 'Shift+Tab',\n });\n\n await nextFrame();\n await nextFrame();\n await nextFrame();\n await nextFrame();\n\n expect(\n el.querySelector(el.focusableSelector) === document.activeElement\n ).to.be.true;\n expect(el.tabIndex).to.equal(-1);\n });\n it('manages roving tabindex', async () => {\n const test = await fixture<HTMLDivElement>(\n html`\n <div>${Default()}</div>\n `\n );\n const el = test.querySelector('sp-grid') as Grid;\n\n await elementUpdated(el);\n\n expect(el.tabIndex).to.equal(0);\n\n el.focus();\n\n await nextFrame();\n await nextFrame();\n\n let focused = el.querySelector(el.focusableSelector) as Card;\n await elementUpdated(focused);\n expect(focused === document.activeElement).to.be.true;\n expect(focused.focused).to.be.true;\n\n await sendKeys({\n press: 'ArrowRight',\n });\n\n focused = el.querySelector(\n `${el.focusableSelector}:nth-child(2)`\n ) as Card;\n await elementUpdated(focused);\n expect(focused === document.activeElement).to.be.true;\n expect(focused.focused).to.be.true;\n\n await sendKeys({\n press: 'ArrowDown',\n });\n\n focused = el.querySelector(\n `${el.focusableSelector}:nth-child(5)`\n ) as Card;\n await elementUpdated(focused);\n expect(focused === document.activeElement).to.be.true;\n expect(focused.focused).to.be.true;\n\n await sendKeys({\n press: 'ArrowLeft',\n });\n\n focused = el.querySelector(\n `${el.focusableSelector}:nth-child(4)`\n ) as Card;\n await elementUpdated(focused);\n expect(focused === document.activeElement).to.be.true;\n expect(focused.focused).to.be.true;\n\n await sendKeys({\n press: 'ArrowUp',\n });\n\n focused = el.querySelector(`${el.focusableSelector}`) as Card;\n await elementUpdated(focused);\n expect(focused === document.activeElement).to.be.true;\n expect(focused.focused).to.be.true;\n });\n it('manages selection', async () => {\n const test = await fixture<HTMLDivElement>(\n html`\n <div>${Default()}</div>\n `\n );\n const el = test.querySelector('sp-grid') as Grid;\n\n await elementUpdated(el);\n\n expect(el.tabIndex).to.equal(0);\n\n el.focus();\n\n await nextFrame();\n await nextFrame();\n\n let focused = el.querySelector(el.focusableSelector) as Card;\n await elementUpdated(focused);\n expect(focused === document.activeElement).to.be.true;\n expect(focused.focused).to.be.true;\n\n await sendKeys({\n press: 'ArrowRight',\n });\n\n focused = el.querySelector(\n `${el.focusableSelector}:nth-child(2)`\n ) as Card;\n await elementUpdated(focused);\n expect(focused === document.activeElement).to.be.true;\n expect(focused.focused).to.be.true;\n\n await sendKeys({\n press: 'Space',\n });\n\n await elementUpdated(el);\n\n expect(el.selected).to.deep.equal([{ id: 1 }]);\n\n await sendKeys({\n press: 'ArrowDown',\n });\n\n focused = el.querySelector(\n `${el.focusableSelector}:nth-child(5)`\n ) as Card;\n await elementUpdated(focused);\n expect(focused === document.activeElement).to.be.true;\n expect(focused.focused).to.be.true;\n\n await sendKeys({\n press: 'Space',\n });\n\n await elementUpdated(el);\n\n expect(el.selected).to.deep.equal([{ id: 1 }, { id: 4 }]);\n\n await sendKeys({\n press: 'ArrowUp',\n });\n\n focused = el.querySelector(\n `${el.focusableSelector}:nth-child(2)`\n ) as Card;\n await elementUpdated(focused);\n expect(focused === document.activeElement).to.be.true;\n expect(focused.focused).to.be.true;\n\n await sendKeys({\n press: 'Space',\n });\n\n await elementUpdated(el);\n\n expect(el.selected).to.deep.equal([{ id: 4 }]);\n });\n it('does not claim lit-virtualizer on the global registry', async () => {\n const test = await fixture<HTMLDivElement>(\n html`\n <div>${Default()}</div>\n `\n );\n const el = test.querySelector('sp-grid') as Grid;\n\n await elementUpdated(el);\n\n customElements.define('lit-virtualizer', class extends HTMLElement {});\n\n // make sure we also don't prevent *any* registration of lit-virtualizer\n expect(() => {\n customElements.define(\n 'lit-virtualizer',\n class extends HTMLElement {}\n );\n }).to.throw();\n });\n});\n"],
5
- "mappings": "AAYA;AACA;AAGA;AAEA;AACA;AACA;AAEA,SAAS,QAAQ,MAAM;AACnB,wBACI,YACI,MAAM,QACF;AAAA,2BACW,QAAQ;AAAA,iBAEvB,CACR;AACA,KAAG,iCAAiC,YAAY;AAC5C,UAAM,OAAO,MAAM,QACf;AAAA,uBACW,QAAQ;AAAA,aAEvB;AACA,UAAM,KAAK,KAAK,cAAc,SAAS;AAEvC,UAAM,eAAe,EAAE;AAEvB,UAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WAAW;AAAA,EACtC,CAAC;AACD,KAAG,iBAAiB,YAAY;AAC5B,UAAM,OAAO,MAAM,QACf;AAAA,uBACW,QAAQ;AAAA,aAEvB;AACA,UAAM,KAAK,KAAK,cAAc,SAAS;AAEvC,UAAM,eAAe,EAAE;AAEvB,WAAO,GAAG,QAAQ,EAAE,GAAG,MAAM,CAAC;AAE9B,OAAG,MAAM;AAET,UAAM,UAAU;AAChB,UAAM,UAAU;AAEhB,WACI,GAAG,cAAc,GAAG,iBAAiB,MAAM,SAAS,aACxD,EAAE,GAAG,GAAG;AAAA,EACZ,CAAC;AACD,KAAG,4BAA4B,YAAY;AACvC,UAAM,OAAO,MAAM,QACf;AAAA,uBACW,QAAQ;AAAA,aAEvB;AACA,UAAM,KAAK,KAAK,cAAc,SAAS;AACvC,UAAM,aAAa,KAAK,cAAc,cAAc;AACpD,UAAM,YAAY,KAAK,cAAc,aAAa;AAElD,UAAM,eAAe,EAAE;AAEvB,WAAO,GA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