toiljs 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.idea/prettier.xml +1 -0
- package/as-pect.config.js +1 -1
- package/build/backend/.tsbuildinfo +1 -1
- package/build/backend/index.js +1 -2
- package/build/cli/.tsbuildinfo +1 -1
- package/build/cli/configure.d.ts +15 -0
- package/build/cli/configure.js +201 -0
- package/build/cli/create.d.ts +4 -0
- package/build/cli/create.js +193 -68
- package/build/cli/features.d.ts +23 -0
- package/build/cli/features.js +85 -0
- package/build/cli/index.js +42 -2
- package/build/cli/proc.d.ts +1 -0
- package/build/cli/proc.js +11 -0
- package/build/cli/ui.js +1 -2
- package/build/cli/validate.d.ts +4 -0
- package/build/cli/validate.js +19 -0
- package/build/client/.tsbuildinfo +1 -1
- package/build/client/Link.d.ts +8 -0
- package/build/client/Link.js +44 -0
- package/build/client/NavLink.d.ts +14 -0
- package/build/client/NavLink.js +37 -0
- package/build/client/Router.d.ts +7 -0
- package/build/client/Router.js +55 -0
- package/build/client/channel/channel.d.ts +23 -0
- package/build/client/channel/channel.js +94 -0
- package/build/client/error-boundary.d.ts +16 -0
- package/build/client/error-boundary.js +19 -0
- package/build/client/head/head.d.ts +26 -0
- package/build/client/head/head.js +87 -0
- package/build/client/head.d.ts +26 -0
- package/build/client/head.js +87 -0
- package/build/client/hooks.d.ts +17 -0
- package/build/client/hooks.js +48 -0
- package/build/client/index.d.ts +18 -6
- package/build/client/index.js +10 -3
- package/build/client/lazy.d.ts +16 -0
- package/build/client/lazy.js +53 -0
- package/build/client/match.js +7 -0
- package/build/client/mount.d.ts +2 -0
- package/build/client/mount.js +13 -0
- package/build/client/navigation/Link.d.ts +8 -0
- package/build/client/navigation/Link.js +44 -0
- package/build/client/navigation/NavLink.d.ts +14 -0
- package/build/client/navigation/NavLink.js +37 -0
- package/build/client/navigation/navigation.d.ts +13 -0
- package/build/client/navigation/navigation.js +97 -0
- package/build/client/navigation/prefetch.d.ts +11 -0
- package/build/client/navigation/prefetch.js +100 -0
- package/build/client/navigation/scroll.d.ts +8 -0
- package/build/client/navigation/scroll.js +36 -0
- package/build/client/navigation.d.ts +13 -0
- package/build/client/navigation.js +97 -0
- package/build/client/params-context.d.ts +2 -0
- package/build/client/params-context.js +2 -0
- package/build/client/prefetch.d.ts +11 -0
- package/build/client/prefetch.js +100 -0
- package/build/client/routing/Router.d.ts +7 -0
- package/build/client/routing/Router.js +55 -0
- package/build/client/routing/error-boundary.d.ts +16 -0
- package/build/client/routing/error-boundary.js +19 -0
- package/build/client/routing/hooks.d.ts +17 -0
- package/build/client/routing/hooks.js +48 -0
- package/build/client/routing/lazy.d.ts +16 -0
- package/build/client/routing/lazy.js +53 -0
- package/build/client/routing/match.d.ts +2 -0
- package/build/client/routing/match.js +32 -0
- package/build/client/routing/mount.d.ts +2 -0
- package/build/client/routing/mount.js +13 -0
- package/build/client/routing/params-context.d.ts +2 -0
- package/build/client/routing/params-context.js +2 -0
- package/build/client/scroll.d.ts +8 -0
- package/build/client/scroll.js +36 -0
- package/build/client/types.d.ts +27 -0
- package/build/client/types.js +1 -0
- package/build/compiler/.tsbuildinfo +1 -1
- package/build/compiler/config.d.ts +2 -0
- package/build/compiler/config.js +14 -2
- package/build/compiler/docs.d.ts +10 -0
- package/build/compiler/docs.js +59 -0
- package/build/compiler/generate.js +144 -16
- package/build/compiler/index.d.ts +4 -2
- package/build/compiler/index.js +4 -3
- package/build/compiler/plugin.js +16 -1
- package/build/compiler/routes.js +5 -1
- package/build/compiler/vite.d.ts +1 -1
- package/build/compiler/vite.js +17 -1
- package/build/io/.tsbuildinfo +1 -1
- package/build/io/BinaryWriter.js +2 -2
- package/eslint.config.js +1 -1
- package/examples/basic/.toil/docs/cli.md +3 -0
- package/examples/basic/.toil/docs/client.md +3 -0
- package/examples/basic/.toil/docs/index.md +3 -0
- package/examples/basic/.toil/docs/routing.md +3 -0
- package/examples/basic/.toil/docs/server.md +3 -0
- package/examples/basic/.toil/docs/styling.md +3 -0
- package/examples/basic/.toil/entry.tsx +3 -8
- package/examples/basic/.toil/globals.ts +6 -0
- package/examples/basic/.toil/index.html +16 -12
- package/examples/basic/.toil/public/images/.gitkeep +1 -0
- package/examples/basic/.toil/public/images/logo.svg +37 -0
- package/examples/basic/.toil/public/robots.txt +2 -0
- package/examples/basic/.toil/routes.ts +9 -7
- package/examples/basic/build/client/assets/404-Bq0jNTUo.js +1 -0
- package/examples/basic/build/client/assets/_...slug_-CXKf6qnB.js +1 -0
- package/examples/basic/build/client/assets/_id_-BadAyQnb.js +1 -0
- package/examples/basic/build/client/assets/about-BOhoEcEO.js +1 -0
- package/examples/basic/build/client/assets/get-started-BIXpcjkT.js +9 -0
- package/examples/basic/build/client/assets/index-BmqcTaBB.js +1 -0
- package/examples/basic/build/client/assets/io-DEVjjaJj.js +1 -0
- package/examples/basic/build/client/assets/layout-DJegirdz.js +1 -0
- package/examples/basic/build/client/assets/react-DEQrz1q7.js +9 -0
- package/examples/basic/build/client/assets/rolldown-runtime-KL5VtC6j.js +1 -0
- package/examples/basic/build/client/assets/routes-BYWn6TxK.js +1 -0
- package/examples/basic/build/client/css/style.css +2 -0
- package/examples/basic/build/client/images/.gitkeep +1 -0
- package/examples/basic/build/client/images/logo.svg +37 -0
- package/examples/basic/build/client/index.html +17 -0
- package/examples/basic/build/client/robots.txt +2 -0
- package/examples/basic/client/404.tsx +2 -5
- package/examples/basic/client/components/.gitkeep +1 -0
- package/examples/basic/client/components/Footer.tsx +8 -0
- package/examples/basic/client/components/HoneycombBackground.tsx +162 -0
- package/examples/basic/client/layout.tsx +43 -26
- package/examples/basic/client/public/favicon.ico +0 -0
- package/examples/basic/client/public/images/.gitkeep +1 -0
- package/examples/basic/client/public/images/logo.svg +37 -0
- package/examples/basic/client/public/index.html +16 -0
- package/examples/basic/client/public/robots.txt +2 -0
- package/examples/basic/client/routes/about.tsx +1 -3
- package/examples/basic/client/routes/blog/[id].tsx +2 -4
- package/examples/basic/client/routes/docs/[...slug].tsx +3 -6
- package/examples/basic/client/routes/get-started.tsx +84 -0
- package/examples/basic/client/routes/index.tsx +74 -7
- package/examples/basic/client/routes/io.tsx +3 -7
- package/examples/basic/client/styles/main.css +461 -0
- package/examples/basic/client/toil.tsx +7 -0
- package/examples/basic/node_modules/.bin/toilinit +16 -0
- package/examples/basic/node_modules/.bin/toilinit.cmd +17 -0
- package/examples/basic/node_modules/.bin/toilinit.ps1 +28 -0
- package/examples/basic/node_modules/.bin/toilscript +16 -0
- package/examples/basic/node_modules/.bin/toilscript.cmd +17 -0
- package/examples/basic/node_modules/.bin/toilscript.ps1 +28 -0
- package/examples/basic/node_modules/.bin/wasm-as +16 -0
- package/examples/basic/node_modules/.bin/wasm-as.cmd +17 -0
- package/examples/basic/node_modules/.bin/wasm-as.ps1 +28 -0
- package/examples/basic/node_modules/.bin/wasm-ctor-eval +16 -0
- package/examples/basic/node_modules/.bin/wasm-ctor-eval.cmd +17 -0
- package/examples/basic/node_modules/.bin/wasm-ctor-eval.ps1 +28 -0
- package/examples/basic/node_modules/.bin/wasm-dis +16 -0
- package/examples/basic/node_modules/.bin/wasm-dis.cmd +17 -0
- package/examples/basic/node_modules/.bin/wasm-dis.ps1 +28 -0
- package/examples/basic/node_modules/.bin/wasm-merge +16 -0
- package/examples/basic/node_modules/.bin/wasm-merge.cmd +17 -0
- package/examples/basic/node_modules/.bin/wasm-merge.ps1 +28 -0
- package/examples/basic/node_modules/.bin/wasm-metadce +16 -0
- package/examples/basic/node_modules/.bin/wasm-metadce.cmd +17 -0
- package/examples/basic/node_modules/.bin/wasm-metadce.ps1 +28 -0
- package/examples/basic/node_modules/.bin/wasm-opt +16 -0
- package/examples/basic/node_modules/.bin/wasm-opt.cmd +17 -0
- package/examples/basic/node_modules/.bin/wasm-opt.ps1 +28 -0
- package/examples/basic/node_modules/.bin/wasm-reduce +16 -0
- package/examples/basic/node_modules/.bin/wasm-reduce.cmd +17 -0
- package/examples/basic/node_modules/.bin/wasm-reduce.ps1 +28 -0
- package/examples/basic/node_modules/.bin/wasm-shell +16 -0
- package/examples/basic/node_modules/.bin/wasm-shell.cmd +17 -0
- package/examples/basic/node_modules/.bin/wasm-shell.ps1 +28 -0
- package/examples/basic/node_modules/.bin/wasm2js +16 -0
- package/examples/basic/node_modules/.bin/wasm2js.cmd +17 -0
- package/examples/basic/node_modules/.bin/wasm2js.ps1 +28 -0
- package/examples/basic/node_modules/.package-lock.json +49 -1
- package/examples/basic/node_modules/.vite/deps/_metadata.json +9 -9
- package/examples/basic/node_modules/binaryen/LICENSE +201 -0
- package/examples/basic/node_modules/binaryen/README.md +1362 -0
- package/examples/basic/node_modules/binaryen/bin/package.json +3 -0
- package/examples/basic/node_modules/binaryen/bin/wasm-as +0 -0
- package/examples/basic/node_modules/binaryen/bin/wasm-ctor-eval +0 -0
- package/examples/basic/node_modules/binaryen/bin/wasm-dis +0 -0
- package/examples/basic/node_modules/binaryen/bin/wasm-merge +0 -0
- package/examples/basic/node_modules/binaryen/bin/wasm-metadce +0 -0
- package/examples/basic/node_modules/binaryen/bin/wasm-opt +0 -0
- package/examples/basic/node_modules/binaryen/bin/wasm-reduce +0 -0
- package/examples/basic/node_modules/binaryen/bin/wasm-shell +0 -0
- package/examples/basic/node_modules/binaryen/bin/wasm2js +0 -0
- package/examples/basic/node_modules/binaryen/index.d.ts +2371 -0
- package/examples/basic/node_modules/binaryen/index.js +30552 -0
- package/examples/basic/node_modules/binaryen/package.json +50 -0
- package/examples/basic/node_modules/long/LICENSE +202 -0
- package/examples/basic/node_modules/long/README.md +286 -0
- package/examples/basic/node_modules/long/index.d.ts +2 -0
- package/examples/basic/node_modules/long/index.js +1581 -0
- package/examples/basic/node_modules/long/package.json +58 -0
- package/examples/basic/node_modules/long/types.d.ts +474 -0
- package/examples/basic/node_modules/long/umd/index.d.ts +3 -0
- package/examples/basic/node_modules/long/umd/index.js +1622 -0
- package/examples/basic/node_modules/long/umd/package.json +3 -0
- package/examples/basic/node_modules/long/umd/types.d.ts +474 -0
- package/examples/basic/node_modules/toilscript/LICENSE +201 -0
- package/examples/basic/node_modules/toilscript/NOTICE +94 -0
- package/examples/basic/node_modules/toilscript/README.md +66 -0
- package/examples/basic/node_modules/toilscript/bin/toilinit.js +468 -0
- package/examples/basic/node_modules/toilscript/bin/toilscript.js +35 -0
- package/examples/basic/node_modules/toilscript/dist/cli.d.ts +4 -0
- package/examples/basic/node_modules/toilscript/dist/cli.generated.d.ts +10027 -0
- package/examples/basic/node_modules/toilscript/dist/cli.js +24474 -0
- package/examples/basic/node_modules/toilscript/dist/cli.js.map +7 -0
- package/examples/basic/node_modules/toilscript/dist/importmap.json +9 -0
- package/examples/basic/node_modules/toilscript/dist/toilscript.d.ts +4 -0
- package/examples/basic/node_modules/toilscript/dist/toilscript.generated.d.ts +11242 -0
- package/examples/basic/node_modules/toilscript/dist/toilscript.js +337 -0
- package/examples/basic/node_modules/toilscript/dist/toilscript.js.map +7 -0
- package/examples/basic/node_modules/toilscript/dist/transform.cjs +1 -0
- package/examples/basic/node_modules/toilscript/dist/transform.d.ts +1 -0
- package/examples/basic/node_modules/toilscript/dist/transform.js +1 -0
- package/examples/basic/node_modules/toilscript/dist/web.js +22 -0
- package/examples/basic/node_modules/toilscript/lib/binaryen.d.ts +2 -0
- package/examples/basic/node_modules/toilscript/lib/binaryen.js +2 -0
- package/examples/basic/node_modules/toilscript/package.json +115 -0
- package/examples/basic/node_modules/toilscript/std/README.md +6 -0
- package/examples/basic/node_modules/toilscript/std/assembly/array.ts +550 -0
- package/examples/basic/node_modules/toilscript/std/assembly/arraybuffer.ts +77 -0
- package/examples/basic/node_modules/toilscript/std/assembly/atomics.ts +127 -0
- package/examples/basic/node_modules/toilscript/std/assembly/bindings/asyncify.ts +16 -0
- package/examples/basic/node_modules/toilscript/std/assembly/bindings/dom.ts +291 -0
- package/examples/basic/node_modules/toilscript/std/assembly/bindings/node.ts +6 -0
- package/examples/basic/node_modules/toilscript/std/assembly/bitflags.ts +53 -0
- package/examples/basic/node_modules/toilscript/std/assembly/builtins.ts +2650 -0
- package/examples/basic/node_modules/toilscript/std/assembly/byteslice.ts +177 -0
- package/examples/basic/node_modules/toilscript/std/assembly/compat.ts +2 -0
- package/examples/basic/node_modules/toilscript/std/assembly/console.ts +42 -0
- package/examples/basic/node_modules/toilscript/std/assembly/crypto.ts +9 -0
- package/examples/basic/node_modules/toilscript/std/assembly/dataview.ts +181 -0
- package/examples/basic/node_modules/toilscript/std/assembly/date.ts +375 -0
- package/examples/basic/node_modules/toilscript/std/assembly/diagnostics.ts +11 -0
- package/examples/basic/node_modules/toilscript/std/assembly/encoding.ts +151 -0
- package/examples/basic/node_modules/toilscript/std/assembly/endian.ts +45 -0
- package/examples/basic/node_modules/toilscript/std/assembly/error.ts +44 -0
- package/examples/basic/node_modules/toilscript/std/assembly/fixedarray.ts +173 -0
- package/examples/basic/node_modules/toilscript/std/assembly/fixedmap.ts +326 -0
- package/examples/basic/node_modules/toilscript/std/assembly/fixedset.ts +275 -0
- package/examples/basic/node_modules/toilscript/std/assembly/function.ts +42 -0
- package/examples/basic/node_modules/toilscript/std/assembly/index.d.ts +2892 -0
- package/examples/basic/node_modules/toilscript/std/assembly/iterator.ts +35 -0
- package/examples/basic/node_modules/toilscript/std/assembly/map.ts +269 -0
- package/examples/basic/node_modules/toilscript/std/assembly/math.ts +3289 -0
- package/examples/basic/node_modules/toilscript/std/assembly/memory.ts +123 -0
- package/examples/basic/node_modules/toilscript/std/assembly/number.ts +388 -0
- package/examples/basic/node_modules/toilscript/std/assembly/object.ts +36 -0
- package/examples/basic/node_modules/toilscript/std/assembly/performance.ts +9 -0
- package/examples/basic/node_modules/toilscript/std/assembly/pointer.ts +80 -0
- package/examples/basic/node_modules/toilscript/std/assembly/polyfills.ts +27 -0
- package/examples/basic/node_modules/toilscript/std/assembly/process.ts +50 -0
- package/examples/basic/node_modules/toilscript/std/assembly/reference.ts +48 -0
- package/examples/basic/node_modules/toilscript/std/assembly/regexp.ts +12 -0
- package/examples/basic/node_modules/toilscript/std/assembly/rt/README.md +83 -0
- package/examples/basic/node_modules/toilscript/std/assembly/rt/common.ts +81 -0
- package/examples/basic/node_modules/toilscript/std/assembly/rt/index-incremental.ts +2 -0
- package/examples/basic/node_modules/toilscript/std/assembly/rt/index-memory.ts +1 -0
- package/examples/basic/node_modules/toilscript/std/assembly/rt/index-minimal.ts +2 -0
- package/examples/basic/node_modules/toilscript/std/assembly/rt/index-stub.ts +1 -0
- package/examples/basic/node_modules/toilscript/std/assembly/rt/index.d.ts +37 -0
- package/examples/basic/node_modules/toilscript/std/assembly/rt/itcms.ts +419 -0
- package/examples/basic/node_modules/toilscript/std/assembly/rt/memory-runtime.ts +94 -0
- package/examples/basic/node_modules/toilscript/std/assembly/rt/rtrace.ts +15 -0
- package/examples/basic/node_modules/toilscript/std/assembly/rt/stub.ts +133 -0
- package/examples/basic/node_modules/toilscript/std/assembly/rt/tcms.ts +254 -0
- package/examples/basic/node_modules/toilscript/std/assembly/rt/tlsf.ts +592 -0
- package/examples/basic/node_modules/toilscript/std/assembly/rt.ts +90 -0
- package/examples/basic/node_modules/toilscript/std/assembly/set.ts +225 -0
- package/examples/basic/node_modules/toilscript/std/assembly/shared/feature.ts +68 -0
- package/examples/basic/node_modules/toilscript/std/assembly/shared/runtime.ts +13 -0
- package/examples/basic/node_modules/toilscript/std/assembly/shared/target.ts +11 -0
- package/examples/basic/node_modules/toilscript/std/assembly/shared/tsconfig.json +11 -0
- package/examples/basic/node_modules/toilscript/std/assembly/shared/typeinfo.ts +72 -0
- package/examples/basic/node_modules/toilscript/std/assembly/staticarray.ts +423 -0
- package/examples/basic/node_modules/toilscript/std/assembly/string.ts +850 -0
- package/examples/basic/node_modules/toilscript/std/assembly/symbol.ts +114 -0
- package/examples/basic/node_modules/toilscript/std/assembly/table.ts +16 -0
- package/examples/basic/node_modules/toilscript/std/assembly/toilscript.ts +16 -0
- package/examples/basic/node_modules/toilscript/std/assembly/tsconfig.json +6 -0
- package/examples/basic/node_modules/toilscript/std/assembly/typedarray.ts +1954 -0
- package/examples/basic/node_modules/toilscript/std/assembly/uri.ts +17 -0
- package/examples/basic/node_modules/toilscript/std/assembly/util/bytes.ts +107 -0
- package/examples/basic/node_modules/toilscript/std/assembly/util/casemap.ts +497 -0
- package/examples/basic/node_modules/toilscript/std/assembly/util/error.ts +58 -0
- package/examples/basic/node_modules/toilscript/std/assembly/util/hash.ts +117 -0
- package/examples/basic/node_modules/toilscript/std/assembly/util/math.ts +1922 -0
- package/examples/basic/node_modules/toilscript/std/assembly/util/memory.ts +290 -0
- package/examples/basic/node_modules/toilscript/std/assembly/util/number.ts +873 -0
- package/examples/basic/node_modules/toilscript/std/assembly/util/sort.ts +313 -0
- package/examples/basic/node_modules/toilscript/std/assembly/util/string.ts +1202 -0
- package/examples/basic/node_modules/toilscript/std/assembly/util/uri.ts +275 -0
- package/examples/basic/node_modules/toilscript/std/assembly/vector.ts +4 -0
- package/examples/basic/node_modules/toilscript/std/assembly.json +16 -0
- package/examples/basic/node_modules/toilscript/std/portable/index.d.ts +461 -0
- package/examples/basic/node_modules/toilscript/std/portable/index.js +416 -0
- package/examples/basic/node_modules/toilscript/std/portable.json +11 -0
- package/examples/basic/node_modules/toilscript/std/types/assembly/index.d.ts +1 -0
- package/examples/basic/node_modules/toilscript/std/types/assembly/package.json +3 -0
- package/examples/basic/node_modules/toilscript/std/types/portable/index.d.ts +1 -0
- package/examples/basic/node_modules/toilscript/std/types/portable/package.json +3 -0
- package/examples/basic/node_modules/toilscript/tsconfig-base.json +13 -0
- package/examples/basic/node_modules/toilscript/util/README.md +23 -0
- package/examples/basic/node_modules/toilscript/util/browser/fs.js +1 -0
- package/examples/basic/node_modules/toilscript/util/browser/module.js +5 -0
- package/examples/basic/node_modules/toilscript/util/browser/path.js +520 -0
- package/examples/basic/node_modules/toilscript/util/browser/process.js +59 -0
- package/examples/basic/node_modules/toilscript/util/browser/url.js +23 -0
- package/examples/basic/node_modules/toilscript/util/cpu.d.ts +9 -0
- package/examples/basic/node_modules/toilscript/util/cpu.js +42 -0
- package/examples/basic/node_modules/toilscript/util/find.d.ts +6 -0
- package/examples/basic/node_modules/toilscript/util/find.js +20 -0
- package/examples/basic/node_modules/toilscript/util/node.d.ts +21 -0
- package/examples/basic/node_modules/toilscript/util/node.js +34 -0
- package/examples/basic/node_modules/toilscript/util/options.d.ts +70 -0
- package/examples/basic/node_modules/toilscript/util/options.js +262 -0
- package/examples/basic/node_modules/toilscript/util/terminal.d.ts +52 -0
- package/examples/basic/node_modules/toilscript/util/terminal.js +35 -0
- package/examples/basic/node_modules/toilscript/util/text.d.ts +26 -0
- package/examples/basic/node_modules/toilscript/util/text.js +114 -0
- package/examples/basic/node_modules/toilscript/util/tsconfig.json +9 -0
- package/examples/basic/node_modules/toilscript/util/web.d.ts +11 -0
- package/examples/basic/node_modules/toilscript/util/web.js +33 -0
- package/examples/basic/package-lock.json +50 -1
- package/examples/basic/package.json +5 -2
- package/examples/basic/server/index.ts +3 -0
- package/examples/basic/server/main.ts +6 -0
- package/examples/basic/server/tsconfig.json +7 -0
- package/examples/basic/toil-env.d.ts +20 -1
- package/examples/basic/toil.config.ts +2 -5
- package/examples/basic/toilconfig.json +30 -0
- package/package.json +2 -2
- package/presets/eslint.js +2 -7
- package/presets/no-uint8array-tostring.js +4 -5
- package/presets/prettier.json +8 -1
- package/src/backend/index.ts +11 -18
- package/src/cli/configure.ts +272 -0
- package/src/cli/create.ts +267 -82
- package/src/cli/features.ts +128 -0
- package/src/cli/index.ts +44 -3
- package/src/cli/proc.ts +20 -0
- package/src/cli/ui.ts +4 -6
- package/src/cli/validate.ts +31 -0
- package/src/client/head/head.ts +140 -0
- package/src/client/index.ts +39 -9
- package/src/client/navigation/Link.tsx +99 -0
- package/src/client/navigation/NavLink.tsx +86 -0
- package/src/client/navigation/navigation.ts +142 -0
- package/src/client/navigation/prefetch.ts +130 -0
- package/src/client/navigation/scroll.ts +53 -0
- package/src/client/routing/Router.tsx +95 -0
- package/src/client/routing/error-boundary.tsx +43 -0
- package/src/client/routing/hooks.ts +115 -0
- package/src/client/routing/lazy.ts +93 -0
- package/src/client/{match.ts → routing/match.ts} +11 -3
- package/src/client/routing/mount.tsx +28 -0
- package/src/client/routing/params-context.ts +10 -0
- package/src/client/types.ts +36 -0
- package/src/compiler/config.ts +26 -10
- package/src/compiler/docs.ts +87 -0
- package/src/compiler/generate.ts +180 -23
- package/src/compiler/index.ts +6 -4
- package/src/compiler/plugin.ts +22 -1
- package/src/compiler/routes.ts +13 -7
- package/src/compiler/vite.ts +28 -5
- package/src/io/BinaryReader.ts +1 -5
- package/src/io/BinaryWriter.ts +3 -3
- package/src/server/index.ts +3 -4
- package/src/server/tsconfig.json +4 -0
- package/templates/app/client/404.tsx +11 -0
- package/templates/app/client/components/.gitkeep +1 -0
- package/templates/app/client/components/Footer.tsx +8 -0
- package/templates/app/client/components/HoneycombBackground.tsx +162 -0
- package/templates/app/client/layout.tsx +53 -0
- package/templates/app/client/public/favicon.ico +0 -0
- package/templates/app/client/public/images/.gitkeep +1 -0
- package/templates/app/client/public/images/logo.svg +37 -0
- package/templates/app/client/public/index.html +16 -0
- package/templates/app/client/public/robots.txt +2 -0
- package/templates/app/client/routes/about.tsx +11 -0
- package/templates/app/client/routes/blog/[id].tsx +12 -0
- package/templates/app/client/routes/docs/[...slug].tsx +12 -0
- package/templates/app/client/routes/get-started.tsx +84 -0
- package/templates/app/client/routes/index.tsx +80 -0
- package/templates/app/client/routes/io.tsx +24 -0
- package/templates/app/client/styles/main.css +461 -0
- package/templates/app/client/toil.tsx +7 -0
- package/test/channel.test.ts +1 -1
- package/test/configure.test.ts +90 -0
- package/test/features.test.ts +111 -0
- package/test/head.test.ts +35 -0
- package/test/io.test.ts +8 -0
- package/test/navlink.test.ts +28 -0
- package/test/routes.test.ts +16 -1
- package/test/validate.test.ts +42 -0
- package/vitest.config.ts +1 -1
- package/examples/basic/dist/assets/404-D1bS2aH_.js +0 -1
- package/examples/basic/dist/assets/_...slug_-wR3shlWn.js +0 -1
- package/examples/basic/dist/assets/_id_-EWYvHfi2.js +0 -1
- package/examples/basic/dist/assets/about-Ddvj1tjF.js +0 -1
- package/examples/basic/dist/assets/index-CdG0me90.js +0 -1
- package/examples/basic/dist/assets/io-CODNJU57.js +0 -1
- package/examples/basic/dist/assets/layout-C15ZTPYI.js +0 -1
- package/examples/basic/dist/assets/react-JbAfoxYe.js +0 -9
- package/examples/basic/dist/assets/rolldown-runtime-1VNLd2iN.js +0 -1
- package/examples/basic/dist/assets/routes-GoydenoY.js +0 -1
- package/examples/basic/dist/index.html +0 -12
- package/src/client/runtime.tsx +0 -190
- /package/src/client/{channel.ts → channel/channel.ts} +0 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { useRef, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
const HEX_R = 34;
|
|
4
|
+
const GAP = 3;
|
|
5
|
+
const DRAW_R = HEX_R - GAP;
|
|
6
|
+
const GLOW_DIST = 140;
|
|
7
|
+
|
|
8
|
+
function tracePath(ctx: CanvasRenderingContext2D, cx: number, cy: number, r: number) {
|
|
9
|
+
ctx.beginPath();
|
|
10
|
+
|
|
11
|
+
for (let i = 0; i < 6; i++) {
|
|
12
|
+
const a = (Math.PI / 3) * i - Math.PI / 6;
|
|
13
|
+
const x = cx + r * Math.cos(a);
|
|
14
|
+
const y = cy + r * Math.sin(a);
|
|
15
|
+
|
|
16
|
+
if (i === 0) {
|
|
17
|
+
ctx.moveTo(x, y);
|
|
18
|
+
} else {
|
|
19
|
+
ctx.lineTo(x, y);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
ctx.closePath();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function buildGrid(w: number, h: number): Array<{ x: number; y: number }> {
|
|
27
|
+
const colW = Math.sqrt(3) * HEX_R;
|
|
28
|
+
|
|
29
|
+
const rowH = HEX_R * 1.5;
|
|
30
|
+
const cols = Math.ceil(w / colW) + 2;
|
|
31
|
+
const rows = Math.ceil(h / rowH) + 2;
|
|
32
|
+
const hexes: Array<{ x: number; y: number }> = [];
|
|
33
|
+
|
|
34
|
+
for (let row = -1; row < rows; row++) {
|
|
35
|
+
for (let col = -1; col < cols; col++) {
|
|
36
|
+
hexes.push({
|
|
37
|
+
x: col * colW + (row % 2 !== 0 ? colW / 2 : 0),
|
|
38
|
+
y: row * rowH,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return hexes;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default function HoneycombBackground() {
|
|
47
|
+
const canvasRef = useRef<HTMLCanvasElement>(null);
|
|
48
|
+
const mouse = useRef({ x: -9999, y: -9999 });
|
|
49
|
+
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
const canvas = canvasRef.current;
|
|
52
|
+
|
|
53
|
+
if (!canvas) return;
|
|
54
|
+
|
|
55
|
+
const ctx = canvas.getContext('2d');
|
|
56
|
+
|
|
57
|
+
if (!ctx) return;
|
|
58
|
+
|
|
59
|
+
const dpr = window.devicePixelRatio || 1;
|
|
60
|
+
let hexes: Array<{ x: number; y: number }> = [];
|
|
61
|
+
let raf: number;
|
|
62
|
+
|
|
63
|
+
function resize() {
|
|
64
|
+
if (!canvas || !ctx) return;
|
|
65
|
+
|
|
66
|
+
const w = window.innerWidth;
|
|
67
|
+
const h = window.innerHeight;
|
|
68
|
+
canvas.width = w * dpr;
|
|
69
|
+
canvas.height = h * dpr;
|
|
70
|
+
canvas.style.width = `${w}px`;
|
|
71
|
+
canvas.style.height = `${h}px`;
|
|
72
|
+
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
73
|
+
hexes = buildGrid(w, h);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function draw() {
|
|
77
|
+
if (!ctx) return;
|
|
78
|
+
|
|
79
|
+
const w = window.innerWidth;
|
|
80
|
+
const h = window.innerHeight;
|
|
81
|
+
ctx.clearRect(0, 0, w, h);
|
|
82
|
+
|
|
83
|
+
const mx = mouse.current.x;
|
|
84
|
+
const my = mouse.current.y;
|
|
85
|
+
|
|
86
|
+
for (const { x, y } of hexes) {
|
|
87
|
+
const dist = Math.hypot(x - mx, y - my);
|
|
88
|
+
const t = Math.max(0, 1 - dist / GLOW_DIST);
|
|
89
|
+
const ease = t * t * (3 - 2 * t);
|
|
90
|
+
|
|
91
|
+
tracePath(ctx, x, y, DRAW_R);
|
|
92
|
+
|
|
93
|
+
ctx.fillStyle = 'rgba(255,255,255,0.018)';
|
|
94
|
+
ctx.fill();
|
|
95
|
+
|
|
96
|
+
if (ease > 0) {
|
|
97
|
+
ctx.fillStyle = `rgba(72,148,255,${ease * 0.025})`;
|
|
98
|
+
ctx.fill();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
ctx.strokeStyle = 'rgba(255,255,255,0.055)';
|
|
102
|
+
ctx.lineWidth = 1;
|
|
103
|
+
ctx.stroke();
|
|
104
|
+
|
|
105
|
+
if (ease > 0) {
|
|
106
|
+
ctx.save();
|
|
107
|
+
ctx.shadowColor = `rgba(72,148,255,${ease * 0.2})`;
|
|
108
|
+
ctx.shadowBlur = 8 * ease;
|
|
109
|
+
ctx.strokeStyle = `rgba(120,180,255,${ease * 0.2})`;
|
|
110
|
+
ctx.lineWidth = 1 + ease * 0.4;
|
|
111
|
+
ctx.stroke();
|
|
112
|
+
ctx.restore();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
raf = requestAnimationFrame(draw);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
resize();
|
|
120
|
+
draw();
|
|
121
|
+
|
|
122
|
+
const onResize = () => {
|
|
123
|
+
cancelAnimationFrame(raf);
|
|
124
|
+
resize();
|
|
125
|
+
draw();
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const onMove = (e: MouseEvent) => {
|
|
129
|
+
mouse.current = { x: e.clientX, y: e.clientY };
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const onLeave = () => {
|
|
133
|
+
mouse.current = { x: -9999, y: -9999 };
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
window.addEventListener('resize', onResize);
|
|
137
|
+
window.addEventListener('mousemove', onMove);
|
|
138
|
+
document.addEventListener('mouseleave', onLeave);
|
|
139
|
+
|
|
140
|
+
return () => {
|
|
141
|
+
cancelAnimationFrame(raf);
|
|
142
|
+
window.removeEventListener('resize', onResize);
|
|
143
|
+
window.removeEventListener('mousemove', onMove);
|
|
144
|
+
document.removeEventListener('mouseleave', onLeave);
|
|
145
|
+
};
|
|
146
|
+
}, []);
|
|
147
|
+
|
|
148
|
+
return (
|
|
149
|
+
<canvas
|
|
150
|
+
ref={canvasRef}
|
|
151
|
+
style={{
|
|
152
|
+
position: 'fixed',
|
|
153
|
+
inset: 0,
|
|
154
|
+
width: '100%',
|
|
155
|
+
height: '100%',
|
|
156
|
+
pointerEvents: 'none',
|
|
157
|
+
zIndex: 0,
|
|
158
|
+
}}
|
|
159
|
+
/>
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
|
|
@@ -1,36 +1,53 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
+
import Footer from './components/Footer';
|
|
3
|
+
import HoneycombBackground from './components/HoneycombBackground';
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
a { color: #2563FF; text-decoration: none; }
|
|
9
|
-
a:hover { color: #22E3AB; }
|
|
10
|
-
code { background: #11161f; color: #22E3AB; padding: 0.1rem 0.4rem; border-radius: 4px; font-size: 0.9em; }
|
|
11
|
-
h1 { background: linear-gradient(90deg, #2563FF, #7C3AED, #22E3AB); -webkit-background-clip: text; background-clip: text; color: transparent; }
|
|
12
|
-
`;
|
|
5
|
+
const GitHubIcon = () => (
|
|
6
|
+
<svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
|
|
7
|
+
<path d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.166 6.839 9.489.5.092.682-.217.682-.482 0-.237-.009-.868-.013-1.703-2.782.604-3.369-1.341-3.369-1.341-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.003.07 1.531 1.03 1.531 1.03.892 1.529 2.341 1.087 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.683-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.025A9.578 9.578 0 0 1 12 6.836a9.59 9.59 0 0 1 2.504.337c1.909-1.294 2.747-1.025 2.747-1.025.546 1.377.202 2.394.1 2.647.64.699 1.028 1.592 1.028 2.683 0 3.842-2.339 4.687-4.566 4.935.359.309.678.919.678 1.852 0 1.336-.012 2.415-.012 2.743 0 .267.18.579.688.481C19.138 20.163 22 16.418 22 12c0-5.523-4.477-10-10-10z" />
|
|
8
|
+
</svg>
|
|
9
|
+
);
|
|
13
10
|
|
|
14
11
|
export default function Layout({ children }: { children?: ReactNode }) {
|
|
15
12
|
return (
|
|
16
|
-
<div
|
|
17
|
-
<
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<
|
|
13
|
+
<div className="app">
|
|
14
|
+
<HoneycombBackground />
|
|
15
|
+
<Toil.Head
|
|
16
|
+
titleTemplate="%s By Dacely"
|
|
17
|
+
title="ToilJS"
|
|
18
|
+
meta={[{ name: 'description', content: 'The most performant React framework.' }]}
|
|
19
|
+
/>
|
|
20
|
+
<header className="nav">
|
|
21
|
+
<Toil.Link href="/" className="nav-logo">
|
|
22
|
+
<img src="images/logo.svg" alt="ToilJS" width={28} height={28} />
|
|
23
|
+
<span>ToilJS</span>
|
|
24
|
+
</Toil.Link>
|
|
25
|
+
|
|
26
|
+
<nav className="nav-center">
|
|
27
|
+
<Toil.NavLink href="/" end className="nav-center-link">
|
|
28
|
+
Home
|
|
29
|
+
</Toil.NavLink>
|
|
30
|
+
<Toil.NavLink href="/get-started" className="nav-center-link">
|
|
31
|
+
Get Started
|
|
32
|
+
</Toil.NavLink>
|
|
33
|
+
</nav>
|
|
34
|
+
|
|
35
|
+
<nav className="nav-links">
|
|
36
|
+
<Toil.Link href="https://toil.org/docs">Docs</Toil.Link>
|
|
37
|
+
<a
|
|
38
|
+
href="https://github.com/btc-vision/toiljs"
|
|
39
|
+
target="_blank"
|
|
40
|
+
rel="noopener noreferrer"
|
|
41
|
+
className="nav-github">
|
|
42
|
+
<GitHubIcon />
|
|
43
|
+
GitHub
|
|
44
|
+
</a>
|
|
31
45
|
</nav>
|
|
32
46
|
</header>
|
|
33
|
-
|
|
47
|
+
|
|
48
|
+
<main className="content">{children}</main>
|
|
49
|
+
|
|
50
|
+
<Footer />
|
|
34
51
|
</div>
|
|
35
52
|
);
|
|
36
53
|
}
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Place images and other static assets here; served at /images/*.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 500 500">
|
|
3
|
+
<!-- Generator: Adobe Illustrator 30.4.0, SVG Export Plug-In . SVG Version: 2.1.4 Build 226) -->
|
|
4
|
+
<defs>
|
|
5
|
+
<style>
|
|
6
|
+
.st0 {
|
|
7
|
+
fill: #fff;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.st1 {
|
|
11
|
+
fill: url(#linear-gradient1);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.st2 {
|
|
15
|
+
fill: url(#linear-gradient);
|
|
16
|
+
}
|
|
17
|
+
</style>
|
|
18
|
+
<linearGradient id="linear-gradient" x1="43.27" y1="43.27" x2="467.12" y2="467.12" gradientUnits="userSpaceOnUse">
|
|
19
|
+
<stop offset="0" stop-color="#6990ff"/>
|
|
20
|
+
<stop offset=".03" stop-color="#6479f9"/>
|
|
21
|
+
<stop offset=".08" stop-color="#5d57f0"/>
|
|
22
|
+
<stop offset=".12" stop-color="#583de9"/>
|
|
23
|
+
<stop offset=".17" stop-color="#542ae3"/>
|
|
24
|
+
<stop offset=".23" stop-color="#521ee0"/>
|
|
25
|
+
<stop offset=".28" stop-color="#521be0"/>
|
|
26
|
+
<stop offset=".66" stop-color="#6900f4"/>
|
|
27
|
+
<stop offset="1" stop-color="#7f00f6"/>
|
|
28
|
+
</linearGradient>
|
|
29
|
+
<linearGradient id="linear-gradient1" x1="149.99" y1="355.49" x2="149.99" y2="0" gradientUnits="userSpaceOnUse">
|
|
30
|
+
<stop offset=".15" stop-color="#6990ff" stop-opacity=".6"/>
|
|
31
|
+
<stop offset=".55" stop-color="#531ae1"/>
|
|
32
|
+
</linearGradient>
|
|
33
|
+
</defs>
|
|
34
|
+
<rect class="st2" width="500" height="500" rx="130" ry="130"/>
|
|
35
|
+
<path class="st1" d="M299.98,0L0,355.49v-225.49C0,58.2,58.2,0,130,0h169.98Z"/>
|
|
36
|
+
<path class="st0" d="M106.17,111.11h285.24c9.9,0,16.7,9.96,13.09,19.18l-17.98,45.96c-2.11,5.39-7.31,8.94-13.09,8.94h-74.65c-7.76,0-14.06,6.29-14.06,14.06v214.94c0,7.76-6.29,14.06-14.06,14.06h-45.96c-7.76,0-14.06-6.29-14.06-14.06v-217.25c0-7.76-6.29-14.06-14.06-14.06h-73.66c-5.82,0-11.04-3.59-13.12-9.02l-16.76-43.64c-3.54-9.21,3.26-19.1,13.12-19.1Z"/>
|
|
37
|
+
</svg>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<meta name="theme-color" content="#080D11" />
|
|
7
|
+
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
|
8
|
+
<title>ToilJS By Dacely</title>
|
|
9
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
10
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
11
|
+
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@700;800;900&display=swap" rel="stylesheet" />
|
|
12
|
+
</head>
|
|
13
|
+
<body>
|
|
14
|
+
<div id="root"></div>
|
|
15
|
+
</body>
|
|
16
|
+
</html>
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { Link } from 'toiljs/client';
|
|
2
|
-
|
|
3
1
|
export default function About() {
|
|
4
2
|
return (
|
|
5
3
|
<main>
|
|
@@ -7,7 +5,7 @@ export default function About() {
|
|
|
7
5
|
<p>
|
|
8
6
|
This page is served by <code>client/routes/about.tsx</code>.
|
|
9
7
|
</p>
|
|
10
|
-
<Link href="/">Back home</Link>
|
|
8
|
+
<Toil.Link href="/">Back home</Toil.Link>
|
|
11
9
|
</main>
|
|
12
10
|
);
|
|
13
11
|
}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { Link, useParams } from 'toiljs/client';
|
|
2
|
-
|
|
3
1
|
export default function BlogPost() {
|
|
4
|
-
const { id } = useParams();
|
|
2
|
+
const { id } = Toil.useParams();
|
|
5
3
|
return (
|
|
6
4
|
<main>
|
|
7
5
|
<h1>Blog post {id}</h1>
|
|
8
6
|
<p>
|
|
9
7
|
Dynamic route from <code>client/routes/blog/[id].tsx</code>.
|
|
10
8
|
</p>
|
|
11
|
-
<Link href="/">Back home</Link>
|
|
9
|
+
<Toil.Link href="/">Back home</Toil.Link>
|
|
12
10
|
</main>
|
|
13
11
|
);
|
|
14
12
|
}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import { Link, useParams } from 'toiljs/client';
|
|
2
|
-
|
|
3
1
|
export default function Docs() {
|
|
4
|
-
const { slug } = useParams();
|
|
2
|
+
const { slug } = Toil.useParams();
|
|
5
3
|
return (
|
|
6
4
|
<main>
|
|
7
5
|
<h1>Docs</h1>
|
|
8
6
|
<p>
|
|
9
|
-
Catch-all route <code>client/routes/docs/[...slug].tsx</code> matched:{
|
|
10
|
-
<code>{slug}</code>
|
|
7
|
+
Catch-all route <code>client/routes/docs/[...slug].tsx</code> matched: <code>{slug}</code>
|
|
11
8
|
</p>
|
|
12
|
-
<Link href="/">Back home</Link>
|
|
9
|
+
<Toil.Link href="/">Back home</Toil.Link>
|
|
13
10
|
</main>
|
|
14
11
|
);
|
|
15
12
|
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export default function GetStarted() {
|
|
2
|
+
return (
|
|
3
|
+
<div className="gs-page">
|
|
4
|
+
|
|
5
|
+
{/* Hero */}
|
|
6
|
+
<div className="gs-hero">
|
|
7
|
+
<h1 className="gs-title">Get Started</h1>
|
|
8
|
+
<p className="gs-desc">Everything you need to build your first ToilJS app.</p>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
{/* Info grid */}
|
|
13
|
+
<section className="gs-section">
|
|
14
|
+
<h2 className="gs-section-title">Project Structure</h2>
|
|
15
|
+
<div className="gs-grid">
|
|
16
|
+
|
|
17
|
+
<div className="gs-card gs-card--accent1">
|
|
18
|
+
<div className="gs-card-icon">
|
|
19
|
+
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/></svg>
|
|
20
|
+
</div>
|
|
21
|
+
<h3>File-based Routing</h3>
|
|
22
|
+
<p>Every <code>.tsx</code> file in <code>client/routes/</code> becomes a route. No config required.</p>
|
|
23
|
+
<pre><code>{`index.tsx → /
|
|
24
|
+
about.tsx → /about
|
|
25
|
+
[id].tsx → /:id
|
|
26
|
+
[...slug].tsx → /*`}</code></pre>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<div className="gs-card gs-card--accent2">
|
|
30
|
+
<div className="gs-card-icon">
|
|
31
|
+
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><rect x="2" y="3" width="20" height="14" rx="2"/><path d="M8 21h8M12 17v4"/></svg>
|
|
32
|
+
</div>
|
|
33
|
+
<h3>Public Folder</h3>
|
|
34
|
+
<p>Files in <code>public/</code> are copied as-is to the build root. Reference them with an absolute path.</p>
|
|
35
|
+
<pre><code>{`public/images/logo.svg
|
|
36
|
+
→ /images/logo.svg`}</code></pre>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<div className="gs-card gs-card--accent3">
|
|
40
|
+
<div className="gs-card-icon">
|
|
41
|
+
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18M9 21V9"/></svg>
|
|
42
|
+
</div>
|
|
43
|
+
<h3>Layout</h3>
|
|
44
|
+
<p><code>client/layout.tsx</code> wraps every page. Use it for your nav, footer, providers, and global styles.</p>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<div className="gs-card gs-card--accent4">
|
|
48
|
+
<div className="gs-card-icon">
|
|
49
|
+
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>
|
|
50
|
+
</div>
|
|
51
|
+
<h3>Entry Point</h3>
|
|
52
|
+
<p><code>client/toil.tsx</code> is the app entry. Import global CSS and call <code>Toil.mount()</code> — runs once on startup.</p>
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
</div>
|
|
56
|
+
</section>
|
|
57
|
+
|
|
58
|
+
{/* Navigation section */}
|
|
59
|
+
<section className="gs-section">
|
|
60
|
+
<h2 className="gs-section-title">Navigation</h2>
|
|
61
|
+
<div className="gs-card gs-card--flat">
|
|
62
|
+
<div className="gs-card-icon">
|
|
63
|
+
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>
|
|
64
|
+
</div>
|
|
65
|
+
<h3>Use <code>{'<Toil.Link>'}</code> for client-side navigation</h3>
|
|
66
|
+
<p>Avoids full page reloads and keeps transitions instant. Use a regular <code>{'<a>'}</code> only for external links.</p>
|
|
67
|
+
<pre><code>{`// ✅ Internal navigation
|
|
68
|
+
<Toil.Link href="/about">About</Toil.Link>
|
|
69
|
+
|
|
70
|
+
// ✅ External link
|
|
71
|
+
<a href="https://toil.org" target="_blank">Docs</a>`}</code></pre>
|
|
72
|
+
</div>
|
|
73
|
+
</section>
|
|
74
|
+
|
|
75
|
+
<div className="gs-actions">
|
|
76
|
+
<Toil.Link href="/" className="btn btn-secondary">← Back home</Toil.Link>
|
|
77
|
+
<a href="https://toil.org/docs" target="_blank" rel="noopener noreferrer" className="btn btn-primary">
|
|
78
|
+
Read the Docs
|
|
79
|
+
</a>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
@@ -1,13 +1,80 @@
|
|
|
1
|
-
|
|
1
|
+
const GitHubIcon = () => (
|
|
2
|
+
<svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
|
|
3
|
+
<path d="M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.166 6.839 9.489.5.092.682-.217.682-.482 0-.237-.009-.868-.013-1.703-2.782.604-3.369-1.341-3.369-1.341-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.003.07 1.531 1.03 1.531 1.03.892 1.529 2.341 1.087 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.683-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.025A9.578 9.578 0 0 1 12 6.836a9.59 9.59 0 0 1 2.504.337c1.909-1.294 2.747-1.025 2.747-1.025.546 1.377.202 2.394.1 2.647.64.699 1.028 1.592 1.028 2.683 0 3.842-2.339 4.687-4.566 4.935.359.309.678.919.678 1.852 0 1.336-.012 2.415-.012 2.743 0 .267.18.579.688.481C19.138 20.163 22 16.418 22 12c0-5.523-4.477-10-10-10z" />
|
|
4
|
+
</svg>
|
|
5
|
+
);
|
|
6
|
+
|
|
7
|
+
const icons = {
|
|
8
|
+
hmr: (
|
|
9
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
10
|
+
<polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2" />
|
|
11
|
+
</svg>
|
|
12
|
+
),
|
|
13
|
+
routing: (
|
|
14
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
15
|
+
<path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z" />
|
|
16
|
+
</svg>
|
|
17
|
+
),
|
|
18
|
+
typescript: (
|
|
19
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
|
|
20
|
+
<rect x="2" y="2" width="20" height="20" rx="3" fill="currentColor" />
|
|
21
|
+
<path d="M13.5 12H15.5V18H17V12H19V10.5H13.5V12Z" fill="var(--bg)" />
|
|
22
|
+
<path d="M11 10.5C9.07 10.5 7.5 12.07 7.5 14C7.5 15.45 8.38 16.69 9.65 17.23L7.5 18H11C12.93 18 14.5 16.43 14.5 14.5C14.5 13.26 13.86 12.17 12.9 11.55C12.42 11.22 11.73 10.5 11 10.5ZM11 12C12.1 12 13 12.9 13 14C13 15.1 12.1 16 11 16H9.72C9.28 15.57 9 14.81 9 14C9 12.9 9.9 12 11 12Z" fill="var(--bg)" />
|
|
23
|
+
</svg>
|
|
24
|
+
),
|
|
25
|
+
builds: (
|
|
26
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
27
|
+
<path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z" />
|
|
28
|
+
<polyline points="3.27 6.96 12 12.01 20.73 6.96" />
|
|
29
|
+
<line x1="12" y1="22.08" x2="12" y2="12" />
|
|
30
|
+
</svg>
|
|
31
|
+
),
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const features = [
|
|
35
|
+
{ icon: icons.hmr, label: 'Instant HMR' },
|
|
36
|
+
{ icon: icons.routing, label: 'File Routing' },
|
|
37
|
+
{ icon: icons.typescript, label: 'TypeScript' },
|
|
38
|
+
{ icon: icons.builds, label: 'Optimized Builds' },
|
|
39
|
+
];
|
|
2
40
|
|
|
3
41
|
export default function Home() {
|
|
4
42
|
return (
|
|
5
|
-
<
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
43
|
+
<section className="hero">
|
|
44
|
+
<div className="hero-logo">
|
|
45
|
+
<img src="images/logo.svg" className="hero-logo-glow" alt="" aria-hidden="true" width={96} height={96} />
|
|
46
|
+
<img src="images/logo.svg" className="hero-logo-img" alt="ToilJS" width={96} height={96} />
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<h1 className="hero-title">ToilJS</h1>
|
|
50
|
+
|
|
51
|
+
<p className="hero-tagline">
|
|
52
|
+
Next-gen React.<br />
|
|
53
|
+
<span>Zero config.</span>
|
|
10
54
|
</p>
|
|
11
|
-
|
|
55
|
+
|
|
56
|
+
<p className="hero-desc">
|
|
57
|
+
File-based routing, blazing-fast HMR, and full TypeScript.
|
|
58
|
+
<br />All powered by Vite.
|
|
59
|
+
</p>
|
|
60
|
+
|
|
61
|
+
<ul className="features">
|
|
62
|
+
{features.map(f => (
|
|
63
|
+
<li key={f.label} className="feature-badge">
|
|
64
|
+
{f.icon}{f.label}
|
|
65
|
+
</li>
|
|
66
|
+
))}
|
|
67
|
+
</ul>
|
|
68
|
+
|
|
69
|
+
<div className="hero-cta">
|
|
70
|
+
<Toil.Link href="/get-started" className="btn btn-primary">
|
|
71
|
+
Get Started
|
|
72
|
+
</Toil.Link>
|
|
73
|
+
<a className="btn btn-secondary" href="https://github.com/btc-vision/toiljs" target="_blank" rel="noopener noreferrer">
|
|
74
|
+
<GitHubIcon />
|
|
75
|
+
GitHub
|
|
76
|
+
</a>
|
|
77
|
+
</div>
|
|
78
|
+
</section>
|
|
12
79
|
);
|
|
13
80
|
}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import { Link } from 'toiljs/client';
|
|
2
|
-
|
|
3
|
-
// Note: BinaryWriter / BinaryReader / FastMap / FastSet are NATIVE globals in a toil app —
|
|
4
|
-
// no import needed. They're injected at runtime and typed via the generated .toil/toil-env.d.ts.
|
|
5
1
|
export default function IoDemo() {
|
|
6
2
|
const writer = new BinaryWriter();
|
|
7
3
|
writer.writeU32(42);
|
|
@@ -19,10 +15,10 @@ export default function IoDemo() {
|
|
|
19
15
|
<main>
|
|
20
16
|
<h1>Native IO</h1>
|
|
21
17
|
<p>
|
|
22
|
-
<code>new BinaryWriter()</code> with no import — round-tripped {n} and
|
|
23
|
-
|
|
18
|
+
<code>new BinaryWriter()</code> with no import — round-tripped {n} and "{s}" through{' '}
|
|
19
|
+
{bytes.length} bytes; FastSet size {seen.size}.
|
|
24
20
|
</p>
|
|
25
|
-
<Link href="/">Back home</Link>
|
|
21
|
+
<Toil.Link href="/">Back home</Toil.Link>
|
|
26
22
|
</main>
|
|
27
23
|
);
|
|
28
24
|
}
|