feat: remove differentKeyEventNamesShimIE

This commit is contained in:
gvangeest 2021-12-29 11:37:17 +01:00
parent fd5b9980f8
commit 2b583ee750
16 changed files with 11 additions and 57 deletions

View file

@ -0,0 +1,10 @@
---
'@lion/button': minor
'@lion/calendar': minor
'@lion/core': minor
'@lion/listbox': minor
'@lion/overlays': minor
'@lion/select-rich': minor
---
Remove differentKeyEventNamesShimIE, since IE11 isn't supported any more

View file

@ -1,5 +1,4 @@
import { browserDetection, css, DisabledWithTabIndexMixin, html, LitElement } from '@lion/core';
import '@lion/core/differentKeyEventNamesShimIE';
const isKeyboardClickEvent = (/** @type {KeyboardEvent} */ e) => e.key === ' ' || e.key === 'Enter';
const isSpaceKeyboardClickEvent = (/** @type {KeyboardEvent} */ e) => e.key === ' ';

View file

@ -1,7 +1,6 @@
/* eslint-disable lit-a11y/click-events-have-key-events */
import { LionButton } from '@lion/button';
import { browserDetection } from '@lion/core';
import '@lion/core/differentKeyEventNamesShimIE';
import {
aTimeout,
defineCE,

View file

@ -1,6 +1,5 @@
/* eslint-disable lit-a11y/click-events-have-key-events */
import { LionButtonReset } from '@lion/button';
import '@lion/core/differentKeyEventNamesShimIE';
import { aTimeout, defineCE, expect, fixture, html, unsafeStatic } from '@open-wc/testing';
import sinon from 'sinon';

View file

@ -1,6 +1,5 @@
/* eslint-disable lit-a11y/click-events-have-key-events */
import { LionButtonSubmit } from '@lion/button';
import '@lion/core/differentKeyEventNamesShimIE';
import { aTimeout, defineCE, expect, fixture, html, unsafeStatic } from '@open-wc/testing';
import { sendKeys } from '@web/test-runner-commands';
import sinon from 'sinon';

View file

@ -8,7 +8,6 @@ import {
normalizeDateTime,
} from '@lion/localize';
import '@lion/core/differentKeyEventNamesShimIE';
import { calendarStyle } from './calendarStyle.js';
import { createDay } from './utils/createDay.js';
import { createMultipleMonth } from './utils/createMultipleMonth.js';

View file

@ -1 +0,0 @@
import './src/differentKeyEventNamesShimIE.js';

View file

@ -32,8 +32,7 @@
"test": "cd ../../ && npm run test:browser -- --group core"
},
"sideEffects": [
"./closestPolyfill.js",
"./differentKeyEventNamesShimIE.js"
"./closestPolyfill.js"
],
"dependencies": {
"@open-wc/dedupe-mixin": "^1.3.0",
@ -51,7 +50,6 @@
".": "./index.js",
"./test-helpers": "./test-helpers/index.js",
"./closestPolyfill": "./src/closestPolyfill.js",
"./differentKeyEventNamesShimIE": "./src/differentKeyEventNamesShimIE.js",
"./docs/*": "./docs/*"
}
}

View file

@ -1,40 +0,0 @@
if (typeof window.KeyboardEvent !== 'function') {
// e.g. is IE and needs "polyfill"
const event = KeyboardEvent.prototype;
const descriptor = Object.getOwnPropertyDescriptor(event, 'key');
if (descriptor) {
/** @type {Object.<string, string>} */
const keys = {
Win: 'Meta',
Scroll: 'ScrollLock',
Spacebar: ' ',
Down: 'ArrowDown',
Left: 'ArrowLeft',
Right: 'ArrowRight',
Up: 'ArrowUp',
Del: 'Delete',
Apps: 'ContextMenu',
Esc: 'Escape',
Multiply: '*',
Add: '+',
Subtract: '-',
Decimal: '.',
Divide: '/',
};
Object.defineProperty(event, 'key', {
// eslint-disable-next-line object-shorthand, func-names
get: function () {
if (descriptor.get) {
const key = descriptor.get.call(this);
// eslint-disable-next-line no-prototype-builtins
return keys.hasOwnProperty(key) ? keys[key] : key;
}
return undefined;
},
});
}
}

View file

@ -1,6 +1,5 @@
import { css, dedupeMixin, html, ScopedElementsMixin, SlotMixin } from '@lion/core';
import '@lion/core/closestPolyfill';
import '@lion/core/differentKeyEventNamesShimIE';
import { ChoiceGroupMixin, FormControlMixin, FormRegistrarMixin } from '@lion/form-core';
import { LionOptions } from './LionOptions.js';

View file

@ -1,5 +1,4 @@
import { LitElement, repeat } from '@lion/core';
import '@lion/core/differentKeyEventNamesShimIE';
import { Required } from '@lion/form-core';
import { LionOptions } from '@lion/listbox';
import '@lion/listbox/define';

View file

@ -1,4 +1,3 @@
import '@lion/core/differentKeyEventNamesShimIE';
import { EventTargetShim } from '@lion/core';
// eslint-disable-next-line import/no-cycle
import { overlays } from './overlays.js';

View file

@ -1,5 +1,4 @@
/* eslint-disable no-new */
import '@lion/core/differentKeyEventNamesShimIE';
import { aTimeout, defineCE, expect, fixture, html, unsafeStatic } from '@open-wc/testing';
import { fixtureSync } from '@open-wc/testing-helpers';
import sinon from 'sinon';

View file

@ -1,8 +1,6 @@
import { LionListbox } from '@lion/listbox';
import { html, ScopedElementsMixin, SlotMixin, browserDetection } from '@lion/core';
import { OverlayMixin, withDropdownConfig } from '@lion/overlays';
import '@lion/core/differentKeyEventNamesShimIE';
import { LionSelectInvoker } from './LionSelectInvoker.js';
/**

View file

@ -2,7 +2,6 @@ import { Required } from '@lion/form-core';
import { expect, triggerBlurFor, triggerFocusFor, fixture } from '@open-wc/testing';
import { html } from 'lit/static-html.js';
import { browserDetection } from '@lion/core';
import '@lion/core/differentKeyEventNamesShimIE';
import '@lion/listbox/define';
import '@lion/select-rich/define';

View file

@ -1,5 +1,4 @@
import { LitElement } from '@lion/core';
import '@lion/core/differentKeyEventNamesShimIE';
import { renderLitAsNode } from '@lion/helpers';
import { LionOption } from '@lion/listbox';
import '@lion/listbox/define';