-
-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add svelte support --------- Co-authored-by: Cezar Augusto <boss@cezaraugusto.net>
- Loading branch information
1 parent
09ac34e
commit 44d4169
Showing
21 changed files
with
717 additions
and
10 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
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,31 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
node_modules | ||
|
||
# testing | ||
coverage | ||
|
||
# production | ||
dist | ||
|
||
# misc | ||
.DS_Store | ||
|
||
# local env files | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
# lock files | ||
yarn.lock | ||
package-lock.json | ||
|
||
# debug files | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# extension.js | ||
extension-env.d.ts |
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,13 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/chrome-manifest.json", | ||
"manifest_version": 3, | ||
"version": "0.0.1", | ||
"name": "New Tab Svelte", | ||
"description": "An Extension.js example.", | ||
"icons": { | ||
"48": "images/extension_48.png" | ||
}, | ||
"chrome_url_overrides": { | ||
"newtab": "newtab/index.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,18 @@ | ||
<script lang="ts"> | ||
let message = 'Welcome to your Svelte Extension.' | ||
</script> | ||
|
||
<header> | ||
<h1> | ||
<img class="svelte" src="/logo.png" alt="The Svelte logo" width="120px" /> | ||
<br /> | ||
{message} | ||
</h1> | ||
<p> | ||
Learn more about creating browser extensions at | ||
<a href="https://extension.js.org" target="_blank"> | ||
https://extension.js.org | ||
</a> | ||
. | ||
</p> | ||
</header> |
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" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<title>Svelte Template</title> | ||
</head> | ||
<body> | ||
<noscript>You need to enable JavaScript to run this extension.</noscript> | ||
<div id="app"></div> | ||
</body> | ||
<script type="module" src="./script.ts"></script> | ||
</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,8 @@ | ||
import 'sakura.css' | ||
import './styles.css' | ||
import App from './NewTabApp.svelte' | ||
|
||
const app = new App({ | ||
target: document.getElementById('app')! | ||
}) | ||
export default app |
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,85 @@ | ||
html { | ||
font-size: 62.5%; | ||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, | ||
'Helvetica Neue', Arial, 'Noto Sans', sans-serif; | ||
} | ||
|
||
body { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: calc(100vh - 4rem); | ||
min-width: 300px; | ||
padding: 2rem; | ||
font-size: 1.8rem; | ||
line-height: 1.618; | ||
max-width: 38em; | ||
margin: auto; | ||
color: #c9c9c9; | ||
background-color: #0a0c10; | ||
} | ||
|
||
@media (max-width: 684px) { | ||
body { | ||
font-size: 1.53rem; | ||
} | ||
} | ||
|
||
@media (max-width: 382px) { | ||
body { | ||
font-size: 1.35rem; | ||
} | ||
} | ||
|
||
h1 { | ||
line-height: 1.1; | ||
font-weight: 700; | ||
margin-bottom: 1.5rem; | ||
overflow-wrap: break-word; | ||
word-wrap: break-word; | ||
word-break: break-word; | ||
font-size: 4.7em; | ||
} | ||
|
||
@media (max-width: 684px) { | ||
h1 { | ||
font-size: 2.7em; | ||
} | ||
} | ||
|
||
p { | ||
margin-top: 0px; | ||
margin-bottom: 2.5rem; | ||
} | ||
|
||
a { | ||
text-decoration: none; | ||
border-bottom: 2px solid #c9c9c9; | ||
color: #e5e7eb; | ||
} | ||
|
||
img { | ||
height: auto; | ||
max-width: 100%; | ||
margin-top: 0px; | ||
margin-bottom: 2.5rem; | ||
} | ||
|
||
@media (max-width: 684px) { | ||
img { | ||
margin-top: 2rem; | ||
margin-bottom: 1rem; | ||
} | ||
} | ||
|
||
body { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: calc(100vh - 4rem); | ||
} | ||
|
||
header > div { | ||
display: flex; | ||
align-items: center; | ||
} |
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,20 @@ | ||
{ | ||
"private": true, | ||
"name": "new-tab", | ||
"description": "An Extension.js example.", | ||
"version": "0.0.1", | ||
"author": { | ||
"name": "Cezar Augusto", | ||
"email": "boss@cezaraugusto.net", | ||
"url": "https://cezaraugusto.com" | ||
}, | ||
"license": "MIT", | ||
"dependencies": { | ||
"svelte": "4.2.19", | ||
"sakura.css": "^1.5.0" | ||
}, | ||
"devDependencies": { | ||
"typescript": "5.3.3", | ||
"@tsconfig/svelte": "5.0.4" | ||
} | ||
} |
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,33 @@ | ||
import path from 'path' | ||
import {execSync} from 'child_process' | ||
import {extensionFixtures} from '../extension-fixtures' | ||
|
||
const exampleDir = 'examples/new-svelte' | ||
const pathToExtension = path.join(__dirname, `dist/chrome`) | ||
const test = extensionFixtures(pathToExtension, true) | ||
|
||
test.beforeAll(async () => { | ||
execSync(`pnpm extension build ${exampleDir}`, { | ||
cwd: path.join(__dirname, '..') | ||
}) | ||
}) | ||
|
||
test('should exist an element with the welcome message text', async ({ | ||
page | ||
}) => { | ||
await page.goto('chrome://newtab/') | ||
const h1 = page.locator('h1') | ||
await test.expect(h1).toContainText('Welcome to your') | ||
}) | ||
|
||
test('should exist a default color value', async ({page}) => { | ||
await page.goto('chrome://newtab/') | ||
const h1 = page.locator('h1') | ||
const color = await page.evaluate( | ||
(locator) => { | ||
return window.getComputedStyle(locator!).getPropertyValue('color') | ||
}, | ||
await h1.elementHandle() | ||
) | ||
await test.expect(color).toEqual('rgb(201, 201, 201)') | ||
}) |
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,23 @@ | ||
{ | ||
"extends": "@tsconfig/svelte/tsconfig.json", | ||
"compilerOptions": { | ||
"allowJs": true, | ||
"allowSyntheticDefaultImports": true, | ||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"isolatedModules": true, | ||
"jsx": "react-jsx", | ||
"lib": ["dom", "dom.iterable", "esnext"], | ||
"moduleResolution": "node", | ||
"module": "esnext", | ||
"noEmit": true, | ||
"resolveJsonModule": true, | ||
"strict": true, | ||
"target": "esnext", | ||
"verbatimModuleSyntax": true, | ||
"useDefineForClassFields": true, | ||
"skipLibCheck": true | ||
}, | ||
"include": ["./"], | ||
"exclude": ["node_modules", "dist"] | ||
} |
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.