Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
arperyan authored Jun 21, 2021
0 parents commit 224ce6b
Show file tree
Hide file tree
Showing 16 changed files with 422 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# svelte-web-comp-vite

1 change: 1 addition & 0 deletions dist/count-btn.es.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/count-btn.umd.js

Large diffs are not rendered by default.

Binary file added dist/favicon.ico
Binary file not shown.
13 changes: 13 additions & 0 deletions index.html
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="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Svelte + Vite App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/dist/count-btn.umd.js"></script>
</body>
</html>
34 changes: 34 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"compilerOptions": {
"moduleResolution": "node",
"target": "esnext",
"module": "esnext",
/**
* svelte-preprocess cannot figure out whether you have
* a value or a type, so tell TypeScript to enforce using
* `import type` instead of `import` for Types.
*/
"importsNotUsedAsValues": "error",
"isolatedModules": true,
"resolveJsonModule": true,
/**
* To have warnings / errors of the Svelte compiler at the
* correct position, enable source maps by default.
*/
"sourceMap": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"baseUrl": ".",
/**
* Typecheck JS in `.svelte` and `.js` files by default.
* Disable this if you'd like to use dynamic types.
*/
"checkJs": true
},
/**
* Use global.d.ts instead of compilerOptions.types
* to avoid limiting type declarations.
*/
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte"]
}
228 changes: 228 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "count-btn",
"files": [
"dist"
],
"main": "./dist/count-btn.js",
"module": "./dist/count-btn.es.js",
"version": "0.0.0",
"scripts": {
"dev": "vite",
"build": "vite build",
"serve": "vite preview"
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^1.0.0-next.11",
"svelte": "^3.37.0",
"vite": "^2.3.7"
}
}
Binary file added public/favicon.ico
Binary file not shown.
48 changes: 48 additions & 0 deletions src/App.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<svelte:options tag="svelte-app" />

<script>
import logo from "./assets/svelte.png";
import Counter from "./lib/Counter.svelte";
export let count = 0;
</script>

<main>
<img src={logo} alt="Svelte Logo" />
<h1>Hello world!</h1>

<count-btn {count} />
</main>

<style>
:root {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}
main {
text-align: center;
padding: 1em;
margin: 0 auto;
}
img {
height: 16rem;
width: 16rem;
}
h1 {
color: #ff3e00;
text-transform: uppercase;
font-size: 4rem;
font-weight: 100;
line-height: 1.1;
margin: 2rem auto;
max-width: 14rem;
}
@media (min-width: 480px) {
h1 {
max-width: none;
}
}
</style>
Binary file added src/assets/svelte.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions src/lib/Counter.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<svelte:options tag="count-btn" />

<script>
export let count = 0;
const increment = () => {
count = +count + 1;
};
</script>

<button class="button" on:click={increment}>
Clicks: {count}
</button>

<style>
.button {
font-family: inherit;
font-size: inherit;
padding: 1em 2em;
color: #ff3e00;
background-color: rgba(255, 62, 0, 0.1);
border-radius: 2em;
border: 2px solid rgba(255, 62, 0, 0);
outline: none;
width: 200px;
font-variant-numeric: tabular-nums;
cursor: pointer;
}
.button:focus {
border: 2px solid #ff3e00;
}
.button:active {
background-color: rgba(255, 62, 0, 0.2);
}
</style>
5 changes: 5 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import App from "./App.svelte";

const app = new App();

export default app;
2 changes: 2 additions & 0 deletions src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/// <reference types="svelte" />
/// <reference types="vite/client" />
Loading

0 comments on commit 224ce6b

Please sign in to comment.