index
int64
0
0
repo_id
stringlengths
16
181
file_path
stringlengths
28
270
content
stringlengths
1
11.6M
__index_level_0__
int64
0
10k
0
petrpan-code/emilkowalski/sonner
petrpan-code/emilkowalski/sonner/website/.eslintrc.json
{ "extends": "next/core-web-vitals" }
7,200
0
petrpan-code/emilkowalski/sonner
petrpan-code/emilkowalski/sonner/website/README.md
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). ## Getting Started First, run the development server: ```bash npm run dev # or yarn dev # or pnpm dev ``` Open [http://localhost:3000](http://localhost:3000...
7,201
0
petrpan-code/emilkowalski/sonner
petrpan-code/emilkowalski/sonner/website/next.config.js
/** @type {import('next').NextConfig} */ const nextConfig = { experimental: { appDir: true, }, }; const withNextra = require('nextra')({ title: 'Sonner', theme: 'nextra-theme-docs', themeConfig: './theme.config.jsx', defaultShowCopyCode: true, }); module.exports = withNextra(nextConfig);
7,202
0
petrpan-code/emilkowalski/sonner
petrpan-code/emilkowalski/sonner/website/package-lock.json
{ "name": "website", "version": "0.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { "@babel/runtime": { "version": "7.20.13", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.13.tgz", "integrity": "sha512-gt3PKXs0DBoL9xCvOIIZ2NEqAGZqHjAnmVbfQtB620V0uRe...
7,203
0
petrpan-code/emilkowalski/sonner
petrpan-code/emilkowalski/sonner/website/package.json
{ "name": "website", "version": "0.1.0", "scripts": { "dev": "next dev", "build": "next build", "start": "next start", "lint": "next lint" }, "dependencies": { "@types/node": "18.11.18", "@types/react": "18.2.0", "@types/react-dom": "18.0.10", "@vercel/analytics": "^0.1.11", ...
7,204
0
petrpan-code/emilkowalski/sonner
petrpan-code/emilkowalski/sonner/website/postcss.config.js
module.exports = { plugins: { tailwindcss: {}, autoprefixer: {}, }, }
7,205
0
petrpan-code/emilkowalski/sonner
petrpan-code/emilkowalski/sonner/website/tailwind.config.js
module.exports = { content: [ './app/**/*.{js,ts,jsx,tsx,mdx}', './pages/**/*.{js,ts,jsx,tsx,mdx}', './components/**/*.{js,ts,jsx,tsx,mdx}', // Or if using `src` directory: './src/**/*.{js,ts,jsx,tsx,mdx}', ], theme: { extend: {}, }, plugins: [], };
7,206
0
petrpan-code/emilkowalski/sonner
petrpan-code/emilkowalski/sonner/website/theme.config.jsx
export default { logo: <span style={{ fontWeight: 600 }}>Sonner</span>, project: { link: 'https://github.com/emilkowalski/sonner', }, docsRepositoryBase: 'https://github.com/emilkowalski/sonner/tree/main/website', useNextSeoProps() { return { titleTemplate: '%s – Sonner', }; }, feedback:...
7,207
0
petrpan-code/emilkowalski/sonner
petrpan-code/emilkowalski/sonner/website/tsconfig.json
{ "compilerOptions": { "target": "es5", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "strict": true, "forceConsistentCasingInFileNames": true, "noEmit": true, "esModuleInterop": true, "module": "esnext", "moduleResolution": "node", "resol...
7,208
0
petrpan-code/emilkowalski/sonner/website
petrpan-code/emilkowalski/sonner/website/.vscode/settings.json
{ "typescript.tsdk": "../node_modules/.pnpm/typescript@4.9.5/node_modules/typescript/lib", "typescript.enablePromptUseWorkspaceTsdk": true }
7,209
0
petrpan-code/emilkowalski/sonner/website
petrpan-code/emilkowalski/sonner/website/src/globals.css
:root { --gray0: #fff; --gray1: hsl(0, 0%, 99%); --gray2: hsl(0, 0%, 97.3%); --gray3: hsl(0, 0%, 95.1%); --gray4: hsl(0, 0%, 93%); --gray5: hsl(0, 0%, 90.9%); --gray6: hsl(0, 0%, 88.7%); --gray7: hsl(0, 0%, 85.8%); --gray8: hsl(0, 0%, 78%); --gray9: hsl(0, 0%, 56.1%); --gray10: hsl(0, 0%, 52.3%); ...
7,210
0
petrpan-code/emilkowalski/sonner/website
petrpan-code/emilkowalski/sonner/website/src/style.css
@tailwind base; @tailwind components; @tailwind utilities; :root { --gray0: #fff; --gray1: hsl(0, 0%, 99%); --gray2: hsl(0, 0%, 97.3%); --gray3: hsl(0, 0%, 95.1%); --gray4: hsl(0, 0%, 93%); --gray5: hsl(0, 0%, 90.9%); --gray6: hsl(0, 0%, 88.7%); --gray7: hsl(0, 0%, 85.8%); --gray8: hsl(0, 0%, 78%); ...
7,211
0
petrpan-code/emilkowalski/sonner/website/src/components
petrpan-code/emilkowalski/sonner/website/src/components/CodeBlock/code-block.module.css
.root { padding: 16px; margin: 0; background: var(--gray1); border-radius: 0; position: relative; line-height: 17px; white-space: pre-wrap; background: linear-gradient(to top, var(--gray2), var(--gray1) 16px); } .wrapper { overflow: hidden; margin: 0; position: relative; border-radius: 6px; m...
7,212
0
petrpan-code/emilkowalski/sonner/website/src/components
petrpan-code/emilkowalski/sonner/website/src/components/CodeBlock/index.tsx
import React from 'react'; import Highlight, { defaultProps } from 'prism-react-renderer'; import useMeasure from 'react-use-measure'; import copy from 'copy-to-clipboard'; import { AnimatePresence, motion, MotionConfig } from 'framer-motion'; import styles from './code-block.module.css'; const variants = { visible...
7,213
0
petrpan-code/emilkowalski/sonner/website/src/components
petrpan-code/emilkowalski/sonner/website/src/components/ExpandModes/index.tsx
import { toast } from 'sonner'; import { CodeBlock } from '../CodeBlock'; export const ExpandModes = ({ expand, setExpand, }: { expand: boolean; setExpand: React.Dispatch<React.SetStateAction<boolean>>; }) => { return ( <div> <h2>Expand</h2> <p> You can change the amount of toasts vis...
7,214
0
petrpan-code/emilkowalski/sonner/website/src/components
petrpan-code/emilkowalski/sonner/website/src/components/Footer/footer.module.css
.wrapper { padding: 32px 0; border-top: 1px solid var(--gray3); background: var(--gray1); margin-top: 164px; } .p { display: flex; align-items: center; gap: 12px; margin: 0; font-size: 14px; } .p img { border-radius: 50%; } .p a { font-weight: 600; color: inherit; text-decoration: none; } ...
7,215
0
petrpan-code/emilkowalski/sonner/website/src/components
petrpan-code/emilkowalski/sonner/website/src/components/Footer/index.tsx
import Image from 'next/image'; import emil from 'public/emil.jpeg'; import styles from './footer.module.css'; export const Footer = () => { return ( <footer className={styles.wrapper}> <div className="container"> <p className={styles.p}> <Image alt="Emil's profile picture" src={emil} hei...
7,216
0
petrpan-code/emilkowalski/sonner/website/src/components
petrpan-code/emilkowalski/sonner/website/src/components/Head/index.tsx
import NextHead from 'next/head'; const ogImage = 'https://sonner.emilkowal.ski/og.png'; const Head = () => ( <NextHead> {/* Title */} <title>Sonner</title> <meta name="og:title" content="Sonner" /> {/* Description */} <meta name="description" content="An opinionated toast component for React."...
7,217
0
petrpan-code/emilkowalski/sonner/website/src/components
petrpan-code/emilkowalski/sonner/website/src/components/Hero/hero.module.css
.wrapper { display: flex; flex-direction: column; gap: 12px; align-items: center; } .toastWrapper { display: flex; flex-direction: column; margin: 0 auto; height: 100px; width: 400px; position: relative; mask-image: linear-gradient(to top, transparent 0%, black 35%); opacity: 1; } .toast { w...
7,218
0
petrpan-code/emilkowalski/sonner/website/src/components
petrpan-code/emilkowalski/sonner/website/src/components/Hero/index.tsx
import { toast } from 'sonner'; import styles from './hero.module.css'; import Link from 'next/link'; export const Hero = () => { return ( <div className={styles.wrapper}> <div className={styles.toastWrapper}> <div className={styles.toast} /> <div className={styles.toast} /> <div c...
7,219
0
petrpan-code/emilkowalski/sonner/website/src/components
petrpan-code/emilkowalski/sonner/website/src/components/How/How.tsx
import React from 'react'; export const How = () => { return ( <div> <h2>How is it made?</h2> <p> You can read about why and how it was built{' '} <a href="https://emilkowal.ski/ui/building-a-toast-component" target="_blank" style={{ textDecoration: 'unde...
7,220
0
petrpan-code/emilkowalski/sonner/website/src/components
petrpan-code/emilkowalski/sonner/website/src/components/Installation/index.tsx
'use client'; import React from 'react'; import copy from 'copy-to-clipboard'; import { motion, AnimatePresence, MotionConfig } from 'framer-motion'; import styles from './installation.module.css'; const variants = { visible: { opacity: 1, scale: 1 }, hidden: { opacity: 0, scale: 0.5 }, }; export const Installa...
7,221
0
petrpan-code/emilkowalski/sonner/website/src/components
petrpan-code/emilkowalski/sonner/website/src/components/Installation/installation.module.css
.code { padding: 0 62px 0 12px; border-radius: 6px; background: linear-gradient(to top, var(--gray2), var(--gray1) 8px); font-family: var(--font-mono); font-size: 14px; position: relative; cursor: copy; height: 40px; border: 1px solid var(--gray3); display: flex; align-items: center; } .copy { ...
7,222
0
petrpan-code/emilkowalski/sonner/website/src/components
petrpan-code/emilkowalski/sonner/website/src/components/Other/Other.tsx
import React from 'react'; import { useMemo } from 'react'; import { toast } from 'sonner'; import { CodeBlock } from '../CodeBlock'; import styles from './other.module.css'; export const Other = ({ setRichColors, setCloseButton, }: { setRichColors: React.Dispatch<React.SetStateAction<boolean>>; setCloseButton...
7,223
0
petrpan-code/emilkowalski/sonner/website/src/components
petrpan-code/emilkowalski/sonner/website/src/components/Other/other.module.css
ol[dir='ltr'] .headlessClose { --headless-close-start: unset; --headless-close-end: 6px; } ol[dir='rtl'] .headlessClose { --headless-close-start: 6px; --headless-close-end: unset; } .headless { padding: 16px; width: 356px; box-sizing: border-box; border-radius: 8px; background: var(--gray1); borde...
7,224
0
petrpan-code/emilkowalski/sonner/website/src/components
petrpan-code/emilkowalski/sonner/website/src/components/Position/index.tsx
import { toast } from 'sonner'; import { CodeBlock } from '../CodeBlock'; import React from 'react'; const positions = ['top-left', 'top-center', 'top-right', 'bottom-left', 'bottom-center', 'bottom-right'] as const; export type Position = (typeof positions)[number]; export const Position = ({ position: activePosi...
7,225
0
petrpan-code/emilkowalski/sonner/website/src/components
petrpan-code/emilkowalski/sonner/website/src/components/Types/Types.tsx
import React from 'react'; import { toast } from 'sonner'; import { CodeBlock } from '../CodeBlock'; const promiseCode = '`${data.name} toast has been added`'; export const Types = () => { const [activeType, setActiveType] = React.useState(allTypes[0]); return ( <div> <h2>Types</h2> <p>You can cu...
7,226
0
petrpan-code/emilkowalski/sonner/website/src/components
petrpan-code/emilkowalski/sonner/website/src/components/Usage/index.tsx
import { CodeBlock } from '../CodeBlock'; export const Usage = () => { return ( <div> <h2>Usage</h2> <p>Render the toaster in the root of your app.</p> <CodeBlock initialHeight={270}>{`import { Toaster, toast } from 'sonner' // ... function App() { return ( <div> <Toaster /> ...
7,227
0
petrpan-code/emilkowalski/sonner/website/src
petrpan-code/emilkowalski/sonner/website/src/pages/_app.tsx
import type { ReactElement } from 'react'; import type { AppProps } from 'next/app'; import { Analytics } from '@vercel/analytics/react'; import '../style.css'; import '../globals.css'; export default function Nextra({ Component, pageProps }: AppProps): ReactElement { return ( <> {/* @ts-ignore */} <...
7,228
0
petrpan-code/emilkowalski/sonner/website/src
petrpan-code/emilkowalski/sonner/website/src/pages/_meta.json
{ "getting-started": { "title": "Getting Started", "href": "/getting-started" }, "-- API": { "type": "separator", "title": "API" }, "toast": { "title": "toast()", "href": "/toast" }, "toaster": { "title": "Toaster", "href": "/toaster" }, "-- GUIDES": { "type": "sepa...
7,229
0
petrpan-code/emilkowalski/sonner/website/src
petrpan-code/emilkowalski/sonner/website/src/pages/getting-started.mdx
import { Tab, Tabs, Cards, Card, Steps } from 'nextra-theme-docs'; import { toast } from 'sonner'; # Getting Started Sonner is an opinionated toast component for React. You can read more about why and how it was built [here](https://emilkowal.ski/ui/building-a-toast-component). <Steps> ### Install <Tabs items={['pn...
7,230
0
petrpan-code/emilkowalski/sonner/website/src
petrpan-code/emilkowalski/sonner/website/src/pages/index.tsx
import React from 'react'; import { Toaster } from 'sonner'; import { Installation } from '@/src/components/Installation'; import { Hero } from '@/src/components/Hero'; import { Types } from '@/src/components/Types/Types'; import { ExpandModes } from '@/src/components/ExpandModes'; import { Footer } from '@/src/compone...
7,231
0
petrpan-code/emilkowalski/sonner/website/src
petrpan-code/emilkowalski/sonner/website/src/pages/styling.mdx
# Styling Styling can be done globally via `toastOptions`, this way every toast will have the same styling. ```jsx <Toaster toastOptions={{ style: { background: 'red', }, className: 'class', }} /> ``` You can also use the same props when calling `toast` to style a specific toast. ```jsx toast(...
7,232
0
petrpan-code/emilkowalski/sonner/website/src
petrpan-code/emilkowalski/sonner/website/src/pages/toast.mdx
import { toast } from 'sonner'; # Toast() Use it to render a toast. You can call it from anywhere, even outside of React. ## Rendering the toast You can call it with just a string. ```jsx import { toast } from 'sonner'; toast('Hello World!'); ``` Or provide an object as the second argument with more options. The...
7,233
0
petrpan-code/emilkowalski/sonner/website/src
petrpan-code/emilkowalski/sonner/website/src/pages/toaster.mdx
# Toaster This component renders all the toasts, you can place it anywhere in your app. ## Customization You can see examples of most of the scenarios described below on the [homepage](/). ### Expand When you hover on one of the toasts, they will expand. You can make that the default behavior by setting the `expan...
7,234
0
petrpan-code/alephjs
petrpan-code/alephjs/aleph.js/CODE_OF_CONDUCT.md
# Contributor Covenant Code of Conduct ## Our Pledge We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of...
7,235
0
petrpan-code/alephjs
petrpan-code/alephjs/aleph.js/CONTRIBUTING.md
# Contributing to Aleph.js Welcome, and thank you for taking time in contributing to Aleph.js! You can contribute to Aleph.js in different ways: - Submit new features - Report and fix bugs - Review code - Improve our [documentation](https://github.com/alephjs/alephjs.org) ## Development Setup You will need [Deno](h...
7,236
0
petrpan-code/alephjs
petrpan-code/alephjs/aleph.js/LICENSE
The MIT License (MIT) Copyright (c) 2020-2022 The Aleph.js authors. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modi...
7,237
0
petrpan-code/alephjs
petrpan-code/alephjs/aleph.js/README.md
[![Aleph.js: The Full-stack Framework in Deno.](.github/poster.svg)](https://alephjs.org) <p> <a href="https://discord.gg/pWGdS7sAqD"><img src="https://img.shields.io/discord/775256646821085215?color=%23008181&label=Chat&labelColor=%23111&logo=discord&logoColor=%23aaaaaa" alt="Chat"></a> <a href="https://twitter.c...
7,238
0
petrpan-code/alephjs
petrpan-code/alephjs/aleph.js/deno.json
{ "compilerOptions": { "lib": [ "dom", "dom.iterable", "dom.extras", "deno.ns" ], "types": [ "./types.d.ts" ], "jsx": "react-jsx", "jsxImportSource": "https://esm.sh/v126/react@18.2.0" }, "importMap": "./import_map.json", "fmt": { "options": { "lin...
7,239
0
petrpan-code/alephjs
petrpan-code/alephjs/aleph.js/dev.ts
import dev from "./server/dev.ts"; if (import.meta.main) { dev(Deno.args); }
7,240
0
petrpan-code/alephjs
petrpan-code/alephjs/aleph.js/import_map.json
{ "imports": { "std/": "https://deno.land/std@0.180.0/", "aleph/": "./", "aleph/server": "./server/mod.ts", "aleph/dev": "./server/dev.ts", "aleph/plugins/deploy": "./plugins/deploy.ts", "aleph/plugins/unocss": "./plugins/unocss.ts", "aleph/plugins/mdx": "./plugins/mdx.ts", "aleph/reac...
7,241
0
petrpan-code/alephjs
petrpan-code/alephjs/aleph.js/init.ts
/** @format */ import { Untar } from "https://deno.land/std@0.192.0/archive/untar.ts"; import { parse } from "https://deno.land/std@0.192.0/flags/mod.ts"; import { blue, bold, cyan, dim, green, red } from "https://deno.land/std@0.192.0/fmt/colors.ts"; import { copy as copyDir } from "https://deno.land/std@0.192.0/fs/c...
7,242
0
petrpan-code/alephjs
petrpan-code/alephjs/aleph.js/types.d.ts
type CTX = import("./server/types.ts").Context; // deno-lint-ignore no-empty-interface declare interface Context extends CTX {} /** The Middleare for Aleph server. */ declare interface Middleware { /** The middleware name. */ readonly name?: string; /** The middleware fetch method. */ fetch(request: Request, c...
7,243
0
petrpan-code/alephjs
petrpan-code/alephjs/aleph.js/version.ts
/** `VERSION` managed by https://deno.land/x/publish */ export const VERSION = "1.0.0-beta.44"; /** The flag indicates that the version is canary version. */ export const isCanary = false;
7,244
0
petrpan-code/alephjs/aleph.js
petrpan-code/alephjs/aleph.js/.vscode/extensions.json
{ "recommendations": [ "denoland.vscode-deno" ] }
7,245
0
petrpan-code/alephjs/aleph.js
petrpan-code/alephjs/aleph.js/.vscode/settings.json
{ "deno.enable": true, "deno.lint": true, "deno.config": "./deno.json", "[typescript][typescriptreact][json][markdown]": { "editor.defaultFormatter": "denoland.vscode-deno", "editor.formatOnSave": true } }
7,246
0
petrpan-code/alephjs/aleph.js/examples
petrpan-code/alephjs/aleph.js/examples/api-app/README.md
# REST API App A REST API application powered by Aleph.js in Deno, deploy to [Deno Deploy](https://deno.com/deploy): https://aleph-api.deno.dev/
7,247
0
petrpan-code/alephjs/aleph.js/examples
petrpan-code/alephjs/aleph.js/examples/api-app/server.ts
import { serve } from "aleph/server"; import denoDeploy from "aleph/plugins/deploy"; import modules from "./routes/_export.ts"; declare global { interface Context { foo: string; } } serve({ plugins: [ denoDeploy({ modules }), ], middlewares: [ { name: "foo", fetch: (_req, ctx) => { ...
7,248
0
petrpan-code/alephjs/aleph.js/examples/api-app
petrpan-code/alephjs/aleph.js/examples/api-app/routes/_export.ts
// Exports router modules for serverless env that doesn't support the dynamic import. // This module will be updated automatically in development mode, do NOT edit it manually. import * as $0 from "./ws.ts"; import * as $1 from "./index.ts"; import * as $2 from "./users/index.ts"; import * as $3 from "./users/$uid.ts"...
7,249
0
petrpan-code/alephjs/aleph.js/examples/api-app
petrpan-code/alephjs/aleph.js/examples/api-app/routes/index.ts
// GET "/" export function GET(req: Request, ctx: Context) { const url = new URL(req.url); console.log("[middleware:foo]", ctx.foo); return Response.json({ "users_url": `${url.origin}/users`, "user_url": `${url.origin}/users/{user}`, "websocket_url": `${url.protocol === "https:" ? "wss" : "ws"}://${ur...
7,250
0
petrpan-code/alephjs/aleph.js/examples/api-app
petrpan-code/alephjs/aleph.js/examples/api-app/routes/ws.ts
export const GET = (req: Request) => { const { socket, response } = Deno.upgradeWebSocket(req); socket.onopen = () => { socket.send("hello"); console.log("socket opened"); }; socket.onmessage = (event) => { console.log("socket message", event); socket.send(event.data); }; return response; };...
7,251
0
petrpan-code/alephjs/aleph.js/examples/api-app/routes
petrpan-code/alephjs/aleph.js/examples/api-app/routes/users/$uid.ts
import { users } from "./index.ts"; // GET "/users/:uid" export function GET(_req: Request, ctx: Context) { const user = users.find((u) => String(u.uid) === ctx.params.uid); if (user) { return Response.json(user); } return Response.json({ error: { message: "user not found", code: "userNotFound" } }, { stat...
7,252
0
petrpan-code/alephjs/aleph.js/examples/api-app/routes
petrpan-code/alephjs/aleph.js/examples/api-app/routes/users/index.ts
export type User = { uid: number; name: string; createdAt: string; }; export const users: User[] = [ { uid: 1, name: "john doe", createdAt: "2020-01-01T00:00:00.000Z" }, { uid: 2, name: "mike johnson", createdAt: "2020-01-02T00:00:00.000Z" }, { uid: 3, name: "mary jane", createdAt: "2020-01-03T00:00:00.000...
7,253
0
petrpan-code/alephjs/aleph.js/examples
petrpan-code/alephjs/aleph.js/examples/github-oauth-middleware/README.md
# Github OAuth A demo application using Github OAuth(middleware) by Aleph.js, deploy to [Deno Deploy](https://deno.com/deploy): https://aleph-github-oauth.deno.dev/
7,254
0
petrpan-code/alephjs/aleph.js/examples
petrpan-code/alephjs/aleph.js/examples/github-oauth-middleware/index.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <div id="root"></div> <script type="module" src="./main.ts"></script> </body> </html>
7,255
0
petrpan-code/alephjs/aleph.js/examples
petrpan-code/alephjs/aleph.js/examples/github-oauth-middleware/main.ts
import { bootstrap } from "aleph/react"; bootstrap();
7,256
0
petrpan-code/alephjs/aleph.js/examples
petrpan-code/alephjs/aleph.js/examples/github-oauth-middleware/server.ts
import { serve } from "aleph/server"; import denoDeploy from "aleph/plugins/deploy"; import react from "aleph/plugins/react"; import unocss from "aleph/plugins/unocss"; import presetUno from "@unocss/preset-uno"; import { GithubOauth } from "./middlewares/oauth.ts"; import modules from "./routes/_export.ts"; serve({ ...
7,257
0
petrpan-code/alephjs/aleph.js/examples/github-oauth-middleware
petrpan-code/alephjs/aleph.js/examples/github-oauth-middleware/middlewares/oauth.ts
export type GithubUser = { id: number; login: string; avatar_url: string; name: string; }; export type GithubOauthConfig = { clientId?: string; clientSecret?: string; }; export class GithubOauth implements Middleware { readonly name: string = "github-oauth"; #config: GithubOauthConfig; constructor...
7,258
0
petrpan-code/alephjs/aleph.js/examples/github-oauth-middleware
petrpan-code/alephjs/aleph.js/examples/github-oauth-middleware/routes/_export.ts
// Exports router modules for serverless env that doesn't support the dynamic import. // This module will be updated automatically in development mode, do NOT edit it manually. import * as $0 from "./index.tsx"; export default { "/": $0, };
7,259
0
petrpan-code/alephjs/aleph.js/examples/github-oauth-middleware
petrpan-code/alephjs/aleph.js/examples/github-oauth-middleware/routes/index.tsx
import { useData } from "aleph/react"; import type { GithubUser } from "../middlewares/oauth.ts"; export const data = (_req: Request, ctx: Context<{ user: GithubUser }>) => { return Response.json({ user: ctx.user }); }; export default function Index() { const { data: { user } } = useData<{ user: GithubUser }>(); ...
7,260
0
petrpan-code/alephjs/aleph.js/examples
petrpan-code/alephjs/aleph.js/examples/leptos-app/Cargo.lock
# This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 3 [[package]] name = "ahash" version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ "getrandom...
7,261
0
petrpan-code/alephjs/aleph.js/examples
petrpan-code/alephjs/aleph.js/examples/leptos-app/Cargo.toml
[package] name = "leptos-app" version = "0.1.0" edition = "2021" [lib] crate-type = ["cdylib", "rlib"] [dependencies] broadcaster = "1" console_log = "0.2" console_error_panic_hook = "0.1" serde = { version = "1", features = ["derive"] } futures = "0.3" cfg-if = "1" lazy_static = "1" leptos = { version = "0.1.3", def...
7,262
0
petrpan-code/alephjs/aleph.js/examples
petrpan-code/alephjs/aleph.js/examples/leptos-app/LICENSE
MIT License Copyright (c) 2022 Greg Johnston Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, dis...
7,263
0
petrpan-code/alephjs/aleph.js/examples
petrpan-code/alephjs/aleph.js/examples/leptos-app/Makefile.toml
[tasks.build] command = "cargo" args = ["+nightly", "build-all-features"] install_crate = "cargo-all-features"
7,264
0
petrpan-code/alephjs/aleph.js/examples
petrpan-code/alephjs/aleph.js/examples/leptos-app/README.md
# Leptos Counter Isomorphic Example This example demonstrates how to use a function isomorphically, to run a server side function from the browser and receive a result. ## Client Side Rendering For this example the server must store the counter state since it can be modified by many users. This means it is not possi...
7,265
0
petrpan-code/alephjs/aleph.js/examples
petrpan-code/alephjs/aleph.js/examples/leptos-app/dev.ts
import { fromFileUrl, join } from "std/path/mod.ts"; import dev, { createWatchFsEmitter } from "aleph/dev"; const emitter = createWatchFsEmitter(); emitter.on("modify", ({ specifier }) => { if (specifier.endsWith(".rs")) { // rebuild the leptos app then restart the dev server start(); } }); let buildClien...
7,266
0
petrpan-code/alephjs/aleph.js/examples
petrpan-code/alephjs/aleph.js/examples/leptos-app/index.html
<!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title>Leptos - Aleph.js</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="icon" href="./assets/logo.svg"> <script type="module" src="./main.ts"></script> </head> <body></body> </html>
7,267
0
petrpan-code/alephjs/aleph.js/examples
petrpan-code/alephjs/aleph.js/examples/leptos-app/main.ts
import init, { hydrate } from "./pkg/client.js"; // reload page on rebuild import.meta.hot?.decline(); // run app main init().then(hydrate);
7,268
0
petrpan-code/alephjs/aleph.js/examples
petrpan-code/alephjs/aleph.js/examples/leptos-app/server.ts
import { serve } from "aleph/server"; import init, { ssr } from "./pkg/server.js"; const wasmUrl = new URL("./pkg/server_bg.wasm", import.meta.url); await init(await Deno.readFile(wasmUrl)); serve({ ssr: ({ url }) => { return ssr(url.href); }, });
7,269
0
petrpan-code/alephjs/aleph.js/examples/leptos-app
petrpan-code/alephjs/aleph.js/examples/leptos-app/pkg/client.js
import { microtask } from "./snippets/leptos_reactive-81881a7e036355c6/inline0.js"; let wasm; const heap = new Array(32).fill(undefined); heap.push(undefined, null, true, false); function getObject(idx) { return heap[idx]; } let heap_next = heap.length; function dropObject(idx) { if (idx < 36) return; heap[...
7,270
0
petrpan-code/alephjs/aleph.js/examples/leptos-app
petrpan-code/alephjs/aleph.js/examples/leptos-app/pkg/server.js
let wasm; const heap = new Array(32).fill(undefined); heap.push(undefined, null, true, false); function getObject(idx) { return heap[idx]; } let heap_next = heap.length; function dropObject(idx) { if (idx < 36) return; heap[idx] = heap_next; heap_next = idx; } function takeObject(idx) { const ret = getO...
7,271
0
petrpan-code/alephjs/aleph.js/examples/leptos-app
petrpan-code/alephjs/aleph.js/examples/leptos-app/src/lib.rs
use cfg_if::cfg_if; cfg_if! { if #[cfg(feature = "hydrate")] { use wasm_bindgen::prelude::wasm_bindgen; use leptos::*; pub mod routes; use routes::{App, AppProps}; #[wasm_bindgen] pub fn hydrate() { console_error_panic_hook::set_once(); _ = co...
7,272
0
petrpan-code/alephjs/aleph.js/examples/leptos-app
petrpan-code/alephjs/aleph.js/examples/leptos-app/src/routes.rs
use leptos::*; use leptos_meta::*; use leptos_router::*; pub mod index; use index::{Counter, CounterProps}; #[component] pub fn App(cx: Scope) -> impl IntoView { provide_meta_context(cx); view! { cx, <Router> <main> <Routes> <Route path="" view=|...
7,273
0
petrpan-code/alephjs/aleph.js/examples/leptos-app/src
petrpan-code/alephjs/aleph.js/examples/leptos-app/src/routes/index.rs
use leptos::*; /// A simple counter component. /// /// You can use doc comments like this to document your component. #[component] pub fn Counter( cx: Scope, ) -> impl IntoView { let (value, set_value) = create_signal(cx, 0); let step = 1; view! { cx, <div> <button on:click=move |...
7,274
0
petrpan-code/alephjs/aleph.js/examples
petrpan-code/alephjs/aleph.js/examples/monaco-editor/README.md
# Monaco Editor A web IDE written in Aleph.js, powered by [Monaco Editor](https://microsoft.github.io/monaco-editor/), deploy to [Deno Deploy](https://deno.com/deploy): https://aleph-monaco-editor.deno.dev/
7,275
0
petrpan-code/alephjs/aleph.js/examples
petrpan-code/alephjs/aleph.js/examples/monaco-editor/editor.ts
import { editor, Uri } from "https://esm.sh/monaco-editor@0.36.1"; import "https://esm.sh/monaco-editor@0.36.1?css"; // deno-lint-ignore ban-ts-comment // @ts-ignore self.MonacoEnvironment = { async getWorker(_: unknown, label: string) { if (label === "typescript" || label === "javascript") { const { defau...
7,276
0
petrpan-code/alephjs/aleph.js/examples
petrpan-code/alephjs/aleph.js/examples/monaco-editor/index.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <style> * { margin: 0; padding: 0; border: none; outline: none; font: inherit; font-size: 100%; vertical-align: baseline; back...
7,277
0
petrpan-code/alephjs/aleph.js/examples
petrpan-code/alephjs/aleph.js/examples/monaco-editor/main.ts
import { createEditor, createModel } from "./editor.ts"; const el = document.querySelector(".editor"); const editor = createEditor(el as HTMLElement); const model = createModel("mod.ts", `// Monaco Editor x Aleph.js (SPA mode) \n\nconsole.log("Hello, world!");\n`); el!.innerHTML = ""; editor.setModel(model);
7,278
0
petrpan-code/alephjs/aleph.js/examples
petrpan-code/alephjs/aleph.js/examples/monaco-editor/server.ts
import { serve } from "aleph/server"; serve({});
7,279
0
petrpan-code/alephjs/aleph.js/examples
petrpan-code/alephjs/aleph.js/examples/react-app/README.md
# React App A React demo application powered by Aleph.js in Deno, deploy to [Deno Deploy](https://deno.com/deploy): https://aleph-hello.deno.dev/
7,280
0
petrpan-code/alephjs/aleph.js/examples
petrpan-code/alephjs/aleph.js/examples/react-app/index.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="icon" href="./assets/logo.svg"> <link rel="stylesheet" href="./style/app.css"> </head> <body> <div id="root"></div> <script type="module" src="./main.ts"></scrip...
7,281
0
petrpan-code/alephjs/aleph.js/examples
petrpan-code/alephjs/aleph.js/examples/react-app/main.ts
/** @format */ import { bootstrap } from "aleph/react"; bootstrap();
7,282
0
petrpan-code/alephjs/aleph.js/examples
petrpan-code/alephjs/aleph.js/examples/react-app/server.ts
/** @format */ import { serve } from "aleph/server"; import react from "aleph/plugins/react"; import denoDeploy from "aleph/plugins/deploy"; import modules from "./routes/_export.ts"; serve({ plugins: [ denoDeploy({ moduleMain: import.meta.url, modules }), react({ ssr: true }), ], });
7,283
0
petrpan-code/alephjs/aleph.js/examples/react-app
petrpan-code/alephjs/aleph.js/examples/react-app/assets/external-link.svg
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M14 5C13.4477 5 13 4.55228 13 4C13 3.44772 13.4477 3 14 3H20C20.2652 3 20.5196 3.10536 20.7071 3.29289C20.8946 3.48043 21 3.73478 21 4L21 10C21 10.5523 20.5523 11 20 11C19.4477 11 19 10.5523 19 10L19 6.41422L...
7,284
0
petrpan-code/alephjs/aleph.js/examples/react-app
petrpan-code/alephjs/aleph.js/examples/react-app/assets/logo.svg
<svg width="100" height="100" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M52.9528 11.1C54.0959 11.1 55.1522 11.7097 55.7239 12.6995C68.5038 34.8259 81.2837 56.9524 94.0636 79.0788C94.642 80.0802 94.6355 81.316 94.0425 82.3088C93.0466 83.9762 92.028 85.6661 91.0325 87.3331C90.4529 8...
7,285
0
petrpan-code/alephjs/aleph.js/examples/react-app
petrpan-code/alephjs/aleph.js/examples/react-app/components/Header.tsx
import { Link } from "aleph/react"; export default function Header() { return ( <header> <div className="header-wrapper"> <h1> <Link to="/"> <svg viewBox="0 0 60 12.09" fill="currentColor" > <title>Aleph.js</title> ...
7,286
0
petrpan-code/alephjs/aleph.js/examples/react-app
petrpan-code/alephjs/aleph.js/examples/react-app/routes/_404.tsx
import { Link } from "aleph/react"; export default function E404() { return ( <div className="screen e404"> <h2> Ooooooops, nothing here! </h2> <p> <Link to="/"> Go back to the homepage </Link> </p> </div> ); }
7,287
0
petrpan-code/alephjs/aleph.js/examples/react-app
petrpan-code/alephjs/aleph.js/examples/react-app/routes/_app.tsx
import Header from "../components/Header.tsx"; export default function App({ children }: { children: React.ReactNode }) { return ( <> <Header /> {children} </> ); }
7,288
0
petrpan-code/alephjs/aleph.js/examples/react-app
petrpan-code/alephjs/aleph.js/examples/react-app/routes/_export.ts
// Exports router modules for serverless env that doesn't support the dynamic import. // This module will be updated automatically in development mode, do NOT edit it manually. import * as $0 from "./_404.tsx"; import * as $1 from "./_app.tsx"; import * as $2 from "./index.tsx"; import * as $3 from "./todos.tsx"; exp...
7,289
0
petrpan-code/alephjs/aleph.js/examples/react-app
petrpan-code/alephjs/aleph.js/examples/react-app/routes/index.tsx
import { Head, Link } from "aleph/react"; const externalLinks = [ ["Get Started", "https://alephjs.org/docs/get-started"], ["Docs", "https://alephjs.org/docs"], ["Github", "https://github.com/alephjs/aleph.js"], ]; export default function Index() { return ( <div className="screen index"> <Head> ...
7,290
0
petrpan-code/alephjs/aleph.js/examples/react-app
petrpan-code/alephjs/aleph.js/examples/react-app/routes/todos.tsx
/** @format */ import type { FormEvent } from "react"; import { Head, useData } from "aleph/react"; type Todo = { id: number; message: string; completed: boolean; }; const store = { todos: JSON.parse(window.localStorage?.getItem("todos") || "[]") as Todo[], save() { localStorage?.setItem("todos", JSON....
7,291
0
petrpan-code/alephjs/aleph.js/examples/react-app
petrpan-code/alephjs/aleph.js/examples/react-app/style/app.css
@import url('./reset.css'); header { width: 100%; height: 80px; position: sticky; top: 0; } header .header-wrapper { margin: 0 auto; width: 90%; max-width: 900px; height: 100%; display: flex; align-items: center; justify-content: space-between; } header h1 a { color: #333; } header h1 svg { ...
7,292
0
petrpan-code/alephjs/aleph.js/examples/react-app
petrpan-code/alephjs/aleph.js/examples/react-app/style/reset.css
/* 1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4) 2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116) */ *, ::before, ::after { box-sizing: border-box; /* 1 */ border-width: 0; /* 2 ...
7,293
0
petrpan-code/alephjs/aleph.js/examples
petrpan-code/alephjs/aleph.js/examples/react-mdx-app/README.md
# React App A React demo application powered by Aleph.js in Deno, deploy to [Deno Deploy](https://deno.com/deploy): https://aleph-hello.deno.dev/
7,294
0
petrpan-code/alephjs/aleph.js/examples
petrpan-code/alephjs/aleph.js/examples/react-mdx-app/index.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="icon" href="./assets/logo.svg"> <link rel="stylesheet" href="./style/app.css"> </head> <body> <div id="root"></div> <script type="module" src="./main.ts"></scrip...
7,295
0
petrpan-code/alephjs/aleph.js/examples
petrpan-code/alephjs/aleph.js/examples/react-mdx-app/main.ts
import { bootstrap } from "aleph/react"; bootstrap();
7,296
0
petrpan-code/alephjs/aleph.js/examples
petrpan-code/alephjs/aleph.js/examples/react-mdx-app/server.ts
/** @format */ import { serve } from "aleph/server"; import denoDeploy from "aleph/plugins/deploy"; import react from "aleph/plugins/react"; import mdx from "aleph/plugins/mdx"; import modules from "./routes/_export.ts"; // check https://mdxjs.com/docs/extending-mdx import remarkFrontmatter from "https://esm.sh/v126/...
7,297
0
petrpan-code/alephjs/aleph.js/examples/react-mdx-app
petrpan-code/alephjs/aleph.js/examples/react-mdx-app/assets/external-link.svg
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M14 5C13.4477 5 13 4.55228 13 4C13 3.44772 13.4477 3 14 3H20C20.2652 3 20.5196 3.10536 20.7071 3.29289C20.8946 3.48043 21 3.73478 21 4L21 10C21 10.5523 20.5523 11 20 11C19.4477 11 19 10.5523 19 10L19 6.41422L...
7,298
0
petrpan-code/alephjs/aleph.js/examples/react-mdx-app
petrpan-code/alephjs/aleph.js/examples/react-mdx-app/assets/logo.svg
<svg width="100" height="100" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M52.9528 11.1C54.0959 11.1 55.1522 11.7097 55.7239 12.6995C68.5038 34.8259 81.2837 56.9524 94.0636 79.0788C94.642 80.0802 94.6355 81.316 94.0425 82.3088C93.0466 83.9762 92.028 85.6661 91.0325 87.3331C90.4529 8...
7,299