feat: update to stable @open-wc/scoped-elements

This commit is contained in:
Thomas Allmer 2020-03-25 14:28:02 +01:00
parent 42c840f949
commit 10bac5672b
9 changed files with 24 additions and 45 deletions

View file

@ -171,7 +171,7 @@ Since Scoped Elements changes tagnames under the hood, a tagname querySelector s
like this: like this:
```js ```js
this.querySelector(getTagName('lion-input', this.constructor.scopedElements)); this.querySelector(this.constructor.getScopedTagName('lion-input'));
``` ```
### CSS selectors ### CSS selectors
@ -218,12 +218,12 @@ connectedCallback() {
In a less complex case, we might just want to add a child node to the dom. In a less complex case, we might just want to add a child node to the dom.
```js ```js
import { ScopedElementsMixin, LitElement, getScopedTagNamegetScopedTagName } from '@lion/core'; import { ScopedElementsMixin, LitElement } from '@lion/core';
... ...
__getLightDomNode() { __getLightDomNode() {
return document.createElement(getScopedTagName('lion-input', this.constructor.scopedElements)); return document.createElement(this.constructor.getScopedTagName('lion-input'));
} }
``` ```

View file

@ -52,7 +52,7 @@ export { unsafeHTML } from 'lit-html/directives/unsafe-html.js';
export { until } from 'lit-html/directives/until.js'; export { until } from 'lit-html/directives/until.js';
export { render as renderShady } from 'lit-html/lib/shady-render.js'; export { render as renderShady } from 'lit-html/lib/shady-render.js';
// open-wc // open-wc
export { ScopedElementsMixin, getScopedTagName } from '@open-wc/scoped-elements'; export { ScopedElementsMixin } from '@open-wc/scoped-elements';
export { dedupeMixin } from '@open-wc/dedupe-mixin'; export { dedupeMixin } from '@open-wc/dedupe-mixin';
// ours // ours
export { DelegateMixin } from './src/DelegateMixin.js'; export { DelegateMixin } from './src/DelegateMixin.js';

View file

@ -34,7 +34,7 @@
], ],
"dependencies": { "dependencies": {
"@open-wc/dedupe-mixin": "^1.2.1", "@open-wc/dedupe-mixin": "^1.2.1",
"@open-wc/scoped-elements": "^0.5.0", "@open-wc/scoped-elements": "^1.0.3",
"lit-element": "^2.2.1", "lit-element": "^2.2.1",
"lit-html": "^1.0.0" "lit-html": "^1.0.0"
}, },

View file

@ -44,8 +44,7 @@
"@lion/input-date": "0.5.20", "@lion/input-date": "0.5.20",
"@lion/localize": "0.8.10", "@lion/localize": "0.8.10",
"@lion/overlays": "0.12.6", "@lion/overlays": "0.12.6",
"@lion/validate": "0.8.0", "@lion/validate": "0.8.0"
"@open-wc/scoped-elements": "^0.5.0"
}, },
"devDependencies": { "devDependencies": {
"@open-wc/demoing-storybook": "^1.10.4", "@open-wc/demoing-storybook": "^1.10.4",

View file

@ -1,12 +1,5 @@
import { ChoiceGroupMixin } from '@lion/choice-input'; import { ChoiceGroupMixin } from '@lion/choice-input';
import { import { css, html, LitElement, ScopedElementsMixin, SlotMixin } from '@lion/core';
css,
getScopedTagName,
html,
LitElement,
ScopedElementsMixin,
SlotMixin,
} from '@lion/core';
import { FormControlMixin, FormRegistrarMixin, InteractionStateMixin } from '@lion/field'; import { FormControlMixin, FormRegistrarMixin, InteractionStateMixin } from '@lion/field';
import { formRegistrarManager } from '@lion/field/src/registration/formRegistrarManager.js'; import { formRegistrarManager } from '@lion/field/src/registration/formRegistrarManager.js';
import { OverlayMixin, withDropdownConfig } from '@lion/overlays'; import { OverlayMixin, withDropdownConfig } from '@lion/overlays';
@ -107,9 +100,7 @@ export class LionSelectRich extends ScopedElementsMixin(
return { return {
...super.slots, ...super.slots,
invoker: () => invoker: () =>
document.createElement( document.createElement(this.constructor.getScopedTagName('lion-select-invoker')),
getScopedTagName('lion-select-invoker', this.constructor.scopedElements),
),
}; };
} }

View file

@ -1,4 +1,4 @@
import { html, css, ScopedElementsMixin, getScopedTagName } from '@lion/core'; import { html, css, ScopedElementsMixin } from '@lion/core';
import { LionField } from '@lion/field'; import { LionField } from '@lion/field';
import { ChoiceInputMixin } from '@lion/choice-input'; import { ChoiceInputMixin } from '@lion/choice-input';
import { LionSwitchButton } from './LionSwitchButton.js'; import { LionSwitchButton } from './LionSwitchButton.js';
@ -25,10 +25,7 @@ export class LionSwitch extends ScopedElementsMixin(ChoiceInputMixin(LionField))
get slots() { get slots() {
return { return {
...super.slots, ...super.slots,
input: () => input: () => document.createElement(this.constructor.getScopedTagName('lion-switch-button')),
document.createElement(
getScopedTagName('lion-switch-button', this.constructor.scopedElements),
),
}; };
} }

View file

@ -37,8 +37,7 @@
], ],
"dependencies": { "dependencies": {
"@lion/core": "0.4.5", "@lion/core": "0.4.5",
"@lion/localize": "0.8.10", "@lion/localize": "0.8.10"
"@open-wc/scoped-elements": "^0.5.0"
}, },
"devDependencies": { "devDependencies": {
"@open-wc/demoing-storybook": "^1.10.4", "@open-wc/demoing-storybook": "^1.10.4",

View file

@ -1,6 +1,6 @@
/* eslint-disable class-methods-use-this, camelcase, no-param-reassign, max-classes-per-file */ /* eslint-disable class-methods-use-this, camelcase, no-param-reassign, max-classes-per-file */
import { dedupeMixin, SlotMixin, ScopedElementsMixin, getScopedTagName } from '@lion/core'; import { dedupeMixin, SlotMixin, ScopedElementsMixin } from '@lion/core';
import { localize } from '@lion/localize'; import { localize } from '@lion/localize';
import { LionValidationFeedback } from './LionValidationFeedback.js'; import { LionValidationFeedback } from './LionValidationFeedback.js';
import { ResultValidator } from './ResultValidator.js'; import { ResultValidator } from './ResultValidator.js';
@ -25,7 +25,7 @@ function arrayDiff(array1 = [], array2 = []) {
export const ValidateMixin = dedupeMixin( export const ValidateMixin = dedupeMixin(
superclass => superclass =>
// eslint-disable-next-line no-unused-vars, no-shadow // eslint-disable-next-line no-unused-vars, no-shadow
class ValidateMixin extends ScopedElementsMixin(SyncUpdatableMixin(SlotMixin(superclass))) { class ValidateMixin extends SyncUpdatableMixin(SlotMixin(ScopedElementsMixin(superclass))) {
static get scopedElements() { static get scopedElements() {
return { return {
...super.scopedElements, ...super.scopedElements,
@ -117,9 +117,7 @@ export const ValidateMixin = dedupeMixin(
return { return {
...super.slots, ...super.slots,
feedback: () => feedback: () =>
document.createElement( document.createElement(this.constructor.getScopedTagName('lion-validation-feedback')),
getScopedTagName('lion-validation-feedback', this.constructor.scopedElements),
),
}; };
} }

View file

@ -2261,15 +2261,10 @@
"@open-wc/semantic-dom-diff" "^0.13.16" "@open-wc/semantic-dom-diff" "^0.13.16"
"@types/chai" "^4.1.7" "@types/chai" "^4.1.7"
"@open-wc/dedupe-mixin@^1.1.1": "@open-wc/dedupe-mixin@^1.2.1", "@open-wc/dedupe-mixin@^1.2.12":
version "1.1.1" version "1.2.12"
resolved "https://registry.yarnpkg.com/@open-wc/dedupe-mixin/-/dedupe-mixin-1.1.1.tgz#3ac8e498422ef316276bbe4aa687e35bd10c6871" resolved "https://registry.yarnpkg.com/@open-wc/dedupe-mixin/-/dedupe-mixin-1.2.12.tgz#5fd2e562bf37e66a98d4a51402d03cb2afffbd0e"
integrity sha512-Y1+h5nQjJnDHP+8OceZB47I4D7iOiYnM0jXYLGEi96IusR93et30BIyEEQAJ4AvYfbuIrdbf0L5vQWfszU6/Jg== integrity sha512-a18Md4Utj1nRHaIix5tfd52t2kfN0zghcen5VGb70bwtvI0HuRfoum9vmbCr+XugpnRc4Tql7HJAbNBW0Y7Gvw==
"@open-wc/dedupe-mixin@^1.2.1":
version "1.2.10"
resolved "https://registry.yarnpkg.com/@open-wc/dedupe-mixin/-/dedupe-mixin-1.2.10.tgz#4992874e98b8c49ed71e7e17d2adc7538d62260b"
integrity sha512-I3/aKV8OJ5LkZLOvTiGRgKs+o7VVz3EUozbc7yeKJo7x8+j+NHWhVvtNHE8GXAXbN3s4KmMWQt1mXWCEZwNg7g==
"@open-wc/demoing-storybook@^1.10.4": "@open-wc/demoing-storybook@^1.10.4":
version "1.10.5" version "1.10.5"
@ -2330,13 +2325,13 @@
eslint-config-prettier "^3.3.0" eslint-config-prettier "^3.3.0"
prettier "^1.19.1" prettier "^1.19.1"
"@open-wc/scoped-elements@^0.5.0": "@open-wc/scoped-elements@^1.0.3":
version "0.5.0" version "1.0.3"
resolved "https://registry.yarnpkg.com/@open-wc/scoped-elements/-/scoped-elements-0.5.0.tgz#485b0e530acb3530933198af66f5dbef1e64a277" resolved "https://registry.yarnpkg.com/@open-wc/scoped-elements/-/scoped-elements-1.0.3.tgz#f8d6a7b2d0c5fc5a72a657d1bdb2b9ec9d016a4c"
integrity sha512-SVMzFDBjXPAD+5sgbZ/SaGSfEoIVgcmYzbeXRvR5afdkikKdQcXONb4nsA5QqotpDci3eWxT4UClMax+44C8sA== integrity sha512-+oFcWdWrNYi5pW6c2Ds5BxaaD5oXINEHtN3ktAa9UuSXW2it5C3YSoFQiZoN0thyp/neHMMo1XktT+ZsruYkhg==
dependencies: dependencies:
"@open-wc/dedupe-mixin" "^1.1.1" "@open-wc/dedupe-mixin" "^1.2.12"
lit-element "^2.0.1" lit-element "^2.2.1"
"@open-wc/semantic-dom-diff@^0.13.16": "@open-wc/semantic-dom-diff@^0.13.16":
version "0.13.21" version "0.13.21"