{"id":23674030,"url":"https://github.com/farism/mint-canvas","last_synced_at":"2026-01-27T16:07:00.461Z","repository":{"id":191856500,"uuid":"685509115","full_name":"farism/mint-canvas","owner":"farism","description":"Canvas wrapper for Mint lang","archived":false,"fork":false,"pushed_at":"2023-09-22T08:16:45.000Z","size":257,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-21T10:49:17.532Z","etag":null,"topics":["canvas","mint","mint-lang"],"latest_commit_sha":null,"homepage":"https://mint-canvas.netlify.app/","language":"Mint","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/farism.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-31T11:50:22.000Z","updated_at":"2023-09-11T08:31:57.000Z","dependencies_parsed_at":"2023-09-22T18:21:25.628Z","dependency_job_id":"9be5a727-d7d8-4b65-9e60-90e050e91578","html_url":"https://github.com/farism/mint-canvas","commit_stats":null,"previous_names":["farism/mint-canvas"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/farism/mint-canvas","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farism%2Fmint-canvas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farism%2Fmint-canvas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farism%2Fmint-canvas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farism%2Fmint-canvas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/farism","download_url":"https://codeload.github.com/farism/mint-canvas/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farism%2Fmint-canvas/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28816540,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T12:25:15.069Z","status":"ssl_error","status_checked_at":"2026-01-27T12:25:05.297Z","response_time":168,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["canvas","mint","mint-lang"],"created_at":"2024-12-29T12:59:10.825Z","updated_at":"2026-01-27T16:07:00.438Z","avatar_url":"https://github.com/farism.png","language":"Mint","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mint Canvas\n\n[Mint](https://mint-lang.com/) wrapper for browser Canvas APIs\n\n# Simple Example\n\nA simple example looks like this\n\n```mint\ncomponent Main {\n  fun componentDidMount {\n    case Dom.Canvas.fromDomElement(canvas) {\n      Maybe::Just(el) =\u003e\n        {\n          el\n          |\u003e Canvas.rect(10, 20, 150, 100)\n          |\u003e Canvas.fill\n\n          \"\"\n        }\n\n      Maybe::Nothing =\u003e\n        \"\"\n    }\n  }\n\n  fun render : Html {\n    \u003ccanvas as canvas/\u003e\n  }\n}\n```\n\n# [Demo Website](https://mint-canvas.netlify.app/)\n\nMost of the examples on MDN's [CanvasRenderingContext2D](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/) site have been ported to `mint-canvas` and can be viewed on the demo website.\n\n# [Demo Examples folder](/example/source/examples/)\n\nOr directly view the example source files.\n\n# Patterns\n\n## Chaining\n\nMost `Canvas` APIs return the passed in canvas `Dom.Canvas`. This allows you to chain calls with `|\u003e`.\n\n```mint\ncanvasEl\n|\u003e Canvas.beginPath\n|\u003e Canvas.setFillStyle(CanvasFillStyle::String(\"#ff6\"))\n|\u003e Canvas.fillRect(0, 0, dims.width, dims.height)\n|\u003e Canvas.beginPath\n|\u003e Canvas.setFillStyle(CanvasFillStyle::String(\"blue\"))\n|\u003e Canvas.moveTo(20, 20)\n|\u003e Canvas.lineTo(180, 20)\n|\u003e Canvas.lineTo(130, 130)\n|\u003e Canvas.closePath\n|\u003e Canvas.fill\n|\u003e Canvas.clearRect(10, 10, 120, 100)\n```\n\n## Setting properties\n\nInstance properties become setter functions. Introduces enums where it makes sense.\n\n```mint\ncanvasEl\n|\u003e Canvas.setLetterSpacing(10)\n|\u003e Canvas.setImageSmoothingQuality(CanvasImageSmoothingQuality::Low)\n```\n\n## Context2d\n\nAll APIs take `Dom.Canvas` as the first paramter. `getContext('2d')` is called under the hood.\n\n```mint\n/*\nAdds a rectangle to the current path.\n\nLike other methods that modify the current path, this method does not directly render anything. To draw the rectangle onto a canvas, you can use the `fill()` or `stroke()` methods.\n*/\nfun rect (\n  el : Dom.Canvas,\n  x : Number,\n  y : Number,\n  width : number,\n  height : number\n) : Dom.Canvas {\n  `#{el}.getContext('2d').rect(#{x}, #{y}, #{width}, #{height})`\n  el\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarism%2Fmint-canvas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffarism%2Fmint-canvas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarism%2Fmint-canvas/lists"}