{"id":33054393,"url":"https://github.com/Wildhoney/Standalone","last_synced_at":"2025-11-15T10:01:25.902Z","repository":{"id":57345238,"uuid":"55620680","full_name":"Wildhoney/Standalone","owner":"Wildhoney","description":"Create framework agnostic components that are truly reusable and interoperable with all the benefits of the React ecosystem – using the HTML5 custom elements API to extend HTML's vocabulary.","archived":false,"fork":false,"pushed_at":"2016-09-26T14:02:11.000Z","size":6807,"stargazers_count":207,"open_issues_count":4,"forks_count":9,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-09-14T04:30:22.153Z","etag":null,"topics":["components","custom-elements","react","reactjs","webcomponents"],"latest_commit_sha":null,"homepage":"http://react-standalone.herokuapp.com/","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/Wildhoney.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-06T16:05:52.000Z","updated_at":"2025-08-05T00:02:30.000Z","dependencies_parsed_at":"2022-08-26T08:40:51.954Z","dependency_job_id":null,"html_url":"https://github.com/Wildhoney/Standalone","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/Wildhoney/Standalone","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wildhoney%2FStandalone","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wildhoney%2FStandalone/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wildhoney%2FStandalone/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wildhoney%2FStandalone/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Wildhoney","download_url":"https://codeload.github.com/Wildhoney/Standalone/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wildhoney%2FStandalone/sbom","scorecard":{"id":151318,"data":{"date":"2025-08-11","repo":{"name":"github.com/Wildhoney/Standalone","commit":"04f377115689251a31d11911a8f2ec61f3ee478a"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 1/28 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 3 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-16T10:45:16.221Z","repository_id":57345238,"created_at":"2025-08-16T10:45:16.221Z","updated_at":"2025-08-16T10:45:16.221Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284538091,"owners_count":27022334,"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-11-15T02:00:06.050Z","response_time":57,"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":["components","custom-elements","react","reactjs","webcomponents"],"created_at":"2025-11-14T04:00:21.582Z","updated_at":"2025-11-15T10:01:25.892Z","avatar_url":"https://github.com/Wildhoney.png","language":"JavaScript","funding_links":[],"categories":["Libraries and Frameworks"],"sub_categories":["ReactJS"],"readme":"![React Standalone](media/logo.png)\n\n\u003e Create framework agnostic components that are truly reusable and interoperable with all the benefits of the React ecosystem \u0026ndash; using the HTML5 [custom elements API](https://www.w3.org/TR/custom-elements/) to extend HTML's vocabulary.\n\n![Travis](http://img.shields.io/travis/Wildhoney/Standalone.svg?style=flat-square)\n\u0026nbsp;\n![npm](http://img.shields.io/npm/v/react-standalone.svg?style=flat-square)\n\u0026nbsp;\n![License MIT](http://img.shields.io/badge/license-mit-lightgrey.svg?style=flat-square)\n\n* **npm:** `npm install react-standalone --save`\n\n## Table of Contents\n\n* [Getting Started](#getting-started)\n* [Handling Props](#handling-props)\n    * [Specifying a Schema](#specifying-a-schema)\n* [Component Events](#component-events)\n    * [Passing JSON Structure](#passing-json-structure)\n* [Element Methods](#element-methods)\n* [Extending Elements](#extending-elements)\n* [Browser Support](#browser-support)\n    \n---\n\n## Getting Started\n\nTake a look at the [`mars-weather` component](example/packages/mars-weather) for an idea on how to structure your reusable component \u0026ndash; however essentially a *component* consists of a tag name \u0026mdash; such as `mars-weather`, the React `component` and an [optional schema](#specifying-a-schema) using [`osom`](https://github.com/Kikobeats/osom).\n\n```javascript\nimport { createModule } from 'standalone';\nimport schema from './schema';\nimport component from './component';\n\nexport default createModule('mars-weather', { schema, component });\n\n```\n\nOnce you have created your package, a custom element will be created with the supplied `tagName` which can be embedded into the DOM \u0026ndash; all of the React lifecycle methods will be invoked, such as `componentWillUnmount` when the element has been removed from the DOM.\n\n```html\n\u003cmars-weather /\u003e\n```\n\nAs the `mars-weather` component is an entirely custom element, it can be embedded in **any** JavaScript framework \u0026mdash; Angular, Vue, React, Cycle, Ember, [Vanilla](http://vanilla-js.com/), etc...\n\n**Bonus:** Use [Keo with shadow boundaries](https://github.com/Wildhoney/Keo/blob/master/docs/SHADOW_DOM.md) for a true [Polymer-esque](https://www.polymer-project.org/1.0/) feel.\n\n## Handling Props\n\nBy specifying attributes on the custom element, the values of the attributes are passed into your component as props \u0026ndash; any changes to the `state` will be handled internally to your component, whereas any changes to your element's attributes will cause a re-render with the updated `props`.\n\nIn the `mars-weather` example, we have setup the `getDefaultProps` method to return the default props, however users can override the `unit` prop by passing in a [`data` attribute](http://html5doctor.com/html5-custom-data-attributes/) named `data-unit`.\n\n```html\n\u003cmars-weather data-unit=\"C\" /\u003e\n```\n\nIn the above case, the `data-unit` attribute will be transformed to `unit` \u0026mdash; as `Standalone` strips away any `data-` prefixes \u0026mdash; and then re-renders your component, allowing you to access the attribute as `this.props.unit`.\n\n### Specifying a Schema\n\nAs **all** HTML attributes are `string`s, `Standalone` allows you to specify a schema for your component, which will transform `string` attributes into the data type you expect using [`osom`](https://github.com/Kikobeats/osom).\n\n```javascript\nexport default {\n    unit: {\n        type: String,\n        default: 'F'\n    }\n};\n```\n\nOnce you have configured the schema to use for your component, you can happily setup the usual [React `propTypes`](https://facebook.github.io/react/docs/reusable-components.html) specifying the data type you're expecting to be passed through.\n\n## Component Events\n\nUsing [Custom Events](https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Creating_and_triggering_events) you can easily set-up a communication channel between your components and the outside world.\n\n```javascript\n// Instantiate `CustomEvent` and then specify the name of the event, followed\n// by the payload which will be passed to your listener function.\nconst event = new CustomEvent('migrate-planets', {\n    bubbles: true,\n    detail: {\n        planet: 'Saturn'\n    }\n});\n\nfindDOMNode(this).dispatchEvent(event);\n```\n\nIt's crucial that you emit the event as `bubbles: true` otherwise the event would simply halt at the `findDOMNode(this)` node rather than bubbling up to the `mars-weather` node \u0026mdash; unless you dispatch the event on the `mars-weather` node by using `findDOMNode(this).parentNode`.\n\nWithin your component you emit the event \u0026mdash; `CustomEvent` \u0026mdash; using `dispatchEvent` and then bind your custom element \u0026mdash; such as `mars-weather` \u0026mdash; using `addEventListener` from the outside.\n\n```javascript\nconst node = document.querySelector('mars-weather');\n\nnode.addEventListener('migrate-planets', event =\u003e {\n\n    // Update the `data-planet` attribute to reflect the newly migrated planet\n    // which will cause the component to re-render with the update prop.\n    node.setAttribute('data-planet', event.detail.planet);\n\n});\n```\n\n### Passing JSON Structure\n\nAs invoking `setAttribute` on your component causes React to re-render your component, it may be useful to supply a JSON payload to your component instead \u0026mdash; especially if you're defining a multitude of attributes; this also helps with performance as you would only need one `setAttribute` to update many props and re-render.\n\nBy defining a schema you can specify an attribute that will be parsed as JSON.\n\n```javascript\nexport default {\n    payload: {\n        type: JSON.parse\n    }\n}\n```\n\nAttaching a JSON string to your element's `data-payload` attribute will cause it to be parsed into an object using `JSON.parse`, and passed to your React component as `this.props.payload` which can be defined in the `propTypes` using `PropTypes.shape`.\n\n## Element Methods\n\nAll `Standalone` components extend `HTMLElement.prototype` and allow for adding custom functions to the element \u0026mdash; which you can invoke once you have a reference to the associated element. Take a look at [`mars-weather`'s methods](https://github.com/Wildhoney/Standalone/blob/master/example/packages/mars-weather/methods.js) for an example.\n\n```javascript\nconst getWeather = function() {\n    const weather = this.component.state.weather.atmoOpacity.toLowerCase();\n    return `The current weather on Mars is ${weather}!`;\n};\n\n// ...\n\ndocument.querySelector('mars-weather').getWeather();\n```\n\nWhen a component has been appended to the DOM it will update its `HTMLElement` prototype to assign the rendered component to `getPrototypeOf(this).component` \u0026mdash; this conveniently allows you to access the `props` and `state`, and invoke functions internal to the React component.\n\nIt's worth noting that `this.component` will **only** be available once the component has been appended to the DOM.\n\n## Extending Elements\n\nWith the Custom Elements API it is possible to extend existing elements \u0026ndash; using the `is` attribute to specialise. `Standalone` allows you to extend elements by passing the element to extend.\n\n```javascript\n// Creates a `mars-weather` element.\nexport default createModule('mars-weather', { schema, methods, component });\n\n// Creates a `input[is=\"mars-weather\"]` element.\nexport default createModule('input/mars-weather', { schema, methods, component });\n```\n\nIt's worth noting that when you extend a known element, your element will extend its prototype \u0026ndash; in the case above the `mars-weather` element will extend `input` and its `HTMLInputElement` prototype.\n\n## Browser Support\n\n* Chrome \u003e= v33\n* Opera \u003e= v20\n* *IE \u003e= 11\n* *Safari \u003e= 7\n* *Firefox\n\n_\\* Requires the excellent [webcomponents-lite.js](https://github.com/WebComponents/webcomponentsjs) polyfill (13K gzipped)_\n\n[![forthebadge](http://forthebadge.com/images/badges/built-with-love.svg)](http://forthebadge.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWildhoney%2FStandalone","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FWildhoney%2FStandalone","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWildhoney%2FStandalone/lists"}