- 479a956d: Marked
@open-wc/scoped-elements
as side-effect free
- fec89f1d: Backport registry creation check from v2
- 3e6fff71: fix types for angular
- c386fcf9: fix: types again
- 12011875: Fix types for scoped elements
- See the
MIGRATION.md
for more information
- 84e38ab1: Use split versions for all lit dependencies
- c6cdea6f: fix: Backport passing the scoped custom element registry via the registry option in addition to the customElement option to account for the change in the specification
- 0402c80f: fix: add scopedElementsVersion
- 9d86f689: Add "type": "module" to package.json so build tools won't assume this is a CommonJS module.
- 935c8ffe: Drop support for Node@14
- 80c6ae66: Use latest @web/* dependencies.
Upgrade Rollup to
v3.x
- Updated dependencies [935c8ffe]
- @open-wc/dedupe-mixin@1.4.0
- 52f3fa6d: fix: getScopedTagName bug
-
89fb5601: Add type entrypoint which enables you to get more advanced type information like
import { ScopedElementsHost } from '@open-wc/scoped-elements/types.js';
- 61e2668f: update eslint, eslint-config-airbnb-base and eslint-plugin-import
- bf99826e: Check if
__registry
actually exists on the current class, not a parent. - 12b9a736: Fixed compatibility with Typescript 4.7 nodeResolution: "node16".
- dbc2b9e2: Update
ScopedElementsMixin
type info to includecreateScopedElement
-
3bb2f979: BREAKING CHANGE: Work without polyfill if possible (and do not auto load polyfill)
ScopedElementsMixin 2.x tried to be as convenient as possible by automatically loading the scoped custom elements registry polyfill. This however led to a fatal error whenever you registered any component before ScopedElementsMixin was used.
The error especially happened when you would import a component applying ScopedElementsMixin into an existing application, fundamentally going against the "import and use" nature of web components.
Therefore, we decided to not load the polyfill inside the mixin, but let the developer (optionally) load it on top of his/her app. This means that, depending on the app of the developer, the change can be breaking. After updating to this latest version, two scenarios will be possible:
- everything is fixed and less js is loaded than before: the app doesn't need scoping (in this case the app either continues to work as is, or the fatal error mentioned above will disappear)
- the fatal error is replaced by a console error from ScopedElementsMixin: the app needs scoping, because different versions of the same component are used (in this case, the fatal error mentioned above will disappear and a console error asking you to load the polyfill on top of your app will appear)
Only the second case requires an action. The remaining error can be resolved via a small migration path, a breaking bugfix if you will, which should be treated as if it were a security breaking change: consumers do the breaking bug fix on their end, because releasing a new major version would not be beneficial, neither to us nor to our consumers.
Not loading the polyfill by default will also allow sites to opt out of it altogether. This means until the browser ships scoped registries, the developer can choose to fall back to the global registry, by not loading the polyfill. This will save bandwidth & complexity since it doesn't need to be loaded by the client in that case.
All previous 2.x versions will be deprecated and scoped element will behave as follows:
- If polyfill is not loaded it will use the global registry as a fallback
- Log error if actually scoping is needed and polyfill is not loaded
- If you manually create elements you will need to handle polyfilled and not polyfilled cases now
- const myButton = this.shadowRoot.createElement('my-button'); + const myButton = this.createScopedElement('my-button');
This also removes
@webcomponents/scoped-custom-element-registry
as a production dependency.If you need scoping be sure to load the polyfill before any other web component gets registered.
It may look something like this in your HTML
<script src="/node_modules/@webcomponents/scoped-custom-element-registry/scoped-custom-element-registry.min.js"></script>
or if you have an SPA you can load it at the top of your app shell code
import '@webcomponents/scoped-custom-element-registry';
You need scoping if you want to
- use 2 major versions of a web component (e.g. in an SPA pageA uses 1.x and pageB uses 2.x of color-picker)
- or you want to use the same tag name with different implementations (use tag color-picker from foo here and from bar here)
- 1649ba46: Release bump version as major versions have already been used and unpublished in an accidental publish about a year ago.
-
edca5a82: Adds compatibility for lit with
lit-html v2
andlit-element v3
.-
This version does NOT work with lit-element v2 - please use Scoped Elements v1 for it
-
Uses a
CustomElementsRegistry
instance for each component class instead of for each component instance. In case you need to have a registry for each component instance, you must override the registryget
andset
methods to bind the registry to the component instance/** @override */ get registry() { return this.__registry; } /** @override */ set registry(registry) { this.__registry = registry; }
-
getScopedTagName
became deprecated - use the nativeel.tagName
instead
-
- 1e54d297: Use the webcomponents polyfill instead of the forked one
- 4b9ea6f6: Use lit@2.0 stable based dependencies across the project.
- c05d92fb: Mark
loadPolyfill.js
as a side effect - 0513917c: Keep deprecated static getScopedTagName function
- ff17798f: Adjust the renderBefore node so that any styles in Lit content render before adoptedStyleSheets.
- a0b5e360: fix getScopedTagName returning the tag that was passed in
- 4b9ea6f6: Use lit@2.0 stable based dependencies across the project.
- ff17798f: Adjust the renderBefore node so that any styles in Lit content render before adoptedStyleSheets.
- 1e54d297: Use the webcomponents polyfill instead of the forked one
- 0513917c: Keep deprecated static getScopedTagName function
- a0b5e360: fix getScopedTagName returning the tag that was passed in
- c05d92fb: Mark
loadPolyfill.js
as a side effect
-
edca5a82: Adds compatibility for lit with
lit-html v2
andlit-element v3
.-
This version does NOT work with lit-element v2 - please use Scoped Elements v1 for it
-
Uses a
CustomElementsRegistry
instance for each component class instead of for each component instance. In case you need to have a registry for each component instance, you must override the registryget
andset
methods to bind the registry to the component instance/** @override */ get registry() { return this.__registry; } /** @override */ set registry(registry) { this.__registry = registry; }
-
getScopedTagName
became deprecated - use the nativeel.tagName
instead
-
- 31ff454a: Add constructor to ScopedElementsHost type so that base constructors have the same return type as extensions. See TypeScript issue.
- 9fb1c131: refactor to remove optional chaining syntax in Cache file for better tooling compatibility
- 04666893: Fix types
- 95d055dc: Define lazy components per Scoped Element instance instead of by Scoped Element class. This forces
getScopedTagName
method to stop being a static method.
- 4a81d791: Add types folder to npm artifacts
- 17e9e7dc: Change type distribution workflow
All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.
1.2.2 (2020-08-19)
- scoped-elements: add host to the mixin type for static props (88ffd99)
1.2.1 (2020-08-14)
- scoped-elements: make code ie11 compatible (08483df)
1.2.0 (2020-08-05)
- scoped-elements: add data-tag-name with the original tagName (d97454e)
1.1.2 (2020-07-08)
Note: Version bump only for package @open-wc/scoped-elements
1.1.1 (2020-04-26)
- scoped-elements: duplicate definition (9aecafb)
1.1.0 (2020-04-25)
- scoped-elements: self-registering components compatibility (d4806e4)
1.0.9 (2020-04-20)
Note: Version bump only for package @open-wc/scoped-elements
1.0.8 (2020-04-12)
Note: Version bump only for package @open-wc/scoped-elements
1.0.7 (2020-04-06)
Note: Version bump only for package @open-wc/scoped-elements
1.0.6 (2020-04-05)
- scoped-elements: define unused lazy scoped elements (5b863a2)
1.0.5 (2020-03-28)
- scoped-elements: elements not scoped by directives (71f7438)
1.0.4 (2020-03-26)
Note: Version bump only for package @open-wc/scoped-elements
1.0.3 (2020-03-25)
- scoped-elements: getScopedTagName returns undefined (a96c675)
1.0.2 (2020-03-24)
Note: Version bump only for package @open-wc/scoped-elements
1.0.1 (2020-03-20)
Note: Version bump only for package @open-wc/scoped-elements
1.0.0 (2020-03-19)
- scoped-elements: fix some jsDocs (b4d4fc1)
- scoped-elements: getScopedTagName is not available anymore as a function but a ScopedElementsMixin method.
0.7.1 (2020-03-19)
Note: Version bump only for package @open-wc/scoped-elements
0.7.0 (2020-03-19)
- scoped-elements: add support for lazy elements (0d67b9f)
0.6.9 (2020-03-19)
Note: Version bump only for package @open-wc/scoped-elements
0.6.8 (2020-03-15)
Note: Version bump only for package @open-wc/scoped-elements
0.6.7 (2020-03-15)
Note: Version bump only for package @open-wc/scoped-elements
0.6.6 (2020-03-11)
Note: Version bump only for package @open-wc/scoped-elements
0.6.5 (2020-03-10)
Note: Version bump only for package @open-wc/scoped-elements
0.6.4 (2020-03-10)
Note: Version bump only for package @open-wc/scoped-elements
0.6.3 (2020-03-08)
Note: Version bump only for package @open-wc/scoped-elements
0.6.2 (2020-03-06)
Note: Version bump only for package @open-wc/scoped-elements
0.6.1 (2020-03-02)
Note: Version bump only for package @open-wc/scoped-elements
0.6.0 (2020-02-29)
- rollup-plugin-html: first release (9acb29a)
0.5.0 (2020-02-24)
- scoped-elements: add getScopedTagName function (21132e0)
0.4.1 (2020-02-23)
Note: Version bump only for package @open-wc/scoped-elements
0.4.0 (2020-02-19)
- scoped-elements: implement as ScopedElementsMixin (b4f6483)
0.3.1 (2020-02-13)
0.3.0 (2020-02-13)
- scoped-elements: keep descriptive tag name when building (64b8a44)
- scoped-elements: add '-se' suffix to all scoped tag names (28c7011)
0.2.15 (2020-02-12)
0.2.14 (2020-02-10)
Note: Version bump only for package @open-wc/scoped-elements
0.2.13 (2020-02-10)
Note: Version bump only for package @open-wc/scoped-elements
0.2.12 (2020-02-09)
Note: Version bump only for package @open-wc/scoped-elements
0.2.11 (2020-02-09)
Note: Version bump only for package @open-wc/scoped-elements
0.2.10 (2020-02-06)
Note: Version bump only for package @open-wc/scoped-elements
0.2.9 (2020-02-06)
Note: Version bump only for package @open-wc/scoped-elements
0.2.8 (2020-02-03)
Note: Version bump only for package @open-wc/scoped-elements
0.2.7 (2020-02-03)
Note: Version bump only for package @open-wc/scoped-elements
0.2.6 (2020-02-02)
Note: Version bump only for package @open-wc/scoped-elements
0.2.5 (2020-01-31)
- skip brooken published versions (25d21de)
0.2.3 (2020-01-27)
Note: Version bump only for package @open-wc/scoped-elements
0.2.2 (2020-01-27)
Note: Version bump only for package @open-wc/scoped-elements
0.2.1 (2020-01-19)
Note: Version bump only for package @open-wc/scoped-elements
- scoped-elements: add scoped elements feature (a7e195b)