diff --git a/.gitignore b/.gitignore index 9b1ee42..d83efe8 100644 --- a/.gitignore +++ b/.gitignore @@ -173,3 +173,4 @@ dist # Finder (MacOS) folder config .DS_Store +target diff --git a/bun.lockb b/bun.lockb index db61286..17015fe 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/bunfig.toml b/bunfig.toml new file mode 100644 index 0000000..7d5eb98 --- /dev/null +++ b/bunfig.toml @@ -0,0 +1 @@ +preload = ["./src/myPlugin.ts"] diff --git a/package.json b/package.json index 228135d..21d42ab 100644 --- a/package.json +++ b/package.json @@ -4,17 +4,21 @@ "type": "module", "scripts": { "start": "bun run src/index.tsx", - "dev": "bun run --hot src/index.tsx" + "dev": "bun run --watch --hot src/index.tsx" }, "devDependencies": { "@types/bun": "latest", "csstype": "^3.1.3" }, "peerDependencies": { - "typescript": "^5.0.0" + "typescript": "^5.7.2" }, "dependencies": { "lightningcss": "^1.29.1", - "serve-static-bun": "^0.5.3" + "pokedex-promise-v2": "^4.2.1", + "serve-static-bun": "^0.5.3", + "tree-sitter-cli": "^0.25.2", + "tree-sitter-typescript": "^0.23.2", + "web-tree-sitter": "^0.25.2" } } diff --git a/src/components/Button.tsx b/src/components/Button.tsx new file mode 100644 index 0000000..e69de29 diff --git a/src/components/Counter.state.ts b/src/components/Counter.state.ts new file mode 100644 index 0000000..ac7ac34 --- /dev/null +++ b/src/components/Counter.state.ts @@ -0,0 +1,22 @@ +import { createState } from "~/lib/state"; + +export default createState( + { value: 0 }, + { + add: (ctx) => ({ + onClick: () => { + const { value } = ctx.get(); + ctx.set({ value: value + 1 }); + ctx.$counter.innerText = String(value + 1); + }, + }), + counter: (_ctx) => ({}), + sub: (ctx) => ({ + onClick: () => { + const { value } = ctx.get(); + ctx.set({ value: value - 1 }); + ctx.$counter.innerText = String(value - 1); + }, + }), + }, +); diff --git a/src/components/Counter.tsx b/src/components/Counter.tsx new file mode 100644 index 0000000..c119070 --- /dev/null +++ b/src/components/Counter.tsx @@ -0,0 +1,14 @@ +import { useState } from "~/lib/hooks"; +import counterState from "./Counter.state"; + +export const Counter = () => { + const { sub, counter, add } = useState(counterState); + + return ( +
+ + 0 + +
+ ); +}; diff --git a/src/components/Heading.tsx b/src/components/Heading.tsx new file mode 100644 index 0000000..ab68473 --- /dev/null +++ b/src/components/Heading.tsx @@ -0,0 +1,43 @@ +import type { Styles } from "~/types"; + +interface HeadingProps { + children: JSX.Children; + as?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "div" | "span"; + size?: + | "xs" + | "sm" + | "base" + | "lg" + | "xl" + | "2xl" + | "3xl" + | "4xl" + | "5xl" + | "6xl" + | "7xl" + | "8xl" + | "9xl"; + style?: Styles; +} + +const Heading = ({ + children, + as = "span", + size = "base", + style, +}: HeadingProps) => { + const Tag = as; + return ( + + {children} + + ); +}; + +export default Heading; diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index 48f1e80..c2c477b 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -1,5 +1,7 @@ import Global from "~/lib/Global"; import Navigation from "./Navigation"; +import Heading from "./Heading"; +import { Link } from "./Link"; interface LayoutProps { children: JSX.Element | JSX.Element[]; @@ -7,29 +9,72 @@ interface LayoutProps { export default function Layout({ children }: LayoutProps) { return ( -
+ <> -
Header
- - {children} -
+
+
+
+ + + +
+ +
+
+
{children}
+ +
+ ); } diff --git a/src/components/Link.tsx b/src/components/Link.tsx new file mode 100644 index 0000000..1218308 --- /dev/null +++ b/src/components/Link.tsx @@ -0,0 +1,5 @@ +type Props = JSX.IntrinsicElements["a"]; + +export const Link = (props: Props) => { + return ; +}; diff --git a/src/components/Navigation.tsx b/src/components/Navigation.tsx index d880f42..f8038ab 100644 --- a/src/components/Navigation.tsx +++ b/src/components/Navigation.tsx @@ -13,13 +13,21 @@ export default function Navigation() {