Skip to content

Commit

Permalink
fix: add polyfill of in-element
Browse files Browse the repository at this point in the history
  • Loading branch information
knownasilya committed Oct 4, 2020
1 parent 5d48037 commit 9017b32
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 10 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ Write templates for your components inside of a Shadow DOM root.
Allows encapsulating styles (CSS) and markup (HTML) but using templates like
you're used to.

> Note: This addon uses a private API `{{-in-element}}`, but this API is on it's
> way to becoming public. See [RFC 287](https://github.com/emberjs/rfcs/pull/287),
> which was recently accepted.
Not sure what Shadow DOM is? Check out this [MDN article](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM).

> Compatibility: Not all browsers support Shadow DOM (v1) yet, see [CanIUse](https://caniuse.com/#feat=shadowdomv1)
Expand All @@ -23,6 +19,8 @@ Not sure what Shadow DOM is? Check out this [MDN article](https://developer.mozi
- Ember CLI v2.13 or above
- Node.js v10 or above

If using Ember < 3.20, this addon will use the private version of `{{in-element}}` via a polyfill.

## Installation

```sh
Expand Down Expand Up @@ -81,7 +79,7 @@ See the [Contributing](CONTRIBUTING.md) guide for details.

## Attribution

Thanks to [@rwjblue](https://github.com/rwjblue) for realizing that `{{-in-element}}` can be used for the shadow root!
Thanks to [@rwjblue](https://github.com/rwjblue) for realizing that `{{in-element}}` can be used for the shadow root!

## License

Expand Down
4 changes: 2 additions & 2 deletions app/templates/components/shadow-root.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
<Tag ...attributes {{did-insert this.setupRoot}} />

{{#if this.shadow}}
{{#-in-element this.shadow}}
{{#in-element this.shadow}}
{{yield}}
{{/-in-element}}
{{/in-element}}
{{/if}}
{{/if}}
{{/let}}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"ember-cli-sri": "^2.1.1",
"ember-cli-terser": "^4.0.0",
"ember-export-application-global": "^2.0.1",
"ember-in-element-polyfill": "^1.0.0",
"ember-load-initializers": "^2.1.1",
"ember-maybe-import-regenerator": "^0.1.6",
"ember-qunit": "^4.6.0",
Expand Down
61 changes: 58 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2221,6 +2221,11 @@ babel-plugin-htmlbars-inline-precompile@^1.0.0:
resolved "https://registry.yarnpkg.com/babel-plugin-htmlbars-inline-precompile/-/babel-plugin-htmlbars-inline-precompile-1.0.0.tgz#a9d2f6eaad8a3f3d361602de593a8cbef8179c22"
integrity sha512-4jvKEHR1bAX03hBDZ94IXsYCj3bwk9vYsn6ux6JZNL2U5pvzCWjqyrGahfsGNrhERyxw8IqcirOi9Q6WCo3dkQ==

babel-plugin-htmlbars-inline-precompile@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/babel-plugin-htmlbars-inline-precompile/-/babel-plugin-htmlbars-inline-precompile-3.2.0.tgz#c4882ea875d0f5683f0d91c1f72e29a4f14b5606"
integrity sha512-IUeZmgs9tMUGXYu1vfke5I18yYJFldFGdNFQOWslXTnDWXzpwPih7QFduUqvT+awDpDuNtXpdt5JAf43Q1Hhzg==

babel-plugin-htmlbars-inline-precompile@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/babel-plugin-htmlbars-inline-precompile/-/babel-plugin-htmlbars-inline-precompile-4.2.0.tgz#73e7a199c14db139b9c9aea240e03b7112784c81"
Expand Down Expand Up @@ -3142,6 +3147,13 @@ broccoli-node-info@^2.1.0:
resolved "https://registry.yarnpkg.com/broccoli-node-info/-/broccoli-node-info-2.1.0.tgz#ca84560e8570ff78565bea1699866ddbf58ad644"
integrity sha512-l6qDuboJThHfRVVWQVaTs++bFdrFTP0gJXgsWenczc1PavRVUmL1Eyb2swTAXXMpDOnr2zhNOBLx4w9AxkqbPQ==

broccoli-output-wrapper@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/broccoli-output-wrapper/-/broccoli-output-wrapper-2.0.0.tgz#f1e0b9b2f259a67fd41a380141c3c20b096828e6"
integrity sha512-V/ozejo+snzNf75i/a6iTmp71k+rlvqjE3+jYfimuMwR1tjNNRdtfno+NGNQB2An9bIAeqZnKhMDurAznHAdtA==
dependencies:
heimdalljs-logger "^0.1.10"

broccoli-output-wrapper@^3.2.1:
version "3.2.3"
resolved "https://registry.yarnpkg.com/broccoli-output-wrapper/-/broccoli-output-wrapper-3.2.3.tgz#e5c9de7c881570eb4c0b0d194bb12d9671b25a9b"
Expand Down Expand Up @@ -3170,7 +3182,7 @@ broccoli-persistent-filter@^1.1.6, broccoli-persistent-filter@^1.4.3:
symlink-or-copy "^1.0.1"
walk-sync "^0.3.1"

broccoli-persistent-filter@^2.2.1, broccoli-persistent-filter@^2.2.2, broccoli-persistent-filter@^2.3.0:
broccoli-persistent-filter@^2.2.1, broccoli-persistent-filter@^2.2.2, broccoli-persistent-filter@^2.3.0, broccoli-persistent-filter@^2.3.1:
version "2.3.1"
resolved "https://registry.yarnpkg.com/broccoli-persistent-filter/-/broccoli-persistent-filter-2.3.1.tgz#4a052e0e0868b344c3a2977e35a3d497aa9eca72"
integrity sha512-hVsmIgCDrl2NFM+3Gs4Cr2TA6UPaIZip99hN8mtkaUPgM8UeVnCbxelCvBjUBHo0oaaqP5jzqqnRVvb568Yu5g==
Expand Down Expand Up @@ -3237,6 +3249,19 @@ broccoli-plugin@^2.1.0:
rimraf "^2.3.4"
symlink-or-copy "^1.1.8"

broccoli-plugin@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/broccoli-plugin/-/broccoli-plugin-3.1.0.tgz#54ba6dd90a42ec3db5624063292610e326b1e542"
integrity sha512-7w7FP8WJYjLvb0eaw27LO678TGGaom++49O1VYIuzjhXjK5kn2+AMlDm7CaUFw4F7CLGoVQeZ84d8gICMJa4lA==
dependencies:
broccoli-node-api "^1.6.0"
broccoli-output-wrapper "^2.0.0"
fs-merger "^3.0.1"
promise-map-series "^0.2.1"
quick-temp "^0.1.3"
rimraf "^2.3.4"
symlink-or-copy "^1.1.8"

broccoli-plugin@^4.0.1, broccoli-plugin@^4.0.2, broccoli-plugin@^4.0.3:
version "4.0.3"
resolved "https://registry.yarnpkg.com/broccoli-plugin/-/broccoli-plugin-4.0.3.tgz#9dcfbfb6a1b27a37cc22e65c071719ce9f92bc1e"
Expand Down Expand Up @@ -4970,6 +4995,26 @@ ember-cli-htmlbars-inline-precompile@^2.1.0:
heimdalljs-logger "^0.1.9"
silent-error "^1.1.0"

ember-cli-htmlbars@^4.3.1:
version "4.4.0"
resolved "https://registry.yarnpkg.com/ember-cli-htmlbars/-/ember-cli-htmlbars-4.4.0.tgz#7ca17d5ca8f7550984346d9e6e93da0c3323f8d9"
integrity sha512-ohgctqk7dXIZR4TgN0xRoUYltWhghFJgqmtuswQTpZ7p74RxI9PKx+E8WV/95mGcPzraesvMNBg5utQNvcqgNg==
dependencies:
"@ember/edition-utils" "^1.2.0"
babel-plugin-htmlbars-inline-precompile "^3.2.0"
broccoli-debug "^0.6.5"
broccoli-persistent-filter "^2.3.1"
broccoli-plugin "^3.1.0"
common-tags "^1.8.0"
ember-cli-babel-plugin-helpers "^1.1.0"
fs-tree-diff "^2.0.1"
hash-for-dep "^1.5.1"
heimdalljs-logger "^0.1.10"
json-stable-stringify "^1.0.1"
semver "^6.3.0"
strip-bom "^4.0.0"
walk-sync "^2.0.2"

ember-cli-htmlbars@^5.1.0, ember-cli-htmlbars@^5.3.1:
version "5.3.1"
resolved "https://registry.yarnpkg.com/ember-cli-htmlbars/-/ember-cli-htmlbars-5.3.1.tgz#61793964fc2599ce750db9e972ab55c6dd177c48"
Expand Down Expand Up @@ -5117,7 +5162,7 @@ ember-cli-version-checker@^4.1.0:
semver "^6.3.0"
silent-error "^1.1.1"

ember-cli-version-checker@^5.1.1:
ember-cli-version-checker@^5.0.2, ember-cli-version-checker@^5.1.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/ember-cli-version-checker/-/ember-cli-version-checker-5.1.1.tgz#3185c526c14671609cbd22ab0d0925787fc84f3d"
integrity sha512-YziSW1MgOuVdJSyUY2CKSC4vXrGQIHF6FgygHkJOxYGjZNQYwf5MK0sbliKatvJf7kzDSnXs+r8JLrD74W/A8A==
Expand Down Expand Up @@ -5255,6 +5300,16 @@ ember-export-application-global@^2.0.1:
resolved "https://registry.yarnpkg.com/ember-export-application-global/-/ember-export-application-global-2.0.1.tgz#b120a70e322ab208defc9e2daebe8d0dfc2dcd46"
integrity sha512-B7wiurPgsxsSGzJuPFkpBWnaeuCu2PGpG2BjyrfA1VcL7//o+5RSnZqiCEY326y7qmxb2GoCgo0ft03KBU0rRw==

ember-in-element-polyfill@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/ember-in-element-polyfill/-/ember-in-element-polyfill-1.0.0.tgz#10365af6fe31bc59e71ec463ed209d4ba4caecda"
integrity sha512-0eSfWWgkOMvj7lcjo20VX8uX4HYxSOxm6MY3bAzqW5RpnHcpcrRf6o4y80xLGh5pp9z8FobiUfFwubphACP8mQ==
dependencies:
debug "^4.1.1"
ember-cli-babel "^7.19.0"
ember-cli-htmlbars "^4.3.1"
ember-cli-version-checker "^5.0.2"

ember-load-initializers@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/ember-load-initializers/-/ember-load-initializers-2.1.1.tgz#d1a8bead00bc44222b0ab181840869992beb30f5"
Expand Down Expand Up @@ -6485,7 +6540,7 @@ fs-extra@^9.0.0:
jsonfile "^6.0.1"
universalify "^1.0.0"

fs-merger@^3.1.0:
fs-merger@^3.0.1, fs-merger@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/fs-merger/-/fs-merger-3.1.0.tgz#f30f74f6c70b2ff7333ec074f3d2f22298152f3b"
integrity sha512-RZ9JtqugaE8Rkt7idO5NSwcxEGSDZpLmVFjtVQUm3f+bWun7JAU6fKyU6ZJUeUnKdJwGx8uaro+K4QQfOR7vpA==
Expand Down

0 comments on commit 9017b32

Please sign in to comment.