-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(stencil):out of box functions, countor \ newtab timer \ events
- Loading branch information
Showing
28 changed files
with
462 additions
and
127 deletions.
There are no files selected for viewing
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
console.log('background is running') | ||
|
||
chrome.runtime.onMessage.addListener((request) => { | ||
if (request.type === 'COUNT') { | ||
console.log('background has received a message from popup, and count is ', request?.count) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
template-stencil-ts/src/components/devtools-root/devtools-root.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
:root { | ||
font-family: | ||
system-ui, | ||
-apple-system, | ||
BlinkMacSystemFont, | ||
'Segoe UI', | ||
Roboto, | ||
Oxygen, | ||
Ubuntu, | ||
Cantarell, | ||
'Open Sans', | ||
'Helvetica Neue', | ||
sans-serif; | ||
|
||
color-scheme: light dark; | ||
background-color: #242424; | ||
} | ||
|
||
@media (prefers-color-scheme: light) { | ||
:root { | ||
background-color: #fafafa; | ||
} | ||
|
||
a:hover { | ||
color: #5530ff; | ||
} | ||
} | ||
|
||
body { | ||
min-width: 20rem; | ||
margin: 0; | ||
} | ||
|
||
body { | ||
min-width: 20rem; | ||
} | ||
|
||
main { | ||
text-align: center; | ||
padding: 1em; | ||
margin: 0 auto; | ||
} | ||
|
||
h3 { | ||
color: #5530ff; | ||
text-transform: uppercase; | ||
font-size: 1.5rem; | ||
font-weight: 200; | ||
line-height: 1.2rem; | ||
margin: 2rem auto; | ||
} | ||
|
||
a { | ||
font-size: 0.5rem; | ||
margin: 0.5rem; | ||
color: #cccccc; | ||
text-decoration: none; | ||
} | ||
|
25 changes: 25 additions & 0 deletions
25
template-stencil-ts/src/components/devtools-root/devtools-root.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Component, h } from '@stencil/core' | ||
|
||
chrome.devtools.panels.create('StencilCrx', '', '../../devtools.html', function () { | ||
console.log('devtools panel create') | ||
}) | ||
|
||
@Component({ | ||
tag: 'devtools-root', | ||
styleUrl: 'devtools-root.css', | ||
shadow: false, | ||
}) | ||
export class DevToolsRoot { | ||
private link = 'https://github.com/guocaoyi/create-chrome-ext' | ||
|
||
render() { | ||
return ( | ||
<main> | ||
<h3>DevTools Page</h3> | ||
<a href={this.link} target="_blank"> | ||
generated by create-chrome-ext | ||
</a> | ||
</main> | ||
) | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
template-stencil-ts/src/components/newtab-root/newtab-root.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
:root { | ||
font-family: | ||
system-ui, | ||
-apple-system, | ||
BlinkMacSystemFont, | ||
'Segoe UI', | ||
Roboto, | ||
Oxygen, | ||
Ubuntu, | ||
Cantarell, | ||
'Open Sans', | ||
'Helvetica Neue', | ||
sans-serif; | ||
|
||
color-scheme: light dark; | ||
background-color: #242424; | ||
} | ||
|
||
@media (prefers-color-scheme: light) { | ||
:root { | ||
background-color: #fafafa; | ||
} | ||
} | ||
|
||
body { | ||
min-width: 20rem; | ||
margin: 0; | ||
} | ||
|
||
section::before { | ||
content: ''; | ||
position: fixed; | ||
z-index: -1; | ||
width: 100vw; | ||
height: 100vh; | ||
background-image: url('https://source.unsplash.com/random'); | ||
background-size: cover; | ||
filter: blur(10px); | ||
} | ||
|
||
section { | ||
width: 100vw; | ||
height: 100vh; | ||
|
||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
align-items: center; | ||
} | ||
|
||
h1 { | ||
color: #5530ff; | ||
text-transform: uppercase; | ||
font-size: 6rem; | ||
margin: 2rem auto; | ||
} | ||
|
||
a { | ||
font-size: 0.5rem; | ||
margin: 0.5rem; | ||
color: #cccccc; | ||
text-decoration: none; | ||
} |
42 changes: 42 additions & 0 deletions
42
template-stencil-ts/src/components/newtab-root/newtab-root.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { Component, State, h } from '@stencil/core' | ||
|
||
const getTime = () => { | ||
const date = new Date() | ||
const hour = String(date.getHours()).padStart(2, '0') | ||
const minute = String(date.getMinutes()).padStart(2, '0') | ||
return `${hour}:${minute}` | ||
} | ||
|
||
@Component({ | ||
tag: 'newtab-root', | ||
styleUrl: 'newtab-root.css', | ||
shadow: false, | ||
}) | ||
export class NewTabRoot { | ||
private link = 'https://github.com/guocaoyi/create-chrome-ext' | ||
private intervalId: any | ||
|
||
@State() time = getTime() | ||
|
||
componentDidRender() { | ||
this.intervalId = setInterval(() => { | ||
this.time = getTime() | ||
}, 1000) | ||
} | ||
|
||
disconnectedCallback() { | ||
clearInterval(this.intervalId) | ||
} | ||
|
||
render() { | ||
return ( | ||
<section> | ||
<span></span> | ||
<h1>{this.time}</h1> | ||
<a href={this.link} target="_blank"> | ||
generated by create-chrome-ext | ||
</a> | ||
</section> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 21 additions & 9 deletions
30
template-stencil-ts/src/components/options-root/options-root.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.