Giter VIP home page Giter VIP logo

leva's People

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

leva's Issues

Text input: remove :active state

The :active state is confusing in a text input, it makes it look like a button. It should be removed.

Screen_Recording_2021-02-01_at_12.03.55.mov

useTwixSettings

More complex use cases might need complex settings/configuration, we can use a hook that can be called multiple times - ideally one - and settings are merged:

useTwixSettings({ container: ref, theme: "red-hot", onChange: serialize })

Related to #17

Spring Controls

This control mixes a graph element with two+ sliders for spring parameters.

x

From Principle

  • Basic controls
  • Fix default settings

Proposal: make the "interval" API coherent with the "slider" one

Currently, the interval api looks like this

interval: { min: -10, max: 10, bounds: [-100, 100] },

While, the slider api looks like this

slider: { value: 0, min: -10, max: 10 },

It would make much more sense if the interval api would look like this

interval: { value: [-10, 10], min: -100, max: 100 },

where the value is actually the controlled value.

It is more coherent since the only thing that changes is that the value is now an array, the slider itself doesn't change.

I can make a PR if we decide to.

Positions

  • Point2D
  • Point3D
  • allow arrays
  • build UI

Rename

Rename in readme, exported API and examples

Header: consider new design

I made some mockups that solve some UX issues the header currently has:

Branding No branding No nothing

advantages:

  • the search becomes a secondary action, since most users wouldn't use it (if there are only a few inputs for example)
  • end users know it's draggable now
  • triangle is there to show that it can be collapsed and also uncollapsed if it starts already collapsed

Select

  • format as { key: value }
  • format as value[]

Proposal: render the UI conditionally

Sometimes, it is useful to show the pane conditionally, while everything works the same. In my case, I need to show the pane only to designers and not the client. I achieve this via a special url, and I have a check like

export const DEBUG = window.location.search.includes('?debug')

which check if ?debug is appended to the url.

WIth use-tweaks, we achieved this with a really dirty useTweaksOnDebug:

const getValuesFromTweaks = (...args: any[]) => {
  const obj = typeof args[0] === 'object' ? args[0] : args[1]

  const getEntries = (obj: any): any => {
    return Object.keys(obj).flatMap((k) => {
      const v = obj[k]

      if (v.type !== undefined) {
        if (v.type === 1) {
          // Folder
          return getEntries(v.schema)
        } else {
          // Button or Separator
          return []
        }
      } else {
        return [[k, v.value ?? v]] // array of tuple because of flatmap
      }
    })
  }

  return Object.fromEntries(getEntries(obj))
}

export const useTweaksOnDebug: typeof useTweaks = DEBUG ? useTweaks : getValuesFromTweaks

I don't know how the API of this would look like if we plan to remove the <Twix> component, any solution is appreciated.

Render fields conditionally

@gsimone implementation idea:

useControls({
   togglerino: true,
   myFielderino: {
       value: "theta",
       condition: (siblings, all) => siblings.togglerino
   }
})

TBD

Styling

  • root pane
  • folder
  • string
  • number
  • position
  • color
  • spring

Folder

  • allow for settings
  • expanded / collapsed

Color input: make it close on mouseout

Problem

When changing the color, it's kinda annoying that the color picker doesn't close by itself, rather you must click outside:

Screen_Recording_2021-02-01_at_12.13.44.mov

Desired solution

The color picker should close on mouseout after a 300-500ms timeout.

Number

  • min / max with slider
  • step
  • Slider by default #6
  • padding

Proposal: support collapsing the root and starting with the pane collapsed

Sometimes (when presenting to a client for example) it is useful to put the focus on the actual developed piece instead of the controls pane. In these situations, it's ideal if the whole pane starts collapsed, and only if a user wants, he can open it and interact with the controls.

This is also useful in situations where you have waaay to many properties that it covers the full span fo the window height, although this can be managed with subfolders:

Making fields controllable

We can do so in a rough, non-user-friendly way by just exporting setValueAtPath and letting the user figure out the current path. This works on the assumption that the type of user that needs this, would know what to do.

We can think of ways to make this a first class thing

react-colorful v5

Hi, sorry for bothering you, but I have news that might be helpful for this project:

react-colorful v5 was just released and it doesn't require importing CSS-file.
It means that you can remove all CSS code you copied from the original repo.
Just use the CSS-in-JS solution of your choice to override the styles you need.

https://github.com/omgovich/react-colorful/releases

Serialization & persistance

Users should be able to persist changes or to serialize and saved them

@emmelleppi started doing work for this in use-tweaks

I think this one will be way easier since we can just serialize, unserialize the whole store. Thoughts? @dbismut

Slider by default with precision cursor

All numeric inputs should be slider by default like figma.

When a user hovers the field label, show a ew-resize cursor and allow drag to change the value
scro

Related #2

  • Precision cursor

Slider: make it narrower

I don't know why but it felt better than when it was narrower, it felt more precise.

Screen.Recording.2021-02-01.at.12.36.41.mov

Bug in the video at 0:09 when I click on the other end of the slider, the slider rectangle doesn't go where I clicked, but rater a bit on the left.

Palette

image
image

From Kepler.gl by Über

Interval

Ability to drag minimum and maximum edges for bounds.

  • basic controls
  • better styling

Fix scroll

When the panels are higher than the window, bad stuff happens. We should handle scroll inside the pane itself

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.