RohanVashisht commited on
Commit
7a5aa35
·
verified ·
1 Parent(s): 52c9e5e

Upload 11 files

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ database/programs.json filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,10 +1,15 @@
1
- ---
2
- title: Test
3
- emoji: 🏆
4
- colorFrom: indigo
5
- colorTo: gray
6
- sdk: docker
7
- pinned: false
8
- ---
9
-
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
1
+ # api
2
+
3
+ To install dependencies:
4
+
5
+ ```bash
6
+ bun install
7
+ ```
8
+
9
+ To run:
10
+
11
+ ```bash
12
+ bun run src/index.ts
13
+ ```
14
+
15
+ This project was created using `bun init` in bun v1.2.9. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
bun.lock ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "lockfileVersion": 1,
3
+ "workspaces": {
4
+ "": {
5
+ "name": "api",
6
+ "devDependencies": {
7
+ "@types/bun": "latest",
8
+ },
9
+ "peerDependencies": {
10
+ "typescript": "^5",
11
+ },
12
+ },
13
+ },
14
+ "packages": {
15
+ "@types/bun": ["@types/[email protected]", "", { "dependencies": { "bun-types": "1.2.9" } }, "sha512-epShhLGQYc4Bv/aceHbmBhOz1XgUnuTZgcxjxk+WXwNyDXavv5QHD1QEFV0FwbTSQtNq6g4ZcV6y0vZakTjswg=="],
16
+
17
+ "@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-u0HuPQwe/dHrItgHHpmw3N2fYCR6x4ivMNbPHRkBVP4CvN+kiRrKHWk3i8tXiO/joPwXLMYvF9TTF0eqgHIuOw=="],
18
+
19
+ "@types/ws": ["@types/[email protected]", "", { "dependencies": { "@types/node": "*" } }, "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg=="],
20
+
21
+ "bun-types": ["[email protected]", "", { "dependencies": { "@types/node": "*", "@types/ws": "*" } }, "sha512-dk/kOEfQbajENN/D6FyiSgOKEuUi9PWfqKQJEgwKrCMWbjS/S6tEXp178mWvWAcUSYm9ArDlWHZKO3T/4cLXiw=="],
22
+
23
+ "typescript": ["[email protected]", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ=="],
24
+
25
+ "undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
26
+ }
27
+ }
database/games.json ADDED
@@ -0,0 +1 @@
 
 
1
+ [{"avatar_url": "https://avatars.githubusercontent.com/u/32980656?v=4", "name": "raylib-zig", "full_name": "Not-Nik/raylib-zig", "created_at": "2020-02-15T09:58:13Z", "description": "Manually tweaked, auto-generated raylib bindings for zig. https://github.com/raysan5/raylib", "default_branch": "devel", "open_issues": 8, "stargazers_count": 1056, "forks_count": 175, "watchers_count": 1056, "tags_url": "https://api.github.com/repos/Not-Nik/raylib-zig/tags", "license": "-", "topics": ["binding", "bindings", "game-development", "gamedev", "raylib", "zig", "zig-package"], "size": 2853, "fork": false, "updated_at": "2025-04-13T08:36:04Z", "has_build_zig": true, "has_build_zig_zon": true, "readme_content": "![logo](https://github.com/Not-Nik/raylib-zig/raw/devel/logo/logo.png)\n\n# raylib-zig\n\nManually tweaked, auto-generated [raylib](https://github.com/raysan5/raylib) bindings for zig.\n\nBindings tested on raylib version 5.6-dev and Zig 0.14.0\n\nThanks to all the [contributors](https://github.com/Not-Nik/raylib-zig/graphs/contributors) for their help with this\nbinding.\n\n## Example\n\n```zig\nconst rl = @import(\"raylib\");\n\npub fn main() anyerror!void {\n // Initialization\n //--------------------------------------------------------------------------------------\n const screenWidth = 800;\n const screenHeight = 450;\n\n rl.initWindow(screenWidth, screenHeight, \"raylib-zig [core] example - basic window\");\n defer rl.closeWindow(); // Close window and OpenGL context\n\n rl.setTargetFPS(60); // Set our game to run at 60 frames-per-second\n //--------------------------------------------------------------------------------------\n\n // Main game loop\n while (!rl.windowShouldClose()) { // Detect window close button or ESC key\n // Update\n //----------------------------------------------------------------------------------\n // TODO: Update your variables here\n //----------------------------------------------------------------------------------\n\n // Draw\n //----------------------------------------------------------------------------------\n rl.beginDrawing();\n defer rl.endDrawing();\n\n rl.clearBackground(.white);\n\n rl.drawText(\"Congrats! You created your first window!\", 190, 200, 20, .light_gray);\n //----------------------------------------------------------------------------------\n }\n}\n```\n\n## Building the examples\n\nTo build all available examples simply `zig build examples`. To list available examples run `zig build --help`. If you\nwant to run an example, say `basic_window` run `zig build basic_window`\n\n## Building and using\n\n### Using raylib-zig's template\n\n* Execute `project_setup.sh project_name`, this will create a folder with the name specified\n* You can copy that folder anywhere you want and edit the source\n* Run `zig build run` at any time to test your project\n\n### In an existing project (e.g. created with `zig init`)\n\nDownload and add raylib-zig as a dependency by running the following command in your project root:\n\n```\nzig fetch --save git+https://github.com/Not-Nik/raylib-zig#devel\n```\n\nThen add raylib-zig as a dependency and import its modules and artifact in your `build.zig`:\n\n```zig\nconst raylib_dep = b.dependency(\"raylib_zig\", .{\n .target = target,\n .optimize = optimize,\n});\n\nconst raylib = raylib_dep.module(\"raylib\"); // main raylib module\nconst raygui = raylib_dep.module(\"raygui\"); // raygui module\nconst raylib_artifact = raylib_dep.artifact(\"raylib\"); // raylib C library\n```\n\nNow add the modules and artifact to your target as you would normally:\n\n```zig\nexe.linkLibrary(raylib_artifact);\nexe.root_module.addImport(\"raylib\", raylib);\nexe.root_module.addImport(\"raygui\", raygui);\n```\n\nIf you additionally want to support Web as a platform with emscripten, you will need to use `emcc.zig` by importing\nraylib-zig's build script with `const rlz = @import(\"raylib_zig\");` and then accessing its functions with `rlz.emcc`.\nRefer to raylib-zig's project template on how to use them.\n\n### Passing build options\n\nraylib allows customisations of certain parts of its build process such as choosing an OpenGL version, building as a\nshared library or not including certain modules. You can optionally pass these options to raylib-zig dependency like so\n\n```zig\nconst raylib_dep = b.dependency(\"raylib_zig\", .{\n .target = target,\n .optimize = optimize,\n .shared = true, // Build raylib as a shared library\n .opengl_version = rlz.OpenglVersion.gl_2_1, // Use OpenGL 2.1 (requires importing raylib-zig's build script)\n});\n```\n\n### Defining feature macros\n\nraylib lets the user enable and disable options for different features, loading different file formats for images,\nfonts, 3D models and audio, linkage variants. You can specify these options for your raylib-zig build by defining the\ncorresponding C macro before you link with it, e.g.:\n\n```zig\nraylib_artifact.root_module.addCMacro(\"SUPPORT_FILEFORMAT_JPG\", \"\");\n```\n\n## Exporting for web\n\nTo export your project for the web, first install emsdk.\nOnce emsdk is installed, set it up by running\n\n`emsdk install latest`\n\nFind the folder where it's installed and run\n\n`zig build -Dtarget=wasm32-emscripten --sysroot [path to emsdk]/upstream/emscripten`\n\nonce that is finished, the exported project should be located at `zig-out/htmlout`\n\n### When is the binding updated?\n\nI plan on updating it every mayor release (2.5, 3.0, etc.). Keep in mind these are technically header files, so any\nimplementation stuff should be updatable with some hacks on your side.\n\n### What needs to be done?\n\n+ _(Done)_ Set up a proper package build and a build script for the examples\n+ Port all the examples\n+ Member functions/initialisers\n"}, {"avatar_url": "https://avatars.githubusercontent.com/u/19482899?v=4", "name": "mach", "full_name": "hexops/mach", "created_at": "2021-07-04T17:37:47Z", "description": "zig game engine & graphics toolkit", "default_branch": "main", "open_issues": 155, "stargazers_count": 3863, "forks_count": 176, "watchers_count": 3863, "tags_url": "https://api.github.com/repos/hexops/mach/tags", "license": "-", "topics": ["2d", "3d", "composable", "cross-platform", "ecs", "entity-component-system", "game-development", "game-engine", "gamedev", "graphics", "gui", "open-source", "steam-deck", "webassembly", "webgpu", "zig", "ziglang"], "size": 10250, "fork": false, "updated_at": "2025-04-13T10:59:21Z", "has_build_zig": true, "has_build_zig_zon": true, "readme_content": "<a href=\"https://machengine.org\">\n <picture>\n <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://machengine.org/assets/media/mach/logo_dark.svg\">\n <img alt=\"mach-opus\" src=\"https://machengine.org/assets/media/mach/logo_light.svg\" height=\"150px\">\n </picture>\n</a>\n\nZig game engine & graphics toolkit for building high-performance, truly cross-platform, robust & modular games, visualizations, and desktop/mobile GUI apps.\n\n<a href=\"https://user-images.githubusercontent.com/3173176/173177664-2ac9e90b-9429-4b09-aaf9-b80b53fee49f.gif\"><img align=\"left\" src=\"https://user-images.githubusercontent.com/3173176/173177664-2ac9e90b-9429-4b09-aaf9-b80b53fee49f.gif\" alt=\"gen-texture-light\" height=\"190px\"></img></a>\n<a href=\"https://user-images.githubusercontent.com/3173176/163936001-fd9eb918-7c29-4dcc-bfcb-5586f2ea1f9a.gif\"><img align=\"left\" src=\"https://user-images.githubusercontent.com/3173176/163936001-fd9eb918-7c29-4dcc-bfcb-5586f2ea1f9a.gif\" alt=\"boids\" height=\"190px\"></img></a>\n<a href=\"https://user-images.githubusercontent.com/3173176/173177646-a3f0982c-f07b-496f-947b-265bdc71ece9.gif\"><img src=\"https://user-images.githubusercontent.com/3173176/173177646-a3f0982c-f07b-496f-947b-265bdc71ece9.gif\" alt=\"textured-cube\" height=\"190px\"></img></a>\n\n## Learn more\n\n[machengine.org](https://machengine.org)\n\n## Join the community\n\nJoin the [Mach community on Discord](https://discord.gg/XNG3NZgCqp) to discuss this project, ask questions, get help, etc.\n\n**We're here to make games and have fun, so please help keep the community focused on that.** No politics/heated topics are allowed. Unfortunately, the political landscape today makes it such that we must also state fascists can go f*k themselves. :) Anyone else is very welcome here.\n\n"}, {"avatar_url": "https://avatars.githubusercontent.com/u/113083639?v=4", "name": "zig-gamedev", "full_name": "zig-gamedev/zig-gamedev", "created_at": "2021-07-16T14:14:52Z", "description": "Dev repo for @zig-gamedev libs and sample applications", "default_branch": "main", "open_issues": 30, "stargazers_count": 2529, "forks_count": 178, "watchers_count": 2529, "tags_url": "https://api.github.com/repos/zig-gamedev/zig-gamedev/tags", "license": "-", "topics": ["cross-platform", "d3d12", "demos", "directx12", "game-development", "gamedev", "graphics", "libraries", "math", "opengl", "physics", "realtime", "simd", "webgpu", "zig", "ziglang"], "size": 62890, "fork": false, "updated_at": "2025-04-12T00:50:14Z", "has_build_zig": true, "has_build_zig_zon": true, "readme_content": "# [zig-gamedev](https://github.com/zig-gamedev) dev repo\n\nThe original repo spawned in July 2021 by [Michal Ziulek](https://github.com/michal-z). This is the main development repo for the [zig-gamedev libraries](https://github.com/zig-gamedev#libraries) and [sample applications](#sample-applications-native-wgpu).\n\nZig is still in development. Our main branch aims to track zig nightly-ish. See [.zigversion](./.zigversion) for the last known compatible Zig version for any revision.\n\nLibraries now live in their own repositories and are consumed using Zig's package manager. Git submodules are also included in this repo for developer convenience but are not required to build. Users that wish to use the submodules instead of remote packages can replace build.zig.zon with dev.build.zig.zon.\n\n### Build and run the [Samples](#sample-applications-native-wgpu)\n\nTo get started on Windows/Linux/macOS try out [physically based rendering (wgpu)](https://github.com/zig-gamedev/zig-gamedev/tree/main/samples/physically_based_rendering_wgpu) sample:\n```\nzig build physically_based_rendering_wgpu-run\n```\n\nTo get a list of all available build steps:\n```\nzig build -l\n```\n\n## Sample applications (native wgpu)\n\nSome of the sample applications are listed below. More can be found in [samples](samples/) directory.\n\n1. [physically based rendering (wgpu)](samples/physically_based_rendering_wgpu): This sample implements physically-based rendering (PBR) and image-based lighting (IBL) to achive realistic looking rendering results.<br />`zig build physically_based_rendering_wgpu-run`\n\n <a href=\"samples/physically_based_rendering_wgpu\"><img src=\"samples/physically_based_rendering_wgpu/screenshot0.jpg\" alt=\"physically based rendering (wgpu)\" height=\"200\"></a>\n\n1. [audio experiments (wgpu)](samples/audio_experiments_wgpu): This sample lets the user experiment with audio and observe data that feeds the hardware.<br />`zig build audio_experiments_wgpu-run`\n\n <a href=\"samples/audio_experiments_wgpu\"><img src=\"samples/audio_experiments_wgpu/screenshot.png\" alt=\"audio experiments (wgpu)\" height=\"200\"></a>\n\n1. [bullet physics test (wgpu)](samples/bullet_physics_test_wgpu): This sample application demonstrates how to use full 3D physics engine in your Zig programs.<br />`zig build bullet_physics_test_wgpu-run`\n\n <a href=\"samples/bullet_physics_test_wgpu\"><img src=\"samples/bullet_physics_test_wgpu/screenshot.jpg\" alt=\"bullet physics test (wgpu)\" height=\"200\"></a>\n\n1. [procedural mesh (wgpu)](samples/procedural_mesh_wgpu): This sample shows how to efficiently draw several procedurally generated meshes.<br />`zig build procedural_mesh_wgpu-run`\n\n <a href=\"samples/procedural_mesh_wgpu\"><img src=\"samples/procedural_mesh_wgpu/screenshot.png\" alt=\"procedural mesh (wgpu)\" height=\"200\"></a>\n\n1. [gui test (wgpu)](samples/gui_test_wgpu): This sample shows how to use our [zgui](libs/zgui) library.<br />`zig build gui_test_wgpu-run`\n\n <a href=\"samples/gui_test_wgpu\"><img src=\"samples/gui_test_wgpu/screenshot.png\" alt=\"gui test (wgpu)\" height=\"200\"></a>\n\n## Sample applications (DirectX 12)\n\nSome of the sample applications are listed below. More can be found in [samples](samples/) directory. They can be built and run on Windows and Linux (Wine + VKD3D-Proton 2.8+):\n\n1. [bindless](samples/bindless): This sample implements physically based shading and image based lighting to achieve realistic looking rendering results. It uses bindless textures and HLSL 6.6 dynamic resources.<br />`zig build bindless-run`\n\n <a href=\"samples/bindless\"><img src=\"samples/bindless/screenshot.png\" alt=\"bindless\" height=\"200\"></a>\n\n1. [rasterization](samples/rasterization): This sample application shows how GPU rasterizes triangles in slow motion.<br />`zig build rasterization-run`\n\n <a href=\"samples/rasterization\"><img src=\"samples/rasterization/screenshot.png\" alt=\"rasterization\" height=\"200\"></a>\n\n1. [simple raytracer](samples/simple_raytracer): This sample implements basic hybrid renderer. It uses rasterization to resolve primary rays and raytracing (DXR) for shadow rays.<br />`zig build simple_raytracer-run`\n\n <a href=\"samples/simple_raytracer\"><img src=\"samples/simple_raytracer/screenshot.png\" alt=\"simple raytracer\" height=\"200\"></a>\n\n1. [mesh shader test](samples/mesh_shader_test): This sample shows how to use DirectX 12 Mesh Shader.<br />`zig build mesh_shader_test-run`\n\n <a href=\"samples/mesh_shader_test\"><img src=\"samples/mesh_shader_test/screenshot.png\" alt=\"mesh shader test\" height=\"200\"></a>\n"}, {"avatar_url": "https://avatars.githubusercontent.com/u/1416077?v=4", "name": "jok", "full_name": "Jack-Ji/jok", "created_at": "2022-05-13T07:57:55Z", "description": "A minimal 2d/3d game framework for @ziglang.", "default_branch": "main", "open_issues": 7, "stargazers_count": 232, "forks_count": 8, "watchers_count": 232, "tags_url": "https://api.github.com/repos/Jack-Ji/jok/tags", "license": "-", "topics": ["gamedev", "linux", "macos", "sdl2", "webassembly", "windows", "ziglang"], "size": 24969, "fork": false, "updated_at": "2025-04-13T09:22:39Z", "has_build_zig": true, "has_build_zig_zon": true, "readme_content": "[![build](/../../actions/workflows/windows_native.yml/badge.svg)](/../../actions/workflows/windows_native.yml) [![build](/../../actions/workflows/linux_native.yml/badge.svg)](/../../actions/workflows/linux_native.yml) [![build](/../../actions/workflows/macos_native.yml/badge.svg)](/../../actions/workflows/macos_native.yml) [![build](/../../actions/workflows/webassembly.yml/badge.svg)](/../../actions/workflows/webassembly.yml) [![build](/../../actions/workflows/windows_cross.yml/badge.svg)](/../../actions/workflows/windows_cross.yml) [![build](/../../actions/workflows/linux_cross.yml/badge.svg)](/../../actions/workflows/linux_cross.yml)\n\n\n# jok\nA minimal 2d/3d game framework for zig.\n\n## What you need?\n* [Zig Compiler](https://ziglang.org/download/) (Master branch always targets latest zig, use tagged release if you wanna stick to stable version)\n* SDL2 Library\n* Any code editor you like (consider using [zls](https://github.com/zigtools/zls) for your own favor)\n\n## Features\n* Friendly build system, very easy to setup new project\n* Able to cross-compile between Windows and Linux (thanks to [ziglang](https://ziglang.org))\n* Excellent rendering performance (thanks to SDL2's [geometry rendering](https://wiki.libsdl.org/SDL2/SDL_RenderGeometryRaw))\n* Fully integrated Dear-ImGui\n* Asset system (via [physfs](https://github.com/icculus/physfs), supports fs/zip/7zip/iso etc)\n* Plugin System (register/unregister/hot-reloading)\n* 2D batch system\n* 2D primitives (line/rectangle/quad/triangle/circle/ellipse/bezier-curve/convex-polygon/concave-polygon/polyline)\n* 2D sprite rendering (scale/rotate/blending/flipping/depth)\n* 2D sprite sheet generation/save/load\n* 2D animation system\n* 2D particle system\n* 2D scene management\n* 2D physics system (via [chipmunk](https://chipmunk-physics.net/), optional)\n* 3D batch system\n* 3D skybox rendering\n* 3D mesh rendering (gouraud/flat shading)\n* 3D glTF 2.0 support\n* 3D rigid/skeleton animation rendering/blending\n* 3D lighting effect (Blinn-Phong model by default, customizable)\n* 3D sprite/billboard rendering\n* 3D particle system\n* 3D scene management\n* TrueType support, atlas generation/save/load\n* SVG loading/rendering\n* Sound/Music playing/mixing\n* Tiled editor support (tmx/tsx loading/rendering)\n* Misc little utils, such as easing/timer/signal system\n\n## Supported platforms\n* Windows\n* Linux\n* MacOS\n* WebAssembly\n\nTIPS: To eliminate console terminal on Windows platform, override `exe.subsystem` with `.Windows` in your build script.\n\n## How to start?\n\n1. Add *jok* as your project's dependency\n\n Add jok dependency to your build.zig.zon, with following command:\n ```bash\n zig fetch --save git+https://github.com/jack-ji/jok.git\n ```\n\n2. Use *jok*'s build script to add build step\n\n In your `build.zig`, add:\n ```zig\n const std = @import(\"std\");\n const jok = @import(\"jok\");\n \n pub fn build(b: *std.Build) void {\n const target = b.standardTargetOptions(.{});\n const optimize = b.standardOptimizeOption(.{});\n const exe = jok.createDesktopApp(\n b,\n \"mygame\",\n \"src/main.zig\",\n target,\n optimize,\n .{},\n );\n const install_cmd = b.addInstallArtifact(exe, .{});\n b.getInstallStep().dependOn(&install_cmd.step);\n \n const run_cmd = b.addRunArtifact(exe);\n run_cmd.step.dependOn(&install_cmd.step);\n \n const run_step = b.step(\"run\", \"Run game\");\n run_step.dependOn(&run_cmd.step);\n }\n ```\n\n If you want to add emscripten support for your project, the build script needs more care:\n ```zig\n const std = @import(\"std\");\n const jok = @import(\"jok\");\n \n pub fn build(b: *std.Build) void {\n const target = b.standardTargetOptions(.{});\n const optimize = b.standardOptimizeOption(.{});\n\n if (!target.result.cpu.arch.isWasm()) {\n const exe = jok.createDesktopApp(\n b,\n \"mygame\",\n \"src/main.zig\",\n target,\n optimize,\n .{},\n );\n const install_cmd = b.addInstallArtifact(exe, .{});\n b.getInstallStep().dependOn(&install_cmd.step);\n\n const run_cmd = b.addRunArtifact(exe);\n run_cmd.step.dependOn(&install_cmd.step);\n\n const run_step = b.step(\"run\", \"Run game\");\n run_step.dependOn(&run_cmd.step);\n } else {\n const webapp = createWeb(\n b,\n \"mygame\",\n \"src/main.zig\",\n target,\n optimize,\n .{\n .preload_path = \"optional/relative/path/to/your/assets\",\n .shell_file_path = \"optional/relative/path/to/your/shell\",\n },\n );\n b.getInstallStep().dependOn(&webapp.emlink.step);\n\n const run_step = b.step(\"run\", \"Run game\");\n run_step.dependOn(&webapp.emrun.step);\n }\n }\n ```\n\n3. Install SDL2 library:\n\n * Windows Platform\n \n Download SDL2 library from [here](https://libsdl.org/), extract into your hard drive, and create file `.build_config/sdl.json` in your project directory:\n ```json\n {\n \"x86_64-windows-gnu\": {\n \"include\": \"D:/SDL2-2.28.5/x86_64-w64-mingw32/include\",\n \"libs\": \"D:/SDL2-2.28.5/x86_64-w64-mingw32/lib\",\n \"bin\": \"D:/SDL2-2.28.5/x86_64-w64-mingw32/bin\"\n }\n }\n ```\n If you have multiple projects, you can config path to a global `sdl.json` using environment variable, defaults to `SDL_CONFIG_PATH`.\n \n * Linux Platform\n \n Debian/Ubuntu:\n ```bash\n sudo apt install libsdl2-dev\n ```\n \n Fedora/CentOS:\n ```bash\n sudo yum install SDL2-devel\n ```\n \n * MacOS\n \n ```bash\n brew install sdl2\n ```\n\n4. Write some code!\n\n You may import and use jok now, here's skeleton of your `src/main.zig`:\n ```zig\n const std = @import(\"std\");\n const jok = @import(\"jok\");\n \n pub fn init(ctx: jok.Context) !void {\n // your init code\n }\n \n pub fn event(ctx: jok.Context, e: jok.Event) !void {\n // your event processing code\n }\n \n pub fn update(ctx: jok.Context) !void {\n // your game state updating code\n }\n \n pub fn draw(ctx: jok.Context) !void {\n // your drawing code\n }\n \n pub fn quit(ctx: jok.Context) void {\n // your deinit code\n }\n\n pub fn getMemory() ?*const anyopaque {\n // OPTIONAL: return memory of your game\n }\n \n pub fn reloadMemory(mem: ?*const anyopaque) void {\n // OPTIONAL: restore memory of your game\n }\n ```\n \n Noticed yet? That's right, you don't need to write main function, `jok` got your back.\n The game is deemed as a separate package to `jok`'s runtime as a matter of fact. Your\n only responsibility is to provide 5 public functions: \n * init - initialize your game, run only once\n * event - process events happened between frames (keyboard/mouse/controller etc)\n * update - logic update between frames\n * draw - render your screen here (60 fps by default)\n * quit - do something before game is closed\n\n You can customize some setup settings (window width/height, fps, debug level etc), by \n defining some public constants using predefined names (they're all prefixed with`jok_`).\n Checkout [`src/config.zig`](https://github.com/Jack-Ji/jok/blob/main/src/config.zig).\n Most of which are still modifiable at runtime.\n \n The other 2 optional public functions are only needed when you'are writing a plugin:\n * getMemory - get memory of you plugin, called when plugin is updated\n * reloadMemory - reload memory of your plugin, called when plugin is updated\n\n For more detail of plugin's usage, check example `hotreload`.\n \n Now, compile and run your game using command `zig build run`, have fun!\n Please let me know if you have any issue or developed something interesting with this little framework.\n\n## NOTE\n**Jok** is short for **joke**, which is about how overly-complicated modern graphics programming has become.\nPeople are gradually forgetting lots of computing techniques used to deliver amazing games on simple machines.\nWith so many tools, engines and computing resources at hand, however, gamedev is not as fun as it used to be. \n**Jok** is an offort trying to bring the joy back, it's being developed in the spirit of retro-machines of\n1990s (especially PS1), which implies following limitations:\n\n* Custom vertex/fragment shader is not possible\n* Only support [affine texture mapping](https://en.wikipedia.org/wiki/Texture_mapping#Affine_texture_mapping)\n* No [depth buffer](https://en.wikipedia.org/wiki/Z-buffering)\n\nThe limitations demand developers to be both creative and careful about game's design.\n\n## Third-Party Libraries\n* [SDL2](https://www.libsdl.org) (zlib license)\n* [physfs](https://github.com/icculus/physfs) (zlib license)\n* [zig-gamedev](https://github.com/zig-gamedev/zig-gamedev) (MIT license)\n* [chipmunk](https://chipmunk-physics.net/) (MIT license)\n* [stb headers](https://github.com/nothings/stb) (MIT license)\n* [nanosvg](https://github.com/memononen/nanosvg) (zlib license)\n* [nativefiledialog](https://github.com/mlabbe/nativefiledialog) (zlib license)\n\n## Built-in Fonts\n* [Classic Console Neue](http://webdraft.hu/fonts/classic-console/) (MIT license)\n\n## Games made in jok\n* [A Bobby Carrot Game Clone](https://github.com/TheWaWaR/bobby-carrot)\n"}, {"avatar_url": "https://avatars.githubusercontent.com/u/60377?v=4", "name": "zig-gamekit", "full_name": "prime31/zig-gamekit", "created_at": "2020-11-12T19:02:04Z", "description": "Companion repo for zig-renderkit for making 2D games", "default_branch": "main", "open_issues": 3, "stargazers_count": 130, "forks_count": 15, "watchers_count": 130, "tags_url": "https://api.github.com/repos/prime31/zig-gamekit/tags", "license": "-", "topics": [], "size": 1043, "fork": false, "updated_at": "2025-03-22T20:13:11Z", "has_build_zig": true, "has_build_zig_zon": false, "readme_content": "# Zig GameKit\nCompanion repo and example implementation for [zig-renderkit](https://github.com/prime31/zig-renderkit). `GameKit` provides an example implementation of a game framework built on top of `RenderKit`. It includes the core render loop, window (via SDL), input, Dear ImGui and timing support. You can use it as a base to make a 2D game as-is or create your own 2D framework based on it.\n\n`GameKit` provides the following wrappers around `RenderKit`'s API showing how it can be abstracted away in a real world project: `Texture`, `Shader` and `OffscreenPass`. Building on top of those types, `GameKit` then provides `Mesh` and `DynamicMesh` which manage buffers and bindings for you. Finally, the high level types utilize `DynamicMesh` and cover pretty much all that any 2D game would require: `Batcher` (quad/sprite batch) and `TriangleBatcher`.\n\nSome basic utilities and a small math lib with just the types required for the renderer (`Vec2`, `Vec3`, `Color`, `3x2 Matrix`, `Quad`) are also included.\n\n\n## Dependencies\nGameKit has just one external dependency: SDL. You can install SDL with the package manager of your choice.\n\n\n### Usage\n- clone the repository recursively: `git clone --recursive https://github.com/prime31/zig-gamekit`\n- `zig build help` to see what examples are availble\n- `zig build EXAMPLE_NAME` to run an example\n\n\n### Minimal GameKit Project File\n```zig\nvar texture: Texture = undefined;\n\npub fn main() !void {\n try gamekit.run(.{ .init = init, .render = render });\n}\n\nfn init() !void {\n texture = Texture.initFromFile(std.heap.HeapAllocator, \"texture.png\", .nearest) catch unreachable;\n}\n\nfn render() !void {\n gamekit.gfx.beginPass(.{ .color = Color.lime });\n gamekit.gfx.draw.tex(texture, .{ .x = 50, .y = 50 });\n gamekit.gfx.endPass();\n}\n```\n"}]
database/gui.json ADDED
@@ -0,0 +1 @@
 
 
1
+ [{"avatar_url": "https://avatars.githubusercontent.com/u/110254452?v=4", "name": "capy", "full_name": "capy-ui/capy", "created_at": "2021-03-24T11:36:16Z", "description": "\ud83d\udcbbBuild one codebase and get native UI on Windows, Linux and Web", "default_branch": "master", "open_issues": 20, "stargazers_count": 2064, "forks_count": 77, "watchers_count": 2064, "tags_url": "https://api.github.com/repos/capy-ui/capy/tags", "license": "-", "topics": ["cross-platform", "cross-platform-gui", "gui", "gui-library", "linux", "ui", "user-interface", "windows", "zig", "zig-package", "ziglang"], "size": 15764, "fork": false, "updated_at": "2025-04-12T15:40:25Z", "has_build_zig": true, "has_build_zig_zon": true, "readme_content": "<a href=\"https://capy-ui.org\">\n <p align=\"center\">\n <picture>\n <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://capy-ui.org/img/capy_big2_dark.png\">\n <img src=\"https://capy-ui.org/img/capy_big2.png\" alt=\"Capy UI\" height=\"200px\">\n </picture>\n </p>\n</a>\n\n**As of now, Capy is NOT ready for use in production as I'm still making breaking changes**\n\n**Capy targets Zig version `0.14.0-dev.1911+3bf89f55c` / `2024.10.0-mach` ([Nominated Zig versions](https://machengine.org/docs/nominated-zig/))**\n, it doesn't work on Zig `0.13.0`\n\n---\n\n[![Code Coverage](https://img.shields.io/codecov/c/github/capy-ui/capy?style=for-the-badge)](https://app.codecov.io/gh/capy-ui/capy)\n[![MPL-2.0 License](https://img.shields.io/github/license/capy-ui/capy?style=for-the-badge)](https://github.com/capy-ui/capy/blob/master/LICENSE)\n\n![the glorius software in action](https://raw.githubusercontent.com/zenith391/bottom-zig-gui/main/.github/screenshot.png)\n\n## Introduction\n\nCapy is a **GUI library for Zig**. It is mainly intended for creating applications using native controls from the operating system.\nCapy is a declarative UI library aiming to be easy to write for and versatile.\n\nIt has been made with the goal to empower standalone UI applications, integration in games or any other rendering process is a non-goal.\n\n## Features\n- Use Zig for frontend and backend\n- Accessibility: compatibility with almost all accessibility tools\n- Cross-platform\n- Uses the target OS toolkit\n- Cross-compilable from any platform to any other platform\n- *Tiny* executables - Every [example](https://github.com/capy-ui/capy/tree/master/examples)'s size < 2MB, which is smaller than 'hello world' in Go\n\n## Getting Started\n\nIf you're starting a new project, simply clone [capy-template](https://github.com/capy-ui/capy-template) and follow build instructions.\n\nOtherwise or for more information, please look in the [docs](https://capy-ui.org/docs/getting-started/installation).\n\nYou can ask questions and receive updates on the [#capy-ui Matrix channel](https://matrix.to/#/#capy-ui:matrix.org).\n\n## Usage\n\nA simple application using capy:\n\n```zig\nconst capy = @import(\"capy\");\nconst std = @import(\"std\");\npub usingnamespace capy.cross_platform;\n\npub fn main() !void {\n try capy.init();\n\n var window = try capy.Window.init();\n try window.set(\n capy.column(.{ .spacing = 10 }, .{ // have 10px spacing between each column's element\n capy.row(.{ .spacing = 5 }, .{ // have 5px spacing between each row's element\n capy.button(.{ .label = \"Save\", .onclick = @ptrCast(&buttonClicked) }),\n capy.button(.{ .label = \"Run\", .onclick = @ptrCast(&buttonClicked) })\n }),\n // 'expanded' means the widget will take all the space it can\n // in the parent container\n capy.expanded(\n capy.textArea(.{ .text = \"Hello World!\" })\n )\n })\n );\n\n window.setPreferredSize(800, 600);\n window.show();\n capy.runEventLoop();\n}\n\nfn buttonClicked(button: *capy.Button) !void {\n std.log.info(\"You clicked the button with text {s}\", .{button.getLabel()});\n}\n```\n\nIt is easy to add something like a button or a text area. The example can already be used to notice a widget's parameters are usually enclosed in anonymous\nstructs (`.{ .label = \"Save\" }`). You can also see that simply wrapping a widget with `capy.Expanded( ... )` will tell it to take all the space it can.\n\n## Contributing\nContributing can be as simple as opening an issue and detailling what bug you encountered or what feature you wish to have. \nIf you want to help the project more directly, you can fork the project and then create a pull request.\n\n## Supported platforms\n\nA platform is considered supported only if it can be built to from every other OS.\n\nLegends:\n- \u2705 Working and can be cross-compile from all platforms supported by Zig\n- \ud83e\uddea Experimental\n- \ud83c\udfc3 Planned\n\n### Desktop\n\n\u2705 Windows x86_64 \n\u2705 Windows i386\n\n\ud83c\udfc3 macOS M1 \n\ud83c\udfc3 macOS x86_64 \n\n\u2705 Linux x86_64 \n\u2705 Linux i386 \n\u2705 Linux aarch64 (PinePhone, PineBook...) \n\n\u2705 FreeBSD x86_64 \n\n### Mobile\n\n\ud83e\uddea Android \n\ud83c\udfc3 iOS\n\n### Web\n\n\u2705 WebAssembly\n\nNote: As there's no \"official\" GUI library for Linux, GTK 4 has been chosen as it is the one\nthat works and can be configured on the most distros. It's also the reason Libadwaita won't\nbe adopted, as it's meant for GNOME and GNOME only by disallowing styling and integration\nwith other DEs.\n\n\n\n## Supported components\nFor now, not every platform supports the same components. So here's a list of the ones that are supported:\n\n| |win32|macOS|GTK|Android|wasm|\n|------------------|-----|-----|---|-----|-----|\n|Button |\u2705|\u2705|\u2705|\u2705|\u2705|\n|Canvas |\u274c|\u274c|\u2705|\u2705|\u2705|\n|CheckBox |\u2705|\u274c|\u2705|\u274c|\u274c|\n|Dropdown |\u2705|\u274c|\u2705|\u274c|\u274c|\n|Image |\u274c|\u274c|\u2705|\u274c|\u2705|\n|Label |\u2705|\u2705|\u2705|\u2705|\u2705|\n|Menu |\u274c|\u274c|\u274c|\u274c|\u274c|\n|Navigation |\u274c|\u274c|\u274c|\u274c|\u274c|\n|NavigationSidebar |\u274c|\u274c|\u2705|\u274c|\u274c|\n|Scrollable |\u2705|\u274c|\u2705|\u274c|\u274c|\n|Slider |\u2705|\u274c|\u2705|\u274c|\u2705|\n|Tabs |\u2705|\u274c|\u2705|\u274c|\u274c|\n|TextArea |\u2705|\u274c|\u2705|\u274c|\u274c|\n|TextField |\u2705|\u274c|\u2705|\u2705|\u2705|\n|Window |\u2705|\u2705|\u2705|\u2705|\u2705\n"}, {"avatar_url": "https://avatars.githubusercontent.com/u/133399259?v=4", "name": "zig-webui", "full_name": "webui-dev/zig-webui", "created_at": "2023-05-12T20:21:26Z", "description": "Use any web browser or WebView as GUI, with Zig in the backend and modern web technologies in the frontend, all in a lightweight portable library.", "default_branch": "main", "open_issues": 6, "stargazers_count": 549, "forks_count": 23, "watchers_count": 549, "tags_url": "https://api.github.com/repos/webui-dev/zig-webui/tags", "license": "-", "topics": ["cross-platform-gui", "gui", "gui-library", "linux", "webui", "windows", "zig", "zig-package", "zig-webui"], "size": 1883, "fork": false, "updated_at": "2025-04-13T11:32:49Z", "has_build_zig": true, "has_build_zig_zon": true, "readme_content": "<div align=\"center\">\n\n![Logo](https://raw.githubusercontent.com/webui-dev/webui-logo/main/webui_zig.png)\n\n# WebUI Zig v2.5.0-beta.4\n\n<!-- [build-status]: https://img.shields.io/github/actions/workflow/status/webui-dev/go-webui/ci.yml?branch=main&style=for-the-badge&logo=V&labelColor=414868&logoColor=C0CAF5 -->\n\n[last-commit]: https://img.shields.io/github/last-commit/webui-dev/zig-webui?style=for-the-badge&logo=github&logoColor=C0CAF5&labelColor=414868\n<!-- [release-version]: https://img.shields.io/github/v/tag/webui-dev/go-webui?style=for-the-badge&logo=webtrees&logoColor=C0CAF5&labelColor=414868&color=7664C6 -->\n[license]: https://img.shields.io/github/license/webui-dev/zig-webui?style=for-the-badge&logo=opensourcehardware&label=License&logoColor=C0CAF5&labelColor=414868&color=8c73cc\n\n<!-- [![][build-status]](https://github.com/webui-dev/go-webui/actions?query=branch%3Amain) -->\n\n[![][last-commit]](https://github.com/webui-dev/zig-webui/pulse)\n<!-- [![][release-version]](https://github.com/webui-dev/go-webui/releases/latest) -->\n[![][license]](https://github.com/webui-dev/zig-webui/blob/main/LICENSE)\n\n> Use any web browser or WebView as GUI, with Zig in the backend and modern web technologies in the frontend, all in a lightweight portable library.\n\n![Screenshot](https://raw.githubusercontent.com/webui-dev/webui-logo/main/screenshot.png)\n\n</div>\n\n## Features\n\n- Portable (*Needs only a web browser or a WebView at runtime*)\n- One header file\n- Lightweight (*Few Kb library*) & Small memory footprint\n- Fast binary communication protocol\n- Multi-platform & Multi-Browser\n- Using private profile for safety\n- Cross-platform WebView\n\n## API Documentation\n\n* [https://webui-dev.github.io/zig-webui/](https://webui-dev.github.io/zig-webui/)\n* [https://webui.me/docs/2.5/#/](https://webui.me/docs/2.5/#/)\n\n## Examples\n\nThere are several examples for newbies, they are in the `examples` directory.\n\nYou can use `zig build --help` to view all buildable examples.\n\nLike `zig build run_minimal`, this will build and run the `minimal` example.\n\n## Installation\n\n> note: for `0.13.0` and previous version, please use tag `2.5.0-beta.2`\n\n### Zig `0.14.0` \\ `nightly`\n\n> To be honest, I don\u2019t recommend using the nightly version because the API of the build system is not yet stable, which means that there may be problems with not being able to build after nightly is updated.\n\n1. Add to `build.zig.zon`\n\n```sh\n# It is recommended to replace the following branch with commit id\nzig fetch --save https://github.com/webui-dev/zig-webui/archive/main.tar.gz\n# Of course, you can also use git+https to fetch this package!\n```\n\n2. Config `build.zig`\n\nAdd this:\n\n```zig\n// To standardize development, maybe you should use `lazyDependency()` instead of `dependency()`\n// more info to see: https://ziglang.org/download/0.12.0/release-notes.html#toc-Lazy-Dependencies\nconst zig_webui = b.dependency(\"zig_webui\", .{\n .target = target,\n .optimize = optimize,\n .enable_tls = false, // whether enable tls support\n .is_static = true, // whether static link\n});\n\n// add module\nexe.root_module.addImport(\"webui\", zig_webui.module(\"webui\"));\n```\n\n> It is not recommended to dynamically link libraries under Windows, which may cause some symbol duplication problems.\n> see this issue: https://github.com/ziglang/zig/issues/15107\n\n### Windows without console\n\nFor hide console window, you can set `exe.subsystem = .Windows;`!\n\n## UI & The Web Technologies\n\n[Borislav Stanimirov](https://ibob.bg/) discusses using HTML5 in the web browser as GUI at the [C++ Conference 2019 (_YouTube_)](https://www.youtube.com/watch?v=bbbcZd4cuxg).\n\n<!-- <div align=\"center\">\n <a href=\"https://www.youtube.com/watch?v=bbbcZd4cuxg\"><img src=\"https://img.youtube.com/vi/bbbcZd4cuxg/0.jpg\" alt=\"Embrace Modern Technology: Using HTML 5 for GUI in C++ - Borislav Stanimirov - CppCon 2019\"></a>\n</div> -->\n\n<div align=\"center\">\n\n![CPPCon](https://github.com/webui-dev/webui/assets/34311583/4e830caa-4ca0-44ff-825f-7cd6d94083c8)\n\n</div>\n\nWeb application UI design is not just about how a product looks but how it works. Using web technologies in your UI makes your product modern and professional, And a well-designed web application will help you make a solid first impression on potential customers. Great web application design also assists you in nurturing leads and increasing conversions. In addition, it makes navigating and using your web app easier for your users.\n\n### Why Use Web Browsers?\n\nToday's web browsers have everything a modern UI needs. Web browsers are very sophisticated and optimized. Therefore, using it as a GUI will be an excellent choice. While old legacy GUI lib is complex and outdated, a WebView-based app is still an option. However, a WebView needs a huge SDK to build and many dependencies to run, and it can only provide some features like a real web browser. That is why WebUI uses real web browsers to give you full features of comprehensive web technologies while keeping your software lightweight and portable.\n\n### How Does it Work?\n\n<div align=\"center\">\n\n![Diagram](https://github.com/ttytm/webui/assets/34311583/dbde3573-3161-421e-925c-392a39f45ab3)\n\n</div>\n\nThink of WebUI like a WebView controller, but instead of embedding the WebView controller in your program, which makes the final program big in size, and non-portable as it needs the WebView runtimes. Instead, by using WebUI, you use a tiny static/dynamic library to run any installed web browser and use it as GUI, which makes your program small, fast, and portable. **All it needs is a web browser**.\n\n### Runtime Dependencies Comparison\n\n| | Tauri / WebView | Qt | WebUI |\n| ------------------------------- | ----------------- | -------------------------- | ------------------- |\n| Runtime Dependencies on Windows | _WebView2_ | _QtCore, QtGui, QtWidgets_ | **_A Web Browser_** |\n| Runtime Dependencies on Linux | _GTK3, WebKitGTK_ | _QtCore, QtGui, QtWidgets_ | **_A Web Browser_** |\n| Runtime Dependencies on macOS | _Cocoa, WebKit_ | _QtCore, QtGui, QtWidgets_ | **_A Web Browser_** |\n\n## Supported Web Browsers\n\n| Browser | Windows | macOS | Linux |\n| --------------- | --------------- | ------------- | --------------- |\n| Mozilla Firefox | \u2714\ufe0f | \u2714\ufe0f | \u2714\ufe0f |\n| Google Chrome | \u2714\ufe0f | \u2714\ufe0f | \u2714\ufe0f |\n| Microsoft Edge | \u2714\ufe0f | \u2714\ufe0f | \u2714\ufe0f |\n| Chromium | \u2714\ufe0f | \u2714\ufe0f | \u2714\ufe0f |\n| Yandex | \u2714\ufe0f | \u2714\ufe0f | \u2714\ufe0f |\n| Brave | \u2714\ufe0f | \u2714\ufe0f | \u2714\ufe0f |\n| Vivaldi | \u2714\ufe0f | \u2714\ufe0f | \u2714\ufe0f |\n| Epic | \u2714\ufe0f | \u2714\ufe0f | _not available_ |\n| Apple Safari | _not available_ | _coming soon_ | _not available_ |\n| Opera | _coming soon_ | _coming soon_ | _coming soon_ |\n\n## Supported WebView\n\n| WebView | Status |\n| --------------- | --------------- |\n| Windows WebView2 | \u2714\ufe0f |\n| Linux GTK WebView | \u2714\ufe0f |\n| macOS WKWebView | \u2714\ufe0f |\n\n### License\n\n> Licensed under the MIT License.\n"}, {"avatar_url": "https://avatars.githubusercontent.com/u/3290996?v=4", "name": "dvui", "full_name": "david-vanderson/dvui", "created_at": "2022-05-15T23:37:21Z", "description": null, "default_branch": "main", "open_issues": 30, "stargazers_count": 704, "forks_count": 49, "watchers_count": 704, "tags_url": "https://api.github.com/repos/david-vanderson/dvui/tags", "license": "-", "topics": [], "size": 15880, "fork": false, "updated_at": "2025-04-12T18:24:30Z", "has_build_zig": true, "has_build_zig_zon": true, "readme_content": "# DVUI - Immediate Zig GUI for Apps and Games\n\n[Homepage](https://david-vanderson.github.io) A Zig GUI toolkit for whole applications or extra debugging windows in an existing application.\n\nTested with [Zig](https://ziglang.org/) 0.14 (use tag v0.2.0 for zig 0.13)\n\nHow to run the built-in examples:\n\n- ```zig build sdl-standalone```\n- ```zig build sdl-ontop```\n- ```zig build raylib-standalone```\n- ```zig build raylib-ontop```\n- ```zig build web-test```\n - then load `zig-out/bin/index.html`\n - [online demo](https://david-vanderson.github.io/demo)\n- SDL3:\n - ```zig build sdl-standalone -Dsdl3```\n - ```zig build sdl-ontop -Dsdl3```\n - if you encounter error `No Wayland` also add flag `-Dlinux_display_backend=X11`\n \n\n[Online Docs](https://david-vanderson.github.io/docs) This document is a broad overview. See [implementation details](readme-implementation.md) for how to write and modify widgets.\n\nOnline discussion happens in #gui-dev on the zig discord server: https://discord.gg/eJgXXTtVzA or in IRC (Libera) channel #dvui\n\nBelow is a screenshot of the demo window, whose source code can be found at `src/Examples.zig`.\n\n![Screenshot of DVUI Standalone Example (Application Window)](/screenshot_demo.png?raw=true)\n\n### Projects using DVUI\n\n* [Podcast Player](https://github.com/david-vanderson/podcast)\n* [Graphical Janet REPL](https://codeberg.org/iacore/janet-graphical-repl)\n* [FIDO2/ Passkey compatible authenticator implementation for Linux](https://github.com/r4gus/keypass)\n* [QEMU frontend](https://github.com/AnErrupTion/ZigEmu)\n* [Static site generator GUI](https://github.com/nhanb/webmaker2000)\n\n## Features\n\n- Immediate Mode Interface\n- Process every input event (suitable for low-fps situations)\n- Use for whole UI or for debugging on top of existing application\n- Existing backends\n - [SDL](https://libsdl.org/)\n - [Web](https://david-vanderson.github.io/demo)\n - [Raylib](https://www.raylib.com/)\n- Icon support via [TinyVG](https://tinyvg.tech/)\n- Raster image support via [stb_image](https://github.com/nothings/stb)\n- Font support\n - [freetype](https://github.com/david-vanderson/freetype/tree/zig-pkg)\n - [stb_truetype](https://github.com/nothings/stb)\n- Touch support\n - Including selection draggables in text entries\n- Native file dialogs via [tinyfiledialogs](https://sourceforge.net/projects/tinyfiledialogs)\n- Animations\n- Themes\n- FPS throttling\n\n## Usage\n\n[DVUI Demo](https://github.com/david-vanderson/dvui-demo) is a template project you can use as a starting point.\n\nThe build.zig and build.zig.zon files there show how to reference dvui as a zig dependency.\n\n## Built-in Widgets\n\n - Text Entry (single and multiline)\n - Includes touch support (selection draggables and menu)\n - Number Entry\n - Supports all Integer and Floating Point types\n - Text Layout\n - Parts can be clickable\n - Parts separately styled\n - Floating Window\n - Menu\n - Popup/Context Window\n - Scroll Area\n - Button\n - Multi-line label\n - Can be clickable for links\n - Slider\n - SliderEntry\n - Combo slider and text entry\n - Checkbox\n - Radio Buttons\n - Toast\n - Panes with draggable sash\n - Dropdown\n - Reorderable Lists\n - Drag to reorder/remove/add\n- Missing Widgets for now\n - Data Grid\n - Docking\n\n## Design\n\n### Immediate Mode\n```zig\nif (try dvui.button(@src(), \"Ok\", .{}, .{})) {\n dialog.close();\n}\n```\nWidgets are not stored between frames like in traditional gui toolkits (gtk, win32, cocoa). `dvui.button()` processes input events, draws the button on the screen, and returns true if a button click happened this frame.\n\nFor an intro to immediate mode guis, see: https://github.com/ocornut/imgui/wiki#about-the-imgui-paradigm\n\n#### Advantages\n* Reduce widget state\n * example: checkbox directly uses your app's bool\n* Reduce gui state\n * the widgets shown each frame directly reflect the code run each frame\n * harder to be in a state where the gui is showing one thing but the app thinks it's showing something else\n * don't have to clean up widgets that aren't needed anymore\n* Functions are the composable building blocks of the gui\n * since running a widget is a function, you can wrap a widget easily\n```zig\n// Let's wrap the sliderEntry widget so we have 3 that represent a Color\npub fn colorSliders(src: std.builtin.SourceLocation, color: *dvui.Color, opts: Options) !void {\n var hbox = try dvui.box(src, .horizontal, opts);\n defer hbox.deinit();\n\n var red: f32 = @floatFromInt(color.r);\n var green: f32 = @floatFromInt(color.g);\n var blue: f32 = @floatFromInt(color.b);\n\n _ = try dvui.sliderEntry(@src(), \"R: {d:0.0}\", .{ .value = &red, .min = 0, .max = 255, .interval = 1 }, .{ .gravity_y = 0.5 });\n _ = try dvui.sliderEntry(@src(), \"G: {d:0.0}\", .{ .value = &green, .min = 0, .max = 255, .interval = 1 }, .{ .gravity_y = 0.5 });\n _ = try dvui.sliderEntry(@src(), \"B: {d:0.0}\", .{ .value = &blue, .min = 0, .max = 255, .interval = 1 }, .{ .gravity_y = 0.5 });\n\n color.r = @intFromFloat(red);\n color.g = @intFromFloat(green);\n color.b = @intFromFloat(blue);\n}\n```\n\n#### Drawbacks\n* Hard to do fire-and-forget\n * example: show a dialog with an error message from code that won't be run next frame\n * dvui includes a retained mode space for dialogs and toasts for this\n* Hard to do dialog sequence\n * retained mode guis can run a modal dialog recursively so that dialog code can only exist in a single function\n * dvui retained dialogs can be chained together for this\n\n### Handle All Events\nDVUI processes every input event, making it useable in low framerate situations. A button can receive a mouse-down event and a mouse-up event in the same frame and correctly report a click. A custom button could even report multiple clicks per frame. (the higher level `dvui.button()` function only reports 1 click per frame)\n\nIn the same frame these can all happen:\n- text entry field A receives text events\n- text entry field A receives a tab that moves keyboard focus to field B\n- text entry field B receives more text events\n\nBecause everything is in a single pass, this works in the normal case where widget A is run before widget B. It doesn't work in the opposite order (widget B receives a tab that moves focus to A) because A ran before it got focus.\n\n### Floating Windows\nThis library can be used in 2 ways:\n- as the gui for the whole application, drawing over the entire OS window\n- as floating windows on top of an existing application with minimal changes:\n - use widgets only inside `dvui.floatingWindow()` calls\n - `dvui.addEvent...` functions return false if event won't be handled by dvui (main application should handle it)\n - change `dvui.cursorRequested()` to `dvui.cursorRequestedFloating()` which returns null if the mouse cursor should be set by the main application\n\nFloating windows and popups are handled by deferring their rendering so that they render properly on top of windows below them. Rendering of all floating windows and popups happens during `window.end()`.\n\n### FPS throttling\nIf your app is running at a fixed framerate, use `window.begin()` and `window.end()` which handle bookkeeping and rendering.\n\nIf you want to only render frames when needed, add `window.beginWait()` at the start and `window.waitTime()` at the end. These cooperate to sleep the right amount and render frames when:\n- an event comes in\n- an animation is ongoing\n- a timer has expired\n- user code calls `dvui.refresh(null, ...)` (if your code knows you need a frame after the current one)\n- a background thread calls `dvui.refresh(window, ...)` which in turn calls `backend.refresh()`\n\n`window.waitTime()` also accepts a max fps parameter which will ensure the framerate stays below the given value.\n\n`window.beginWait()` and `window.waitTime()` maintain an internal estimate of how much time is spent outside of the rendering code. This is used in the calculation for how long to sleep for the next frame.\n\nThe estimate is visible in the demo window Animations > Clock > \"Estimate of frame overhead\". The estimate is only updated on frames caused by a timer expiring (like the clock example), and it starts at 1ms.\n\n### Widget init and deinit\nThe easiest way to use widgets is through the high-level functions that create and install them:\n```zig\n{\n var box = try dvui.box(@src(), .vertical, .{.expand = .both});\n defer box.deinit();\n\n // widgets run here will be children of box\n}\n```\nThese functions allocate memory for the widget onto an internal arena allocator that is flushed each frame.\n\nInstead you can allocate the widget on the stack using the lower-level functions:\n```zig\n{\n var box = BoxWidget.init(@src(), .vertical, false, .{.expand = .both});\n // box now has an id, can look up animations/timers\n\n try box.install();\n // box is now parent widget\n\n try box.drawBackground();\n // might draw the background in a different way\n\n defer box.deinit();\n\n // widgets run here will be children of box\n}\n```\nThe lower-level functions give a lot more customization options including animations, intercepting events, and drawing differently.\n\nStart with the high-level functions, and when needed, copy the body of the high-level function and customize from there.\n\n### Parent, Child, and Layout\nThe primary layout mechanism is nesting widgets. DVUI keeps track of the current parent widget. When a widget runs, it is a child of the current parent. A widget may then make itself the current parent, and reset back to the previous parent when it runs `deinit()`.\n\nThe parent widget decides what rectangle of the screen to assign to each child.\n\nUsually you want each part of a gui to either be packed tightly (take up only min size), or expand to take the available space. The choice might be different for vertical vs. horizontal.\n\nWhen a child widget is laid out (sized and positioned), it sends 2 pieces of info to the parent:\n- min size\n- hints for when space is larger than min size (expand, gravity_x, gravity_y)\n\nIf parent is not `expand`ed, the intent is to pack as tightly as possible, so it will give all children only their min size.\n\nIf parent has more space than the children need, it will lay them out using the hints:\n- expand - whether this child should take more space or not\n- gravity - if not expanded, where to position child in larger space\n\n### Appearance\nEach widget has the following options that can be changed through the Options struct when creating the widget:\n- margin (space outside border)\n- border (on each side)\n- padding (space inside border)\n- min_size_content (margin/border/padding added to get min size)\n- max_size_content (margin/border/padding added to get maximum min size)\n- background (fills space inside border with background color)\n- corner_radius (for each corner)\n- colors (either RGBA value or named)\n - example RGBA `.color_text = .{ .color = .{ .r = 0xe0, .g = 0x1b, .b = 0x24 } }`\n - example named `.color_text = .{ .name = .err }` (get current theme's `color_err`)\n - color_accent\n - color_text\n - color_text_press\n - color_fill\n - color_fill_hover\n - color_fill_press\n - color_border\n- font_style (use theme's fonts)\n - or directly set font:\n - font\n\nEach widget has its own default options. These can be changed directly:\n```zig\ndvui.ButtonWidget.defaults.background = false;\n```\n\nThemes can be changed between frames or even within a frame. The theme controls the fonts and colors referenced by font_style and named colors.\n```zig\nif (theme_dark) {\n win.theme = win.themes.get(\"Adwaita Dark\").?;\n}\nelse {\n win.theme = win.themes.get(\"Adwaita Light\").?;\n}\n```\nThe theme's color_accent is also used to show keyboard focus.\n\nSee [implementation details](readme-implementation.md) for more information.\n\n"}, {"avatar_url": "https://avatars.githubusercontent.com/u/6756180?v=4", "name": "qml_zig", "full_name": "kassane/qml_zig", "created_at": "2020-12-19T17:33:55Z", "description": "QML bindings for the Zig programming language", "default_branch": "main", "open_issues": 2, "stargazers_count": 107, "forks_count": 4, "watchers_count": 107, "tags_url": "https://api.github.com/repos/kassane/qml_zig/tags", "license": "-", "topics": ["qml-bindings", "qml-zig", "zig", "zig-package", "ziglang"], "size": 1692, "fork": false, "updated_at": "2025-04-09T00:35:51Z", "has_build_zig": true, "has_build_zig_zon": true, "readme_content": "# QML-zig\n![GitHub All Releases](https://img.shields.io/github/downloads/kassane/qml_zig/total?style=flat-square) ![GitHub release (latest by date)](https://img.shields.io/github/v/release/kassane/qml_zig?style=flat-square) ![GitHub](https://img.shields.io/github/license/kassane/qml_zig?style=flat-square)\n\nBindings are based on [DOtherSide](https://github.com/filcuc/dotherside) C bindings for QML Library is mostly feature-compliant with other bindings based on the library, but lacks some minor features and has quite a few bugs.\n\n# Preview\n![qml_zig](https://user-images.githubusercontent.com/6756180/102698635-a5518500-421d-11eb-8705-98013d2328d7.jpg)\n\n# Build - Steps\n\n## Requirements\n\nAll software required for building.\n\n- Qt 5.15 or higher\n- Zig v0.12.0, 0.13.0 or master\n- CMake v3.2 or higher (DOtherSide build)\n\n### Question\n\n#### Works on Qt6?\n\nMaybe, check [DOtherSide](https://github.com/filcuc/dotherside) support!!\n\n## Instructions\n\n~~~bash\n# Clone repo\ngit clone --recursive https://github.com/kassane/qml_zig\n\n# Open folder\ncd qml_zig\n\n# build DOtherSide\nzig build cmake\n\n# Build\nzig build ExampleName -Doptimize=ReleaseSafe|-Doptimize=ReleaseFast|-Doptimize=ReleaseSmall\n~~~\n\n# Examples\n\n`zig build Animated` - Run an Animated Box\n\n`zig build Hello` - Hello World, with Menu and Clickable Button\n\n`zig build Cells` - Cells example from QML Tute, click a color to change the text\n\n`zig build Button` - Button with 2-way comms to the Zig code\n\n`zig build Layouts` - Layouts examples\n\n`zig build Splits` - Splitview example\n\n`zig build Tables` - Tableview example\n\n# Work in Progres Examples\n\n`zig build Particle` - Particle system example\n- Needs QObject wrapper working yet, to pass zig objects to the QML side\n\n# Status\n\n- Basic initialization and execution\n- More Examples - thanks [@zigster64](https://github.com/zigster64)!\n- Providing properties to QML files\n\n# TODO\n\n- [ ] QAbstractListModels\n- [ ] QObject - **working progress**\n- [ ] QStyle\n"}, {"avatar_url": "https://avatars.githubusercontent.com/u/37966791?v=4", "name": "zfltk", "full_name": "MoAlyousef/zfltk", "created_at": "2021-01-19T16:04:08Z", "description": "Zig bindings for the FLTK gui library", "default_branch": "main", "open_issues": 5, "stargazers_count": 65, "forks_count": 8, "watchers_count": 65, "tags_url": "https://api.github.com/repos/MoAlyousef/zfltk/tags", "license": "-", "topics": ["fltk", "gui", "zig", "zig-package"], "size": 9454, "fork": false, "updated_at": "2025-04-09T06:49:12Z", "has_build_zig": true, "has_build_zig_zon": true, "readme_content": "# zfltk\nA Zig wrapper for the FLTK gui library.\n\n## Building the package from source\n```sh\ngit clone https://github.com/MoAlyousef/zfltk\ncd zfltk\nzig build\n```\n\nTo build the examples, pass `-Dzfltk-build-examples=true` to your `zig build` command.\n\n## Usage\nzfltk supports the zig package manager. To create a new project:\n\n```sh\nmkdir myproject\ncd myproject\nzig init\n```\n\nThis should create `build.zig`, `build.zig.zon` and other files.\n\nYou can add zfltk as a dependency to your project with one of these:\n\n```sh\n## specific release\n# 0.6.0 for zig 0.13\nzig fetch --save=zfltk https://github.com/MoAlyousef/zfltk/archive/refs/tags/pkg0.6.0.zip\n## or main branch\nzig fetch --save=zfltk https://github.com/MoAlyousef/zfltk/archive/refs/heads/main.zip\n```\n\nThis might add something like this in your `build.zig.zon`:\n```zig\n.{\n ...\n .dependencies = .{\n .zfltk = .{\n .url = \"https://github.com/MoAlyousef/zfltk/archive/refs/tags/pkg0.7.0.zip\",\n .hash = \"...\",\n },\n },\n ...\n}\n```\n\nYou can add the following to your build.zig:\n```zig\n const zfltk_dep = b.dependency(\"zfltk\", .{\n .target = target,\n .optimize = optimize,\n });\n exe.root_module.addImport(\"zfltk\", zfltk_dep.module(\"zfltk\"));\n```\n\nThen you can run:\n```sh\nzig build run\n```\n\n## Dependencies \nzfltk requires a system install of cfltk (which along with fltk will be statically linked to your executable). CMake and a C++ compiler.\nYou can install cfltk using:\n```sh\ngit clone https://github.com/MoAlyousef/cfltk -b fltk1.4 --recurse-submodules --depth=1\ncd cfltk\n./scripts/bootstrap_posix.sh # optionally specify a -DCMAKE_INSTALL_PREFX=/some/path\n```\nThis might require super user privileges if no install prefix is provided since it might install to /usr/local.\nIf you install cfltk into a non-standard search path you would need to supply your executable with an include path and library path:\n```zig\n exe.addLibraryPath(\"/some/path/include\");\n exe.addIncludePath(\"/some/path/lib\");\n```\nAlternatively you can supply the zig executable with a search prefix:\n```bash\nzig build --search-prefix /some/path\n```\ncfltk dependencies:\n- Windows: With mingw, no dependencies.\n- MacOS: MacOS SDK.\n- Linux: X11 and OpenGL development headers need to be installed for development. The libraries themselves are available on linux distros with a graphical user interface.\n\nFor Debian-based GUI distributions, that means running:\n```sh\nsudo apt-get install libx11-dev libxext-dev libxft-dev libxinerama-dev libxcursor-dev libxrender-dev libxfixes-dev libpango1.0-dev libpng-dev libgl1-mesa-dev libglu1-mesa-dev\n```\nFor RHEL-based GUI distributions, that means running:\n```sh\nsudo yum groupinstall \"X Software Development\" && yum install pango-devel libXinerama-devel libpng-devel libstdc++-static\n```\nFor Arch-based GUI distributions, that means running:\n```sh\nsudo pacman -S libx11 libxext libxft libxinerama libxcursor libxrender libxfixes libpng pango cairo libgl mesa --needed\n```\nFor Alpine linux:\n```sh\napk add pango-dev fontconfig-dev libxinerama-dev libxfixes-dev libxcursor-dev libpng-dev mesa-gl\n```\nFor nixos:\n```sh\nnix-shell --packages rustc cmake git gcc xorg.libXext xorg.libXft xorg.libXinerama xorg.libXcursor xorg.libXrender xorg.libXfixes libcerf pango cairo libGL mesa pkg-config\n```\n\n## API\nUsing the Zig wrapper (under development):\n```zig\nconst zfltk = @import(\"zfltk\");\nconst app = zfltk.app;\nconst Window = zfltk.window.Window;\nconst Button = zfltk.button.Button;\nconst Box = zfltk.box.Box;\nconst Color = zfltk.enums.Color;\n\nfn butCb(but: *Button, data: ?*anyopaque) void {\n var box = Box.fromRaw(data.?);\n\n box.setLabel(\"Hello World!\");\n\n but.setColor(Color.fromName(.cyan));\n}\n\npub fn main() !void {\n try app.init();\n app.setScheme(.gtk);\n\n var win = try Window.init(.{\n .w = 400,\n .h = 300,\n\n .label = \"Hello\",\n });\n win.freePosition();\n\n var but = try Button.init(.{\n .x = 160,\n .y = 220,\n .w = 80,\n .h = 40,\n\n .label = \"Click me!\",\n });\n\n but.setDownBox(.flat);\n\n var box = try Box.init(.{\n .x = 10,\n .y = 10,\n .w = 380,\n .h = 180,\n\n .boxtype = .up,\n });\n\n box.setLabelFont(.courier);\n box.setLabelSize(18);\n\n win.end();\n win.show();\n\n but.setCallbackEx(butCb, box);\n try app.run();\n}\n```\nThe messaging api can also be used:\n```zig\nconst zfltk = @import(\"zfltk\");\nconst app = zfltk.app;\nconst Window = zfltk.window.Window;\nconst Button = zfltk.button.Button;\nconst Box = zfltk.box.Box;\nconst enums = zfltk.enums;\n\npub const Message = enum(usize) {\n // Can't begin with Zero!\n first = 1,\n second,\n};\n\npub fn main() !void {\n try app.init();\n app.setScheme(.gtk);\n\n var win = try Window.init(.{\n .w = 400,\n .h = 300,\n\n .label = \"Hello\",\n });\n\n var but1 = try Button.init(.{\n .x = 100,\n .y = 220,\n .w = 80,\n .h = 40,\n\n .label = \"Button 1\",\n });\n\n var but2 = try Button.init(.{\n .x = 200,\n .y = 220,\n .w = 80,\n .h = 40,\n\n .label = \"Button 2\",\n });\n\n var mybox = try Box.init(.{\n .x = 10,\n .y = 10,\n .w = 380,\n .h = 180,\n\n .boxtype = .up,\n });\n\n mybox.setLabelFont(.courier);\n mybox.setLabelSize(18);\n\n win.end();\n win.show();\n but1.emit(Message, .first);\n but2.emit(Message, .second);\n\n while (app.wait()) {\n if (app.recv(Message)) |msg| switch (msg) {\n .first => mybox.setLabel(\"Button 1 Clicked!\"),\n .second => mybox.setLabel(\"Button 2 Clicked!\"),\n };\n }\n}\n```\n\nUsing the C Api directly:\n```zig\nconst c = @cImport({\n @cInclude(\"cfltk/cfl.h\"); // Fl_init_all, Fl_run\n @cInclude(\"cfltk/cfl_enums.h\"); // Fl_Color_*\n @cInclude(\"cfltk/cfl_image.h\"); // Fl_register_images\n @cInclude(\"cfltk/cfl_button.h\"); // Fl_Button\n @cInclude(\"cfltk/cfl_box.h\"); // Fl_Box\n @cInclude(\"cfltk/cfl_window.h\"); // Fl_Window\n});\n\n// fltk initizialization of optional functionalities\npub fn fltkInit() void {\n c.Fl_init_all(); // inits all styles, if needed\n c.Fl_register_images(); // register image types supported by fltk, if needed\n _ = c.Fl_lock(); // enable multithreading, if needed\n}\n\n// Button callback\npub fn butCb(w: ?*c.Fl_Widget, data: ?*anyopaque) callconv(.C) void {\n c.Fl_Box_set_label(@ptrCast(data), \"Hello World!\");\n c.Fl_Button_set_color(@ptrCast(w), c.Fl_Color_Cyan);\n}\n\npub fn main() !void {\n fltkInit();\n\n _ = c.Fl_set_scheme(\"gtk+\");\n const win = c.Fl_Window_new(100, 100, 400, 300, \"Hello\");\n const but = c.Fl_Button_new(160, 220, 80, 40, \"Click me!\");\n const box = c.Fl_Box_new(10, 10, 380, 180, \"\");\n c.Fl_Box_set_box(box, c.Fl_BoxType_UpBox);\n c.Fl_Box_set_label_size(box, 18);\n c.Fl_Box_set_label_font(box, c.Fl_Font_Courier);\n c.Fl_Window_end(win);\n c.Fl_Window_show(win);\n c.Fl_Button_set_callback(but, butCb, box);\n _ = c.Fl_run();\n}\n```\nYou can also mix and match for any missing functionalities in the Zig wrapper (see examples/mixed.zig).\n\nWidgets also provide a `call` method which allows to call any method that wasn't wrapped yet in the bindings:\n```zig\n var flex = try Flex.init(.{\n .w = 400,\n .h = 300,\n .orientation = .vertical,\n });\n\n flex.call(\"set_margins\", .{10, 20, 10, 20});\n```\n\n![alt_test](screenshots/image.jpg)\n![alt_test](screenshots/editor.jpg)\n\n[video tutorial](https://youtu.be/D2ijlrDStdM)\n\n"}]
database/packages.json ADDED
The diff for this file is too large to render. See raw diff
 
database/programs.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8500932f980872616f1a0d9faf8fc491c9fcea8ca72536c56887ca66d5e4054c
3
+ size 11004566
database/web.json ADDED
The diff for this file is too large to render. See raw diff
 
dockerfile ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use official Bun image
2
+ FROM oven/bun:1.0.30
3
+
4
+ # Set working directory
5
+ WORKDIR /app
6
+
7
+ # Copy code to container
8
+ COPY . .
9
+
10
+ # Install dependencies using Bun
11
+ RUN bun install
12
+
13
+ # Expose the app port
14
+ EXPOSE 3000
15
+
16
+ # Start the server
17
+ CMD ["bun", "server.js"]
package.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "api",
3
+ "module": "src/index.ts",
4
+ "type": "module",
5
+ "private": true,
6
+ "devDependencies": {
7
+ "@types/bun": "latest"
8
+ },
9
+ "peerDependencies": {
10
+ "typescript": "^5"
11
+ }
12
+ }
src/index.ts ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { serve } from "bun";
2
+ import packages from "../database/packages.json";
3
+ import programs from "../database/programs.json";
4
+
5
+ serve({
6
+ port: 3000,
7
+ fetch(req) {
8
+ const url = new URL(req.url);
9
+ const pathname = url.pathname;
10
+ const q = url.searchParams.get("q")?.trim().toLowerCase();
11
+ const filter = url.searchParams.get("filter")?.trim().toLowerCase();
12
+
13
+ const corsHeaders = {
14
+ "Content-Type": "application/json",
15
+ "Access-Control-Allow-Origin": "*",
16
+ };
17
+
18
+ // CORS preflight handling
19
+ if (req.method === "OPTIONS") {
20
+ return new Response(null, {
21
+ status: 204,
22
+ headers: {
23
+ "Access-Control-Allow-Origin": "*",
24
+ "Access-Control-Allow-Methods": "GET, POST, OPTIONS",
25
+ "Access-Control-Allow-Headers": "Content-Type",
26
+ },
27
+ });
28
+ }
29
+
30
+ if (pathname === "/api/searchPackages") {
31
+ const results = packages.filter(
32
+ ({ name, full_name, description, topics }) => {
33
+ if (
34
+ filter &&
35
+ !topics?.some((t: string) => t.toLowerCase() === filter)
36
+ )
37
+ return false;
38
+ if (!q) return true;
39
+ return [name, full_name, description, ...(topics || [])].some(
40
+ (field: string) => field?.toLowerCase().includes(q),
41
+ );
42
+ },
43
+ );
44
+
45
+ return new Response(JSON.stringify(results.slice(0, 25)), {
46
+ status: 200,
47
+ headers: corsHeaders,
48
+ });
49
+ }
50
+
51
+ if (pathname === "/api/searchProgams") {
52
+ const results = programs.filter(({ full_name, description, topics }) => {
53
+ if (filter && !topics?.some((t: string) => t.toLowerCase() === filter))
54
+ return false;
55
+ if (!q) return true;
56
+ return [full_name, description, ...(topics || [])].some(
57
+ (field: string) => field?.toLowerCase().includes(q),
58
+ );
59
+ });
60
+
61
+ return new Response(JSON.stringify(results.slice(0, 25)), {
62
+ status: 200,
63
+ headers: corsHeaders,
64
+ });
65
+ }
66
+
67
+ if (pathname === "/api/infiniteScrollPackages") {
68
+ const pageNumberParam = url.searchParams.get("pageNumber");
69
+ const pageNumber = parseInt(pageNumberParam || "0", 10);
70
+
71
+ if (isNaN(pageNumber) || pageNumber < 0) {
72
+ return new Response(JSON.stringify({ error: "Invalid page number" }), {
73
+ status: 400,
74
+ headers: corsHeaders,
75
+ });
76
+ }
77
+
78
+ const lowerLimit = pageNumber * 10;
79
+ const scrollResults = packages.slice(lowerLimit, lowerLimit + 10);
80
+
81
+ return new Response(JSON.stringify(scrollResults), {
82
+ status: 200,
83
+ headers: corsHeaders,
84
+ });
85
+ }
86
+
87
+ if (pathname === "/api/infiniteScrollPrograms") {
88
+ const section = url.searchParams.get("section");
89
+ const [ll, ul] = (url.searchParams.get("range") || "")
90
+ .split("..")
91
+ .map(Number);
92
+
93
+ if (!section || isNaN(ll) || isNaN(ul)) {
94
+ return new Response(JSON.stringify([]), {
95
+ status: 400,
96
+ headers: corsHeaders,
97
+ });
98
+ }
99
+
100
+ const getSortedResponse = (sortFn: Function) =>
101
+ new Response(JSON.stringify([...programs].sort(sortFn).slice(ll, ul)), {
102
+ status: 200,
103
+ headers: corsHeaders,
104
+ });
105
+
106
+ if (section === "mostUsed") {
107
+ return getSortedResponse(
108
+ (a: any, b: any) => b.stargazers_count - a.stargazers_count,
109
+ );
110
+ }
111
+
112
+ if (section === "latestRepos") {
113
+ return getSortedResponse(
114
+ (a: any, b: any) =>
115
+ new Date(b.created_at).getTime() - new Date(a.created_at).getTime(),
116
+ );
117
+ }
118
+
119
+ return new Response(JSON.stringify([]), {
120
+ status: 400,
121
+ headers: corsHeaders,
122
+ });
123
+ }
124
+
125
+ return new Response("Not Found", {
126
+ status: 404,
127
+ headers: { "Access-Control-Allow-Origin": "*" },
128
+ });
129
+ },
130
+ });
tsconfig.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "compilerOptions": {
3
+ // Environment setup & latest features
4
+ "lib": ["ESNext"],
5
+ "target": "ESNext",
6
+ "module": "ESNext",
7
+ "moduleDetection": "force",
8
+ "jsx": "react-jsx",
9
+ "allowJs": true,
10
+
11
+ // Bundler mode
12
+ "moduleResolution": "bundler",
13
+ "allowImportingTsExtensions": true,
14
+ "verbatimModuleSyntax": true,
15
+ "noEmit": true,
16
+
17
+ // Best practices
18
+ "strict": true,
19
+ "skipLibCheck": true,
20
+ "noFallthroughCasesInSwitch": true,
21
+ "noUncheckedIndexedAccess": true,
22
+
23
+ // Some stricter flags (disabled by default)
24
+ "noUnusedLocals": false,
25
+ "noUnusedParameters": false,
26
+ "noPropertyAccessFromIndexSignature": false
27
+ }
28
+ }