A Pen by Thomas Reggi on CodePen.
🌺
- GitHub Staff
- https://reggi.com
- @[email protected]
- in/thomasreggi
This file contains hidden or 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
| class Route { | |
| urlPattern: URLPattern | |
| constructor ( | |
| public method: string, | |
| public pathname: string, | |
| public handler: (req: Request) => Promise<Response> | Response | |
| ) { | |
| this.urlPattern = new URLPattern({ pathname }) | |
| } | |
| } |
This file contains hidden or 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
| import { serve } from "https://deno.land/[email protected]/http/server.ts"; | |
| import * as path from 'https://deno.land/[email protected]/path/mod.ts' | |
| import { parse } from "https://deno.land/[email protected]/encoding/yaml.ts"; | |
| const cwd = Deno.cwd() | |
| const results = `export const chungus = { | |
| love: true, | |
| meow: (v: string) => v | |
| }` |
This file contains hidden or 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
| import {clientImport} from '../main.ts' | |
| const e = await clientImport(import.meta.url, "../examples/web_components/content_warning.ts") | |
| console.log(e) |
This file contains hidden or 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
| import { JSX, ComponentChild, VNode } from "https://esm.sh/v96/[email protected]" | |
| import render from 'preact-render-to-string' | |
| // you need a way to ignore the type error for an async component | |
| const asyncComponent = (component: (props: any) => Promise<JSX.Element>): (props: any) => JSX.Element => { | |
| return component as any | |
| } | |
| const Alice = asyncComponent(async (props: { children: ComponentChild}) => { | |
| const x = await Promise.resolve('Alice') |
This file contains hidden or 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
| export type ElementEvents = | |
| "animationcancel" | | |
| "animationend" | | |
| "animationiteration" | | |
| "animationstart" | | |
| "afterscriptexecute" | | |
| "auxclick" | | |
| "beforescriptexecute" | | |
| "blur" | | |
| "click" | |
This file contains hidden or 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
| import { useContext } from 'preact/hooks'; | |
| import { createContext, Fragment, JSX } from 'preact'; | |
| import { HandlerContext, Handlers, PageProps } from "$fresh/server.ts"; | |
| const RequestContext = createContext(new Request('http://localhost:8000/')); | |
| const useRequest = () => useContext(RequestContext); | |
| export const passRequestHandler: Handlers<Request> = { | |
| GET(request, ctx) { |
This file contains hidden or 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
| import { Plugin } from "$fresh/server.ts"; | |
| const sources = [ | |
| "https://raw.githubusercontent.com/bigskysoftware/htmx/dev/src/htmx.js", | |
| "https://raw.githubusercontent.com/bigskysoftware/htmx/dev/src/ext/head-support.js" | |
| ] | |
| export default function htmx(): Plugin { | |
| const main = `data:application/javascript,${sources.map(s => `import "${s}";`).join('')} export default () => {}` | |
| return { |
This file contains hidden or 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
| /// <reference no-default-lib="true" /> | |
| /// <reference lib="dom" /> | |
| /// <reference lib="dom.asynciterable" /> | |
| /// <reference lib="deno.ns" /> | |
| /// <reference lib="deno.unstable" /> | |
| import { serve, ConnInfo } from "https://deno.land/[email protected]/http/server.ts"; | |
| import { InnerRenderFunction, RenderContext, ServerContext } from "$fresh/server.ts"; | |
| import manifest from "./fresh.gen.ts"; |
This file contains hidden or 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
| "editor.gotoLocation.multipleDefinitions": "goto", | |
| "editor.gotoLocation.multipleTypeDefinitions": "goto", | |
| "editor.gotoLocation.multipleDeclarations": "goto", | |
| "editor.gotoLocation.multipleImplementations": "goto", | |
| "editor.gotoLocation.multipleReferences": "goto", |