Coder Social home page Coder Social logo

techniq / svelte-ux Goto Github PK

View Code? Open in Web Editor NEW
564.0 6.0 29.0 3.69 MB

Collection of Svelte components, actions, stores, and utilities to build highly interactive applications.

Home Page: https://svelte-ux.techniq.dev/

License: MIT License

HTML 0.14% Svelte 61.25% JavaScript 2.70% TypeScript 35.88% CSS 0.04%
svelte svelte-components

svelte-ux's Introduction

svelte-ux logo

Svelte UX

The projects aims to simplify building highly interactive and visual applications. It provides over 200 components, actions, stores, and utils, with many more planned.

The components are built using Tailwind with extensibility and customization in mind through the use of theming, variants, granular class overrides, and slots. A rich design token system is also currently in the works.

See also the companion library LayerChart for a large collection of composable chart components to build a wide range of visualizations.

Contributing

Install dependencies

pnpm i

Run dev server for svelte-ux package

cd packages/svelte-ux
pnpm dev

Run test for svelte-ux package

cd packages/svelte-ux
pnpm test:unit

Run tests for all packages

pnpm -r test:unit

Run a script from the root

pnpm -F svelte-ux dev

Add changeset to include change in changelog and determine next version

pnpm changeset

svelte-ux's People

Contributors

adamnationx avatar bamarb avatar brandonmcconnell avatar cyates81 avatar dimfeld avatar github-actions[bot] avatar jpoles1 avatar jycouet avatar myieye avatar renovate[bot] avatar scorpio3310 avatar sharifclick avatar shyakadavis avatar techniq avatar thedivtagguy avatar vanderburg avatar willnationsdev 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

svelte-ux's Issues

Preview component

  • Show showing / hiding code (hide by default)
  • Add "Show all code" toggle
    • Need to improve passing props to Preview and then pass showCode prop to all
  • Copy to clipboard

Add `scrollFade` similar to `scrollShadow`

Using mask-image / -webkit-mask-image with a linear-gradient, fade content if scrollable, similar to scrollShadow. See REPL (without scroll adjustment like scrollShadow)

  • Ease in fade based on scroll amount (like scrollShadow)
  • Enable/disable per side (use shadow for top, fade for bottom, for example)
  • Support vertical and horizontal at same time (difficult with mask-image and linearGradient)

[AppLayout] Improve initial SSR layout

Within AppLayout, since matchMedia() is used to determine if the menu drawer should be temporary (overlay) or persistent (side by side), and the navWidth is set via CSS variables, currently there is a layout shift (both on mobile (switch from persistent to temporary) and on desktop (setting nav width)).

We used to disable SSR rendering to bypass the issue by setting ssr: false in svelte.config.js, but this was replaced with a handle hook, which is still possible, but not as clean.

config.kit.ssr has been removed โ€” use the handle hook instead: https://kit.svelte.dev/docs/hooks#handle'

Add Props table to docs

Need to find a way to automatically parse the Svelte props Typescript types and jsdoc comments into a structure to be rendered in the docs

Draggable / Dockable Dialog (convert to Drawer)

Improve docs

Icon enhancements

Update Icon to support

  • font-awesome icons
    • Single path
    • Duotone / multi-path
    • Provided viewbox width/height
  • Additional props (use tailwind classes)
    • spin
    • inverse
    • pulse
    • flip
    • scale
    • rotate

Migrate from Grid/Stack to tailwind classes

Due to Grid / Stack using css variables and are inherited by DOM children, the variables can "leak" into their children (ex. setting a gap in a parent Grid will be used by a child Grid unless overwritten).

Now that tailwind has JIT support with arbitrary values, we can use this to fix the issue.

Most of the migration is straight forward, but there are examples for Grid and Stack.

Improve docs

  • Collapse Examples / API table of contents
  • Fix jump to Examples and API (top level)
  • Add link to open Github to Source (ex. TextField.svelte as well as docs source (ex. TextField.md)
  • Show required vs optional props, improve "default" and type properties
  • Improve look of default slot (remove __ and italic?)
  • Support markdown in description / comments?
  • Add descriptions to most props
  • Search / quick jump (Command+K)

TextField improvements

  • Type
    • Password (toggle to text to reveal)
    • Number (see Masking)
    • Currency? (see Masking)
    • Date (see Masking)
  • Masking (support NumberField, CurrentField, DateField, etc?)
    • Input masking is supported (DateField) but not formatting based on arbitrary length (number with commas, etc)
  • Copy to clipboard
  • Use Field as base

Feature request: Add `classes` structure to `Collapse`

I think it could be useful to add classes to Collapse to be able to set classes specific to the different slotted areas likeโ€ฆ

  • the top-level wrapper div in Collapse
  • the default slot's wrapper div
  • the trigger slot
  • the icon slot

classes could looks like this:

export interface Classes {
  container: string;
  default: string;
  trigger: string;
  icon: string;
}

Add queryParamsStore

  • Support simple types (numbers, strings, booleans)
  • Support objects
  • Support arrays
    • Return array even if single item
    • Arrays of simple types
    • Arrays of objects
  • Handle datatype changing when only a single vs multiple selected (ex. select with a single vs multiple values)
  • Provide better errors when config not found (at least include param name)
  • Support updating single param with queryParamsStore
    • Either support property and only update those with keys passed (require null / undefined to remove) or expose function from store to set
  • Support specifying pushState (browser back) vs replaceState
  • Attempt to guess paramType based on default value and/or current params set?
    • Might be confusing when breaks in certain conditions
  • Consider supporting Number and [Number] along with 'number' and 'number[]' (etc)?
    • Support both formats?
    • What about json (JSON), object (Object)?
    • What about date vs datetime?
      • Maybe Date is bound to datetime and date is handled by passing in an implementation object with encode/decode (see below)
    • Support a custom format in the future (UTC date vs local date, etc)
      • Maybe passing in an implementation object with encode/decode (see below)
  • Consider supporting explicit object with {encode: ..., decode: ....}?
  • Differentiate between null and undefined
    • Should only undefined delete the value (null is persisted)? Example: active/inactive/all toggles

Useful links

Planned Components

visibleHeight action

TextField number type (integer, decimal, ...) improvements

  • Improve handling of empty string (parsed to 0 but can backspace out (but still shows value instead of shrunk label / placeholder))
  • If value 1234.05 set and backspace 5, 1234 is immediately set (removes .0) due to Number(1234.0) resulting in 1234

Popover improvements (including Menu, Tooltip)

Allow Tooltips on disabled items

Tried to create a simple use case REPL but couldn't reproduce (on:mouseenter. fires on the REPL but not in Tooltip unless I disable the display: contents style (disabling in Chrome DevTools causes it to fire as well)

Add RangeField

Currently there is RangeSlider

  • Rename RangeSlider to RangeInput (or maybe MultiRangeInput)
  • Add RangeField which combines Field and RangeInput
  • Update RangeInput to support single value
  • Consider adding native prop which uses a styled <input type="range" {min} {max} {step} />
  • Consider consolidating NumberStepper
  • Add ticks support
  • Add ColorRangeInput and expose maybe as type="color"
  • Replace LayerChart's RangeField (but leverage some of the ideas like showing the number, etc
    • Support clicking number to set (with proper mobile keyboard)
  • Consider adding a CircularSlider (or CircleRangeInput)

Examples:

[Dialog] Consider using <dialog> element or popover API

The new dialog element has improved accessibility including focus trapper (if opened as a modal), and the browser support is good.

There are a few questions to answer:

  • Can we still transition using .show() / .showModal().
    • Might not be able to use svelte transition, but css transitions/animations.
    • No way to fade out backdrop on close (::backdrop element immediately removed)
    • It looks like we can pass the open prop instead of the using the DOM api, which would then allow svelte transitions, but I don't think you can open it as a model, and thus no ::backdrop, focus trapping, etc.
  • Do we use the built in ::backdrop pseudo element instead of using Backdrop
  • Clicking the backdrop / outside the dialog does not appear to be supported (still use Backdrop component?)
  • Scrolling while modal dialog is open is not restricted
  • Safari support is 15.4+

Sadly, this doesn't appear to help any with portal-ing, stacking context (z-index, CSS inheritance, etc)

REPL experimentation

Update `scrollIntoView` action to only scroll parent

Similar to how ToggleOption was updated, instead of using the native node.scrollIntoView(), we should calculate the offset manually and use parentElement.scroll() so the page doesn't scroll, only it's container.

Instead of using the node's direct parent, we might want to use getScrollParent(). The impl in ToggleOption should be used to use this action (or util)

Setup CI/CD

Tooltip improvements

  • Use portal
    • Will fix stacking context issues (z-index set on parent, etc)
  • Allow keeping tooltip open (copy values, etc)
    • Mouseover directly into tooltip (what if there is a gap between anchorEl and popoverEl). Add small time threshold?
    • Click to keep open (what about a button?)
  • Crossfade location between instances
  • Animate and tilt

Add more IntersectionObserver / scroll based components / actions

Add `|local` to Drawer/Dialog/Backdrop/Menu without breaking ToggleButton usage

Recently all Svelte transition usage within svelte-ux was updated to include the |local modifier to not break SvelteKit page transitions (see: sveltejs/svelte#6686, sveltejs/kit#628, sveltejs/kit#8670, and sveltejs/kit#5321.

In doing so, this breaks Dialog and Drawer transitions (particularly in) with ToggleButton since the {#if} within Dialog / Drawer are closer than the one within ToggleButton and thus are no longer treated as local.

One of the benefits of using ToggleButton to conditionally render a Dialog/Drawer is to handle mounting/unmounting even when the component is within a wrapping component (ex. UserDrawer, FilterDrawer, etc) as otherwise the wrapping component will always be mounted / reactive.

  • ToggleButton
    • UserDrawer
      • Drawer

Since Dialog/Drawers are modals, adding |local to fix SvelteKit page transitions shouldn't be needed as you need to dismiss the modal before clicking on a link, but there might be an overlooked use case. For now, the workaround will be to revert adding |local for these components until a better solution is found.

A few thoughts on possibly solutions:

  • Try to not add the {#if open} within Dialog/Drawer when used with ToggleButton
    • We still want it for all other use cases (as removing it completely will complicate them)
    • Trying to add it conditionally just adds another conditional
    • Exposing a separate component (DrawerBase or InternalDrawer or something) with most of the impl could work, but would be confusing to the user
  • Allow the user to opt-out of the {#if on} within ToggleButton, but along with being difficult without another conditional or nested slot, it would break the UserDrawer use case

Setup tests

Focus trap action/component

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.