{"id":30024274,"url":"https://github.com/recordevolution/widget-switch","last_synced_at":"2026-02-04T01:45:27.003Z","repository":{"id":304832125,"uuid":"1020163940","full_name":"RecordEvolution/widget-switch","owner":"RecordEvolution","description":null,"archived":false,"fork":false,"pushed_at":"2026-01-15T15:56:07.000Z","size":883,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-15T19:18:12.989Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/RecordEvolution.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-07-15T12:43:44.000Z","updated_at":"2026-01-15T15:56:12.000Z","dependencies_parsed_at":"2025-09-21T11:18:49.677Z","dependency_job_id":"0f4c7026-84c3-4dfa-ad8e-0a13195af18c","html_url":"https://github.com/RecordEvolution/widget-switch","commit_stats":null,"previous_names":["recordevolution/widget-switch"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/RecordEvolution/widget-switch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RecordEvolution%2Fwidget-switch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RecordEvolution%2Fwidget-switch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RecordEvolution%2Fwidget-switch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RecordEvolution%2Fwidget-switch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RecordEvolution","download_url":"https://codeload.github.com/RecordEvolution/widget-switch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RecordEvolution%2Fwidget-switch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28487586,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T22:54:02.790Z","status":"ssl_error","status_checked_at":"2026-01-16T22:50:10.344Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2025-08-06T06:39:28.341Z","updated_at":"2026-01-16T23:26:58.365Z","avatar_url":"https://github.com/RecordEvolution.png","language":"TypeScript","readme":"# widget-switch\n\nIronFlock widget: A Lit 3.x web component that renders toggle switches using Material Design 3 components. Supports multiple switches with configurable state mapping and IoT device action triggers.\n\n![screenshot](thumbnail.png)\n\n## Installation\n\n```bash\nnpm i @record-evolution/widget-switch\n```\n\n**Peer Dependencies:** This widget requires `@material/web` to be available at runtime via import map or bundled separately.\n\n## Usage\n\n```html\n\u003cscript type=\"module\"\u003e\n    import '@record-evolution/widget-switch'\n\u003c/script\u003e\n\n\u003cwidget-switch-1.1.1\u003e\u003c/widget-switch-1.1.1\u003e\n```\n\n\u003e **Note:** The element tag includes the version number (e.g., `widget-switch-1.1.1`). This is replaced at build time via `@rollup/plugin-replace`.\n\n## Configuration\n\nThe widget accepts an `inputData` property with the following structure:\n\n```typescript\ninterface InputData {\n    title?: string\n    subTitle?: string\n    dataseries?: Array\u003c{\n        label?: string\n        value?: string\n        stateMap?: {\n            on: string // Value(s) representing ON state\n            off: string // Value(s) representing OFF state\n        }\n        actionDevice?: string\n        actionApp?: string\n        actionTopic?: string\n        styling?: {\n            labelColor?: string\n            valueColor?: string\n        }\n    }\u003e\n}\n```\n\n## State Mapping\n\nThe `stateMap` configuration determines how values are interpreted as ON/OFF states:\n\n**Exact values:**\n\n```json\n{ \"on\": \"true, 1, active\", \"off\": \"false, 0, inactive\" }\n```\n\n**Numeric comparisons:**\n\n```json\n{ \"on\": \"\u003e50\", \"off\": \"\u003c=50\" }\n{ \"on\": \"\u003e=100\", \"off\": \"\u003c100\" }\n```\n\nSupported operators: `\u003c`, `\u003c=`, `\u003e`, `\u003e=`\n\n## Action Events\n\nWhen a switch is toggled, the widget dispatches an `action-submit` custom event:\n\n```javascript\nelement.addEventListener('action-submit', (e) =\u003e {\n    console.log(e.detail)\n    // {\n    //   args: true/false,      // New switch state\n    //   actionApp: \"...\",      // Target app\n    //   actionDevice: \"...\",   // Target device ID\n    //   actionTopic: \"...\",    // Action topic to call\n    //   label: \"...\"           // Switch label\n    // }\n})\n```\n\n## Theming\n\nThe widget supports theming via CSS custom properties or the `theme` property:\n\n**CSS Custom Properties:**\n\n```css\nwidget-switch-1.1.1 {\n    --re-text-color: #333;\n    --re-tile-background-color: #fff;\n}\n```\n\n**Theme Object:**\n\n```javascript\nelement.theme = {\n    theme_name: 'dark',\n    theme_object: {\n        backgroundColor: '#1a1a1a',\n        title: {\n            textStyle: { color: '#fff' },\n            subtextStyle: { color: '#aaa' }\n        }\n    }\n}\n```\n\n## Development\n\n```bash\nnpm run start    # Dev server at localhost:8000/demo/\nnpm run build    # Production build to dist/\nnpm run types    # Regenerate TypeScript types from schema\nnpm run release  # Build, bump version, push to git with tag\n```\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frecordevolution%2Fwidget-switch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frecordevolution%2Fwidget-switch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frecordevolution%2Fwidget-switch/lists"}