Giter VIP home page Giter VIP logo

svelte-toolbox's Introduction

No longer maintained

Svelte Toolbox (demo)

A UI component library for Svelte implementing Google's Material Design specification.

Beacuse Svelte Toolbox is early in development, some things may change before we hit v1.0.0 (Please see Component Status).

Contributing

Pull requests are always welcome!

git clone https://github.com/svelte-toolbox/svelte-toolbox.git
cd svelte-toolbox
npm install

To start the development server:

npm run dev

To clean up the project and format the files:

npm run lint

You are welcome to add new features or components, but please open an issue to discuss your idea first.

Usage

Not all of these components are stable. Please see the Component Status section.

There is detailed documentation about each of the components below, but the basic usage can bee seen below.

Svelte/Sapper

Installing svelte-toolbox as a devDependency allows Svelte to compile the svelte-toolbox components right along with the rest of your code.

npm i --save-dev svelte-toolbox
# or yarn
<script>
	import { UIButton, Ripple } from 'svelte-toolbox';
</script>

<UIButton on:click="{() => alert('done!')}">Click me!</UIButton>

<Ripple>
	There is a nice ripple effect on this text.
</Ripple>

HTML/CSS/VanillaJS

You can use CDN's from jsDelivr.net, unpkg.com, or bundle.run. You can also install svelte-toolbox into your project via npm or yarn.

In this example, however, we will use the unpkg CDN:

<!-- CSS/JS -->
<script src="https://unpkg.com/svelte-toolbox/dist/index.min.js"></script>
<link
	rel="stylesheet"
	href="https://unpkg.com/svelte-toolbox/public/bundle.css"
/>

<!-- Default styles -->
<link
	rel="stylesheet"
	href="https://unpkg.com/svelte-toolbox/public/global.css"
/>

<div id="button"></div>

<script>
	new Toolbox.UIButton({ target: document.querySelector('#button') });
</script>

Demos

Global Styles

We recommend adding the contents of public/global.css to your global stylesheet. These will be the default styles for the components you import from svelte-toolbox.

P.S. If you like the styles in public/global.css, and don't want to change them, you could just link to it:

<link
	href="https://unpkg.com/svelte-toolbox/public/global.css"
	rel="stylesheet"
/>
<!-- or, depending on your setup, you might even be able to do this  -->
<link href="node_modules/svelte-toolbox/public/global.css" rel="stylesheet" />

Component Status

Component Status
Ripple Stable, no breaking changes or new features are expected.
UIButton Stable, in that no breaking chenges are expected, but new features are.
UIInput Mostly Stable, there is some improvment under the hood to be done. This might effect the public API.
IconButton Stable. Although new features are expected, no breaking changes are.
Switch Stable. Although new features are expected, no breaking changes are.
Card Stable, no breaking changes or new features are expected.
Checkbox Unstable. This component is not yet finished. Please see this project.

Documentation

Some of these components are still unstable. Please see the Component Status section.

Need help? Have a question?

Then you have come to the right place.

Open an Issue or join the question friendly Discord Server.

Credits

Inspiration

As I was working on an app using Sapper, I was made aware of the fact that if there was a UI component library out there for Svelte, it would make developing a Svelte app so much easier!

I am a big fan of the Google Material Design patterns, and because I really like React Toolbox, I decided to make something like it for Svelte.

License

MIT

svelte-toolbox's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar vehmloewff avatar verassitnh 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

svelte-toolbox's Issues

Shadows could animate

If the elevation changes the shadow should animate. This could be disabled by setting transitionElevation to false.

There could also be a prop that gives the elevation on hover. This would be useful for making the card elevate on hover.

Add a label prop for Switch

If the label prop is specified, then Switch would become a block element that gets no shorter than 48px, and just as tall as the label forces it to.

There could also be a left prop of type boolean (default should be false) that puts the switch on the left side of the element.

Example:

Without left:

<Switch on={true} label="Allow notfications"/>

Screen Shot 2019-07-08 at 4 10 14 PM

With left:

<Switch on={true} label="Allow notfications" left={true}/>

Screen Shot 2019-07-08 at 4 10 41 PM

Request: LoadingBar Component

This would be a group of svg based loading bars.

The usage would probably look like this:

<LoadingBar
	value={50}
	preset="line"

	backgroundWidth={10}
	backgroundCorners={0}
	foregroundWidth={20}
	foregroundCorners={0}
	backgroundColor="var(--loading-bar-background)"
	foregroundColor="var(--loading-bar-foreground)"

	showLabel={true}
	showUnits={true}
	units="%"
	labelColor="var(--loading-bar-label)"
	unitsColor="var(--loading-bar-units)"

	borderWidth={20}
	borderColor="var(--loading-bar-border)"
/>
<!-- preset values: `line`, `circle`, `fan`, `bubble` -->

IconButton transitions

It would be nice if there was a way to have transitions when an icon changes in IconButton.

This would be key to doing that: https://svelte.dev/examples#transition-events.

We could just add another prop:

<IconButton
    icon={[
        { name: 'favorite' },
        { name: 'favorite_outline' }
    ]}
    transition="scale"
    bind:on
/>

Then, every time on is toggled, the old icon will animate out with a scale transition, and the new one will animate it with a scale.

wrapped-styles.js is missing

Show error on build.

src/components/components.module.js → dist/index.min.mjs, dist/index.min.js...
[!] Error: Could not resolve '../styles/internal/wrapped-styles.js' from src\components\Style.svelte
Error: Could not resolve '../styles/internal/wrapped-styles.js' from src\components\Style.svelte
    at error (D:\work\svelte3\svelte-toolbox\node_modules\rollup\dist\rollup.js:9365:30)
    at ModuleLoader.handleMissingImports (D:\work\svelte3\svelte-toolbox\node_modules\rollup\dist\rollup.js:16317:17)
    at ModuleLoader.<anonymous> (D:\work\svelte3\svelte-toolbox\node_modules\rollup\dist\rollup.js:16368:26)
    at Generator.next (<anonymous>)
    at fulfilled (D:\work\svelte3\svelte-toolbox\node_modules\rollup\dist\rollup.js:15368:28)

hideOverflow does not work

hideOverflow="false" does not work.

<script>
	import { Ripple } from 'svelte-toolbox'
</script>

<Ripple hideOverflow="false">
	<p>
		text
	</p>
</Ripple>

Demo here

`scrollToTop` prop on UIButton

This would just scroll the page to the top when the button is clicked.

Very useful for SPA applications when the route is changed.

Improve `Ripple`

Here are some ways that Ripple can be improved upon:

  • Ripple could have a block prop which should default to false. If true the ripple should have display: block, else inline-block.
  • Ripple could have a disabled prop, which, as can be guessed, disables the ripple.
  • The default span should be higher, and the default time might even need to be shorter. This is requested, so that the animation does not have such a tired and slow look to it.

There should be colors for card

We need some more props for colors in card. Here are some suggestions:

  • backgroundColor
  • backgroundColorHover
  • outlineColor
  • outlineColorHover

The last two are obviously waiting on #79.

Request: Item component

This would normally be used inside List, but it could also be used inside card, or anything else really.

Screenshot from 2019-08-06 21-08-23
Screenshot from 2019-08-06 21-11-04
Screenshot from 2019-08-06 21-11-24
Screenshot from 2019-08-06 21-11-58

eslint-plugin-svelte3 is missing

npm run lint fails with this error:

Error: Failed to load plugin 'svelte3' declared in '.eslintrc': Could not find ESLint Linter in require cache
    at Object.<anonymous> (/workspace/svelte-toolbox/node_modules/eslint-plugin-svelte3/index.js:295:8)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at ConfigArrayFactory._loadPlugin (/workspace/svelte-toolbox/node_modules/eslint/lib/cli-engine/config-array-factory.js:859:49)
    at names.reduce (/workspace/svelte-toolbox/node_modules/eslint/lib/cli-engine/config-array-factory.js:730:33)

Button looks a bit top heavy

It looks like there is either some extra space on the bottom of the button, or the text somehow jumped too high.

2019-07-18t07-07-24

Add a style theme

I am not sure exactly what to call this, but I think that "Style Theme" sounds good.

It's just a set of CSS vars in global.css that look like this:

:root {
	--back: #ffffff;
	--back-light: #f6fafd;
	--back-api: #eff8ff;
	--prime: #98603d;
	--second: #434346;
	--flash: #40b3ff;
	--heading: var(--second);
	--text: #444;
	--sidebar-text: rgba(255, 255, 255, 0.75);
	--border-w: 0.3rem;
	--border-r: 0.4rem;
}

Then all the other vars would be set to those variables.

Yeah, more vars such as --prime-t-10 (--prime transparent 10%) would probably be needed, but for the most part I think this would work.

Notice any problems with this idea? Have a comment?

Drop it below.

Install components, not whole package

From svelte-toolbox I want only Ripple component, but there is no possibility to run:

npm install --save-dev svelte-toolbox/ripple

and import the Ripple by default:

import Ripple from 'svelte-toolbox/ripple'

This would be just great to add in future versions!

Border variations

There should be a prop on Card to adjust the border-radius, with options something like the following:

  • rounded (default)
  • extra-rounded
  • sleek-right
    Screenshot from 2019-08-06 17-40-53
  • sleek-left

Add a text prop to IconButton

A text prop on button might be nice.

Take a look at this code:

<IconButton
    icon="build",
    text="Build"
/>
<!--
    I am still not sure if 'text' should be a prop,
    or if it should be in IconObject.
-->

Wouldn't it be nice if it were to show a label under the icon on a touchscreen, and a tooltip on the icon on desktop?

I think so.

Style bug with UIInput

As seen in this REPL, the input has an extra margin on the bottom.

As this is just the default Svelte REPL styles, it can be overridden with the following css:

input, button, select, textarea {
    margin: 0;
}

But that is just a pain to do every time.

Take the MDC out of UIInput

The MDC component just has to go. It would greatly improve the quality of UIInput if the MD component wasn't there.

Update the page used for manual testing

The page that is used for manual testing should be updated.

This will keep every developer who looks at the page from going into heartache when he has made changes that need visual approval.

Something like the Roberto font, maybe some dummy text, and a hash system such that the url looks like this: localhost:5000/#some-component. This will keep us from having to scroll to just the right place when the page gets really long.

Conditional inline styling

It will be better to put --css-vars in conditional styles like style={someprop is defined ? "--css-var: ${someprop}" : ""} insted of style="--css-var: {someprop}"`

this way you doesnt need to put !important if you do

.some-component{
  color: #fff:
}

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.