📜 ⬆️ ⬇️

W3View - Javascript library for which HTML was created.

Yes, one more new library on JS, I want to share. Fidbek thirsty, anyone better than certainly positive constructive.


I’m programming since time immemorial, when the monitors were deep and big-bellied, and the servers could contend with the current phones. It was necessary to write in different languages ​​both front and back from GUI to SQL and back.


Javascript fascinated me even when it was used only to highlight the buttons (CSS was not always). The DOM API promised to make the user interface programming process easy and effortless, almost fun. I just saw a bright, beautiful future. Well, here it is.


DOM API - the most correct browser UI framework


You may disagree, but this is so, and I'm not going to treat anyone. Yes, I am well aware of its shortcomings, but the advantages outweigh. He is the fastest - mantras are powerless against it.


All that is missing (for me) for comfortable development is the possibility of creating
reusable modules with libraries of composite components. All our attempts to create such an opportunity give rise to radioactive monsters and bicycles with Angular wheels.
We want small and do a lot for this, but we get inconveniences and brakes.


You say - there are Web Components ...


Well, yes, there is, but unfortunately they are not modular, these technologies are good, but made for other purposes. For delivery - yes, not for layout.


In the process of developing a new YouTube, the guys had to create over 400 special Custom Elements. In principle - not so much for YouTube, only they all fell into the global scope. Agree - the lack of modularity is a problem.


W3View allows you to create reusable, modular component libraries.


And gives you complete control over what is happening, real, without dancing with tambourines. You have all the power of the DOM API in your hands and dubious concepts hang over you. You don't need to endure the ugly template language syntax, perverted JSX or spell data binding, you just have HTML, as it is, the way the creator intended it.


//   ! //   "hello-world" <div as="hello-world"> <h1 ref="content"></h1> <input ref="input" placeholder="type your name here"> <h1>Hello <span ref="name">Anonimous</span>!</h1> <script type="javascript"> this.ref.input.onkeydown = this.ref.input.onkeyup = function(e){ me.setData(me.ref.input.value); }; this.onSetData = function(data){ me.ref.name.innerText = data || 'Anonimous'; }; </script> </div> //   " hello-world" -    <div as="double-hello-world"> <hello-world>Hello first</hello-world> <hr> <hello-world>Hello second</hello-world> </div> 

When you plug a "double-hello-world" into the page, you will see the hello-world in action .
Here is another example, a little more complicated . So where is it without TodoMVC ? (everyone does, and I did).


In the examples, the component libraries are very small and built right into the page body, but you can load them as modules with dependency resolution on the fly, or connect a pre-formed JS bundle .
The bundle loads a little faster and can be minified.


W3View does not impose anything on you, it simply expands your possibilities.


You can apply any application structure, - MVC, MVP, MVVM or Flux. You can use all sorts of observers and dispatchers - everything your heart desires. You can design a business model completely independent of the rules imposed by the frameworks. You will not need to smear the UI update logic according to a pattern and express it in ineffable ways, wander around the workaround, tune, search for answers to strange questions (should this component be updated or not should?) And spend the night on
forums with huge community, so no god forbid not to miss the elusive and the only TRUTH. Without all of this you can live - true, you can.


Size does matter (whatever grandma says)



Finally


If you are interested in this thing - you can go to GitHub or install it via npm


 npm install -s w3view 

(both for free)


Probably there is still something to improve in W3View: connecting JS modules, for example, a loader for a webpack, you can probably optimize something. I will definitely do this a little later, or someone will help me (import-replacement all the same).


If you like or dislike what I have already done - feel free to
write comments, any suitable.


Thank.


')

Source: https://habr.com/ru/post/348258/


All Articles