@blockquote-web-components/blockquote-base-style-helpers 1.0.2 → 1.0.4

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/index.js CHANGED
@@ -2,7 +2,7 @@ export {
2
2
  setDocumentStyles,
3
3
  supportCustomStyleInterface,
4
4
  supportsAdoptingStyleSheets,
5
- documentAdoptStyles,
5
+ adoptStyles,
6
6
  } from './src/setDocumentStyles.js';
7
7
 
8
8
  export { setComponentSharedStyles } from './src/setComponentSharedStyles.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockquote-web-components/blockquote-base-style-helpers",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Webcomponent blockquote-base-style-helpers following open-wc recommendations",
5
5
  "keywords": [
6
6
  "lit",
@@ -136,5 +136,5 @@
136
136
  "access": "public"
137
137
  },
138
138
  "customElements": "custom-elements.json",
139
- "gitHead": "4a14f74f572169c99989112aa5681940f4cde3aa"
139
+ "gitHead": "06f7e7928e79f9bb965a22f38bb6b74cfa0337a2"
140
140
  }
@@ -2,24 +2,28 @@ import { supportsAdoptingStyleSheets /* adoptStyles */ } from 'lit';
2
2
  import '@blockquote/polymer/lib/elements/custom-style.js';
3
3
 
4
4
  export { supportsAdoptingStyleSheets /* adoptStyles */ } from 'lit';
5
+
5
6
  export const supportCustomStyleInterface =
6
- window.ShadyCSS && /* c8 ignore next */ window.ShadyCSS.CustomStyleInterface;
7
+ /* c8 ignore next */
8
+ window.ShadyCSS && window.ShadyCSS.CustomStyleInterface && !window.ShadyCSS.nativeShadow;
7
9
 
8
- const renderDocumentRoot = supportsAdoptingStyleSheets
9
- ? document
10
- : /* c8 ignore next */ document.head;
10
+ const renderDocumentRoot =
11
+ /* c8 ignore next */
12
+ supportsAdoptingStyleSheets ? document : document.head;
11
13
 
12
- export const documentAdoptStyles = (renderRoot, styles) => {
14
+ export const adoptStyles = (renderRoot, styles) => {
13
15
  if (supportsAdoptingStyleSheets) {
16
+ // https://github.com/lit/lit/pull/3061
14
17
  // eslint-disable-next-line no-param-reassign
15
- renderRoot.adoptedStyleSheets = renderRoot.adoptedStyleSheets.concat(
16
- styles.map(s => (s instanceof CSSStyleSheet ? s : s.styleSheet)),
17
- ); /* TODO PR css-tag.ts */
18
+ renderRoot.adoptedStyleSheets = [
19
+ ...renderRoot.adoptedStyleSheets,
20
+ ...styles.map(s => (s instanceof CSSStyleSheet ? s : s.styleSheet)),
21
+ ];
18
22
  } else {
19
23
  styles.forEach(s => {
20
24
  const style = document.createElement('style');
21
25
  // eslint-disable-next-line dot-notation
22
- const nonce = window['litNonce']; /* original css-tag.ts const nonce = global['litNonce'] */
26
+ const nonce = window['litNonce'];
23
27
  if (nonce !== undefined) {
24
28
  style.setAttribute('nonce', nonce);
25
29
  }
@@ -41,5 +45,5 @@ const documentCustomStyle = s => {
41
45
  export const setDocumentStyles = styles => {
42
46
  supportCustomStyleInterface
43
47
  ? documentCustomStyle(styles)
44
- : documentAdoptStyles(renderDocumentRoot, [styles]);
48
+ : adoptStyles(renderDocumentRoot, [styles]);
45
49
  };