{"id":13394530,"url":"https://github.com/mohebifar/konsul","last_synced_at":"2025-04-04T12:10:29.892Z","repository":{"id":16098936,"uuid":"78808986","full_name":"mohebifar/konsul","owner":"mohebifar","description":"A react renderer for browser's dev console","archived":false,"fork":false,"pushed_at":"2022-12-06T23:15:03.000Z","size":3705,"stargazers_count":617,"open_issues_count":17,"forks_count":27,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-04-14T13:15:52.126Z","etag":null,"topics":["browser","console","devtools","react"],"latest_commit_sha":null,"homepage":"https://mohebifar.github.io/konsul/","language":"JavaScript","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/mohebifar.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}},"created_at":"2017-01-13T02:50:21.000Z","updated_at":"2024-03-27T01:23:01.000Z","dependencies_parsed_at":"2023-01-14T00:30:25.462Z","dependency_job_id":null,"html_url":"https://github.com/mohebifar/konsul","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohebifar%2Fkonsul","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohebifar%2Fkonsul/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohebifar%2Fkonsul/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohebifar%2Fkonsul/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mohebifar","download_url":"https://codeload.github.com/mohebifar/konsul/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247174456,"owners_count":20896078,"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":["browser","console","devtools","react"],"created_at":"2024-07-30T17:01:22.773Z","updated_at":"2025-04-04T12:10:29.875Z","avatar_url":"https://github.com/mohebifar.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Web (+ NW \u0026 Electron)","Index","📦 Legacy \u0026 Inactive Projects"],"sub_categories":["Chrome Dev Tools"],"readme":"![Konsul Logo](konsul-logo.png)\n\n**Konsul** is an abstraction of the browser's `console` that comes with a React renderer. It offers text styling, images, style inheritance, buttons with click interaction, etc. inside the browsers dev console.\n\n[See the live demo here](https://mohebifar.github.io/konsul/)\n\n[![Travis](https://img.shields.io/travis/rust-lang/rust.svg)]()\n[![npm](https://img.shields.io/npm/v/konsul.svg)]()\n[![js-semistandard-style](https://img.shields.io/badge/code%20style-semistandard-brightgreen.svg)](https://github.com/Flet/semistandard)\n\n# Usage\n## With react\nInstall `konsul` and `react-konsul` using npm:\n\n```\nnpm install konsul react-konsul react\n```\n\nThe following code demonstrates how you can use konsul with react.\n\n```js\nimport createKonsul from 'konsul';\nimport renderToKonsul from 'react-konsul';\n\n// Create an instance of konsul\nconst konsul = createKonsul();\n\n// Render react elements to the browser console!\nrenderToKonsul(\u003ctext style={{ color: 'red', fontWeight: 'bold' }}\u003eHello world!\u003c/text\u003e, konsul);\n```\n\nThis is what the result will look like:\n\n![Konsul \"Hello world\" example](konsul-screenshot.jpg)\n\n[See more examples here](https://github.com/mohebifar/konsul/tree/master/examples/src) with the [live demo](https://mohebifar.github.io/konsul/).\n\n## React element types\n### `text`\nThis node is the only node type that accepts `string`s and `number`s as children.\n\n| Prop | Type | Description |\n| --- | --- | --- |\n| style | [`TextStyle`](https://github.com/mohebifar/konsul/blob/master/src/types/styles.js#L13) | A plain javascript object whose keys are camel cased property names with their property value. |\n| children | `(Text|string|number)[]` | Only `Text`s, `string`s and `number`s are accepted as a Text's children |\n\n### `image`\nA Konsul node for displaying images from a url.\n\n| Prop | Type | Description |\n| --- | --- | --- |\n| style | [`ImageStyle`](https://github.com/mohebifar/konsul/blob/master/src/types/styles.js#L20) | A plain javascript object whose keys are camel cased property names with their property value. |\n| source | `string` | The URL of the image. |\n\n### `button`\nAn interactive node that responds to clicks. **Note that it only works on chrome for now.**\n\n| Prop | Type | Description |\n| --- | --- | --- |\n| onClick | `function` | Called when the user clicks on the element. |\n| label | `string` | The label of the button. It will replace all the characters that are not acceptable for the name of a function with `_`. |\n\n### `group`\nAll the children of a Group element will be wrapped inside `console.group`.\n\n| Prop | Type | Description |\n| --- | --- | --- |\n| children | `Node[]` | All kind of elements except `string`s and `number`s are accepted. |\n\n### `container`\nThis node has no specific behaviour. It works as a container and renders all its children.\n\n\n| Prop | Type | Description |\n| --- | --- | --- |\n| children | `Node[]` | All kind of elements except `string`s and `number`s are accepted. |\n\n## Without react\nInstall `konsul` via npm:\n\n```\nnpm install konsul\n```\n\nThe following code is the previous example but without react:\n\n```js\nimport createKonsul from 'konsul';\n\n// Create an instance of konsul\nconst konsul = createKonsul();\n\n// Create a text\nconst text = konsul.text({\n  style: {\n    color: 'red',\n    fontWeight: 'bold'\n  }\n});\n\n// Append a text to the text element\ntext.append('Hello world!');\n\n// Append the text element to konsul\nkonsul.append(text);\n\n// Render to console. The subsequent renders will occur automatically for example by updating the style or children.\nkonsul.render();\n```\n\n# License\nReleased under the [MIT License](https://mohebifar.mit-license.org/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmohebifar%2Fkonsul","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmohebifar%2Fkonsul","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmohebifar%2Fkonsul/lists"}