GithubHelp home page GithubHelp logo

svelte-extras's People

Contributors

conduitry avatar fiskgrodan avatar rich-harris 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

svelte-extras's Issues

Suggestion: let Deep access methods accept array as key path

Think you have host-to-address map created with Object.create(null):

const store = new Store({
  hostToAddress: Object.create(null)
});

Now, you store IPv address of a domain. If setDeep method accepts an array as a key path:

import { setDeep } from 'svelte-extras';
setDeep.call(store, ['hostToAddress', 'example.com'], '128.66.0.0');

So an array as a key path can include an arbitrary key, and so useful when a key is not sanitized or known to include .. I'd like to see this.

API change proposal for observeMany

The current API for observeMany is this:

this.observeMany(['x', 'y'], (newValues, oldValues) => {
        const x = newValues[0];
        const y = newValues[1];
});

But perhaps this would be better?

this.observeMany(['x', 'y'], (newValues, oldValues) => {
        const {x, y} = newValues;
});

implement observe

now that it's been deprecated, we need a version of it here. we can also update observeDeep and observeMany to use onstate

Add a tween method

I want to be able to do this:

component.tween('foo', 42, {
  duration: 800,
  easing: eases.cubicOut
}).then( () => {
  console.log( 'tada' );
});

Starting a tween should stop any existing tweens on the same key. I suspect setting a key should have the same effect, and probably the only way to do that is to monkey-patch the component when the tween method is first called.

Bug in Spring, Discontinuous Values

A bug was introduced inspring somewhere between 1.51. and 1.6.0.

In 1.5.1 when you interrupt a spring with a new spring things are great. In 1.6.0 it discontinuously jumps to one of the two values in the object that is being updated before resuming the spring simulation properly with both values. In 1.6.0 the y value jumps to the new position while the x value works correctly. In 1.5.1 everything works fine. In 1.6.0 this is also intermittent, so the behavior is not always exhibited.

The REPL seems to be down right now, so I've attached a gif of the behavior and the code is pasted below.

spring2

<div
		 class='ball'
		 style='transform: translate({{coords[0]}}px,{{coords[1]}}px); pointer-events: none;'
></div>

<h3>Mouse over target</h3>
<div
	ref:target
	style="width: 500px; height: 200px; background: blue;margin: 80px;"
	on:mousemove="move(event)"
  on:mouseleave="leave(event)"
>
	
</div>

<style>
	:global(body) {
		padding: 0;
		overflow: hidden;
	}
	
	.ball {
		position: absolute;
		width: 2em;
		height: 2em;
		background-color: purple;
		border-radius: 50%;
		top: -1em;
		left: -1em;
	}
	
</style>

<script>
	import { spring } from '[email protected]';

	export default {
		data() {
			return {
				defaultTarget: [150, 150],
				coords: [0, 0]
			};
		},
		oncreate() {
			this.set({coords: this.get('defaultTarget')});
		},
		methods: {
			move(e) {
				this.spring('coords', [e.clientX, e.clientY], {
					stiffness: 0.3,
					damping: 0.7
				});
			},
			leave(e) {
				const defaultTarget = this.get('defaultTarget');
				this.spring('coords', [defaultTarget[0], defaultTarget[1]], {
					stiffness: 0.1,
					damping: 0.9
				});
			},
			spring
		}
	}
</script>

spring should respect existing velocity

This...

component.spring(x, 100, opts);

// later...
component.spring(x, 100, opts);

...doesn't quite work correctly โ€” the second one should essentially be a no-op, but instead it resets the velocity to zero. It should set the target/stiffness/damping on the current spring but otherwise leave the existing spring intact.

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.