Giter Site home page Giter Site logo

kitschpatrol / svelte-tweakpane-ui Goto Github PK

View Code? Open in Web Editor NEW
95.0 3.0 2.0 10.01 MB

A Svelte component library wrapping UI elements from Tweakpane, plus some additional functionality for convenience and flexibility.

Home Page: https:///kitschpatrol.com/svelte-tweakpane-ui

License: MIT License

JavaScript 1.05% HTML 0.08% Svelte 78.12% TypeScript 20.75%
svelte svelte-components tweakpane ui-components ui-library npm-package components components-library gui parameters

svelte-tweakpane-ui's Introduction

svelte-tweakpane-ui

Svelte Tweakpane UI Banner

NPM Package svelte-tweakpane-ui License: MIT MadeWithSvelte Documentation

Overview

๐ŸŽ›๏ธ Svelte Tweakpane UI wraps user-interface elements from the excellent Tweakpane library in a collection of 31 idiomatic, reactive, type-safe, carefully-crafted, and obsessively-documented Svelte components.

The library makes it easy to quickly and declaratively add knobs and dials to your projects using components that feel like they were made for Svelte. It also augments Tweakpane with a few extra features for your convenience and enjoyment.

The components should be useful for integrating controls and value monitoring in parametrically driven artworks, data visualizations, creative tools, simulations, etc.

Demo

Svelte Tweakpane UI quick demo

Documentation

Please see the documentation site for much more information:
https://kitschpatrol.com/svelte-tweakpane-ui

Quick start

  1. Add Svelte Tweakpane UI to your Svelte project:
npm install svelte-tweakpane-ui
  1. Import and use Tweakpane components in your .svelte files:
<script lang="ts">
  import { Button } from 'svelte-tweakpane-ui';
</script>

<Button on:click={() => alert('๐ŸŽ›๏ธ')} />

Components

Core

  • Binding
    Wraps the Tweakpane addBinding method.
  • Blade
    Wraps the Tweakpane addBlade method.
  • Folder
    Organize multiple controls into a collapsable folder.
  • Pane
    The root <Pane> component, used for organizing controls into a single group and controlling how and where the Tweakpane is displayed.
  • Separator
    A convenience component providing a subtle visual separator between controls, in the spirit of the HTML <hr> element.
  • TabGroup
    Contains a collection of <TabPage> components to be presented as a tabs.
  • TabPage
    Contains a collection of Tweakpane controls to be presented as a single group inside a <TabGroup> component.

Control

Monitor

  • FpsGraph
    A control for monitoring and graphing frame rates over time.
  • Monitor
    Wraps the Tweakpane monitor binding functionality for boolean, number, and string values.
  • Profiler
    Measure and visualize multiple quantities over time.
  • WaveformMonitor
    Visualize multiple numeric values as a waveform.

Extra

  • AutoObject
    Rapid-development component which automatically creates a set of Tweakpane controls for an arbitrary object.
  • AutoValue
    Rapid-development component which automatically creates a Tweakpane control for an arbitrary value.
  • Element
    A component for embedding arbitrary HTML elements into a pane.

Maintainers

@kitschpatrol

Contributing

Issues and pull requests are welcome.

License

MIT ยฉ Eric Mika


Note: This library is not to be confused with Karl Moore's svelte-tweakpane.

svelte-tweakpane-ui's People

Contributors

kitschpatrol 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

Watchers

 avatar  avatar  avatar

svelte-tweakpane-ui's Issues

Empty titles break dragging behavior

First of all, thank you for this amazing library!

Steps to reproduce:

<script lang="ts">
  import { Pane } from 'svelte-tweakpane-ui';
</script>

<!-- I've done this to avoid the default title that comes up -->
<Pane title='' position='draggable'>
  ...
</Pane>

When this is done the pane is no longer draggable.

Pane collapse/expand behavior not correct

Thanks for making this library!

I have a pane that I want to start in collapsed form, but I'm having trouble getting it to work.

If I do this, the pane starts open. I can click on it to collapse it. The div resizes to fit the Pane when it collapses and expands, as desired:

<div id="settings">
	<Pane title="More" position="inline" >
		<Text ...>
		<Text ...>
	</Pane>
</div>

If I do <Pane title="More" position="inline" expanded={false}>, then the Pane starts collapsed. When I click on it, it does not open. Weirdly, it does increase in width to accommodate the contents that would be visible if it actually opened.

Seems like it's possible this warning is related,

[vite-plugin-svelte] [...] +page.svelte:343:1 Unused CSS selector ".tp-rotv"

Thank you!

Plugin waveform integration shows large bundle size

On build, I get this:

.svelte-kit/output/client/_app/version.json                                                 0.03 kB โ”‚ gzip:   0.05 kB     
.svelte-kit/output/client/.vite/manifest.json                                               5.53 kB โ”‚ gzip:   0.81 kB     
.svelte-kit/output/client/_app/immutable/assets/App.CCahpbvf.css                            0.04 kB โ”‚ gzip:   0.06 kB     
.svelte-kit/output/client/_app/immutable/assets/4.BDLXB7HW.css                              0.13 kB โ”‚ gzip:   0.13 kB     
.svelte-kit/output/client/_app/immutable/assets/3.CAMqKQym.css                              0.13 kB โ”‚ gzip:   0.13 kB     

[... ~20 other entries below 5kB]

.svelte-kit/output/client/_app/immutable/chunks/scheduler.BDbv0bUs.js                       7.34 kB โ”‚ gzip:   3.01 kB     
.svelte-kit/output/client/_app/immutable/entry/start.B0_Jn7u1.js                           28.00 kB โ”‚ gzip:  11.21 kB     
.svelte-kit/output/client/_app/immutable/chunks/App.BQfPGA7d.js                           156.51 kB โ”‚ gzip:  47.69 kB     
.svelte-kit/output/client/_app/immutable/chunks/tweakpane-plugin-waveform.CqpbEbFB.js   1,851.88 kB โ”‚ gzip: 427.60 kB

(!) Some chunks are larger than 500 kB after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.

Notice the warning at the end, and the size of the last chunk.

Since I'm not even using the waveform plugin, and most of my other chunks are under 8kB, I'm really wondering what's happening there. Why is tree shaking not working for the waveform plugin? I don't even know if the error is from tweakpane itself or your otherwise fantastic library here.

Do you know what could be causing that?

Draggable Pane sticks to cursor when dragging operation is interrupted.

When you drag the draggable pane and, for example, Alt+Tab out of the browser window. Upon returning the pane will stick to the cursor even when the user isn't dragging (holding down LMB) anymore. This can be easily reproduced in the demo that is in the docs.

I've been digging through the InternalPaneDraggable.svelte code and I'm guessing this might be because of the "pointerup" event not firing upon stuff like Alt-Tabbing, this might be an easy fix by adding a "pointercancel" event listener as well that unbinds the move listener like the upListener would. I haven't tested that though.

Logarithmic scale for generic input

Hey! Awesome library!

I was looking into how to use a logarithmic scale for a slider, and realized it was more involved than listening to on:change and updating the value accordingly.

Do you have any pointers on how to do it?

AutoObject for List or RadioButtons

Thank you for your amazing work! I also tried to create a PR for this change, but I'm not able to do so easily ๐Ÿ˜ˆ

Is it simple to implement a special key:value for AutoObject in order to automatically create a List control (aka a Select) or a RadioGroup buttons?

For example, it could be implemented with:

myKey: ['alpha', 'beta']

Or with labels:

myKey: [{alpha:'AlphaLabel', beta:'BetaLabel'}]

Given that the Array is not checked as an input type in the AutoObject if statement, I think it is feasible. Thanks!

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.