{"id":19501243,"url":"https://github.com/acryps/page","last_synced_at":"2026-05-15T00:33:33.866Z","repository":{"id":187243640,"uuid":"676528660","full_name":"acryps/page","owner":"acryps","description":null,"archived":false,"fork":false,"pushed_at":"2024-06-05T11:22:34.000Z","size":97,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-01-08T10:14:30.725Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/acryps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-09T12:07:18.000Z","updated_at":"2024-06-05T11:22:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"7618b8bd-2bca-4368-97ce-388bd93031a1","html_url":"https://github.com/acryps/page","commit_stats":null,"previous_names":["acryps/page"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acryps%2Fpage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acryps%2Fpage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acryps%2Fpage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acryps%2Fpage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/acryps","download_url":"https://codeload.github.com/acryps/page/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240749037,"owners_count":19851392,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-11-10T22:12:00.999Z","updated_at":"2026-05-15T00:33:33.829Z","avatar_url":"https://github.com/acryps.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm version](https://badge.acryps.com/npm/@acryps%2Fpage)](http://badge.acryps.com/go/npm/@acryps%2Fpage)\n\n# @acryps/page TypeScript Frontend Component System\n\nSimple component system with integrated routing.\n\n## Setup\nYou\"ll need to enable jsx in your tsconfig\n\u003cpre\u003e{\n\t\"compileOnSave\": false,\n\t\"compilerOptions\": {\n\t\t\u003cb\u003e\"jsx\": \"react\",\n\t\t\"jsxFactory\": \"this.createElement\",\u003c/b\u003e\n\t\t....\n\t}\n}\u003c/pre\u003e\n\nCompile your client with `tsc` and `page compile`!\n```\ntsc \u0026\u0026 page compile\n```\n\n## Usage\nCreate a component by extending the component class\n\n``` tsx\nexport class ExampleComponent extends Component {\n\tconstructor() {\n\t\tsuper();\n\t}\n\n\trender() {\n\t\treturn \u003csection\u003e\n\t\t\tExample Component!\n\t\t\u003c/section\u003e;\n\t}\n}\n\nnew ExampleComponent().host(document.body);\n```\n\nLet\"s extends this by creating a recursive component\n\n``` tsx\nexport class ExampleRecursiveComponent extends Component {\n\tconstructor(private index: number) {\n\t\tsuper();\n\t}\n\n\trender() {\n\t\treturn \u003csection\u003e\n\t\t\tComponent {this.index}\n\n\t\t\t{index \u003e 0 \u0026\u0026 new ExampleRecursiveComponent(index - 1)}\n\t\t\u003c/section\u003e;\n\t}\n}\n\nnew ExampleRecursiveComponent(10).host(document.body);\n```\n\n## Router\npage has a built-in router\n``` tsx\nconst router = new PathRouter(PageComponent\n\t.route(\"/home\", HomeComponent),\n\t.route(\"/books\", BooksComponent\n\t\t.default(BookOverviewComponent)\n\t\t.route(\"/:id\", BookDetailComponent)\n\t)\n\t\n\t// will only be resolved and thus loaded when users access the /admin route\n\t// → your builder can do code splitting!\n\t.route(\"/admin\", () =\u003e import(\"./admin\").then(module =\u003e module.default))\n);\n\nclass PageComponent extends Component {\n\trender(child) {\n\t\treturn \u003cmain\u003e\n\t\t\t\u003cnav\u003eApp\u003c/nav\u003e\n\n\t\t\t{child}\n\t\t\u003c/main\u003e;\n\t}\n}\n\nclass HomeComponent extends Component {\n\trender() {\n\t\treturn \u003cp\u003eWelcome to my Book Store\u003c/p\u003e;\n\t}\n}\n\nclass BooksComponent extends Component {\n\trender(child) {\n\t\treturn \u003csection\u003e\n\t\t\t\u003ch1\u003eBooks!\u003c/h1\u003e\n\n\t\t\t{child}\n\t\t\u003c/section\u003e;\n\t}\n}\n\nclass BookOverviewComponent extends Component {\n\trender() {\n\t\treturn \u003cui-book-overview\u003e\n\t\t\t\u003cbutton ui-href=\"someid\"\u003eSome book!\u003c/button\u003e\n\t\t\t\u003cbutton ui-href=\"someid\"\u003eSome other book!\u003c/button\u003e\n\t\t\t\u003cbutton ui-href=\"someid\"\u003eAnother book!\u003c/button\u003e\n\t\t\u003c/ui-book-overview\u003e;\n\t}\n}\n\nclass BookDetailComponent extends Component {\n\tparameters: { id: string }\n\n\trender() {\n\t\treturn \u003cp\u003eBook with id {this.parameters.id}\u003c/p\u003e;\n\t}\n}\n\nrouter.host(document.body);\n```\n\n## Directives\nYou can create custom directives (attribute handlers).\n\n``` ts\nComponent.directives[\"epic-link\"] = (element, value, tag, attributes, content) =\u003e {\n\telement.onclick = () =\u003e {\n\t\tlocation.href = value;\n\t}\n}\n\nexport class ExampleComponent extends Component {\n\tconstructor() {\n\t\tsuper();\n\t}\n\n\trender() {\n\t\treturn \u003csection\u003e\n\t\t\tTest \u003ca epic-link=\"http://github.com/\"\u003eLink\u003c/a\u003e\n\t\t\u003c/section\u003e;\n\t}\n}\n\nnew ExampleComponent().host(document.body);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facryps%2Fpage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Facryps%2Fpage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facryps%2Fpage/lists"}