extension-create 4.0.9 → 4.0.10
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/dist/test-template-javascript/src/content/ContentApp.js +1 -2
- package/dist/test-template-javascript/src/content/scripts.js +7 -1
- package/dist/test-template-javascript/src/sidebar/SidebarApp.js +1 -3
- package/dist/test-template-javascript/src/sidebar/scripts.js +2 -1
- package/package.json +1 -1
- package/templates/javascript/README.md +1 -1
- package/templates/javascript/src/content/ContentApp.js +1 -2
- package/templates/javascript/src/content/scripts.js +7 -1
- package/templates/javascript/src/sidebar/SidebarApp.js +1 -3
- package/templates/javascript/src/sidebar/scripts.js +2 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
console.log('[From the page context] Hello from content_scripts!')
|
|
2
1
|
import createContentApp from './ContentApp.js'
|
|
3
2
|
import './styles.css'
|
|
4
3
|
|
|
4
|
+
console.log('[From the page context] Hello from content_scripts!')
|
|
5
|
+
|
|
5
6
|
/**
|
|
6
7
|
* Extension.js content_script entrypoint. The framework calls this on
|
|
7
8
|
* injection and calls the returned function on HMR/teardown to clean up.
|
|
@@ -10,6 +11,10 @@ import './styles.css'
|
|
|
10
11
|
export default function initial() {
|
|
11
12
|
const rootDiv = document.createElement('div')
|
|
12
13
|
rootDiv.setAttribute('data-extension-root', 'true')
|
|
14
|
+
// Isolate the host from page styles (e.g. example.com ships div{opacity:.8},
|
|
15
|
+
// which would otherwise fade the whole widget): the shadow DOM only protects
|
|
16
|
+
// descendants; the host element itself still takes page CSS.
|
|
17
|
+
rootDiv.style.cssText = 'all: initial !important'
|
|
13
18
|
document.body.appendChild(rootDiv)
|
|
14
19
|
|
|
15
20
|
// Injecting content_scripts inside a shadow dom
|
|
@@ -19,6 +24,7 @@ export default function initial() {
|
|
|
19
24
|
|
|
20
25
|
const styleElement = document.createElement('style')
|
|
21
26
|
shadowRoot.appendChild(styleElement)
|
|
27
|
+
|
|
22
28
|
fetchCSS().then((response) => (styleElement.textContent = response))
|
|
23
29
|
|
|
24
30
|
// Render ContentApp inside shadow root
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
console.log('[From the page context] Hello from content_scripts!')
|
|
2
1
|
import createContentApp from './ContentApp.js'
|
|
3
2
|
import './styles.css'
|
|
4
3
|
|
|
4
|
+
console.log('[From the page context] Hello from content_scripts!')
|
|
5
|
+
|
|
5
6
|
/**
|
|
6
7
|
* Extension.js content_script entrypoint. The framework calls this on
|
|
7
8
|
* injection and calls the returned function on HMR/teardown to clean up.
|
|
@@ -10,6 +11,10 @@ import './styles.css'
|
|
|
10
11
|
export default function initial() {
|
|
11
12
|
const rootDiv = document.createElement('div')
|
|
12
13
|
rootDiv.setAttribute('data-extension-root', 'true')
|
|
14
|
+
// Isolate the host from page styles (e.g. example.com ships div{opacity:.8},
|
|
15
|
+
// which would otherwise fade the whole widget): the shadow DOM only protects
|
|
16
|
+
// descendants; the host element itself still takes page CSS.
|
|
17
|
+
rootDiv.style.cssText = 'all: initial !important'
|
|
13
18
|
document.body.appendChild(rootDiv)
|
|
14
19
|
|
|
15
20
|
// Injecting content_scripts inside a shadow dom
|
|
@@ -19,6 +24,7 @@ export default function initial() {
|
|
|
19
24
|
|
|
20
25
|
const styleElement = document.createElement('style')
|
|
21
26
|
shadowRoot.appendChild(styleElement)
|
|
27
|
+
|
|
22
28
|
fetchCSS().then((response) => (styleElement.textContent = response))
|
|
23
29
|
|
|
24
30
|
// Render ContentApp inside shadow root
|