Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wibus-wee-ac/wc-lantern
Lantern for Web Components
https://github.com/wibus-wee-ac/wc-lantern
Last synced: about 1 month ago
JSON representation
Lantern for Web Components
- Host: GitHub
- URL: https://github.com/wibus-wee-ac/wc-lantern
- Owner: wibus-wee-ac
- License: mit
- Created: 2022-01-31T03:33:03.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-22T21:28:06.000Z (almost 2 years ago)
- Last Synced: 2024-12-12T02:18:33.332Z (about 1 month ago)
- Language: TypeScript
- Homepage:
- Size: 48.8 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Lantern for Web Components
[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/element/wibus-wee/lantern-element) [![npm](https://img.shields.io/npm/v/wc-lantern)](https://www.npmjs.com/package/wc-lantern)
![npm bundle size](https://img.shields.io/bundlephobia/minzip/wc-lantern)
![jsDelivr hits (npm)](https://img.shields.io/jsdelivr/npm/hy/wc-lantern)> ~~Learn from [从零开始写一个 Web Component - GitHub Corners | 云游君的小站](https://www.yunyoujun.cn/posts/how-to-write-a-web-component/)~~
A web component by ~~[lit](https://github.com/lit/lit)~~ [jwc.js](https://jwc.js.org/)
The final product is an ES module, and it can be used alone.
> Anywhere like Vanilla JS / Vue / React / Angular / Svelte ...
## Usage
```bash
npm i wc-lantern
```### By CDN
See [demo/index.html](https://github.com/wibus-wee/wc-lantern/blob/main/demo/index.html)
```html
```
### By NPM
```ts
// main.ts
import "wc-lantern"
``````html
```
## API
### Example
```html
```
### `src/index.ts`:
#### class: `LanternElement`
##### Superclass
| Name | Module | Package |
| ------------ | ------ | ------- |
| `JwcComponent` | | jwcjs |##### Fields
| Name | Privacy | Type | Default | Description | Inherited From |
| --------------- | ------- | --------- | --------- | --------------------------------------------------------------------------------------------- | -------------- |
| `text` | | `string` | `'春,节'` | The text on lantern,use \`,\` to divide the text | |
| `number` | | `number` | `2` | The number of lanterns returned, up to 2 | |
| `displayMobile` | | `boolean` | `false` | display on moblie (very not recommended) | |
| `disPlayBoth` | | `boolean` | `false` | Whether to display left or right; otherwise, the output will be based on the 'position' field | |
| `position` | | `string` | `'right'` | The position of the lantern, left or right | |
## Author
wc-lantern © Wibus, Released under the MIT License.
> [Personal Website](http://iucky.cn/) · [Blog](https://blog.iucky.cn/) · GitHub [@wibus-wee](https://github.com/wibus-wee/) · Telegram [@wibus✪](https://t.me/wibus_wee)