@spectrum-web-components/grid 0.47.1 → 0.48.0-beta.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.47.1",
3
+ "version": "0.48.0-beta.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -64,8 +64,8 @@
64
64
  "dependencies": {
65
65
  "@lit-labs/observers": "^2.0.2",
66
66
  "@lit-labs/virtualizer": "^2.0.12",
67
- "@spectrum-web-components/base": "^0.47.1",
68
- "@spectrum-web-components/reactive-controllers": "^0.47.1",
67
+ "@spectrum-web-components/base": "^0.48.0-beta.0",
68
+ "@spectrum-web-components/reactive-controllers": "^0.48.0-beta.0",
69
69
  "lit": "^2.5.0 || ^3.1.3"
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": "151a3e21c39150dbc3f3a884b660be0bd352bda1"
77
+ "gitHead": "9a1377f0402a17b732b96e17ad06b800df6ab52e"
78
78
  }
package/test/grid.test.js CHANGED
@@ -30,7 +30,8 @@ describe("Grid", () => {
30
30
  const el = test.querySelector("sp-grid");
31
31
  await elementUpdated(el);
32
32
  expect(el.tabIndex).to.equal(0);
33
- el.focus();
33
+ await sendKeys({ press: "Tab" });
34
+ await sendKeys({ press: "Tab" });
34
35
  await nextFrame();
35
36
  await nextFrame();
36
37
  if (!isWebKit()) {
@@ -50,7 +51,8 @@ describe("Grid", () => {
50
51
  const el = test.querySelector("sp-grid");
51
52
  await elementUpdated(el);
52
53
  expect(el.tabIndex).to.equal(0);
53
- el.focus();
54
+ await sendKeys({ press: "Tab" });
55
+ await sendKeys({ press: "Tab" });
54
56
  await nextFrame();
55
57
  await nextFrame();
56
58
  const firstItem = el.querySelector(el.focusableSelector);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["grid.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 { 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/theme/sp-theme.js';\nimport '@spectrum-web-components/theme/scale-medium.js';\nimport '@spectrum-web-components/theme/theme-light.js';\nimport '@spectrum-web-components/grid/sp-grid.js';\nimport { Grid } from '@spectrum-web-components/grid';\nimport { Default } from '../stories/grid.stories.js';\nimport { sendKeys, sendMouse } from '@web/test-runner-commands';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers.js';\nimport { isWebKit } from '@spectrum-web-components/shared';\n\ndescribe('Grid', () => {\n testForLitDevWarnings(\n async () =>\n await fixture<HTMLDivElement>(html`\n <div>${Default()}</div>\n `)\n );\n it('loads default grid accessibly', async () => {\n const test = await fixture<HTMLDivElement>(html`\n <div>${Default()}</div>\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>(html`\n <div>${Default()}</div>\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 if (!isWebKit()) {\n sendMouse({\n type: 'click',\n position: [0, 0],\n });\n }\n\n expect(\n el.querySelector(el.focusableSelector) === document.activeElement\n ).to.be.true;\n });\n it('does not focus when clicking grid', async () => {\n const test = await fixture<HTMLDivElement>(html`\n <sp-theme color=\"light\" scale=\"medium\">${Default()}</sp-theme>\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 const firstItem = el.querySelector(el.focusableSelector) as HTMLElement;\n\n expect(firstItem === document.activeElement).to.be.true;\n\n const firstRect = firstItem?.getBoundingClientRect();\n const position = [\n Math.round(firstRect.x + firstRect.width + 2),\n Math.round(firstRect.y + 2),\n ] as [number, number];\n await sendMouse({\n type: 'click',\n position,\n });\n\n await nextFrame();\n await nextFrame();\n\n expect(\n el.querySelector(el.focusableSelector) === document.activeElement\n ).to.be.false;\n });\n it('allows to tab in and out', async () => {\n const test = await fixture<HTMLDivElement>(html`\n <div>${Default()}</div>\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>(html`\n <div>${Default()}</div>\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>(html`\n <div>${Default()}</div>\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>(html`\n <div>${Default()}</div>\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,SAAS,gBAAgB,QAAQ,SAAS,iBAAiB;AAC3D,SAAS,YAAY;AAGrB,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AAEP,SAAS,eAAe;AACxB,SAAS,UAAU,iBAAiB;AACpC,SAAS,6BAA6B;AACtC,SAAS,gBAAgB;AAEzB,SAAS,QAAQ,MAAM;AACnB;AAAA,IACI,YACI,MAAM,QAAwB;AAAA,uBACnB,QAAQ,CAAC;AAAA,aACnB;AAAA,EACT;AACA,KAAG,iCAAiC,YAAY;AAC5C,UAAM,OAAO,MAAM,QAAwB;AAAA,mBAChC,QAAQ,CAAC;AAAA,SACnB;AACD,UAAM,KAAK,KAAK,cAAc,SA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AAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;AAExD,UAAM,SAAS;AAAA,MACX,OAAO;AAAA,IACX,CAAC;AAED,cAAU,GAAG;AAAA,MACT,GAAG,GAAG,iBAAiB;AAAA,IAC3B;AACA,UAAM,eAAe,OAAO;AAC5B,WAAO,YAAY,SAAS,aAAa,EAAE,GAAG,GAAG;AACjD,WAAO,QAAQ,OAAO,EAAE,GAAG,GAAG;AAE9B,UAAM,SAAS;AAAA,MACX,OAAO;AAAA,IACX,CAAC;AAED,UAAM,eAAe,EAAE;AAEvB,WAAO,GAAG,QAAQ,EAAE,GAAG,KAAK,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;AAAA,EACjD,CAAC;AACD,KAAG,yDAAyD,YAAY;AACpE,UAAM,OAAO,MAAM,QAAwB;AAAA,mBAChC,QAAQ,CAAC;AAAA,SACnB;AACD,UAAM,KAAK,KAAK,cAAc,SAAS;AAEvC,UAAM,eAAe,EAAE;AAEvB,mBAAe,OAAO,mBAAmB,cAAc,YAAY;AAAA,IAAC,CAAC;AAGrE,WAAO,MAAM;AACT,qBAAe;AAAA,QACX;AAAA,QACA,cAAc,YAAY;AAAA,QAAC;AAAA,MAC/B;AAAA,IACJ,CAAC,EAAE,GAAG,MAAM;AAAA,EAChB,CAAC;AACL,CAAC;",
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/theme/sp-theme.js';\nimport '@spectrum-web-components/theme/scale-medium.js';\nimport '@spectrum-web-components/theme/theme-light.js';\nimport '@spectrum-web-components/grid/sp-grid.js';\nimport { Grid } from '@spectrum-web-components/grid';\nimport { Default } from '../stories/grid.stories.js';\nimport { sendKeys, sendMouse } from '@web/test-runner-commands';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers.js';\nimport { isWebKit } from '@spectrum-web-components/shared';\n\ndescribe('Grid', () => {\n testForLitDevWarnings(\n async () =>\n await fixture<HTMLDivElement>(html`\n <div>${Default()}</div>\n `)\n );\n it('loads default grid accessibly', async () => {\n const test = await fixture<HTMLDivElement>(html`\n <div>${Default()}</div>\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>(html`\n <div>${Default()}</div>\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 await sendKeys({ press: 'Tab' });\n await sendKeys({ press: 'Tab' });\n\n await nextFrame();\n await nextFrame();\n\n if (!isWebKit()) {\n sendMouse({\n type: 'click',\n position: [0, 0],\n });\n }\n\n expect(\n el.querySelector(el.focusableSelector) === document.activeElement\n ).to.be.true;\n });\n it('does not focus when clicking grid', async () => {\n const test = await fixture<HTMLDivElement>(html`\n <sp-theme color=\"light\" scale=\"medium\">${Default()}</sp-theme>\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 await sendKeys({ press: 'Tab' });\n await sendKeys({ press: 'Tab' });\n\n await nextFrame();\n await nextFrame();\n\n const firstItem = el.querySelector(el.focusableSelector) as HTMLElement;\n\n expect(firstItem === document.activeElement).to.be.true;\n\n const firstRect = firstItem?.getBoundingClientRect();\n const position = [\n Math.round(firstRect.x + firstRect.width + 2),\n Math.round(firstRect.y + 2),\n ] as [number, number];\n await sendMouse({\n type: 'click',\n position,\n });\n\n await nextFrame();\n await nextFrame();\n\n expect(\n el.querySelector(el.focusableSelector) === document.activeElement\n ).to.be.false;\n });\n it('allows to tab in and out', async () => {\n const test = await fixture<HTMLDivElement>(html`\n <div>${Default()}</div>\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>(html`\n <div>${Default()}</div>\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>(html`\n <div>${Default()}</div>\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>(html`\n <div>${Default()}</div>\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,SAAS,gBAAgB,QAAQ,SAAS,iBAAiB;AAC3D,SAAS,YAAY;AAGrB,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AAEP,SAAS,eAAe;AACxB,SAAS,UAAU,iBAAiB;AACpC,SAAS,6BAA6B;AACtC,SAAS,gBAAgB;AAEzB,SAAS,QAAQ,MAAM;AACnB;AAAA,IACI,YACI,MAAM,QAAwB;AAAA,uBACnB,QAAQ,CAAC;AAAA,aACnB;AAAA,EACT;AACA,KAAG,iCAAiC,YAAY;AAC5C,UAAM,OAAO,MAAM,QAAwB;AAAA,mBAChC,QAAQ,CAAC;AAAA,SACnB;AACD,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,QAAwB;AAAA,mBAChC,QAAQ,CAAC;AAAA,SACnB;AACD,UAAM,KAAK,KAAK,cAAc,SAAS;AAEvC,UAAM,eAAe,EAAE;AAEvB,WAAO,GAAG,QAAQ,EAAE,GAAG,MAAM,CAAC;AAE9B,UAAM,SAAS,EAAE,OAAO,MAAM,CAAC;AAC/B,UAAM,SAAS,EAAE,OAAO,MAA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D,WAAO,QAAQ,OAAO,EAAE,GAAG,GAAG;AAE9B,UAAM,SAAS;AAAA,MACX,OAAO;AAAA,IACX,CAAC;AAED,UAAM,eAAe,EAAE;AAEvB,WAAO,GAAG,QAAQ,EAAE,GAAG,KAAK,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;AAAA,EACjD,CAAC;AACD,KAAG,yDAAyD,YAAY;AACpE,UAAM,OAAO,MAAM,QAAwB;AAAA,mBAChC,QAAQ,CAAC;AAAA,SACnB;AACD,UAAM,KAAK,KAAK,cAAc,SAAS;AAEvC,UAAM,eAAe,EAAE;AAEvB,mBAAe,OAAO,mBAAmB,cAAc,YAAY;AAAA,IAAC,CAAC;AAGrE,WAAO,MAAM;AACT,qBAAe;AAAA,QACX;AAAA,QACA,cAAc,YAAY;AAAA,QAAC;AAAA,MAC/B;AAAA,IACJ,CAAC,EAAE,GAAG,MAAM;AAAA,EAChB,CAAC;AACL,CAAC;",
6
6
  "names": []
7
7
  }
@@ -1,420 +0,0 @@
1
- {
2
- "schemaVersion": "1.0.0",
3
- "readme": "",
4
- "modules": [
5
- {
6
- "kind": "javascript-module",
7
- "path": "sp-grid.js",
8
- "declarations": [],
9
- "exports": [
10
- {
11
- "kind": "custom-element-definition",
12
- "name": "sp-grid",
13
- "declaration": {
14
- "name": "Grid",
15
- "module": "/src/Grid.js"
16
- }
17
- }
18
- ]
19
- },
20
- {
21
- "kind": "javascript-module",
22
- "path": "src/Grid.js",
23
- "declarations": [
24
- {
25
- "kind": "class",
26
- "description": "",
27
- "name": "Grid",
28
- "members": [
29
- {
30
- "kind": "field",
31
- "name": "__gridPart",
32
- "type": {
33
- "text": "RootPart | undefined"
34
- },
35
- "privacy": "private",
36
- "default": "undefined"
37
- },
38
- {
39
- "kind": "field",
40
- "name": "focusableSelector",
41
- "type": {
42
- "text": "string"
43
- },
44
- "privacy": "public",
45
- "attribute": "focusableSelector"
46
- },
47
- {
48
- "kind": "field",
49
- "name": "gap",
50
- "type": {
51
- "text": "`${'0' | `${number}px`}`"
52
- },
53
- "privacy": "public",
54
- "default": "'0'",
55
- "attribute": "gap"
56
- },
57
- {
58
- "kind": "field",
59
- "name": "padding",
60
- "type": {
61
- "text": "`${'0' | `${number}px`}` | undefined"
62
- },
63
- "privacy": "public",
64
- "attribute": "padding"
65
- },
66
- {
67
- "kind": "field",
68
- "name": "items",
69
- "type": {
70
- "text": "Record<string, unknown>[]"
71
- },
72
- "privacy": "public",
73
- "default": "[]",
74
- "attribute": "items"
75
- },
76
- {
77
- "kind": "field",
78
- "name": "itemSize",
79
- "type": {
80
- "text": "{\n width: number;\n height: number;\n }"
81
- },
82
- "privacy": "public",
83
- "default": "{\n width: 200,\n height: 200,\n }",
84
- "attribute": "itemSize"
85
- },
86
- {
87
- "kind": "field",
88
- "name": "selected",
89
- "type": {
90
- "text": "Record<string, unknown>[]"
91
- },
92
- "privacy": "public",
93
- "default": "[]",
94
- "attribute": "selected"
95
- },
96
- {
97
- "kind": "field",
98
- "name": "gridController",
99
- "default": "new GridController<HTMLElement>(this, {\n elements: () => [],\n itemSize: () => this.itemSize,\n /* c8 ignore next 2 */\n gap: () => this.gap,\n padding: () => this.padding || this.gap,\n })"
100
- },
101
- {
102
- "kind": "method",
103
- "name": "handleChange",
104
- "privacy": "protected",
105
- "return": {
106
- "type": {
107
- "text": "void"
108
- }
109
- },
110
- "parameters": [
111
- {
112
- "name": "event",
113
- "type": {
114
- "text": "Event"
115
- }
116
- }
117
- ]
118
- }
119
- ],
120
- "events": [
121
- {
122
- "description": "Announces that the value of `selected` has changed",
123
- "name": "change"
124
- }
125
- ],
126
- "attributes": [
127
- {
128
- "name": "focusableSelector",
129
- "type": {
130
- "text": "string"
131
- },
132
- "fieldName": "focusableSelector"
133
- },
134
- {
135
- "name": "gap",
136
- "type": {
137
- "text": "`${'0' | `${number}px`}`"
138
- },
139
- "default": "'0'",
140
- "fieldName": "gap"
141
- },
142
- {
143
- "name": "padding",
144
- "type": {
145
- "text": "`${'0' | `${number}px`}` | undefined"
146
- },
147
- "fieldName": "padding"
148
- },
149
- {
150
- "name": "items",
151
- "type": {
152
- "text": "Record<string, unknown>[]"
153
- },
154
- "default": "[]",
155
- "fieldName": "items"
156
- },
157
- {
158
- "name": "itemSize",
159
- "type": {
160
- "text": "{\n width: number;\n height: number;\n }"
161
- },
162
- "default": "{\n width: 200,\n height: 200,\n }",
163
- "fieldName": "itemSize"
164
- },
165
- {
166
- "name": "selected",
167
- "type": {
168
- "text": "Record<string, unknown>[]"
169
- },
170
- "default": "[]",
171
- "fieldName": "selected"
172
- }
173
- ],
174
- "superclass": {
175
- "name": "LitVirtualizer",
176
- "package": "@lit-labs/virtualizer/LitVirtualizer.js"
177
- },
178
- "tagName": "sp-grid",
179
- "customElement": true
180
- }
181
- ],
182
- "exports": [
183
- {
184
- "kind": "js",
185
- "name": "Grid",
186
- "declaration": {
187
- "name": "Grid",
188
- "module": "src/Grid.js"
189
- }
190
- }
191
- ]
192
- },
193
- {
194
- "kind": "javascript-module",
195
- "path": "src/GridController.js",
196
- "declarations": [
197
- {
198
- "kind": "class",
199
- "description": "",
200
- "name": "GridController",
201
- "members": [
202
- {
203
- "kind": "field",
204
- "name": "host",
205
- "type": {
206
- "text": "Grid"
207
- },
208
- "default": "host"
209
- },
210
- {
211
- "kind": "field",
212
- "name": "resizeController",
213
- "type": {
214
- "text": "ResizeController"
215
- },
216
- "default": "new ResizeController(this.host, {\n callback: (entries: ResizeObserverEntry[]): void => {\n entries.forEach((entry) => {\n this.measureDirectionLength(entry.contentRect);\n });\n },\n })"
217
- },
218
- {
219
- "kind": "field",
220
- "name": "rovingTabindexController",
221
- "type": {
222
- "text": "RovingTabindexController<T>"
223
- },
224
- "default": "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 )"
225
- },
226
- {
227
- "kind": "field",
228
- "name": "itemSize",
229
- "type": {
230
- "text": "ItemSize"
231
- },
232
- "readonly": true
233
- },
234
- {
235
- "kind": "method",
236
- "name": "_itemSize",
237
- "privacy": "private",
238
- "return": {
239
- "type": {
240
- "text": "ItemSize"
241
- }
242
- }
243
- },
244
- {
245
- "kind": "field",
246
- "name": "_first",
247
- "type": {
248
- "text": "number"
249
- },
250
- "default": "0"
251
- },
252
- {
253
- "kind": "field",
254
- "name": "gap",
255
- "type": {
256
- "text": "string | undefined"
257
- },
258
- "readonly": true
259
- },
260
- {
261
- "kind": "method",
262
- "name": "_gap",
263
- "privacy": "private",
264
- "return": {
265
- "type": {
266
- "text": "string | undefined"
267
- }
268
- }
269
- },
270
- {
271
- "kind": "field",
272
- "name": "padding",
273
- "type": {
274
- "text": "string | undefined"
275
- },
276
- "readonly": true
277
- },
278
- {
279
- "kind": "method",
280
- "name": "_padding",
281
- "privacy": "private",
282
- "return": {
283
- "type": {
284
- "text": "string | undefined"
285
- }
286
- }
287
- },
288
- {
289
- "kind": "field",
290
- "name": "_last",
291
- "type": {
292
- "text": "number"
293
- },
294
- "default": "0"
295
- },
296
- {
297
- "kind": "method",
298
- "name": "focus",
299
- "privacy": "public",
300
- "return": {
301
- "type": {
302
- "text": "void"
303
- }
304
- },
305
- "parameters": [
306
- {
307
- "name": "options",
308
- "optional": true,
309
- "type": {
310
- "text": "FocusOptions"
311
- }
312
- }
313
- ]
314
- },
315
- {
316
- "kind": "method",
317
- "name": "applyLayout",
318
- "privacy": "protected",
319
- "return": {
320
- "type": {
321
- "text": "void"
322
- }
323
- },
324
- "parameters": [
325
- {
326
- "name": "itemSize",
327
- "type": {
328
- "text": "ItemSize | (() => ItemSize)"
329
- }
330
- },
331
- {
332
- "name": "gap",
333
- "optional": true,
334
- "type": {
335
- "text": "string | (() => string)"
336
- }
337
- },
338
- {
339
- "name": "padding",
340
- "optional": true,
341
- "type": {
342
- "text": "string | (() => string)"
343
- }
344
- }
345
- ]
346
- },
347
- {
348
- "kind": "method",
349
- "name": "measureDirectionLength",
350
- "privacy": "protected",
351
- "return": {
352
- "type": {
353
- "text": "void"
354
- }
355
- },
356
- "parameters": [
357
- {
358
- "name": "contentRect",
359
- "type": {
360
- "text": "DOMRect"
361
- }
362
- }
363
- ]
364
- },
365
- {
366
- "kind": "field",
367
- "name": "handleFocusin",
368
- "privacy": "protected"
369
- },
370
- {
371
- "kind": "field",
372
- "name": "handleFocusout",
373
- "privacy": "protected"
374
- },
375
- {
376
- "kind": "field",
377
- "name": "handleRangeChanged",
378
- "privacy": "protected"
379
- },
380
- {
381
- "kind": "field",
382
- "name": "handleVisibleChanged",
383
- "privacy": "protected"
384
- },
385
- {
386
- "kind": "method",
387
- "name": "hostConnected",
388
- "privacy": "public",
389
- "return": {
390
- "type": {
391
- "text": "void"
392
- }
393
- }
394
- },
395
- {
396
- "kind": "method",
397
- "name": "hostDisconnected",
398
- "privacy": "public",
399
- "return": {
400
- "type": {
401
- "text": "void"
402
- }
403
- }
404
- }
405
- ]
406
- }
407
- ],
408
- "exports": [
409
- {
410
- "kind": "js",
411
- "name": "GridController",
412
- "declaration": {
413
- "name": "GridController",
414
- "module": "src/GridController.js"
415
- }
416
- }
417
- ]
418
- }
419
- ]
420
- }