This repository has been archived by the owner on Aug 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
2,725 additions
and
4,021 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
let count = 0; | ||
|
||
export const getCount = () => count; | ||
|
||
export const setCount = (num: number) => { | ||
count = num | ||
} |
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 @@ | ||
import { getCount, setCount } from "./count"; | ||
|
||
|
||
// Telefunc ensures that `diff` is a `number` at runtime, see https://telefunc.com/shield#typescript | ||
async function onCounterIncrement(diff: number) { | ||
const c = getCount() + diff | ||
setCount(c); | ||
return c | ||
} | ||
|
||
export { onCounterIncrement }; |
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,24 +1,20 @@ | ||
<script lang="ts"> | ||
import Footer from "./footer.svelte"; | ||
import Island from "./Island.svelte"; | ||
// import Inner from "./inner.svelte"; | ||
import math, { pi } from "./math"; | ||
export let count: number; | ||
export let counter: string; | ||
const data = JSON.stringify(count); | ||
const list = [{ age: 100 }]; | ||
const num = new Array(100).fill(0).map((_, i) => i); | ||
function hydrate(node: any) { | ||
console.log("use: ", node, math); | ||
} | ||
const href = "./style.css"; | ||
export let count: number; | ||
</script> | ||
|
||
<Footer {count} /> | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<script type="module" src="./script.ts"></script> | ||
<title>Telefunc</title> | ||
</head> | ||
<body> | ||
<div class="counter"> | ||
<span>Counter: <span class='dis'>{count}</span></span> | ||
<button class='dec'>-1</button> | ||
<button class='inc'>+1</button> | ||
</div> | ||
</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 |
---|---|---|
@@ -1,19 +1,15 @@ | ||
import "virtual:uno.css"; | ||
import { onCounterIncrement } from "../actions/counter.telefunc" | ||
|
||
import Footer from "./footer.svelte"; | ||
const dis = document.querySelector('.dis') | ||
const inc = document.querySelector('.inc') | ||
const dec = document.querySelector('.dec') | ||
|
||
import Island from "./Island.svelte"; | ||
inc?.addEventListener('click', async () => { | ||
const r = await onCounterIncrement(+1) | ||
dis!.textContent = r.toString() | ||
}) | ||
|
||
// import { SERVER } from "$env/private"; | ||
|
||
// const data = JSON.parse(document.getElementById("data")!.textContent!); | ||
|
||
// const counter = new Island({ | ||
// hydrate: true, | ||
// props: { count: 0 }, | ||
// target: document.querySelector(".island")!, | ||
// }); | ||
|
||
// console.log(Island); | ||
|
||
// console.log(SERVER); | ||
dec?.addEventListener('click', async () => { | ||
const r = await onCounterIncrement(-1) | ||
dis!.textContent = r.toString() | ||
}) |
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,17 +1,19 @@ | ||
import { defineConfig } from "vite"; | ||
|
||
import UnoCSS from "unocss/vite"; | ||
import extractorSvelte from "@unocss/extractor-svelte"; | ||
import UnoCSS from "unocss/vite"; | ||
|
||
import { telefunc } from 'telefunc/vite'; | ||
|
||
import { fullstack } from "@leanweb/fullstack"; | ||
import simpleScope from "vite-plugin-simple-scope"; | ||
import tailwindcss from "@vituum/vite-plugin-tailwindcss"; | ||
|
||
export default defineConfig({ | ||
// base: "/static", | ||
plugins: [ | ||
UnoCSS({ extractors: [extractorSvelte()] }), | ||
fullstack(), | ||
simpleScope(), | ||
telefunc() | ||
], | ||
}); |
Oops, something went wrong.