{"id":25600615,"url":"https://github.com/johnfacey/drowjs","last_synced_at":"2025-02-21T15:27:11.171Z","repository":{"id":42142599,"uuid":"215133658","full_name":"johnfacey/drowjs","owner":"johnfacey","description":"Web Component Wrapper for creating HTML Custom Components","archived":false,"fork":false,"pushed_at":"2024-04-10T06:36:43.000Z","size":2124,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-21T02:45:43.608Z","etag":null,"topics":["component","component-based","component-library","html","javascript","nodejs","web-components"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/johnfacey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","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},"funding":{"github":"johnfacey","ko_fi":"johnfacey"}},"created_at":"2019-10-14T19:56:57.000Z","updated_at":"2022-02-13T01:05:21.000Z","dependencies_parsed_at":"2024-04-10T07:43:11.902Z","dependency_job_id":null,"html_url":"https://github.com/johnfacey/drowjs","commit_stats":{"total_commits":37,"total_committers":2,"mean_commits":18.5,"dds":"0.21621621621621623","last_synced_commit":"42070bca51819dd6458603f6abc5e26ee736d96a"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnfacey%2Fdrowjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnfacey%2Fdrowjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnfacey%2Fdrowjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnfacey%2Fdrowjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnfacey","download_url":"https://codeload.github.com/johnfacey/drowjs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240038525,"owners_count":19738157,"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":["component","component-based","component-library","html","javascript","nodejs","web-components"],"created_at":"2025-02-21T15:27:10.287Z","updated_at":"2025-02-21T15:27:11.159Z","avatar_url":"https://github.com/johnfacey.png","language":"HTML","readme":"[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/johnfacey/drowjs)\n\n# Drow\n\nSimple Web Component Library for creating custom HTML Components.\n\u003cdiv style=\"clear:both;padding-bottom:10px\"\u003e\n\u003cp\u003e\n\u003cimg src=\"res/Drow-Setup.png\"\n     alt=\"Drow - Simple Web Component Library for creating custom HTML Components.\" /\u003e\n\u003c/p\u003e\n\u003c/div\u003e\n\n## Updates\n\nConverted object references to Drow and drow internal elements instead of DrowJS\n## Setup\n\nInclude the drow.js in an html file:\n\n```\n\u003cscript src=\"drow.js\"\u003e\u003c/script\u003e\n```\n\nOr as an NPM Module\n```\nimport Drow from 'drow';\n```\n\n## Define a Drow Component\n\nDefine a Drow Object to setup a componet:\n\nComponent needs to have a \u003cbr /\u003e\n- **name** : name of HTML Custom Component \u003cbr /\u003e\n- **props** : properties set on the Custom Component \u003cbr /\u003e\n- **template** : standard html template \u003cbr /\u003e\n- **init** : function() - optional\u003cbr /\u003e\n- **watch** : function(obj) - optional\u003cbr /\u003e\n- **templating** : You can now use handlebars/mustache style variables in templates there are applied by prop name \n    Ex: {{prop1}}\n\nHTML\n```\n\u003cmy-comp prop1=\"AAA\" prop2=\"BBB\"\u003e \u003c/my-comp\u003e\n```\nJavaScript \n```\nvar config = {\n    \"name\" : \"my-comp\",\n    \"props\": ['prop1','prop2'],\n    \"template\": `\u003cdiv\u003e\n                  \u003cdiv\u003eEvery time you click on timestamp it will update the time.\u003c/div\u003e\n            \u003cb\u003eClick for the timestamp\u003c/b\u003e\u003cdiv\u003e{{prop1}}\u003c/div\u003e\n            \u003c/div\u003e`,\n    \"init\" : function(config) {\n        let prop1 = this.getProp('prop1') ? this.getAttribute('prop1') : \"\";\n        //in the init this.getComp() is used to obtain the component\n\n      this.getComp().addEventListener('click', e =\u003e {\n\t\t\tthis.getComp().querySelector(\"b\").innerHTML = new Date();\n\t\t});\n    },\n    watch : function(attribute) {\n        if (attribute.name == 'name') { //in the watch this.comp is a reference to this component\n            attribute.comp.querySelector('b').innerHTML = `Hello, ${attribute.newValue}`;\n        }\n    }\n}\n\nDrowJS.register(config);\n\n```\n\n## Outline\n```\n//Define Component\n\u003cmy-comp title=\"Great Name\" link=\"https://something.com\"\u003e\n  \u003c!-- \n    Web Components must be in primary-secondary name separated by dash ie my-comp \n    Componets and other HTML elements in the comp will be automatically added to the {{bind}} of the components template.\n  --\u003e\n\u003c/my-comp\u003e\n\n//Template for Component\ntemplate = `\u003cdiv\u003e\n  \u003cdiv\u003eTitle: {{title}}\u003c/div\u003e\n  \u003cdiv\u003eLink: {{link}}\u003c/div\u003e\n\u003c/div\u003e`\n\n//Component Config\nvar myComp = {\n    \"name\" : \"my-comp\",\n    \"props\": ['title','link'],\n    \"template\": template,\n    \"init\" : function(config) {       //optional init    \n    },\n    watch : function(attribute) {    //optional watch -- hooks/useEffect\n    }\n}\n//Register Component\nDrowJS.register(myComp); //using the config created earlier\n```\n\n## Examples\n\nBasic Example:\n\n [Example 1](src/index.html)\n\n\n\n## Setup from npm\n\nFirst install dependencies:\n\n```\nnpm install\n```\n\nRun commands:\n```\nnpm run server\n```\n\n## Credits\n\nAuthor [johnfacey.dev](https://johnfacey.dev/)\n\nTwitter [twitter.com/johnfacey](https://twitter.com/johnfacey)\n\n","funding_links":["https://github.com/sponsors/johnfacey","https://ko-fi.com/johnfacey"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnfacey%2Fdrowjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnfacey%2Fdrowjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnfacey%2Fdrowjs/lists"}