Git Product home page Git Product logo

elm-semantic-dom's Introduction

elm-semantic-dom: Syntactic sugar for cooking with Elm VirtualDom

Why?

  1. The code you use to generate your Elm program's view doesn't need to look like HTML or SVG markup.
  2. The functions in elm-lang/html and elm-lang/svg are just wrappers for VirtualDom functions.
  3. There's no reason why you shouldn't build abstractions for view components directly on top of VirtualDom โ€” it gives you more flexibility.
  4. Because VirtualDom is intended for advanced use and customization, it's a bare-bones package without helpers that would make it's functionality easier to manipulate.
  5. So: I created a set of helper functions for working with VirtualDom and put them all in one package with semantically structured modules.
  6. The package is intended as an infrastructure for building higher level abstractions on top of VirtualDom, without the need to import Html or Svg.
  7. All functions in this package are designed to be used in the "pipeline" style, where data flows through a series of functions in an easily readable way, from top to bottom and left to right.
  8. Functions are also written to avoid unused arguments, with additional "custom" functions available for rarely-used cases.
  9. The idea behind my semantic naming schema is that the module name should always be used when invoking a function; it improves the readability and maintainability of Elm code, and you will never have to resolve errors due to conflicting function names from imported modules. So, when you import a module from this package, I recommend that you don't expose any function names. Then you can use Dom.Element.container and Dom.Keyed.container in the same module without overthinking it.
  10. I am aware that module naming scheme I chose conflicts with elm-lang/dom, which could be a problem but doesn't have to be. To avoid a compiler error when there is a need to manage DOM effects, I created danielnarey/elm-semantic-effects to wrap elm-lang/dom. When the two "dom" are not both listed as imports in the elm-package.json file, there is no compiler error, even if both packages are dependencies.
  11. Constructive suggestions are welcome!

Package Reference

View on GitHub

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.