├── .github └── workflows │ └── deploy.yml ├── .gitignore ├── .vscode └── settings.json ├── README.md ├── _components └── deno │ ├── api.tsx │ └── tool.tsx ├── _config.ts ├── _data ├── deno.yml ├── std.yml ├── tips.yml ├── tools.yml └── web.yml ├── deno-logo.svg ├── deno.json ├── index.vto ├── scripts ├── main.js └── x-modal.js └── styles.css /.github/workflows/deploy.yml: -------------------------------------------------------------------------------- 1 | name: Deploy 2 | on: [push] 3 | 4 | jobs: 5 | deploy: 6 | name: Deploy 7 | runs-on: ubuntu-latest 8 | permissions: 9 | id-token: write # Needed for auth with Deno Deploy 10 | contents: read # Needed to clone the repository 11 | 12 | steps: 13 | - name: Clone repository 14 | uses: actions/checkout@v3 15 | 16 | - name: Setup Deno environment 17 | uses: denoland/setup-deno@v1 18 | with: 19 | deno-version: v1.x 20 | 21 | - name: Build site 22 | run: deno task build 23 | 24 | - name: Upload to Deno Deploy 25 | uses: denoland/deployctl@v1 26 | with: 27 | project: "cheatsheet" 28 | entrypoint: https://deno.land/std@0.181.0/http/file_server.ts 29 | root: ./_site 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | _site -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "deno.enable": true, 3 | "deno.lint": true, 4 | "deno.unstable": true 5 | } 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Deno Cheat Sheet 2 | 3 | Run it with `deno task serve`. 4 | -------------------------------------------------------------------------------- /_components/deno/api.tsx: -------------------------------------------------------------------------------- 1 | interface Props { 2 | name: string; 3 | stable: boolean; 4 | deprecated?: boolean; 5 | deploy?: boolean; 6 | sync: boolean; 7 | type: "function" | "class" | "variable" | "type"; 8 | mdn?: string; 9 | contains?: { 10 | name: string; 11 | mdn?: string; 12 | }; 13 | } 14 | 15 | export default function api( 16 | { name, stable, deprecated, deploy, sync, type, mdn, contains }: Props, 17 | ) { 18 | const syncName = sync ? `${name}Sync` : undefined; 19 | 20 | return ( 21 |

22 | {" "} 29 | {syncName && ( 30 | <> 31 | {" / "} 32 | 33 | 34 | )} {!stable && unstable}{" "} 35 | {deprecated && deprecated} 36 | {" "} 37 | {deploy && deploy} 38 |

39 | ); 40 | } 41 | 42 | interface LinkProps { 43 | name: string; 44 | text?: string; 45 | stable: boolean; 46 | mdn?: string; 47 | type: "function" | "class" | "variable" | "type"; 48 | } 49 | 50 | function Link({ name, text, stable, type, mdn }: LinkProps) { 51 | const suffix = type === "function" ? "()" : ""; 52 | const href = `https://deno.land/api?${stable ? "" : "unstable&"}s=${name}`; 53 | 54 | const mdnHref = mdn ? `https://developer.mozilla.org/en-US/docs${mdn}` : null; 55 | 56 | return ( 57 | {(text || name) + suffix} 58 | ); 59 | } 60 | -------------------------------------------------------------------------------- /_components/deno/tool.tsx: -------------------------------------------------------------------------------- 1 | interface Props { 2 | cli: string; 3 | links?: { 4 | text: string; 5 | url: string; 6 | }[]; 7 | } 8 | 9 | export default function doc({ cli, links }: Props) { 10 | return ( 11 | <> 12 |
13 |         {cli}
14 |       
15 | {links?.map((link) => {link.text})} 16 | 17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /_config.ts: -------------------------------------------------------------------------------- 1 | import lume from "lume/mod.ts"; 2 | import jsx from "lume/plugins/jsx.ts"; 3 | import postcss from "lume/plugins/postcss.ts"; 4 | 5 | const location = new URL("https://cheatsheet.deno.dev/"); 6 | 7 | export default lume({ location }) 8 | .use(jsx()) 9 | .use(postcss()) 10 | .copy("scripts") 11 | .copy("deno-logo.svg") 12 | .ignore("README.md") 13 | .data("cache", Date.now()); 14 | -------------------------------------------------------------------------------- /_data/deno.yml: -------------------------------------------------------------------------------- 1 | - title: File System 2 | content: 3 | - name: Deno.watchFs 4 | stable: true 5 | type: function 6 | - name: Deno.FsFile 7 | stable: true 8 | type: class 9 | - name: Deno.copyFile 10 | stable: true 11 | sync: true 12 | type: function 13 | - name: Deno.create 14 | stable: true 15 | sync: true 16 | type: function 17 | - name: Deno.makeTempDir 18 | stable: true 19 | sync: true 20 | type: function 21 | - name: Deno.makeTempFile 22 | stable: true 23 | sync: true 24 | type: function 25 | - name: Deno.mkdir 26 | stable: true 27 | sync: true 28 | type: function 29 | - name: Deno.readDir 30 | stable: true 31 | deploy: true 32 | sync: true 33 | type: function 34 | - name: Deno.readFile 35 | stable: true 36 | sync: true 37 | - name: Deno.readLink 38 | stable: true 39 | sync: true 40 | type: function 41 | - name: Deno.readTextFile 42 | stable: true 43 | deploy: true 44 | sync: true 45 | type: function 46 | - name: Deno.writeFile 47 | stable: true 48 | sync: true 49 | type: function 50 | - name: Deno.writeTextFile 51 | stable: true 52 | sync: true 53 | type: function 54 | - name: Deno.truncate 55 | stable: true 56 | sync: true 57 | type: function 58 | - name: Deno.chmod 59 | stable: true 60 | sync: true 61 | type: function 62 | - name: Deno.chown 63 | stable: true 64 | sync: true 65 | type: function 66 | - name: Deno.rename 67 | stable: true 68 | sync: true 69 | type: function 70 | - name: Deno.stat 71 | stable: true 72 | deploy: true 73 | sync: true 74 | type: function 75 | - name: Deno.symlink 76 | stable: true 77 | sync: true 78 | type: function 79 | - name: Deno.realPath 80 | stable: true 81 | deploy: true 82 | sync: true 83 | type: function 84 | - name: Deno.remove 85 | stable: true 86 | sync: true 87 | type: function 88 | - name: Deno.lstat 89 | stable: true 90 | deploy: true 91 | sync: true 92 | type: function 93 | - name: Deno.isatty 94 | stable: true 95 | deprecated: true 96 | type: function 97 | - name: Deno.link 98 | stable: true 99 | sync: true 100 | type: function 101 | - name: Deno.utime 102 | stable: true 103 | sync: true 104 | type: function 105 | 106 | - title: Tools 107 | content: 108 | - name: Deno.test 109 | stable: true 110 | type: function 111 | - name: Deno.bench 112 | stable: true 113 | type: function 114 | - name: Deno.cron 115 | stable: true 116 | type: function 117 | 118 | - title: Resources 119 | content: 120 | - name: Deno.resources 121 | stable: true 122 | deprecated: true 123 | type: function 124 | - name: Deno.close 125 | stable: true 126 | deprecated: true 127 | type: function 128 | - name: Deno.open 129 | stable: true 130 | deploy: true 131 | sync: true 132 | type: function 133 | - name: Deno.read 134 | stable: true 135 | sync: true 136 | deprecated: true 137 | type: function 138 | - name: Deno.write 139 | stable: true 140 | sync: true 141 | deprecated: true 142 | type: function 143 | - name: Deno.seek 144 | stable: true 145 | sync: true 146 | type: function 147 | - name: Deno.ftruncate 148 | stable: true 149 | deprecated: true 150 | sync: true 151 | type: function 152 | - name: Deno.fdatasync 153 | stable: true 154 | sync: true 155 | type: function 156 | - name: Deno.fstat 157 | stable: true 158 | deprecated: true 159 | sync: true 160 | type: function 161 | - name: Deno.fsync 162 | stable: true 163 | sync: true 164 | type: function 165 | - name: Deno.flock 166 | stable: false 167 | deprecated: true 168 | sync: true 169 | type: function 170 | - name: Deno.funlock 171 | stable: false 172 | deprecated: true 173 | sync: true 174 | type: function 175 | - name: Deno.futime 176 | stable: true 177 | sync: true 178 | type: function 179 | 180 | - title: FFI (Foreign Function Interface) 181 | content: 182 | - name: Deno.UnsafeFnPointer 183 | stable: false 184 | type: class 185 | - name: Deno.UnsafePointerView 186 | stable: false 187 | type: class 188 | - name: Deno.dlopen 189 | stable: false 190 | type: function 191 | 192 | - title: KV 193 | content: 194 | - name: Deno.openKv 195 | stable: false 196 | type: function 197 | - name: Deno.KvU64 198 | stable: false 199 | type: class 200 | - name: Deno.AtomicOperation 201 | stable: false 202 | type: class 203 | - name: Deno.Kv 204 | stable: false 205 | type: class 206 | - name: Deno.KvListIterator 207 | stable: false 208 | type: class 209 | 210 | - title: Errors 211 | content: 212 | - name: Deno.errors.AddrInUse 213 | stable: true 214 | type: class 215 | - name: Deno.errors.AddrNotAvailable 216 | stable: true 217 | type: class 218 | - name: Deno.errors.AlreadyExists 219 | stable: true 220 | type: class 221 | - name: Deno.errors.BadResource 222 | stable: true 223 | type: class 224 | - name: Deno.errors.BrokenPipe 225 | stable: true 226 | type: class 227 | - name: Deno.errors.Busy 228 | stable: true 229 | type: class 230 | - name: Deno.errors.ConnectionAborted 231 | stable: true 232 | type: class 233 | - name: Deno.errors.ConnectionRefused 234 | stable: true 235 | type: class 236 | - name: Deno.errors.ConnectionReset 237 | stable: true 238 | type: class 239 | - name: Deno.errors.FilesystemLoop 240 | stable: true 241 | type: class 242 | - name: Deno.errors.Http 243 | stable: true 244 | type: class 245 | - name: Deno.errors.IsADirectory 246 | stable: true 247 | type: class 248 | - name: Deno.errors.Interrupted 249 | stable: true 250 | type: class 251 | - name: Deno.errors.InvalidData 252 | stable: true 253 | type: class 254 | - name: Deno.errors.NetworkUnreachable 255 | stable: true 256 | type: class 257 | - name: Deno.errors.NotADirectory 258 | stable: true 259 | type: class 260 | - name: Deno.errors.NotConnected 261 | stable: true 262 | type: class 263 | - name: Deno.errors.NotFound 264 | stable: true 265 | type: class 266 | - name: Deno.errors.NotSupported 267 | stable: true 268 | type: class 269 | - name: Deno.errors.PermissionDenied 270 | stable: true 271 | type: class 272 | - name: Deno.errors.TimedOut 273 | stable: true 274 | type: class 275 | - name: Deno.errors.UnexpectedEof 276 | stable: true 277 | type: class 278 | - name: Deno.errors.WriteZero 279 | stable: true 280 | type: class 281 | 282 | - title: Subprocesses 283 | content: 284 | - name: Deno.Command 285 | stable: true 286 | type: class 287 | - name: Deno.Process 288 | stable: true 289 | type: class 290 | - name: Deno.run 291 | stable: true 292 | deprecated: true 293 | type: function 294 | - name: Deno.kill 295 | stable: true 296 | type: function 297 | 298 | - title: Runtime utils 299 | content: 300 | - name: Deno.permissions 301 | stable: true 302 | type: variable 303 | contains: 304 | name: Deno.Permissions 305 | - name: Deno.PermissionStatus 306 | stable: true 307 | type: class 308 | - name: Deno.args 309 | stable: true 310 | type: variable 311 | - name: Deno.build 312 | stable: true 313 | type: variable 314 | - name: Deno.env 315 | stable: true 316 | deploy: true 317 | type: variable 318 | - name: Deno.mainModule 319 | stable: true 320 | type: variable 321 | - name: Deno.noColor 322 | stable: true 323 | type: variable 324 | - name: Deno.pid 325 | stable: true 326 | type: variable 327 | - name: Deno.ppid 328 | stable: true 329 | type: variable 330 | - name: Deno.stderr 331 | stable: true 332 | type: variable 333 | - name: Deno.stdin 334 | stable: true 335 | type: variable 336 | - name: Deno.stdout 337 | stable: true 338 | type: variable 339 | - name: Deno.version 340 | stable: true 341 | type: variable 342 | - name: Deno.cwd 343 | stable: true 344 | deploy: true 345 | type: function 346 | - name: Deno.chdir 347 | stable: true 348 | type: function 349 | - name: Deno.memoryUsage 350 | stable: true 351 | type: function 352 | - name: Deno.metrics 353 | stable: true 354 | deprecated: true 355 | type: function 356 | - name: Deno.addSignalListener 357 | stable: true 358 | type: function 359 | - name: Deno.removeSignalListener 360 | stable: true 361 | type: function 362 | - name: Deno.exit 363 | stable: true 364 | type: function 365 | - name: Deno.execPath 366 | stable: true 367 | type: function 368 | - name: Deno.inspect 369 | stable: true 370 | type: function 371 | - name: Deno.DiagnosticCategory 372 | stable: false 373 | type: type 374 | - name: Deno.consoleSize 375 | stable: true 376 | type: function 377 | - name: Deno.uid 378 | stable: true 379 | type: function 380 | - name: Deno.gid 381 | stable: true 382 | type: function 383 | - name: Deno.hostname 384 | stable: true 385 | type: function 386 | - name: Deno.loadavg 387 | stable: true 388 | type: function 389 | - name: Deno.osRelease 390 | stable: true 391 | type: function 392 | - name: Deno.osUptime 393 | stable: true 394 | type: function 395 | - name: Deno.refTimer 396 | stable: true 397 | type: function 398 | - name: Deno.unrefTimer 399 | stable: true 400 | type: function 401 | - name: Deno.systemMemoryInfo 402 | stable: true 403 | type: function 404 | - name: Deno.umask 405 | stable: false 406 | type: function 407 | 408 | - title: Network 409 | content: 410 | - name: Deno.connect 411 | deploy: true 412 | stable: true 413 | type: function 414 | - name: Deno.HttpClient 415 | stable: false 416 | type: class 417 | - name: Deno.connectTls 418 | stable: true 419 | deploy: true 420 | type: function 421 | - name: Deno.listen 422 | stable: true 423 | type: function 424 | - name: Deno.listenTls 425 | stable: true 426 | type: function 427 | - name: Deno.resolveDns 428 | stable: true 429 | deploy: true 430 | type: function 431 | - name: Deno.serveHttp 432 | stable: true 433 | deprecate: true 434 | type: function 435 | - name: Deno.serve 436 | stable: true 437 | type: function 438 | - name: Deno.startTls 439 | stable: true 440 | deploy: true 441 | type: function 442 | - name: Deno.upgradeWebSocket 443 | stable: true 444 | type: function 445 | - name: Deno.shutdown 446 | stable: true 447 | type: function 448 | - name: Deno.connect 449 | stable: false 450 | type: function 451 | - name: Deno.connectTls 452 | stable: false 453 | type: function 454 | - name: Deno.createHttpClient 455 | stable: false 456 | type: function 457 | - name: Deno.listen 458 | stable: false 459 | type: function 460 | - name: Deno.listenDatagram 461 | stable: false 462 | type: function 463 | - name: Deno.networkInterfaces 464 | stable: true 465 | type: function 466 | -------------------------------------------------------------------------------- /_data/std.yml: -------------------------------------------------------------------------------- 1 | - title: Archive/Tar 2 | url: /archive/tar.ts 3 | description: Provides a Tar and Untar classes for compressing and decompressing arbitrary data. 4 | - title: Async 5 | url: /async/mod.ts 6 | description: Provide help with asynchronous tasks like delays, debouncing, deferring, or pooling. 7 | - title: Bytes 8 | url: /bytes/mod.ts 9 | description: Provides helper functions to manipulate Uint8Array byte slices that are not included on the Uint8Array prototype. 10 | - title: CLI 11 | url: /cli/mod.ts 12 | description: Tools for creating interactive command line tools. 13 | - title: Collections 14 | url: /collections/mod.ts 15 | description: Functions for specific common tasks around collection types like Array and Record. 16 | - title: Crypto 17 | url: /crypto/mod.ts 18 | description: Extensions to the Web Crypto supporting additional encryption APIs. 19 | - title: CSV 20 | url: /csv/mod.ts 21 | browser: true 22 | description: Encode and decode for CSV. 23 | - title: Datetime 24 | url: /datetime/mod.ts 25 | browser: true 26 | description: Utilities for dealing with Date objects. 27 | - title: Data structures 28 | url: /data_structures/mod.ts 29 | description: This module exports classes that implements [data structure](https://en.wikipedia.org/wiki/Data_structure) algorithms. 30 | - title: Dotenv 31 | url: /dotenv/mod.ts 32 | description: Load environment variables from .env files. 33 | - title: Encoding/ascii85 34 | url: /encoding/ascii85.ts 35 | browser: true 36 | description: Encode and decode for Ascii85/base85 encoding. 37 | - title: Encoding/base32 38 | url: /encoding/base32.ts 39 | browser: true 40 | description: Encode and decode for base32 encoding. 41 | - title: Encoding/base58 42 | url: /encoding/base58.ts 43 | browser: true 44 | description: Encode and decode for base58 encoding. 45 | - title: Encoding/base64 46 | url: /encoding/base64.ts 47 | browser: true 48 | description: Encode and decode for base64 encoding. 49 | - title: Encoding/base64 (URL safe) 50 | url: /encoding/base64url.ts 51 | browser: true 52 | description: Encode and decode for base64 URL safe encoding. 53 | - title: Encoding/binary 54 | url: /encoding/binary.ts 55 | description: Functions for encoding binary data in array buffers. 56 | - title: Encoding/hex 57 | browser: true 58 | url: /encoding/hex.ts 59 | description: Port of the Go encoding/hex library. 60 | - title: Encoding/varint 61 | url: /encoding/varint.ts 62 | description: Functions for encoding typed integers in array buffers. 63 | - title: Expect 64 | url: /expect/mod.ts 65 | description: This module provides jest compatible expect assertion functionality. 66 | - title: Flags 67 | url: /flags/mod.ts 68 | browser: true 69 | description: Command line arguments parser based on minimist. 70 | - title: Fmt/bytes 71 | url: /fmt/bytes.ts 72 | browser: true 73 | description: Pretty print bytes. 74 | - title: Fmt/colors 75 | url: /fmt/colors.ts 76 | browser: true 77 | description: String formatters and utilities for dealing with ANSI color codes. 78 | - title: Fmt/printf 79 | url: /fmt/printf.ts 80 | description: Sprintf and printf for printing formatted strings to stdout. 81 | - title: Front matter 82 | url: /front_matter/mod.ts 83 | browser: true 84 | description: Extract front matter from strings. 85 | - title: FS 86 | url: /fs/mod.ts 87 | description: Helpers for working with the filesystem. 88 | - title: HTML/Entities 89 | url: /html/entities.ts 90 | description: Functions for HTML tasks such as escaping or unescaping HTML entities. 91 | - title: HTTP 92 | url: /http/mod.ts 93 | description: Provides user-friendly serve on top of Deno's native HTTP server and other utilities for creating HTTP servers and clients. 94 | - title: Ini 95 | url: /ini/mod.ts 96 | description: parse and stringify for handling INI encoded data, such as the Desktop Entry specification. 97 | - title: JSON 98 | url: /json/mod.ts 99 | description: Functions for parsing and stringify JSON data. 100 | - title: JSONC 101 | url: /jsonc/mod.ts 102 | description: Function for parsing JSONC (JSON with comments) strings. 103 | - title: Log 104 | url: /log/mod.ts 105 | description: Logging library with the support for terminal and file outputs. Also provides interfaces for building custom loggers. 106 | - title: Media types 107 | url: /media_types/mod.ts 108 | description: Utility functions for media types (MIME types). 109 | - title: Net 110 | url: /net/mod.ts 111 | description: Network utilities. 112 | - title: Path 113 | url: /path/mod.ts 114 | browser: true 115 | description: Utilities for working with OS-specific file paths. 116 | - title: Permissions 117 | url: /permissions/mod.ts 118 | description: Helpers for interacting with Deno's permissions system. 119 | - title: Semver 120 | url: /semver/mod.ts 121 | browser: true 122 | description: The semantic version parser. Adapted directly from semver. 123 | - title: Signal 124 | url: /signal/mod.ts 125 | description: Higher level API for dealing with OS signals. 126 | - title: Streams 127 | url: /streams/mod.ts 128 | description: Utilities for working with the Streams API. Includes buffering and conversion. 129 | - title: Testing/asserts 130 | url: /testing/asserts.ts 131 | browser: true 132 | description: A library of assertion functions. 133 | - title: Testing/bdd 134 | url: /testing/bdd.ts 135 | description: A BDD interface to Deno.test() API. 136 | - title: Testing/mock 137 | url: /testing/mock.ts 138 | browser: true 139 | description: A mocking and spying library. 140 | - title: Testing/snapshot 141 | url: /testing/snapshot.ts 142 | description: A snapshotting library. 143 | - title: Testing/time 144 | url: /testing/time.ts 145 | browser: true 146 | description: Utilities for mocking time while testing. 147 | - title: Text 148 | url: /text/mod.ts 149 | description: This module exports utility functions for comparing/sorting/choosing texts with certain criteria. 150 | - title: TOML 151 | browser: true 152 | url: /toml/mod.ts 153 | description: Parse and stringify functions for handling TOML encoded data. 154 | - title: ULID 155 | browser: true 156 | url: /ulid/mod.ts 157 | description: Utilities for generating [ULID](https://github.com/ulid/spec) and decoding the timestamp from the given ULID. 158 | - title: URL 159 | browser: true 160 | url: /url/mod.ts 161 | description: Utilities for working with URL paths. 162 | - title: UUID 163 | browser: true 164 | url: /uuid/mod.ts 165 | description: Generators and validators for UUIDs for versions v1, v4 and v5. 166 | - title: YAML 167 | browser: true 168 | url: /yaml/mod.ts 169 | description: Parse and stringify for handling YAML encoded data. 170 | - title: Web GPU 171 | browser: false 172 | url: /webgpu/mod.ts 173 | description: Utilities for interacting with the [WebGPU API](https://developer.mozilla.org/en-US/docs/Web/API/WebGPU_API). 174 | -------------------------------------------------------------------------------- /_data/tips.yml: -------------------------------------------------------------------------------- 1 | - title: JSX 2 | manual: https://deno.land/manual/jsx_dom 3 | config: | 4 | ### JSX configuration in deno.json 5 | 6 | ```json 7 | { 8 | compilerOptions: { 9 | jsx: "react", 10 | jsxFactory: "React.createElement", 11 | jsxFragmentFactory: "React.Fragment", 12 | } 13 | } 14 | ``` 15 | ### JSX transform mode 16 | - In deno.json: 17 | ```json 18 | { 19 | compilerOptions: { 20 | jsx: "react-jsx", 21 | jsxImportSource: "https://esm.sh/react" 22 | } 23 | } 24 | ``` 25 | - In JavaScript: 26 | ```js 27 | /** @jsxImportSource [URL] */ 28 | ``` 29 | - title: Typescript 30 | manual: https://deno.land/manual/typescript 31 | config: | 32 | ### Cli options 33 | 34 | - Disable type checking: `--no-check` 35 | 36 | ### TypeScript configuration in deno.json 37 | ### JSX configuration in deno.json 38 | 39 | ```json 40 | { 41 | compilerOptions: { 42 | "allowJs": true, 43 | "esModuleInterop": true, 44 | "experimentalDecorators": true, 45 | "inlineSourceMap": true, 46 | "isolatedModules": true, 47 | "jsx": "react", 48 | "lib": ["deno.window"], 49 | "module": "esnext", 50 | "strict": true, 51 | "target": "esnext", 52 | "useDefineForClassFields": true 53 | } 54 | } 55 | ``` -------------------------------------------------------------------------------- /_data/tools.yml: -------------------------------------------------------------------------------- 1 | - title: Testing 2 | manual: https://docs.deno.com/runtime/manual/basics/testing/ 3 | cli: deno test [paths...] 4 | stable: true 5 | links: 6 | - text: Deno.test() 7 | url: https://deno.land/api?s=Deno.DenoTest 8 | 9 | - title: Formatter 10 | manual: https://docs.deno.com/runtime/manual/tools/formatter 11 | cli: deno fmt [files...] 12 | stable: true 13 | 14 | - title: Linter 15 | manual: https://docs.deno.com/runtime/manual/tools/linter 16 | cli: deno lint [files...] 17 | stable: true 18 | links: 19 | - text: All rules 20 | url: https://lint.deno.land/ 21 | 22 | - title: Tasks 23 | stable: true 24 | manual: https://docs.deno.com/runtime/manual/tools/task_runner 25 | cli: deno task [args...] 26 | 27 | - title: Benchmarking 28 | stable: true 29 | manual: https://docs.deno.com/runtime/manual/tools/benchmarker 30 | cli: deno bench [files...] 31 | links: 32 | - text: Deno.bench() 33 | url: https://deno.land/api?s=Deno.bench 34 | 35 | - title: Dependency inspector 36 | stable: true 37 | manual: https://docs.deno.com/runtime/manual/tools/dependency_inspector 38 | cli: deno info [url] 39 | 40 | - title: Documentation 41 | stable: true 42 | manual: https://docs.deno.com/runtime/manual/tools/documentation_generator 43 | cli: deno doc [url] 44 | 45 | - title: Compiling executables 46 | stable: true 47 | manual: https://docs.deno.com/runtime/manual/tools/compiler 48 | cli: deno compile [url] 49 | 50 | - title: REPL 51 | stable: true 52 | manual: https://docs.deno.com/runtime/manual/tools/repl 53 | cli: deno repl 54 | 55 | - title: Script installer 56 | stable: true 57 | manual: https://docs.deno.com/runtime/manual/tools/script_installer 58 | cli: deno install [url] 59 | 60 | - title: Vendoring 61 | stable: true 62 | manual: https://docs.deno.com/runtime/manual/tools/vendor 63 | cli: deno vendor 64 | 65 | - title: Jupyter 66 | stable: false 67 | manual: https://docs.deno.com/runtime/manual/tools/jupyter 68 | cli: deno jupyter 69 | 70 | - title: Init 71 | stable: true 72 | manual: https://deno.land/manual/tools/init 73 | cli: deno init 74 | 75 | - title: Publish 76 | stable: true 77 | manual: https://deno.land/manual/tools/publish 78 | cli: deno publish 79 | 80 | - title: Serve 81 | stable: true 82 | manual: https://deno.land/manual/tools/serve 83 | cli: deno serve 84 | -------------------------------------------------------------------------------- /_data/web.yml: -------------------------------------------------------------------------------- 1 | - title: Window 2 | content: 3 | - name: window 4 | stable: true 5 | deprecated: true 6 | type: variable 7 | mdn: /Web/API/Window/window 8 | contains: 9 | name: Window 10 | mdn: /Web/API/Window 11 | 12 | - name: self 13 | stable: true 14 | type: variable 15 | mdn: /Web/API/Window/self 16 | - name: name 17 | stable: true 18 | type: variable 19 | mdn: /Web/API/Window/name 20 | 21 | - name: location 22 | stable: true 23 | type: variable 24 | mdn: /Web/API/Window/Location 25 | contains: 26 | name: Location 27 | mdn: /Web/API/Location 28 | 29 | - name: navigator 30 | stable: true 31 | type: variable 32 | mdn: /Web/API/Window/navigator 33 | contains: 34 | name: Navigator 35 | mdn: /Web/API/Navigator 36 | 37 | - name: alert 38 | stable: true 39 | type: function 40 | mdn: /Web/API/Window/alert 41 | - name: confirm 42 | stable: true 43 | type: function 44 | mdn: /Web/API/Window/confirm 45 | - name: prompt 46 | stable: true 47 | type: function 48 | mdn: /Web/API/Window/prompt 49 | - name: console 50 | stable: true 51 | deploy: true 52 | type: variable 53 | mdn: /Web/API/Window/console 54 | contains: 55 | name: Console 56 | mdn: /Web/API/console 57 | 58 | - title: Async 59 | content: 60 | - name: clearInterval 61 | stable: true 62 | deploy: true 63 | type: function 64 | mdn: /Web/API/clearInterval 65 | - name: clearTimeout 66 | stable: true 67 | deploy: true 68 | type: function 69 | mdn: /Web/API/clearTimeout 70 | - name: queueMicrotask 71 | stable: true 72 | deploy: true 73 | type: function 74 | mdn: /Web/API/queueMicrotask 75 | - name: setInterval 76 | stable: true 77 | deploy: true 78 | type: function 79 | mdn: /Web/API/setInterval 80 | - name: setTimeout 81 | stable: true 82 | deploy: true 83 | type: function 84 | mdn: /Web/API/setTimeout 85 | 86 | - title: Fetch & URLs 87 | content: 88 | - name: fetch 89 | stable: true 90 | deploy: true 91 | type: function 92 | mdn: /Web/API/fetch 93 | - name: Headers 94 | stable: true 95 | deploy: true 96 | type: class 97 | mdn: /Web/API/Headers 98 | - name: Request 99 | stable: true 100 | deploy: true 101 | type: class 102 | mdn: /Web/API/Request 103 | - name: Response 104 | stable: true 105 | deploy: true 106 | type: class 107 | mdn: /Web/API/Response 108 | - name: URL 109 | stable: true 110 | deploy: true 111 | type: class 112 | mdn: /Web/API/URL 113 | - name: URLSearchParams 114 | stable: true 115 | type: class 116 | mdn: /Web/API/URLSearchParams 117 | - name: URLPattern 118 | stable: true 119 | deploy: true 120 | type: class 121 | mdn: /Web/API/URLPattern 122 | - name: FormData 123 | stable: true 124 | type: class 125 | mdn: /Web/API/FormData 126 | 127 | - title: Websocket 128 | content: 129 | - name: WebSocket 130 | stable: true 131 | deploy: true 132 | type: class 133 | mdn: /Web/API/WebSocket 134 | - name: WebSocketStream 135 | stable: false 136 | type: class 137 | 138 | - title: EventSource 139 | content: 140 | - name: EventSource 141 | stable: true 142 | type: class 143 | mdn: /Web/API/EventSource 144 | 145 | - title: Web Workers 146 | content: 147 | - name: Worker 148 | stable: true 149 | type: class 150 | mdn: /Web/API/Worker 151 | 152 | - title: Message 153 | content: 154 | - name: MessagePort 155 | stable: true 156 | type: class 157 | mdn: /Web/API/MessagePort 158 | - name: MessageChannel 159 | stable: true 160 | type: class 161 | mdn: /Web/API/MessageChannel 162 | 163 | - title: Performance 164 | content: 165 | - name: PerformanceMeasure 166 | stable: true 167 | deploy: true 168 | type: class 169 | mdn: /Web/API/PerformanceMeasure 170 | - name: PerformanceMark 171 | stable: true 172 | deploy: true 173 | type: class 174 | mdn: /Web/API/PerformanceMark 175 | - name: PerformanceEntry 176 | stable: true 177 | deploy: true 178 | type: class 179 | mdn: /Web/API/PerformanceEntry 180 | - name: performance 181 | stable: true 182 | deploy: true 183 | type: variable 184 | mdn: /Web/API/performance_property 185 | contains: 186 | name: Performance 187 | mdn: /Web/API/Performance 188 | 189 | - title: Temporal 190 | content: 191 | - name: Temporal.Calendar 192 | stable: false 193 | type: class 194 | - name: Temporal.Duration 195 | stable: false 196 | type: class 197 | - name: Temporal.Instant 198 | stable: false 199 | type: class 200 | - name: Temporal.PlainDate 201 | stable: false 202 | type: class 203 | - name: Temporal.PlainDateTime 204 | stable: false 205 | type: class 206 | - name: Temporal.PlainMonthDay 207 | stable: false 208 | type: class 209 | - name: Temporal.PlainTime 210 | stable: false 211 | type: class 212 | - name: Temporal.TimeZone 213 | stable: false 214 | type: class 215 | - name: Temporal.ZonedDateTime 216 | stable: false 217 | type: class 218 | 219 | - title: Storage 220 | content: 221 | - name: localStorage 222 | stable: true 223 | type: variable 224 | mdn: /Web/API/Window/localStorage 225 | contains: 226 | name: Storage 227 | mdn: /Web/API/Storage 228 | - name: sessionStorage 229 | stable: true 230 | type: variable 231 | mdn: /Web/API/Window/sessionStorage 232 | contains: 233 | name: Storage 234 | mdn: /Web/API/Storage 235 | 236 | - title: File 237 | content: 238 | - name: File 239 | stable: true 240 | deploy: true 241 | type: class 242 | mdn: /Web/API/File 243 | - name: Blob 244 | stable: true 245 | deploy: true 246 | type: class 247 | mdn: /Web/API/Blob 248 | - name: FileReader 249 | stable: true 250 | type: class 251 | mdn: /Web/API/FileReader 252 | 253 | - title: TextEncoder 254 | content: 255 | - name: TextDecoder 256 | stable: true 257 | deploy: true 258 | type: class 259 | mdn: /Web/API/TextDecoder 260 | - name: TextDecoderStream 261 | stable: true 262 | deploy: true 263 | type: class 264 | mdn: /Web/API/TextDecoderStream 265 | - name: TextEncoder 266 | stable: true 267 | deploy: true 268 | type: class 269 | mdn: /Web/API/TextEncoder 270 | - name: TextEncoderStream 271 | stable: true 272 | deploy: true 273 | type: class 274 | mdn: /Web/API/TextEncoderStream 275 | 276 | - title: Streams 277 | content: 278 | - name: ReadableByteStreamController 279 | stable: true 280 | type: class 281 | mdn: /Web/API/ReadableByteStreamController 282 | - name: ReadableStream 283 | stable: true 284 | deploy: true 285 | type: class 286 | mdn: /Web/API/ReadableStream 287 | - name: ReadableStreamDefaultController 288 | stable: true 289 | type: class 290 | mdn: /Web/API/ReadableStreamDefaultController 291 | - name: ReadableStreamDefaultReader 292 | stable: true 293 | type: class 294 | mdn: /Web/API/ReadableStreamDefaultReader 295 | - name: ReadableStreamReader 296 | stable: true 297 | type: type 298 | - name: TransformStream 299 | stable: true 300 | deploy: true 301 | type: class 302 | mdn: /Web/API/TransformStream 303 | - name: TransformStreamDefaultController 304 | stable: true 305 | type: class 306 | mdn: /Web/API/TransformStreamDefaultController 307 | - name: WritableStream 308 | stable: true 309 | type: class 310 | mdn: /Web/API/WritableStream 311 | - name: WritableStreamDefaultController 312 | stable: true 313 | deploy: true 314 | type: class 315 | mdn: /Web/API/WritableStreamDefaultController 316 | - name: WritableStreamDefaultWriter 317 | stable: true 318 | type: class 319 | mdn: /Web/API/WritableStreamDefaultWriter 320 | - name: CountQueuingStrategy 321 | stable: true 322 | type: class 323 | mdn: /Web/API/CountQueuingStrategy 324 | - name: ByteLengthQueuingStrategy 325 | stable: true 326 | type: class 327 | mdn: /Web/API/ByteLengthQueuingStrategy 328 | 329 | - title: Compression Streams 330 | content: 331 | - name: DecompressionStream 332 | stable: true 333 | type: class 334 | mdn: /Web/API/DecompressionStream 335 | - name: CompressionStream 336 | stable: true 337 | type: class 338 | mdn: /Web/API/CompressionStream 339 | 340 | - title: Cache 341 | content: 342 | - name: Cache 343 | stable: true 344 | type: class 345 | mdn: /Web/API/Cache 346 | - name: CacheStorage 347 | stable: true 348 | type: class 349 | mdn: /Web/API/CacheStorage 350 | 351 | - title: Events 352 | content: 353 | - name: ProgressEvent 354 | stable: true 355 | type: class 356 | mdn: /Web/API/ProgressEvent 357 | - name: EventTarget 358 | stable: true 359 | type: class 360 | mdn: /Web/API/EventTarget 361 | - name: Event 362 | stable: true 363 | type: class 364 | mdn: /Web/API/Event 365 | - name: MessageEvent 366 | stable: true 367 | type: class 368 | mdn: /Web/API/MessageEvent 369 | - name: onload 370 | stable: true 371 | type: variable 372 | mdn: /Web/API/GlobalEventHandlers/onload 373 | - name: onunload 374 | stable: true 375 | type: variable 376 | mdn: /Web/API/WindowEventHandlers/onunload 377 | - name: addEventListener 378 | stable: true 379 | type: function 380 | mdn: /Web/API/EventTarget/addEventListener 381 | - name: dispatchEvent 382 | stable: true 383 | type: function 384 | mdn: /Web/API/EventTarget/dispatchEvent 385 | - name: removeEventListener 386 | stable: true 387 | type: function 388 | mdn: /Web/API/EventTarget/removeEventListener 389 | - name: CustomEvent 390 | stable: true 391 | type: class 392 | mdn: /Web/API/CustomEvent/CustomEvent 393 | - name: CloseEvent 394 | stable: true 395 | type: class 396 | mdn: /Web/API/CloseEvent 397 | 398 | - title: Errors 399 | content: 400 | - name: reportError 401 | stable: true 402 | type: function 403 | mdn: Web/API/reportError 404 | - name: onerror 405 | stable: true 406 | type: variable 407 | mdn: /Web/API/GlobalEventHandlers/onerror 408 | - name: ErrorEvent 409 | stable: true 410 | type: class 411 | mdn: /Web/API/ErrorEvent 412 | - name: DOMException 413 | stable: true 414 | type: class 415 | mdn: /Web/API/DOMException 416 | 417 | - title: AbortController 418 | content: 419 | - name: AbortController 420 | stable: true 421 | type: class 422 | mdn: /Web/API/AbortController 423 | - name: AbortSignal 424 | stable: true 425 | type: class 426 | mdn: /Web/API/AbortSignal 427 | 428 | - title: CryptoKey 429 | content: 430 | - name: crypto 431 | stable: true 432 | deploy: true 433 | type: variable 434 | mdn: /Web/API/crypto_property 435 | contains: 436 | name: Crypto 437 | mdn: /Web/API/Crypto 438 | - name: CryptoKey 439 | stable: true 440 | type: class 441 | mdn: /Web/API/CryptoKey 442 | - name: CryptoKeyPair 443 | stable: true 444 | type: class 445 | mdn: /Web/API/CryptoKeyPair 446 | - name: SubtleCrypto 447 | stable: true 448 | deploy: true 449 | type: class 450 | mdn: /Web/API/SubtleCrypto 451 | 452 | - title: Binary to ASCII 453 | content: 454 | - name: btoa 455 | stable: true 456 | deploy: true 457 | type: function 458 | mdn: /Web/API/btoa 459 | - name: atob 460 | stable: true 461 | deploy: true 462 | type: function 463 | mdn: /Web/API/atob 464 | 465 | - title: Broadcast Channel 466 | content: 467 | - name: BroadcastChannel 468 | stable: true 469 | deploy: true 470 | type: class 471 | mdn: /Web/API/BroadcastChannel 472 | 473 | - title: Structured Clone 474 | content: 475 | - name: structuredClone 476 | stable: true 477 | type: function 478 | mdn: /Web/API/structuredClone 479 | 480 | - title: Image Data 481 | content: 482 | - name: ImageData 483 | stable: true 484 | type: class 485 | mdn: /Web/API/ImageData 486 | 487 | - title: WebAssembly 488 | content: 489 | - name: WebAssembly.CompileError 490 | type: class 491 | stable: true 492 | mdn: /Web/JavaScript/Reference/Global_Objects/WebAssembly/CompileError 493 | - name: WebAssembly.Global 494 | type: class 495 | stable: true 496 | mdn: /Web/JavaScript/Reference/Global_Objects/WebAssembly/Global 497 | - name: WebAssembly.Instance 498 | type: class 499 | stable: true 500 | mdn: /Web/JavaScript/Reference/Global_Objects/WebAssembly/Instance 501 | - name: WebAssembly.LinkError 502 | type: class 503 | stable: true 504 | mdn: /Web/JavaScript/Reference/Global_Objects/WebAssembly/LinkError 505 | - name: WebAssembly.Memory 506 | type: class 507 | stable: true 508 | mdn: /Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory 509 | - name: WebAssembly.Module 510 | type: class 511 | stable: true 512 | mdn: /Web/JavaScript/Reference/Global_Objects/WebAssembly/Module 513 | - name: WebAssembly.RuntimeError 514 | type: class 515 | stable: true 516 | mdn: /Web/JavaScript/Reference/Global_Objects/WebAssembly/RuntimeError 517 | - name: WebAssembly.Table 518 | type: class 519 | stable: true 520 | mdn: /Web/JavaScript/Reference/Global_Objects/WebAssembly/Table 521 | - name: WebAssembly.compile 522 | type: function 523 | stable: true 524 | mdn: /Web/JavaScript/Reference/Global_Objects/WebAssembly/compile 525 | - name: WebAssembly.compileStreaming 526 | type: function 527 | stable: true 528 | mdn: /Web/JavaScript/Reference/Global_Objects/WebAssembly/compileStreaming 529 | - name: WebAssembly.instantiate 530 | type: function 531 | stable: true 532 | mdn: /Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiate 533 | - name: WebAssembly.instantiateStreaming 534 | type: function 535 | stable: true 536 | mdn: /Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiateStreaming 537 | - name: WebAssembly.validate 538 | type: function 539 | stable: true 540 | mdn: /Web/JavaScript/Reference/Global_Objects/WebAssembly/validate 541 | 542 | - title: WebGPU 543 | content: 544 | - name: GPU 545 | type: class 546 | stable: true 547 | - name: GPUAdapter 548 | type: class 549 | stable: true 550 | - name: GPUAdapterInfo 551 | type: class 552 | stable: true 553 | - name: GPUBindGroup 554 | type: class 555 | stable: true 556 | - name: GPUBindGroupLayout 557 | type: class 558 | stable: true 559 | - name: GPUBuffer 560 | type: class 561 | stable: true 562 | - name: GPUBufferUsage 563 | type: class 564 | stable: true 565 | - name: GPUColorWrite 566 | type: class 567 | stable: true 568 | - name: GPUCommandBuffer 569 | type: class 570 | stable: true 571 | - name: GPUCommandEncoder 572 | type: class 573 | stable: true 574 | - name: GPUComputePassEncoder 575 | type: class 576 | stable: true 577 | - name: GPUComputePipeline 578 | type: class 579 | stable: true 580 | - name: GPUDevice 581 | type: class 582 | stable: true 583 | - name: GPUMapMode 584 | type: class 585 | stable: true 586 | - name: GPUOutOfMemoryError 587 | type: class 588 | stable: true 589 | - name: GPUPipelineLayout 590 | type: class 591 | stable: true 592 | - name: GPUQuerySet 593 | type: class 594 | stable: true 595 | - name: GPUQueue 596 | type: class 597 | stable: true 598 | - name: GPURenderBundle 599 | type: class 600 | stable: true 601 | - name: GPURenderBundleEncoder 602 | type: class 603 | stable: true 604 | - name: GPURenderPassEncoder 605 | type: class 606 | stable: true 607 | - name: GPURenderPipeline 608 | type: class 609 | stable: true 610 | - name: GPUSampler 611 | type: class 612 | stable: true 613 | - name: GPUShaderModule 614 | type: class 615 | stable: true 616 | - name: GPUShaderStage 617 | type: class 618 | stable: true 619 | - name: GPUSupportedFeatures 620 | type: class 621 | stable: true 622 | - name: GPUSupportedLimits 623 | type: class 624 | stable: true 625 | - name: GPUTexture 626 | type: class 627 | stable: true 628 | - name: GPUTextureUsage 629 | type: class 630 | stable: true 631 | - name: GPUTextureView 632 | type: class 633 | stable: true 634 | - name: GPUValidationError 635 | type: class 636 | stable: true 637 | -------------------------------------------------------------------------------- /deno-logo.svg: -------------------------------------------------------------------------------- 1 | Deno logo -------------------------------------------------------------------------------- /deno.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "jsx": "react-jsx", 4 | "jsxImportSource": "npm:react", 5 | "types": [ 6 | "lume/types.ts", 7 | "https://unpkg.com/@types/react@18.2.37/index.d.ts" 8 | ] 9 | }, 10 | "lock": false, 11 | "tasks": { 12 | "build": "deno task lume", 13 | "serve": "deno task lume -s", 14 | "lume": "echo \"import 'lume/cli.ts'\" | deno run -A -", 15 | "deploy": "deno task build && rsync -r _site/ 'oscarotero@oscarotero.com:~/www/deno'" 16 | }, 17 | "imports": { 18 | "lume/": "https://deno.land/x/lume@v2.1.4/" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /index.vto: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Deno Cheat Sheet 7 | 8 | 9 | 10 | 11 | 12 |

13 | 14 | Deno cheat sheet 15 | v1.43 16 |

17 | 18 |
19 |
20 | {{ for tool of tools }} 21 |
22 |

23 | 24 | {{ tool.title }} 25 | 26 | {{ if !tool.stable }} 27 |   28 | unstable 29 | {{ /if }} 30 |

31 | {{ comp.deno.tool(tool) }} 32 |
33 | {{ /for }} 34 |
35 |
36 | 37 |
38 |
39 |

Deno runtime API

40 |
41 | 42 |
43 | {{ for section of deno }} 44 |
45 |

{{ section.title }}

46 | 47 |
    48 | {{ for item of section.content.sort((a, b) => a.name.localeCompare(b.name)) }} 49 |
  • 50 | {{ comp.deno.api(item) }} 51 |
  • 52 | {{ /for }} 53 |
54 |
55 | {{ /for }} 56 |
57 |
58 | 59 |
60 |
61 |

Web APIs

62 |
63 | 64 |
65 | {{ for section of web }} 66 |
67 |

{{ section.title }}

68 | 69 |
    70 | {{ for item of section.content.sort((a, b) => a.name.localeCompare(b.name)) }} 71 |
  • 72 | {{ comp.deno.api(item) }} 73 |
  • 74 | {{ /for }} 75 |
76 |
77 | {{ /for }} 78 |
79 |
80 | 81 |
82 |
83 |

Standard library

84 |
85 | 86 |
87 | {{ for section of std }} 88 |
89 |

90 | 91 | {{ section.title }} 92 | 93 | 94 | {{ if section.browser }} 95 |   Browser 96 | {{ /if }} 97 |

98 | {{ section.description |> md }} 99 |
100 | {{ /for }} 101 |
102 |
103 | 104 | 105 | 106 | 109 | 110 | -------------------------------------------------------------------------------- /scripts/main.js: -------------------------------------------------------------------------------- 1 | import "./x-modal.js"; 2 | 3 | const modal = document.querySelector("x-modal"); 4 | 5 | document.querySelectorAll("[data-modal]").forEach((link) => { 6 | const { dataset } = link; 7 | const tabs = {}; 8 | 9 | if (dataset.mdn) { 10 | tabs["See at MDN"] = dataset.mdn; 11 | } 12 | 13 | link.addEventListener("click", (e) => { 14 | e.preventDefault(); 15 | modal.open(link.href, tabs); 16 | }); 17 | }); 18 | document.querySelectorAll("button[data-dialog]").forEach((btn) => { 19 | const next = btn.nextElementSibling; 20 | const dialog = next?.matches("dialog") ? next : null; 21 | btn.addEventListener("click", () => { 22 | dialog?.showModal(); 23 | }); 24 | dialog?.querySelector("button")?.addEventListener("click", () => { 25 | dialog?.close(); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /scripts/x-modal.js: -------------------------------------------------------------------------------- 1 | class XModal extends HTMLElement { 2 | connectedCallback() { 3 | this.shadow = this.attachShadow({ mode: "open" }); 4 | this.shadow.innerHTML = ` 5 | 63 | 64 | 68 | 69 | 70 | `; 71 | 72 | const dialog = this.shadow.querySelector("dialog"); 73 | const close = this.shadow.querySelector("button"); 74 | 75 | close.addEventListener("click", () => dialog.close()); 76 | } 77 | 78 | open(url, tabs = {}) { 79 | const iframe = this.shadow.querySelector("iframe"); 80 | const dialog = this.shadow.querySelector("dialog"); 81 | 82 | iframe.setAttribute("src", url); 83 | 84 | const ul = this.shadow.querySelector("ul"); 85 | const code = []; 86 | 87 | for (const [name, url] of Object.entries(tabs)) { 88 | code.push(`
  • ${name}
  • `); 89 | } 90 | 91 | ul.innerHTML = code.join(""); 92 | 93 | dialog.showModal(); 94 | } 95 | } 96 | 97 | customElements.define("x-modal", XModal); 98 | -------------------------------------------------------------------------------- /styles.css: -------------------------------------------------------------------------------- 1 | @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap'); 2 | 3 | :root { 4 | --font-ui: Inter, -apple-system, system-ui, sans-serif; 5 | --font-code: monospace; 6 | --color-back: white; 7 | --color-front: black; 8 | --color-bg: hsl(215deg, 20%, 96%); 9 | --color-border: hsl(215deg, 20%, 86%); 10 | --color-code: hsl(215deg, 20%, 40%); 11 | --color-nav-bg: black; 12 | --color-nav: white; 13 | 14 | --color-interact: hsl(215deg, 20%, 20%); 15 | --color-interact-hover: hsl(215deg, 20%, 0%); 16 | --color-interact-bg: hsl(215deg, 20%, 86%); 17 | --color-interact-bg-hover: hsl(215deg, 20%, 80%); 18 | 19 | --color-unstable: hsl(346deg, 55%, 30%); 20 | --color-unstable-bg: hsl(346deg, 44%, 90%); 21 | --color-deploy: hsl(215deg, 60%, 30%); 22 | --color-deploy-bg: hsl(215deg, 60%, 90%); 23 | 24 | @media (prefers-color-scheme: dark) { 25 | --color-back: hsl(215deg, 20%, 10%); 26 | --color-front: white; 27 | --color-bg: hsl(215deg, 20%, 16%); 28 | --color-border: hsl(215deg, 20%, 20%); 29 | --color-code: hsl(215deg, 20%, 60%); 30 | --color-nav-bg: hsl(215deg, 28%, 17%); 31 | --color-nav: white; 32 | 33 | --color-interact: hsl(215deg, 20%, 70%); 34 | --color-interact-hover: hsl(215deg, 20%, 100%); 35 | --color-interact-bg: hsl(215deg, 20%, 26%); 36 | --color-interact-bg-hover: hsl(215deg, 20%, 30%); 37 | 38 | --color-unstable: hsl(346deg, 55%, 70%); 39 | --color-unstable-bg: hsl(346deg, 44%, 20%); 40 | --color-deploy: hsl(215deg, 60%, 70%); 41 | --color-deploy-bg: hsl(215deg, 60%, 20%); 42 | } 43 | } 44 | html { 45 | background: var(--color-back); 46 | color: var(--color-front); 47 | } 48 | body { 49 | font-family: var(--font-ui); 50 | margin: 0 auto; 51 | max-width: 1600px; 52 | padding: 0 5vw; 53 | line-height: 1.5; 54 | } 55 | pre, code { 56 | font-family: var(--font-code); 57 | } 58 | pre { 59 | margin: .5em 0; 60 | } 61 | h1, h2, h3, h4 { 62 | font-weight: 600; 63 | } 64 | code { 65 | font-size: .85rem; 66 | background: var(--color-bg); 67 | color: var(--color-code); 68 | border: solid 1px var(--color-border); 69 | padding: 0.1em 0.3em; 70 | border-radius: 4px; 71 | } 72 | pre > code { 73 | display: block; 74 | overflow: auto; 75 | padding: .5em 1em; 76 | } 77 | 78 | .main-title { 79 | font-size: 2rem; 80 | letter-spacing: -0.02em; 81 | margin: clamp(2rem, 5vw, 100px) 0; 82 | display: flex; 83 | align-items: baseline; 84 | justify-content: center; 85 | flex-wrap: wrap; 86 | gap: 1rem; 87 | 88 | & small { 89 | font-weight: normal; 90 | font-size: 1rem; 91 | } 92 | 93 | & img { 94 | align-self: center; 95 | } 96 | } 97 | .main-footer { 98 | text-align: center; 99 | font-size: 0.85rem; 100 | margin: 4rem 0; 101 | 102 | & a { 103 | color: inherit; 104 | } 105 | } 106 | 107 | .section-header { 108 | margin-bottom: 1em; 109 | border-bottom: solid 1px var(--color-border); 110 | background: var(--color-back); 111 | position: sticky; 112 | top: 0; 113 | padding: 0.5rem 0; 114 | margin: 4rem 0 2rem 0; 115 | } 116 | .section-title { 117 | margin: 0; 118 | font-size: 1.6rem; 119 | font-weight: 600; 120 | letter-spacing: -0.02em; 121 | } 122 | .section-content { 123 | column-width: 13em; 124 | column-gap: 3em; 125 | 126 | & > * { 127 | break-inside: avoid; 128 | } 129 | } 130 | .section-subsection { 131 | margin-bottom: 1em; 132 | border-radius: 4px; 133 | overflow: hidden; 134 | 135 | & p { 136 | font-size: .85rem; 137 | margin-top: 0; 138 | color: var(--color-code); 139 | } 140 | } 141 | .section-subtitle { 142 | font-size: 1rem; 143 | margin: 0 0 .5em; 144 | 145 | & a { 146 | color: inherit; 147 | 148 | &:hover { 149 | text-decoration: none; 150 | } 151 | } 152 | } 153 | .section-items { 154 | font-size: .85rem; 155 | list-style: none; 156 | margin: 0 0 1em; 157 | padding: 0; 158 | 159 | & p { 160 | margin: 0; 161 | } 162 | 163 | & a { 164 | display: inline-block; 165 | padding: .25em 0; 166 | border-radius: .3em; 167 | text-decoration: none; 168 | color: var(--color-interact); 169 | 170 | &:hover { 171 | color: var(--color-interact-hover); 172 | text-decoration: underline; 173 | } 174 | } 175 | } 176 | .section-tools { 177 | display: grid; 178 | grid-template-columns: repeat(auto-fit, minmax(18em, 1fr)); 179 | column-gap: 1rem; 180 | row-gap: 1rem; 181 | } 182 | .section-tool { 183 | border-radius: 8px; 184 | padding: 1rem; 185 | background: var(--color-bg); 186 | font-size: 0.85em; 187 | 188 | & > pre code { 189 | padding-left: 0; 190 | border: none; 191 | background: none; 192 | } 193 | 194 | & a { 195 | color: inherit; 196 | 197 | &:hover { 198 | text-decoration: none; 199 | } 200 | } 201 | } 202 | .section-tool-img { 203 | font-size: 40px; 204 | float: right; 205 | margin-top: -10px; 206 | } 207 | 208 | .badge { 209 | display: inline-block; 210 | text-transform: uppercase; 211 | font-size: .65rem; 212 | padding: .1em .5em; 213 | border-radius: 8px; 214 | font-family: var(--font-ui); 215 | font-weight: normal; 216 | 217 | &.is-unstable { 218 | background: var(--color-unstable-bg); 219 | color: var(--color-unstable); 220 | } 221 | 222 | &.is-deprecated { 223 | border: solid 1px var(--color-unstable-bg); 224 | color: var(--color-unstable); 225 | } 226 | 227 | &.is-deploy { 228 | background: var(--color-deploy-bg); 229 | color: var(--color-deploy); 230 | } 231 | 232 | &.is-browser { 233 | background: var(--color-deploy-bg); 234 | color: var(--color-deploy); 235 | } 236 | } 237 | 238 | .config-dialog[open] { 239 | width: min(800px, calc(100vw - 20px)); 240 | padding: 0; 241 | display: grid; 242 | grid-template-rows: auto 1fr; 243 | border-radius: 1em 1em .5em .5em; 244 | border: none; 245 | background: var(--color-back); 246 | color: var(--color-front); 247 | 248 | & nav { 249 | display: flex; 250 | align-items: center; 251 | background: var(--color-nav-bg); 252 | color: var(--color-nav); 253 | justify-content: end; 254 | 255 | column-gap: 1em; 256 | padding: .5em; 257 | } 258 | & button { 259 | width: 2em; 260 | height: 2em; 261 | padding: 0; 262 | display: flex; 263 | align-items: center; 264 | justify-content: center; 265 | border: none; 266 | background: none; 267 | color: inherit; 268 | font-size: 1em; 269 | cursor: pointer; 270 | border-radius: 50%; 271 | 272 | &:hover { 273 | background: rgba(255, 255, 255, 0.3); 274 | } 275 | } 276 | } 277 | 278 | .button { 279 | background: var(--color-interact-bg); 280 | border: none; 281 | padding: .5em 1em; 282 | border-radius: 4px; 283 | cursor: pointer; 284 | font-size: .9rem; 285 | line-height: 1; 286 | color: var(--color-interact); 287 | font-weight: 600; 288 | text-decoration: none; 289 | display: inline-block; 290 | 291 | &:hover { 292 | color: var(--color-interact-hover); 293 | background: var(--color-interact-bg-hover); 294 | } 295 | } 296 | 297 | ::backdrop { 298 | background: rgba(0, 0, 0, 0.5); 299 | } 300 | 301 | .config-content { 302 | line-height: 1.6; 303 | padding: 1.5em; 304 | max-height: calc(100vh - 20px); 305 | overflow-y: auto; 306 | 307 | & ul { 308 | padding-left: 1.2em; 309 | } 310 | 311 | & h3 { 312 | margin: 2em 0 0; 313 | border-bottom: solid 1px var(--color-border); 314 | } 315 | 316 | & > :first-child { 317 | margin-top: 0; 318 | } 319 | 320 | & a { 321 | color: inherit; 322 | } 323 | } --------------------------------------------------------------------------------