Coder Social home page Coder Social logo

freeshineit / web-components Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 1013 KB

lit web components

Home Page: https://freeshineit.github.io/web-components/

License: MIT License

TypeScript 19.43% HTML 9.23% JavaScript 66.21% Shell 0.35% SCSS 4.77%
lit typescript web-component web-components web-component-starter web-components-library web-components-template lit-html sass

web-components's Introduction

Web Components

build Download Version License

Web Components 是一套不同的技术,允许您创建可重用的定制元素(它们的功能封装在您的代码之外)并且在您的 web 应用中使用它们。

Scripts

# development
yarn run dev

# production
yarn run build

# build document
# https://github.com/http-party/http-server
# version >= 14
yarn run build:doc
cd docs && http-server -p 8080 .

Use

yarn install @skax/web-components

component

wc-input, wc-button, wc-list

html

<!-- script -->
<script src="./lib/bundle/@skax/web-components.umd.js"></script>

<form action="/get" name="form">
  <label for="name">
    <wc-input type="text" name="name" id="name" placeholder="input name"></wc-input>
  </label>
  <label for="password">
    <wc-input type="password" name="password" id="password" placeholder="input password"></wc-input>
  </label>
  <wc-button type="submit">Submit</wc-button>
  <wc-button type="rest">Rest</wc-button>
</form>

react

import '@skax/web-components'
// import '@skax/web-components/es/button'

function App() {
  return <wc-button>Button</wc-button>;
}

如果使用了 typescript,在 react-app-env.d.ts中添加下面声明。

/// <reference types="@skax/web-components" />

export declare global {
  namespace JSX {
    interface IntrinsicElements {
      "wc-button": WCButtonElement;
      "wc-input": WCInputElement;
      "wc-list": WCListElement;
    }
  }
}

example

vue3

<script setup>
  import '@skax/web-components'
  // import '@skax/web-components/es/button'
</script>

<template>
  <wc-button>Button</wc-button>
</template>

example

web-components's People

Contributors

freeshineit avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.