Giter VIP home page Giter VIP logo

element's Introduction

LUME

A toolkit that simplifies the creation of rich and interactive 2D or 3D experiences.

Home  ·  Documentation  ·  Examples  ·  Forum  ·  Chat  ·  Source

npm install lume

Features

LUME is composed of several packages that can be used individually, or together as a whole:

lume - HTML elements for rich graphics

HTML elements for easily defining rich and interactive 2D or 3D applications powered by CSS3D, WebGL, or a combination of both.

This package uses and re-exports features from the below packages.

@lume/element - System for defining HTML elements

This is a web component system that allows you to create new, fast, and performant HTML elements in a simple way. It provides the foundation for LUME's HTML elements, and a standard pattern for building new elements that extend the features of LUME.

element-behaviors - Mix functionalities onto HTML elements

This allows you to augment HTML elements with features called "behaviors" that are similar to custom elements: each behavior is defined as a class that has the same lifecycle methods as custom elements. The difference is that an unlimited number of behaviors can be associated with an element.

glas - WebGL engine written in AssemblyScript (WIP)

This is a WebGL engine with the consistent performance of WebAssembly, written in AssemblyScript (a TypeScript-to-WebAssembly compiler).

LUMECraft

LUMECraft is a collection of applications made with LUME, showing what LUME can do, and serving as forkable starting points for further customization.

first-person-shooter - First-person shooter game

A first-person shooter game foundation made with LUME, Solid.js, and Meteor.

Getting involved

There are various ways to get involved!

  • Visit the documentation and make something awesome!
  • Submit fixes or new features to any packages or the website! See the contributing guide.
  • Discuss LUME, get help, or help others in the forums or on our Discord chat server.

Status

tests

element's People

Contributors

trusktr 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  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  avatar  avatar  avatar  avatar  avatar  avatar

element's Issues

add `createEffect` method from the `lume`'s Element3D

this.createEffect() will make an effect that is conveniently stopped in disconnectedCallback. This is useful for creating effects in connectedCallback and then not having to use createRoot and disconnectedCallback to stop them.

Currently:

connectedCallback() {
  super.connectedCallback()
  
  createRoot(dispose => {
    this.dispose = dispose
    createEffect(() => {
      // ...
      onCleanup(() => {...})
    })
  })
}

disconnectedCallback() {
  super.disconnectedCallback()
  this.dispose()
}

Using this.createEffect:

connectedCallback() {
  super.connectedCallback()
  
  this.createEffect(() => {
    // ...
    onCleanup(() => {...})
  })
}

list @lume/cli as a peer dependency at a minimum required version

We need to list @lume/cli as a peer dependency of of @lume/element because @lume/element depends on a certain range of versions of @lume/cli for when it is time to build (with @lume/cli) an application that uses @lume/element with JSX templating. @lume/cli contains the build steps needed to compile the JSX into a form that works with @lume/element.

This isn't an issue if app code uses the html`...` template tag for templating, in which case the compilation of templates happens at runtime, and there's no hard version requirement for @lume/cli in that case.

update to latest solid (0.23)

  • update README on how TS users will import types using jsxImportSource in TS 4.1.1+
  • describe how props/attributes work

functional CSS

Make a simple abstraction that can take a piece of CSS, generate a stylesheet from it, and provide the end developer a function that can be called in order to pass values for CSS variables/properties.

Initial description of the idea is in postcss/postcss#476 (comment).

Basically given the following CSS,

.foo {
  --some-prop: 1px;
  /* ... styles that use var(--some-prop) ... */
}

we can implement some a tool on the JS side that automatically gives you a simple abstraction:

css = css`
  .foo {
    --some-prop: 1px;
    /* ... styles that use var(--some-prop) ... */
  }
`

// ... call this any time later to update the style's `--some-prop` variable ...
this.css.update({someProp: '10px'})

This will help pave the way towards using reactive variables within CSS styles in a performant way.

Another ideas is we can abstract it so that the css template tag can automatically perform the property update internally:

css = css`
  .foo {
    --some-prop: ${this.foo};
    /* ... styles that use var(--some-prop) ... */
  }
`

// ... call this any time later to update the style's `--some-prop` variable ...
this.foo = '10px'

where this.foo is a reactive property.

Or maybe we just auto-create reactive accessors:

css = css`
  .foo {
    --some-prop: 1px;
    /* ... styles that use var(--some-prop) ... */
  }
`

// ... call this any time later to update the style's `--some-prop` variable ...
this.css.someProp = '10px'

inject element's styles at the end of the ShadowRoot children

otherwise the following will fail if styles are prepended:

        template = html`
            <!-- Element styles are currently prepended here. -->

            <!-- import a lib, f.e. bootstrap. -->
            <link rel="stylesheet" href="./lib.css" />

            <!-- Because lib.css ends up *after* element styles, element styles do not override lib styles. -->
            <div class="lib-btn"></div>
        `

Current workaround is to define styleRoot where styles will be appended:

        #styleRoot = document.createElement('div')

        get styleRoot() {
            return this.#styleRoot
        }

        template = html`
            <!-- import a lib, f.e. bootstrap. -->
            <link rel="stylesheet" href="./lib.css" />
            
            <!-- Element styles are prepended here in the styleRoot. -->
            ${this.styleRoot}

            <!-- Styles work as expected, element styles overrode lib styles. -->
            <div class="lib-btn"></div>
        `

PR:

Live Demo "Using JSX and decorator syntax" throw error.

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.