{"id":13560399,"url":"https://github.com/webtides/element-js","last_synced_at":"2025-07-26T00:32:49.523Z","repository":{"id":40352901,"uuid":"260201364","full_name":"webtides/element-js","owner":"webtides","description":"Simple and lightweight base classes for web components with a beautiful API ","archived":false,"fork":false,"pushed_at":"2025-06-13T08:02:55.000Z","size":1534,"stargazers_count":27,"open_issues_count":19,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-07-17T07:46:00.438Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/webtides.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","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}},"created_at":"2020-04-30T12:08:55.000Z","updated_at":"2025-06-30T15:57:09.000Z","dependencies_parsed_at":"2024-02-20T16:41:42.551Z","dependency_job_id":"d79048dd-143b-40db-9f0d-b625fe0ba9f8","html_url":"https://github.com/webtides/element-js","commit_stats":null,"previous_names":[],"tags_count":42,"template":false,"template_full_name":null,"purl":"pkg:github/webtides/element-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webtides%2Felement-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webtides%2Felement-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webtides%2Felement-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webtides%2Felement-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webtides","download_url":"https://codeload.github.com/webtides/element-js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webtides%2Felement-js/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267093811,"owners_count":24034950,"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","status":"online","status_checked_at":"2025-07-25T02:00:09.625Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-08-01T13:00:43.322Z","updated_at":"2025-07-26T00:32:49.178Z","avatar_url":"https://github.com/webtides.png","language":"JavaScript","funding_links":[],"categories":["Libraries for building web components","Libraries"],"sub_categories":["Class Based"],"readme":"# element-js\n\nSimple and lightweight base classes for web components with a beautiful API. Dependency free.\n\n## Introduction\n\n`element-js` lets you write simple, declarative and beautiful web components without the boilerplate.\n\n## How to use\n\n#### Installation\n\ninstall `element-js`\n\n```sh\nnpm install --save @webtides/element-js\n```\n\n#### Use / Example Element\n\n`element-js` elements are plain ES6 classes (vanilla JS) with some nice mappings (eg. properties, watch, etc.).\n\n```javascript\n// Import from a CDN\n// import { BaseElement, defineElement } from 'https://unpkg.com/@webtides/element-js';\n// import { BaseElement, defineElement } from 'https://cdn.skypack.dev/@webtides/element-js';\n// or when installed via npm\nimport { BaseElement, defineElement, Store } from '@webtides/element-js';\n\nconst sharedDate = new Store({ date: Date.now() });\n\nclass ExampleElement extends BaseElement {\n    // normal public properties\n    greeting = 'Hello';\n    name = 'John';\n\n    // lifecycle hook\n    connected() {\n        this.greet();\n    }\n\n    // reactive attributes/properties\n    properties() {\n        return {\n            familyName: 'Doe',\n            sharedDate\n        };\n    }\n\n    // watchers for property changes\n    watch() {\n        return {\n            familyName: (newValue, oldValue) =\u003e {\n                console.log('familyName changed', newValue, oldValue);\n            }\n        };\n    }\n\n    // computed property\n    get computedMsg() {\n        return `${this.greeting} ${this.name} ${this.familyName} ${this.sharedDate.date}`;\n    }\n\n    // method\n    greet() {\n        alert('greeting: ' + this.computedMsg);\n    }\n}\ndefineElement('example-element', ExampleElement);\n```\n\nTo use this element, just import it and use it like any other HTML element\n\n```html\n\u003cscript type=\"module\" src=\"example-element.js\" /\u003e\n\u003cexample-element family-name=\"Smith\"\u003e\u003c/example-element\u003e\n```\n\n## Documentation\n\nFor detailed documentation see the [Docs](docs/README.md).\n\n## Contributing \u0026 Development\n\nFor contributions and development see [contributing docs](.github/CONTRIBUTING.md)\n\n## License\n\n`element-js` is open-sourced software licensed under the MIT [license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebtides%2Felement-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebtides%2Felement-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebtides%2Felement-js/lists"}