{"id":29864433,"url":"https://github.com/lruihao/caniuse-embed-element","last_synced_at":"2026-04-08T10:01:31.699Z","repository":{"id":306025165,"uuid":"1024003625","full_name":"Lruihao/caniuse-embed-element","owner":"Lruihao","description":"A custom web component that embeds caniuse.com browser compatibility data for a specific feature.","archived":false,"fork":false,"pushed_at":"2026-03-02T03:02:41.000Z","size":592,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-02T04:28:46.701Z","etag":null,"topics":["caniuse","caniuse-embed","custom-elements","web-components"],"latest_commit_sha":null,"homepage":"https://caniuse-el.lruihao.cn/","language":"TypeScript","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/Lruihao.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-07-22T03:40:45.000Z","updated_at":"2026-03-02T03:02:45.000Z","dependencies_parsed_at":"2025-07-23T09:11:18.785Z","dependency_job_id":"9d608183-24da-4eb6-9acf-f1278fbbe628","html_url":"https://github.com/Lruihao/caniuse-embed-element","commit_stats":null,"previous_names":["lruihao/caniuse-embed-element"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/Lruihao/caniuse-embed-element","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lruihao%2Fcaniuse-embed-element","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lruihao%2Fcaniuse-embed-element/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lruihao%2Fcaniuse-embed-element/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lruihao%2Fcaniuse-embed-element/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lruihao","download_url":"https://codeload.github.com/Lruihao/caniuse-embed-element/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lruihao%2Fcaniuse-embed-element/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31549900,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T16:28:08.000Z","status":"online","status_checked_at":"2026-04-08T02:00:06.127Z","response_time":54,"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":["caniuse","caniuse-embed","custom-elements","web-components"],"created_at":"2025-07-30T08:15:57.787Z","updated_at":"2026-04-08T10:01:31.648Z","avatar_url":"https://github.com/Lruihao.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `\u003ccaniuse-embed\u003e` Element\n\n[![npm version](https://img.shields.io/npm/v/@cell-x/caniuse-embed-element.svg)](https://www.npmjs.com/package/@cell-x/caniuse-embed-element)\n[![License](https://img.shields.io/npm/l/%40cell-x%2Fcaniuse-embed-element.svg)](https://github.com/Lruihao/caniuse-embed-element/blob/main/LICENSE)\n\nEnglish | [简体中文](./README.zh-cn.md)\n\nA lightweight, customizable web component that embeds [caniuse.com](https://caniuse.com) browser compatibility data for specific web features. Built with [Lit](https://lit.dev/) and designed to seamlessly integrate into any web project.\n\n[🌟 **Live Demo**](https://caniuse-el.lruihao.cn)\n\n![caniuse example](./preview/caniuse.webp)\n\n![baseline example](./preview/baseline.png)\n\n## ✨ Features\n\n- 🎯 **Easy Integration**: Drop-in web component that works with any framework or vanilla HTML\n- 🎨 **Theme Support**: Auto, light, and dark themes that adapt to your design\n- 📱 **Responsive**: Automatically adjusts height based on content\n- ⚡ **Lightweight**: Built with Lit for minimal bundle size\n- 🛠️ **Customizable**: Configure data source, time range, and appearance\n- 🔒 **Type Safe**: Full TypeScript support with comprehensive type definitions\n\n## 🚀 Quick Start\n\n### CDN (Recommended)\n\nAdd the script tag to your HTML:\n\n```html\n\u003cscript src=\"https://unpkg.com/@cell-x/caniuse-embed-element/dist/caniuse-embed-element.iife.js\"\u003e\u003c/script\u003e\n```\n\nThen use the component:\n\n```html\n\u003ccaniuse-embed feature=\"css-grid\"\u003e\u003c/caniuse-embed\u003e\n```\n\n### NPM Installation\n\n```bash\nnpm install @cell-x/caniuse-embed-element\n```\n\n```javascript\nimport '@cell-x/caniuse-embed-element'\n```\n\n## 📖 Usage Examples\n\n### Basic Usage\n\n```html\n\u003ccaniuse-embed feature=\"css-grid\"\u003e\u003c/caniuse-embed\u003e\n```\n\n### With Baseline Support\n\nDisplay browser compatibility baseline information for features:\n\n```html\n\u003ccaniuse-embed feature=\"css-grid\" baseline\u003e\u003c/caniuse-embed\u003e\n```\n\n### With Custom Configuration\n\n```html\n\u003ccaniuse-embed\n  feature=\"flexbox\"\n  theme=\"dark\"\n  past=\"3\"\n  future=\"2\"\n  baseline\n  origin=\"https://caniuse.lruihao.cn\"\n\u003e\u003c/caniuse-embed\u003e\n```\n\n### Framework Integration\n\nHere's an example using Vue.js. For more framework integration examples, see [FRAMEWORK_INTEGRATION.md](./FRAMEWORK_INTEGRATION.md).\n\n```vue\n\u003cscript setup\u003e\nimport '@cell-x/caniuse-embed-element'\n\u003c/script\u003e\n\n\u003ctemplate\u003e\n  \u003cdiv\u003e\n    \u003ccaniuse-embed\n      feature=\"css-grid\"\n      theme=\"dark\"\n      :past=\"3\"\n      :future=\"2\"\n    /\u003e\n  \u003c/div\u003e\n\u003c/template\u003e\n```\n\n## ⚙️ API Reference\n\n### Attributes/Properties\n\n| Attribute  | Type                          | Default                        | Description                                                                |\n| ---------- | ----------------------------- | ------------------------------ | -------------------------------------------------------------------------- |\n| `feature`  | `string`                      | `''`                           | **Required**. The caniuse feature identifier (e.g., 'css-grid', 'flexbox') |\n| `past`     | `0 - 5`                       | `2`                            | Number of past browser versions to display                                 |\n| `future`   | `0 - 3`                       | `1`                            | Number of future browser versions to display                               |\n| `baseline` | `boolean`                     | `false`                        | Show baseline browser compatibility status (when available)                |\n| `origin`   | `string`                      | `'https://caniuse.lruihao.cn'` | Base URL of the caniuse embed service                                      |\n| `theme`    | `'auto' \\| 'light' \\| 'dark'` | `'auto'`                       | Color theme for the embedded content                                       |\n| `loading`  | `'eager' \\| 'lazy'`           | `'lazy'`                       | Loading strategy for the iframe (eager or lazy)                            |\n| `meta`     | `string`                      | `auto-generated`               | Unique identifier for the embed instance                                   |\n\n### About Baseline\n\nThe `baseline` attribute displays the [Baseline](https://web.dev/baseline) browser compatibility status for web features. When enabled, it shows whether a feature is:\n\n- **Widely Available** - Supported across all major browsers\n- **Newly Available** - Recently became available in major browsers\n- **Limited Availability** - Not yet available in all major browsers\n\nThis provides a quick visual indicator of feature adoption and helps developers make informed decisions about using web platform features.\n\n### Finding Feature Names\n\nFeature names correspond to the identifiers used on [caniuse.com](https://caniuse.com). You can find them in:\n\n- The URL path: `https://caniuse.com/css-grid` → feature name is `css-grid`\n- The search results on [caniuse.lruihao.cn](https://caniuse.lruihao.cn/)\n- The [caniuse-db](https://github.com/Fyrd/caniuse/tree/master/features-json) repository\n\n### Common Feature Examples\n\n- `css-grid` - CSS Grid Layout\n- `flexbox` - Flexible Box Layout\n- `arrow-functions` - Arrow Functions\n- `webp` - WebP Image Format\n- `css-variables` - CSS Custom Properties\n- `async-functions` - Async/Await Functions\n- ...\n\n### CSS Classes\n\n- `.ciu-embed-iframe` - The embedded iframe element\n- `.ciu-embed-empty` - Empty state when no feature is specified\n\n## 🌐 Browser Support\n\nThis web component works in all modern browsers that support:\n\n- Custom Elements v1\n- Shadow DOM v1\n- ES2015+ features\n\n\u003c!--\nFor older browsers, consider using polyfills:\n\n```html\n\u003cscript src=\"https://unpkg.com/@webcomponents/webcomponentsjs@^2/webcomponents-loader.js\"\u003e\u003c/script\u003e\n```\n--\u003e\n\n## 🔧 Development\n\n### Prerequisites\n\n- Node.js 20+\n- pnpm 10+\n\n### Setup\n\n```bash\n# Clone the repository\ngit clone https://github.com/Lruihao/caniuse-embed-element.git\ncd caniuse-embed-element\n\n# Install dependencies\npnpm install\n\n# Start development server\npnpm dev\n```\n\n### Build\n\n```bash\n# Build all formats\npnpm build:all\n\n# Build specific formats\npnpm build:lib    # ES modules and types\npnpm build:iife   # IIFE for CDN usage\npnpm build        # Demo build\n```\n\n### Scripts\n\n- `pnpm dev` - Start development server\n- `pnpm build` - Build demo\n- `pnpm build:lib` - Build library (ES modules + types)\n- `pnpm build:iife` - Build IIFE bundle for CDN\n- `pnpm build:all` - Build all formats\n- `pnpm lint` - Run ESLint\n- `pnpm preview` - Preview built demo\n\n## 📦 Distribution\n\nThe package provides multiple build formats:\n\n- **ES Modules** (`dist/`) - For modern bundlers\n- **IIFE Bundle** (`dist/caniuse-embed-element.iife.js`) - For CDN usage\n- **TypeScript Definitions** (`dist/types/`) - For TypeScript projects\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## 📄 License\n\nThis project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.\n\n## 🙏 Acknowledgements\n\n- [pengzhanbo/caniuse-embed](https://github.com/pengzhanbo/caniuse-embed)\n- [mdn-browser-compat-data](https://github.com/mdn/browser-compat-data) - Comprehensive browser compatibility data from MDN\n- [Fyrd/caniuse](https://github.com/Fyrd/caniuse) - The raw browser support data\n\n---\n\nMade with ❤️ by [Lruihao](https://github.com/Lruihao)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flruihao%2Fcaniuse-embed-element","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flruihao%2Fcaniuse-embed-element","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flruihao%2Fcaniuse-embed-element/lists"}