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 { renderToStaticMarkup } from "preact-render-to-string"; | |
| declare global { | |
| namespace preact.JSX { | |
| interface IntrinsicElements { | |
| "el-counter": preact.HTMLAttributes<HTMLElement>; | |
| } | |
| } | |
| } |
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
| type TMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE"; | |
| type THandler = ( | |
| req: Request, | |
| match: URLPatternResult | null, | |
| ) => Response | Promise<Response>; | |
| class Route { | |
| constructor( | |
| private pattern: URLPatternInput, |
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
| { | |
| "compilerOptions": { | |
| "lib": ["dom", "deno.ns"], | |
| "jsx": "precompile", | |
| "jsxImportSource": "preact" | |
| }, | |
| "tasks": { | |
| "dev": "deno run --allow-net --watch server.tsx", | |
| }, | |
| "imports": { |
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 React from "react"; | |
| function usePress(onEnd: (isCancelled: boolean) => void, onStart?: () => void) { | |
| return { | |
| onPointerUp(e: React.PointerEvent<Element>) { | |
| const rect = e.currentTarget.getBoundingClientRect(); | |
| onEnd( | |
| !( | |
| e.clientX >= rect.left && |
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 { useReducer, useEffect } from "react"; | |
| // pathToRegexp can be replaced with URLPattern once browser support improves | |
| // https://developer.mozilla.org/en-US/docs/Web/API/URLPattern | |
| import pathToRegexp from "path-to-regexp"; | |
| const Router = { | |
| PushStateEventType: "pushstate", | |
| ReplaceStateEventType: "replacestate", | |
| PopStateEventType: "popstate", |
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 React from "react" | |
| import { useLocation, useLoaderData, useFetcher } from "remix" | |
| export default function useLoaderDataWithWindowFocusRefetching<LoaderData>() { | |
| const loaderData = useLoaderData<LoaderData>() | |
| const fetcher = useFetcher<LoaderData>() | |
| const location = useLocation() | |
| const pathnameRef = React.useRef(location.pathname) | |
| React.useEffect(() => { |
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 React from "react" | |
| import { useLocation, useNavigate } from "remix" | |
| export default function useWindowFocusRefetching() { | |
| const location = useLocation() | |
| const navigate = useNavigate() | |
| const pathnameRef = React.useRef(location.pathname) | |
| React.useEffect(() => { |
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
| // add to your tailwind.config.js | |
| const plugin = require("tailwindcss/plugin") | |
| const radixPlugin = plugin(({ addVariant }) => { | |
| const dataStates = [ | |
| "open", | |
| "closed", | |
| "active", | |
| "inactive", |
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
| Machine({ | |
| id: "booking", | |
| context: { | |
| newsletterIndex: null, | |
| placementId: null, | |
| availabilityId: null, | |
| reservationId: null | |
| }, | |
| type: "parallel", | |
| states: { |
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
| Machine({ | |
| id: "booking", | |
| context: { | |
| newsletterIndex: null, | |
| placementId: null, | |
| availabilityId: null, | |
| }, | |
| type: "parallel", | |
| states: { | |
| booking: { |
NewerOlder