This repository has been archived by the owner on Sep 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
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
1 parent
e066c9c
commit 5ad6758
Showing
23 changed files
with
179 additions
and
12 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
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,12 @@ | ||
import { JSX } from "preact"; | ||
import { IS_BROWSER } from "$fresh/runtime.ts"; | ||
|
||
export function Button(props: JSX.HTMLAttributes<HTMLButtonElement>) { | ||
return ( | ||
<button | ||
{...props} | ||
disabled={!IS_BROWSER || props.disabled} | ||
class="px-2 py-1 border(gray-100 2) hover:bg-gray-200" | ||
/> | ||
); | ||
} |
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 { Head } from "$fresh/runtime.ts" | ||
|
||
export function Meta({ pageTitle }: { pageTitle: string }) { | ||
const title = `Capi Console –– ${pageTitle}` | ||
return ( | ||
<Head> | ||
<title>{title}</title> | ||
<meta name="description" content={title} /> | ||
</Head> | ||
) | ||
} |
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,6 +1,8 @@ | ||
{ | ||
"compilerOptions": { | ||
"checkJs": false, | ||
"jsx": "react-jsx", | ||
"jsxImportSource": "preact", | ||
"noFallthroughCasesInSwitch": true, | ||
"noImplicitOverride": true, | ||
"noImplicitReturns": true, | ||
|
@@ -38,6 +40,7 @@ | |
"test": "deno task run test_util/ctx.ts -- deno test -A -L=info --ignore=target --parallel", | ||
"test:update": "deno task test -- -- --update", | ||
"bench": "deno bench -A", | ||
"moderate": "deno task run https://deno.land/x/[email protected]/mod.ts && dprint fmt" | ||
"moderate": "deno task run https://deno.land/x/[email protected]/mod.ts && dprint fmt", | ||
"start": "deno task run --watch=docs/,routes/,static/ dev.ts" | ||
} | ||
} |
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,3 @@ | ||
import dev from "$fresh/dev.ts" | ||
|
||
await dev(import.meta.url, "./main.ts") |
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,30 @@ | ||
// DO NOT EDIT. This file is generated by fresh. | ||
// This file SHOULD be checked into source version control. | ||
// This file is automatically updated during development when running `dev.ts`. | ||
|
||
import config from "./deno.json" assert { type: "json" }; | ||
import * as $0 from "./routes/[...path].tsx"; | ||
import * as $1 from "./routes/_404.tsx"; | ||
import * as $2 from "./routes/_500.tsx"; | ||
import * as $3 from "./routes/_app.tsx"; | ||
import * as $4 from "./routes/docs/[...path].tsx"; | ||
import * as $5 from "./routes/index.tsx"; | ||
import * as $$0 from "./islands/Counter.tsx"; | ||
|
||
const manifest = { | ||
routes: { | ||
"./routes/[...path].tsx": $0, | ||
"./routes/_404.tsx": $1, | ||
"./routes/_500.tsx": $2, | ||
"./routes/_app.tsx": $3, | ||
"./routes/docs/[...path].tsx": $4, | ||
"./routes/index.tsx": $5, | ||
}, | ||
islands: { | ||
"./islands/Counter.tsx": $$0, | ||
}, | ||
baseUrl: import.meta.url, | ||
config, | ||
}; | ||
|
||
export default manifest; |
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,4 +1,14 @@ | ||
{ | ||
"imports": { | ||
"$fresh/": "https://deno.land/x/[email protected]/", | ||
"preact": "https://esm.sh/[email protected]", | ||
"preact/": "https://esm.sh/[email protected]/", | ||
"preact-render-to-string": "https://esm.sh/*[email protected]", | ||
"@preact/signals": "https://esm.sh/*@preact/[email protected]", | ||
"@preact/signals-core": "https://esm.sh/*@preact/[email protected]", | ||
"twind": "https://esm.sh/[email protected]", | ||
"twind/": "https://esm.sh/[email protected]/" | ||
}, | ||
"scopes": { | ||
"examples/": { | ||
"http://localhost:5646/@local/": "./", | ||
|
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,17 @@ | ||
import { useState } from "preact/hooks"; | ||
import { Button } from "../components/Button.tsx"; | ||
|
||
interface CounterProps { | ||
start: number; | ||
} | ||
|
||
export default function Counter(props: CounterProps) { | ||
const [count, setCount] = useState(props.start); | ||
return ( | ||
<div class="flex gap-2 w-full"> | ||
<p class="flex-grow-1 font-bold text-xl">{count}</p> | ||
<Button onClick={() => setCount(count - 1)}>-1</Button> | ||
<Button onClick={() => setCount(count + 1)}>+1</Button> | ||
</div> | ||
); | ||
} |
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,19 @@ | ||
/// <reference no-default-lib="true" /> | ||
/// <reference lib="dom" /> | ||
/// <reference lib="dom.iterable" /> | ||
/// <reference lib="dom.asynciterable" /> | ||
/// <reference lib="deno.ns" /> | ||
|
||
import twindPlugin from "$fresh/plugins/twind.ts" | ||
import { start } from "$fresh/server.ts" | ||
import manifest from "./fresh.gen.ts" | ||
import twindConfig from "./twind.config.ts" | ||
|
||
const abortController = new AbortController() | ||
|
||
await start(manifest, { | ||
signal: abortController.signal, | ||
plugins: [ | ||
twindPlugin(twindConfig), | ||
], | ||
}) |
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,12 @@ | ||
import { Handlers } from "$fresh/server.ts" | ||
|
||
export const handler: Handlers = { | ||
GET(_req, ctx) { | ||
const path = ctx.params.path! | ||
try { | ||
return new Response(Deno.readFileSync(path)) | ||
} catch (_e) { | ||
return ctx.renderNotFound() | ||
} | ||
}, | ||
} |
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,5 @@ | ||
import { UnknownPageProps } from "$fresh/server.ts" | ||
|
||
export default function NotFoundPage({ url }: UnknownPageProps) { | ||
return <p>404 not found: {url.pathname}</p> | ||
} |
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 { ErrorPageProps } from "$fresh/server.ts" | ||
|
||
export default function ErrorPage({ error }: ErrorPageProps) { | ||
return ( | ||
<p> | ||
500 internal error: {error instanceof Error | ||
? error.message | ||
: `the following data was thrown: ${JSON.stringify(error)}`} | ||
</p> | ||
) | ||
} |
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,9 @@ | ||
import { AppProps } from "$fresh/server.ts" | ||
|
||
export default function App({ Component }: AppProps) { | ||
return ( | ||
<body> | ||
<Component /> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { PageProps } from "$fresh/server.ts" | ||
|
||
export default function DocsPage({ params }: PageProps) { | ||
const path = params.path! | ||
return <p>Docs –– {path}</p> | ||
} |
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,12 @@ | ||
import { Meta } from "../components/Meta.tsx" | ||
|
||
export default function LandingPage() { | ||
return ( | ||
<> | ||
<Meta pageTitle="Landing" />, | ||
<div class="p-4 mx-auto max-w-screen-md"> | ||
Welcome to the Capi Console | ||
</div>, | ||
</> | ||
) | ||
} |
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,4 +1,5 @@ | ||
import { LocalCapiCodegenServer } from "./server/local.ts" | ||
|
||
console.log("Listening on http://localhost:5646/") | ||
|
||
new LocalCapiCodegenServer().listen(5646) |
Binary file not shown.
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,5 @@ | ||
import { Options } from "$fresh/plugins/twind.ts" | ||
|
||
export default ((): Options => ({ | ||
selfURL: import.meta.url, | ||
}))() |
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 |
---|---|---|
|
@@ -209,3 +209,7 @@ paritypr | |
lparachain | ||
unioned | ||
rustc | ||
twind | ||
preact | ||
asynciterable | ||
sastan |