{"id":16288675,"url":"https://github.com/matronator/mtrgen-template-editor","last_synced_at":"2026-01-16T04:58:28.497Z","repository":{"id":65663829,"uuid":"596814234","full_name":"matronator/mtrgen-template-editor","owner":"matronator","description":"Editor for MTRGen templates as a React component","archived":false,"fork":false,"pushed_at":"2024-09-23T23:41:15.000Z","size":667,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-17T14:03:23.489Z","etag":null,"topics":["mtrgen","react","react-component","react-components","reactjs","template-editor","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/matronator.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["matronator"],"patreon":"matronator","open_collective":null,"ko_fi":"matronator","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["https://www.paypal.me/matronator","https://www.blockchain.com/btc/address/35VRpVQaqFWjUCnVRpGineShz76QyYgSVg"]}},"created_at":"2023-02-03T01:20:53.000Z","updated_at":"2024-09-23T23:41:16.000Z","dependencies_parsed_at":"2023-11-15T23:25:41.305Z","dependency_job_id":"69bf4550-0208-4371-ab84-4faa36a0fb2e","html_url":"https://github.com/matronator/mtrgen-template-editor","commit_stats":{"total_commits":35,"total_committers":1,"mean_commits":35.0,"dds":0.0,"last_synced_commit":"ba5d1ab0a2235b05998d741e22c8721f2862dbc3"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matronator%2Fmtrgen-template-editor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matronator%2Fmtrgen-template-editor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matronator%2Fmtrgen-template-editor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matronator%2Fmtrgen-template-editor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matronator","download_url":"https://codeload.github.com/matronator/mtrgen-template-editor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244543717,"owners_count":20469550,"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":["mtrgen","react","react-component","react-components","reactjs","template-editor","typescript"],"created_at":"2024-10-10T19:49:04.302Z","updated_at":"2026-01-16T04:58:28.491Z","avatar_url":"https://github.com/matronator.png","language":"TypeScript","funding_links":["https://github.com/sponsors/matronator","https://patreon.com/matronator","https://ko-fi.com/matronator","https://www.paypal.me/matronator","https://www.blockchain.com/btc/address/35VRpVQaqFWjUCnVRpGineShz76QyYgSVg"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\r\n  \u003ca href=\"https://github.com/matronator/mtrgen-template-editor\" rel=\"noopener\"\u003e\r\n    \u003cimg width=200px height=200px src=\"https://github.com/matronator/mtrgen-template-editor/blob/main/.github/icon.png?raw=true\" alt=\"Project logo\"\u003e\r\n  \u003c/a\u003e\r\n\u003c/p\u003e\r\n\r\n\u003ch1 align=\"center\"\u003eMTRGen Template Editor\u003c/h1\u003e\r\n\r\n\u003cdiv align=\"center\"\u003e\r\n\r\n[![Status](https://img.shields.io/badge/status-active-success.svg)]()\r\n[![GitHub Issues](https://img.shields.io/github/issues/matronator/mtrgen-template-editor.svg)](https://github.com/matronator/mtrgen-template-editor/issues)\r\n[![GitHub Pull Requests](https://img.shields.io/github/issues-pr/matronator/mtrgen-template-editor.svg)](https://github.com/matronator/mtrgen-template-editor/pulls)\r\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](/LICENSE)\r\n\r\n\u003c/div\u003e\r\n\r\n---\r\n\r\n\u003cp align=\"center\"\u003e\r\n\r\n  Template editor for [MTRGen](https://github.com/matronator/mtrgen) as a React component.\r\n    \u003cbr\u003e \r\n\u003c/p\u003e\r\n\r\n## 📝 Table of Contents\r\n\r\n- [📝 Table of Contents](#-table-of-contents)\r\n- [🧐 About ](#-about-)\r\n- [🏁 Getting Started ](#-getting-started-)\r\n  - [Prerequisites](#prerequisites)\r\n  - [Installing](#installing)\r\n    - [With NPM or PNPM](#with-npm-or-pnpm)\r\n    - [With Yarn](#with-yarn)\r\n    - [With Bun](#with-bun)\r\n- [🎈 Usage ](#-usage-)\r\n  - [Interfaces](#interfaces)\r\n    - [`EditorProps`](#editorprops)\r\n    - [Template Schema Interfaces](#template-schema-interfaces)\r\n- [⛏️ Built Using ](#️-built-using-)\r\n- [✍️ Authors ](#️-authors-)\r\n- [🎧 Dev Soundtrack ](#-dev-soundtrack-)\r\n\r\n## 🧐 About \u003ca name = \"about\"\u003e\u003c/a\u003e\r\n\r\nReact component for editing JSON templates to be used by [MTRGen](https://github.com/matronator/mtrgen).\r\n\r\n## 🏁 Getting Started \u003ca name = \"getting_started\"\u003e\u003c/a\u003e\r\n\r\n### Prerequisites\r\n\r\nYou need to have NodeJS installed and use React in your project.\r\n\r\n### Installing\r\n\r\n#### With NPM or PNPM\r\n\r\n```\r\nnpm install mtrgen-template-editor\r\n```\r\n```\r\npnpm install mtrgen-template-editor\r\n```\r\n\r\n#### With Yarn\r\n\r\n```\r\nyarn add mtrgen-template-editor\r\n```\r\n\r\n#### With Bun\r\n```\r\nbun add mtrgen-template-editor\r\n```\r\n\r\n## 🎈 Usage \u003ca name=\"usage\"\u003e\u003c/a\u003e\r\n\r\n```jsx\r\n// Import the component\r\nimport { MTRGenTemplateEditor, Template } from \"mtrgen-template-editor\";\r\n\r\nfunction App() {\r\n    // Create a template object\r\n    const [template, setTemplate] = useState\u003cTemplate\u003e({\r\n        name: \"Template\",\r\n        path: \"path\",\r\n        filename: \"template\",\r\n        file: {}\r\n    });\r\n\r\n    return (\r\n        \u003cdiv className=\"App\"\u003e\r\n            {/* Use it */}\r\n            \u003cMTRGenTemplateEditor setTemplate={setTemplate} template={template} onTemplateChange={(temp) =\u003e setTemplate(temp) } /\u003e\r\n        \u003c/div\u003e\r\n    );\r\n}\r\n```\r\n\r\n### Interfaces\r\n\r\n#### `EditorProps`\r\n```ts\r\ninterface EditorProps {\r\n    template: Template; // The template object\r\n    onTemplateChange: (template: Template) =\u003e void; // Callback for when the template changes\r\n    setTemplate: Dispatch\u003cSetStateAction\u003cTemplate\u003e\u003e; // React hook for setting the template\r\n}\r\n```\r\n\r\n#### Template Schema Interfaces\r\n```ts\r\ninterface Template {\r\n    autoImport?: boolean;\r\n    file:        File;\r\n    filename:    string;\r\n    name:        string;\r\n    path:        string;\r\n}\r\n\r\ninterface File {\r\n    class?:     Class;\r\n    interface?: Interface;\r\n    namespace?: Namespace;\r\n    strict?:    boolean;\r\n    trait?:     Trait;\r\n    use?:       IndexedString[];\r\n}\r\n\r\ninterface Class {\r\n    comments?:   IndexedString[];\r\n    constants?:  Constant[];\r\n    extends?:    string;\r\n    implements?: IndexedString[];\r\n    methods?:    Method[];\r\n    modifier?:   Modifier;\r\n    name:        string;\r\n    props?:      Prop[];\r\n    traits?:     IndexedString[];\r\n}\r\n\r\ninterface Constant {\r\n    id:          number|string;\r\n    comments?:   IndexedString[];\r\n    name:        string;\r\n    value:       Value;\r\n    visibility?: Visibility;\r\n}\r\n\r\ntype Value = any[] | boolean | number | number | { [key: string]: any } | null | string;\r\n\r\ninterface Method {\r\n    id:          number|string;\r\n    body?:       IndexedString[];\r\n    comments?:   IndexedString[];\r\n    modifier?:   Modifier;\r\n    name:        string;\r\n    nullable?:   boolean;\r\n    params?:     Param[];\r\n    ref?:        boolean;\r\n    return?:     string;\r\n    static?:     boolean;\r\n    visibility?: Visibility;\r\n}\r\n\r\nenum Modifier {\r\n    Abstract = \"abstract\",\r\n    Final = \"final\",\r\n}\r\n\r\ninterface Param {\r\n    id:        number|string;\r\n    name:      string;\r\n    nullable?: boolean;\r\n    promoted?: boolean;\r\n    ref?:      boolean;\r\n    type?:     string;\r\n    value?:    Value;\r\n}\r\n\r\nenum Visibility {\r\n    Private = \"private\",\r\n    Protected = \"protected\",\r\n    Public = \"public\",\r\n}\r\n\r\ninterface Prop {\r\n    id:          number|string;\r\n    comments?:   IndexedString[];\r\n    getter?:     boolean;\r\n    init?:       boolean;\r\n    name:        string;\r\n    nullable?:   boolean;\r\n    setter?:     boolean;\r\n    static?:     boolean;\r\n    type?:       string;\r\n    value?:      Value;\r\n    visibility?: Visibility;\r\n}\r\n\r\ninterface Interface {\r\n    comments?:  IndexedString[];\r\n    constants?: Constant[];\r\n    extends?:   string;\r\n    methods?:   Method[];\r\n    name:       string;\r\n}\r\n\r\ninterface Namespace {\r\n    class?:     Class;\r\n    interface?: Interface;\r\n    name:       string;\r\n    trait?:     Trait;\r\n    use?:       IndexedString[];\r\n}\r\n\r\ninterface Trait {\r\n    comments?: IndexedString[];\r\n    methods?:  Method[];\r\n    name:      string;\r\n    props?:    Prop[];\r\n}\r\n\r\ninterface IndexedString {\r\n    id: number|string;\r\n    value: string;\r\n}\r\n```\r\n\r\n## ⛏️ Built Using \u003ca name = \"built_using\"\u003e\u003c/a\u003e\r\n\r\n- [pnpm](https://pnpm.io) - pnpm\r\n- [TypeScript](https://www.typescriptlang.org) - TypeScript\r\n- [React](https://reactjs.org) - React\r\n- [Bootstrap](https://getbootstrap.com) - Bootstrap\r\n- [React Bootstrap](https://react-bootstrap.github.io) - React Bootstrap\r\n\r\n## ✍️ Authors \u003ca name = \"authors\"\u003e\u003c/a\u003e\r\n\r\n- [@matronator](https://github.com/matronator) - Everything\r\n\r\n## 🎧 Dev Soundtrack \u003ca name = \"dev-soundtrack\"\u003e\u003c/a\u003e\r\n\r\nPackage was built while listening to:\r\n\r\n- [Bring Me The Horizon - There Is a Hell Believe Me I've Seen It. There Is a Heaven Let's Keep It a Secret.](https://www.youtube.com/watch?v=BpkDrTLk9K0)\r\n- [Suicide Silence - The Cleansing](https://www.youtube.com/watch?v=msM_4uznjAg)\r\n- [Blackout Podcast 75 - Black Sun Empire](https://soundcloud.com/blackoutmusicnl/blackout-podcast-75-black-sun-empire)\r\n- [Neonlight - 2 Hours #10YNL Special @ Fat Bemme x Boundless Beatz (11 - 10 - 2019)](https://soundcloud.com/neonlightmusic/10years-neonlight-2hours-special-fatbemme-11-10-2019)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatronator%2Fmtrgen-template-editor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatronator%2Fmtrgen-template-editor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatronator%2Fmtrgen-template-editor/lists"}