GithubHelp home page GithubHelp logo

ferrugemjs / library Goto Github PK

View Code? Open in Web Editor NEW
15.0 15.0 2.0 1.03 MB

A simple library, reactive, conventional and non-intrusive!

Home Page: http://ferrugemjs.github.io/home-page

License: MIT License

JavaScript 22.62% HTML 20.03% TypeScript 57.35%

library's People

Contributors

alexsad avatar ferrugemjs avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

library's Issues

set the viewmodel of a template

possibility to set/change the viewmodel of a template.
eg.

<template view-model="./other-model-view">
 <h1>Hey</h1>
</template>

css inline with style tag

support to tag style in template file.

<template args="$controller">
   <style>
       .my-style{
             color:red;
             ....
        }
    </style>
    ....
</template>

Command function into template

A way to call js functions into template
Motivation:
Call others functions like jq('.datapicker') or jq('.modal').modal .... from template after a event.
Proposal:

<command
  on-ateached
  on-leave-home.subscribe
  on-open-dor.once
>
    jq('.long.modal').modal('show');
</command>

Wold be equivalent to:

this.onAteached($param => jq('.long.modal').modal('show') );
this.onLeaveHome.subscribe($param => jq('.long.modal').modal('show') );
this.onOpenDor.once($param => jq('.long.modal').modal('show') );

support to content

support content:

   <template>
    .....
        <content></content> //the place of the content
    .....
  </template>

some "XML namespace" like support

Motivation:
To simplify the user when need to load other ui library. ex:

<ui:progress-bar></ui:progress-bar>

proposal:

<require from="vendor-ui as ui" type="namespace"></require> 

Changing lifecycle names

changing lifecycle names to:
connectedCallback to attached
disconnectedCallback to detached
shouldUpdateCallback to shouldRefresh or shouldUpdate
attributeChangedCallback to attributeChanged
refresh to update or refresh

GOTO 1.0

Gols to release 1.0:
-Issue #7 (resolved)
-Logo (resolved)
-A basic homepage with API, examples and tutorial (in progress).

refresh tag

Add a refresh tag.
eg.

  <refresh if="any-condition" prop1="teste" prop2="123" prop3="${this.name}"/>

equivalent to:

<script>
 if(any-condition){
   this.refresh({
    prop1:"teste",
    prop2:"123",
    prop3:this.name
   });
 }
</script>

get class name with expression

Actualy is not possible to change class name by a controller attibute.
And several css framework broken in this situaction eg.( .nav > .menu ) .
So its necessary a way to change the class name with a controller attribute
eg.

<template class="${'custom-class-css class_' + this.customClass}">
</template>

each into element

<for each="item in this.list">
   <li>${item.name}</li>
</for>
<li each="item in this.list">${item.name}</li>

Improve undifined method erro

Improve detection and log of errors when in:

  1. event.trigger, event.delegate events of basic html components.
  2. events of custom components.

Content tag não funcionando com texto.

exemplo:

my-comp.html

<template>
    <span>   <content></content>   </span>
</template>

usando

<my-comp>test</my-comp>

ele não mostra o texto como especificado na documentação.

Built in emit

A emit concept to as a alternative to document.dispatchEvent(new CustomEvent('type:evt', { bubles:true, detail:{} })) with same thing like this :
this.emit('type:evt', {});

conditional attribute

Actually we can do it with below code:
eg.

<input disabled="${(3 > 2 ? 'disable': null )}"/>

suggestion:

<input disabled.if="3 > 2"/>

Auto change detection

Scenario

Currently, the component instance needs to send an update to the render component, with refresh method, to warn it about changes in the state.

Proposal:
Use of proxy approach to avoid this coupling.

Eg. currently code

exampleMethod(){
   this.refresh({a:"A"});// this will warn component render about instance change 
} 

Eg. Proposal

exampleMethod(){
   this.a = "A"; // this will warn component render about instance change 
} 

support to directive

Add custom directive support with namespace.
eg.

<require from="custom-directive-color2hex as d"  type="directive"/>
...
<span  d:color="red"></span>

result

<span>#ff0000</span>

Props by constructor

Scenario

Currently any component props is passed as class instance attributes, thus there is no way to maintain private attributes protected.

Proposal:
Pass element props to constructor by parameters.
Eg.

<my-component a="123" b="321" />
export class MyComponent {
  constructor({a, b}){
     this.a = a;
     this.c = a + b;
  }
}

or

export function({a, b}) {
     this.a = a;
     this.c = a + b;
}

template without view-model

proposal:

<template view-model="false">
  <h1>Only a template!</h1>
</template>

motivation:
To use template which proposity is more simple for example with init-app.html or when there is only a compose of several others custom tags

eg.

<template view-model="false">
   <compose view="./header-system">
   <compose view="./body-system">
   <compose view="./footer-system">
</template>

other eg.

<template view-model="false">
   <h1>Simple Banner</h1>
    <img src="assets/img/logo.png">
</template>

component with object

Add creation of component with object as class or function
Eg.

export default {
	"desc":"default desc"
	,teste(){
		this.desc = "changed desc";
		this.refresh();
	}
	,connectedCallback(){
		this.desc = "changed by connected!";
	}
}

support to composition

Basic support to composition.
sintaxe:

<compose controller="teste/teste" view="teste/other-file"></compose>

support to promise as parameter of refresh

Add support to promise as parameter of refresh method
eg.

incrementeWithPromise(){
   let prom1 = new Promise(success => {
	setTimeout( _ => {
		success({inc:this.inc + 1000})
	},4000);
   });
  this
	.refresh(prom1)
	.then( rs => console.log(rs));
}

support to representation functions without view into template

support to representation functions/classes (without view) into template.
eg.

 export class DoCalc{
     value1:number;
     value2:number;
     result():number{
             return value1+value2;
     }
}
<require from="./do-calc" type="function">
<do-calc value1="1" value2="2"></do-calc>

one first html element in template

a better way to resolve template attributes
now:

<template class="static or expression">

proposal:

<template>
 <div class="static or expression" data-others-attr="123">
 </div>
</template>

result:

<div is="custom-comp" class="resolved"></div>

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.