{"id":36954359,"url":"https://github.com/canvas-table/canvas-table","last_synced_at":"2026-01-13T13:00:06.767Z","repository":{"id":328046099,"uuid":"1114069158","full_name":"canvas-table/canvas-table","owner":"canvas-table","description":"HTMLで表を描画するためのカスタム要素","archived":false,"fork":false,"pushed_at":"2025-12-17T12:57:28.000Z","size":67,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-21T01:25:57.160Z","etag":null,"topics":["canvas","custom-element","datagrid","javascript","table","ui-component","virtual-scrolling","web-components"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/canvas-table.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-10T21:21:14.000Z","updated_at":"2025-12-17T12:56:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"af4c9da5-60c6-4f95-a0ae-6351971d8b0f","html_url":"https://github.com/canvas-table/canvas-table","commit_stats":null,"previous_names":["canvas-table/canvas-table"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/canvas-table/canvas-table","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canvas-table%2Fcanvas-table","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canvas-table%2Fcanvas-table/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canvas-table%2Fcanvas-table/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canvas-table%2Fcanvas-table/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/canvas-table","download_url":"https://codeload.github.com/canvas-table/canvas-table/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canvas-table%2Fcanvas-table/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28385798,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T12:01:30.995Z","status":"ssl_error","status_checked_at":"2026-01-13T12:00:09.625Z","response_time":56,"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","custom-element","datagrid","javascript","table","ui-component","virtual-scrolling","web-components"],"created_at":"2026-01-13T13:00:05.675Z","updated_at":"2026-01-13T13:00:06.736Z","avatar_url":"https://github.com/canvas-table.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Canvas Table Element\n\n## Overview\n\nThis project implements a custom HTML element `\u003ccanvas-table\u003e` using the Web Components API and Canvas API. It provides a high-performance table rendering solution with virtualization, scrollbars, and event handling. The table supports large datasets by only rendering visible cells, making it suitable for data grids or spreadsheet-like interfaces.\n\nThe code is licensed under the Apache License 2.0 and copyrighted by AKABANE Meifai in 2025.\n\n## Features\n\n- **Virtualization**: Efficiently renders only the visible portion of the table to handle large datasets.\n- **Scrollbars**: Custom horizontal and vertical scrollbars with drag, button, and wheel support.\n- **Event Handling**: Custom events for mouse interactions (e.g., `table-mouseover`, `table-click`) and scrolling (e.g., `table-scroll`).\n- **Customizable Rendering**: Supports custom cell drawing, text alignment based on data type (string, number, boolean), and multiline text.\n- **Model-Based Data**: Uses `CanvasTableModel` to manage headers, data, and configurations like scrollbar colors and widths.\n- **JSON Support**: Load data from JSON using `CanvasTableModel.fromJSON()`.\n\n## Installation\n\n1. Include the JavaScript file via jsDelivr CDN:\n   ```html\n   \u003cscript src=\"https://cdn.jsdelivr.net/gh/canvas-table/canvas-table@v1/HTMLCanvasTableElement.js\"\u003e\u003c/script\u003e\n   ```\n\n2. The custom element `\u003ccanvas-table\u003e` will be automatically defined via `customElements.define(\"canvas-table\", HTMLCanvasTableElement)`.\n\nNo external dependencies are required; it uses native browser APIs (Canvas, DOM, EventTarget, etc.).\n\n## Usage\n\n### Basic Example\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n    \u003cmeta charset=\"UTF-8\"\u003e\n    \u003ctitle\u003eCanvas Table Demo\u003c/title\u003e\n    \u003cscript src=\"https://cdn.jsdelivr.net/gh/canvas-table/canvas-table@v1/HTMLCanvasTableElement.js\"\u003e\u003c/script\u003e\n    \u003cstyle\u003e\n        canvas-table {\n            width: 800px;\n            height: 600px;\n            display: block;\n            border: 1px solid #ccc;\n        }\n    \u003c/style\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n    \u003ccanvas-table id=\"myTable\"\u003e\u003c/canvas-table\u003e\n    \u003cscript\u003e\n        const tableElement = document.getElementById('myTable');\n        const model = new CanvasTableModel(\n            ['Column 1', 'Column 2', 'Column 3'],  // Headers\n            [\n                ['Cell 1-1', 123, true],\n                ['Cell 2-1', 456, false],\n                // Add more rows...\n            ]\n        );\n        tableElement.table = model;\n\n        // Listen to events\n        model.addEventListener('table-click', (event) =\u003e {\n            console.log('Clicked cell:', event.addr);\n        });\n    \u003c/script\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n### Loading from JSON\n\n```javascript\nconst jsonData = '{\"header\": [\"Name\", \"Age\"], \"data\": [[\"Alice\", 30], [\"Bob\", 25]]}';\nconst model = CanvasTableModel.fromJSON(jsonData);\ntableElement.table = model;\n```\n\n### Customization\n\n- **Cell Sizes**: Override `getWidth(columnNo)` and `getHeight(rowNo)` in a subclass of `CanvasTableModel`.\n- **Drawing**: Extend `drawData(renderer, rowNo, columnNo)` to customize cell appearance (background, text, borders).\n- **Scrollbars**: Configure via model properties like `scrollbarWidth`, `scrollbarTrackColor`, etc.\n- **Events**: Attach listeners to the model for custom events like `table-scroll`, `table-mouseover`.\n\n## API Reference\n\n### CanvasTableModel\n\n- `constructor(header: string[], data: any[][])`\n- Properties: `offsetX`, `offsetY`, `hasHorizontalScrollbar`, `hasVerticalScrollbar`, etc.\n- Methods: `drawData`, `findCellAtPoint`, `virtualInit`\n\n### HTMLCanvasTableElement\n\n- `table`: Getter/setter for the model.\n- Events: Dispatched on the model (e.g., `table-attache`, `table-detache`).\n\n## Limitations\n\n- Fixed cell sizes by default (columns: 120px, rows: 30px).\n- No built-in editing; extend for interactivity.\n- Accessibility: Canvas-based, so add ARIA attributes if needed for screen readers.\n- Browser Support: Modern browsers with Canvas and Web Components support.\n\n## License\n\nLicensed under the Apache License, Version 2.0. See [LICENSE](http://www.apache.org/licenses/LICENSE-2.0) for details.\n\n## Author\n\nAKABANE Meifai (2025)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcanvas-table%2Fcanvas-table","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcanvas-table%2Fcanvas-table","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcanvas-table%2Fcanvas-table/lists"}