-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(solid):out of box functions, countor \ newtab timer \ events
- Loading branch information
Showing
57 changed files
with
858 additions
and
271 deletions.
There are no files selected for viewing
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,13 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" href="/icon/logo.ico" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Chrome Extension + Solid + JS + Vite</title> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="/src/devtools/index.jsx"></script> | ||
</body> | ||
</html> |
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,13 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" href="/icon/logo.ico" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Chrome Extension + Solid + JS + Vite</title> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="/src/newtab/index.jsx"></script> | ||
</body> | ||
</html> |
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
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
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
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
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 |
---|---|---|
@@ -1,3 +1,7 @@ | ||
console.info('chrome-ext template-svelte-ts background script') | ||
console.log('background is running') | ||
|
||
export {} | ||
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 was deleted.
Oops, something went wrong.
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 @@ | ||
console.info('contentScript is running') |
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
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,16 @@ | ||
import './DevTools.css' | ||
|
||
export const DevTools = () => { | ||
const link = 'https://github.com/guocaoyi/create-chrome-ext' | ||
|
||
return ( | ||
<main> | ||
<h3>DevTools Page</h3> | ||
<a href={link} target="_blank"> | ||
generated by create-chrome-ext | ||
</a> | ||
</main> | ||
) | ||
} | ||
|
||
export default DevTools |
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,28 @@ | ||
: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; | ||
} |
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,11 @@ | ||
/* @refresh reload */ | ||
import { render } from 'solid-js/web' | ||
|
||
import './index.css' | ||
import { DevTools } from './DevTools' | ||
|
||
render(() => <DevTools />, document.getElementById('app') ?? document.body) | ||
|
||
chrome.devtools.panels.create('SolidCrx', '', '../../devtools.html', function () { | ||
console.log('devtools panel create') | ||
}) |
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
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,34 @@ | ||
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: #142d61; | ||
text-transform: uppercase; | ||
font-size: 6rem; | ||
margin: 2rem auto; | ||
} | ||
|
||
a { | ||
font-size: 0.5rem; | ||
margin: 0.5rem; | ||
color: #cccccc; | ||
text-decoration: none; | ||
} |
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,33 @@ | ||
import { createSignal, onCleanup } from 'solid-js' | ||
|
||
import './NewTab.css' | ||
|
||
export const NewTab = () => { | ||
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}` | ||
} | ||
|
||
const [time, setTime] = createSignal(getTime()) | ||
const link = 'https://github.com/guocaoyi/create-chrome-ext' | ||
|
||
let interval = setInterval(() => { | ||
setTime(getTime()) | ||
}, 1000) | ||
|
||
onCleanup(() => clearInterval(interval)) | ||
|
||
return ( | ||
<section> | ||
<span></span> | ||
<h1>{time()}</h1> | ||
<a href={link} target="_blank"> | ||
generated by create-chrome-ext | ||
</a> | ||
</section> | ||
) | ||
} | ||
|
||
export default NewTab |
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,28 @@ | ||
: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; | ||
} |
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 @@ | ||
/* @refresh reload */ | ||
import { render } from 'solid-js/web' | ||
|
||
import './index.css' | ||
import { NewTab } from './NewTab' | ||
|
||
render(() => <NewTab />, document.getElementById('app') ?? document.body) |
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
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.