GithubHelp home page GithubHelp logo

beforesemicolon / cwco Goto Github PK

View Code? Open in Web Editor NEW
57.0 2.0 0.0 1.33 MB

Powerful and Fast Web Component Library with a Simple API

Home Page: https://cwco.beforesemicolon.com/

License: MIT License

JavaScript 0.09% TypeScript 99.91%
webcomponents web-components typescript javascript components components-library components-framework webapp html css

cwco's Introduction

CWCO

CWCO Banner

website npm license sponsor

node version Build Build

Contextfull Web Component Library created to improve native Web Component APIs user experience with:

  • ✅ No Build Required (Plug and Play)!
  • ✅ Works with other library and frameworks like React, Angular, Vue, Svelte, etc;
  • ✅ Truly Reactive Template
  • ✅ Powerful built-in Directives(including ability to create your own)
  • ✅ Built-in Context Data Handling
  • ✅ Event and Data Binding in HTML and CSS
  • ✅ Build view directly in HTML file
  • ✅ Simple API
  • ✅ Fast rendering
  • ✅ Lightweight package

Documentation (cwco.beforesemicolon.com)

Install

This module can be used directly in the browser as well in Node environment. You can even use it along with other web libraries and frameworks like React and Angular.

Browser

<!-- use the latest version -->
<script src="https://unpkg.com/cwco/dist/cwco.min.js"></script>

<!-- use a specific version -->
<script src="https://unpkg.com/[email protected]/dist/cwco.min.js"></script>

<!-- link your app script after -->
<script src="app.js"></script>

NodeJs

npm install cwco

You can then import the constructors class according to what you are building.

const { WebComponent, ContextProviderComponent, Directive } = require('cwco');

Code Editors & IDEs

CWCO is just HTML and if you want syntax highlighting for VSCode you can use the inline-html

VSCode

For syntax highlighting of HTML and CSS in javascript use inline-html or lit-html plugins.

You can import html from cwco which is just a help for VSCode which does nothing special to the HTML string you use it with.

import {html, css, WebComponent} from "./cwco";

class MyButton extends WebComponent {
  get template() {
    return html`<button><slot></slot></button>`
  }
  
  get stylesheet() {
    return css`<style>button {color: #222}</style>`
    // or 
    // return css`button {color: #222}`
  }
}

Jet Brain IDEs

These IDEs have built-in HTML-in-Javascript syntax highlighting which can be useful when developing CWCO web components.

Want to Help?

Learn How

cwco's People

Contributors

dependabot[bot] avatar dym-sh avatar ecorreia45 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cwco's Issues

handle function calls in directives

The following can be too much for template:

<li repeat="app.todos.filter(todo => app.searchTerm.length >= 3 ? todo.title.toLowerCase().search(app.searchTerm) >= 0 : true)"
></li>

This should be able to be formatted to

<li repeat="getSearchMatchedList(app.todos)"></li>

Right now the directive don't handle function calls as value, like the on* attributes do

The pattern attribute may contain syntax that does not work with data binding syntax

The following will break the component

<input type="password" id="pwd" name="pwd"
  pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}"
  title="Must contain at least one  number and one uppercase and lowercase letter, and at least 8 or more characters">

This is because it tries to resolve {8,} thinking its a data binding.

We need a way to handle such cases when we have regex or something similar.

wrongly calculated `current-tab-indicator` offset in firefox

Describe the bug
most likely, offset of current-tab-indicator is calculated from absolute position of current-tab,
which means it's parent (or parent's parent) element needs position:relative

To Reproduce
Steps to reproduce the behavior:

  1. Open https://beforesemicolon.github.io/cwco/?example=create-component.html&theme=neo&file=app.js in Firefox
  2. See the problem:
    before

Expected behavior
offset should be calculated from relative position of current-tab element, like this:
after

Desktop (please complete the following information):

  • OS: any
  • Browser: Firefox
  • Version: latest

Additional context
fixed in #7

Create a VSCode plugin for HTML and CSS highlight for CWCO

The plugin does not need to exist inside this repo but anything to make it compatible can be done here.

Submission of a plugin will make the contributor part of the core development of CWCO.

Plugin name: cwco
Features:

  • support syntax highlight;
  • support the data binding syntax and mapping to the data in the class
  • auto detection of CWCO syntax in .html, .css, .ts, .js, .cjs and .mjs files

initial request: #15

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.