npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@brayamvalero/vue3-skeleton

v0.0.32

Published

An elegant skeleton library compatible with Vue 3

Downloads

648

Readme

:skull: Vue3-Skeleton

Build and craft amazing loading experiences that automatically adapts to your Vue app.

This repository is inspired by react-loading-skeleton

:rocket: Install

Install the package via NPM

npm i @brayamvalero/vue3-skeleton

:memo: Basic usage

Install the plugin globally.

import { createApp } from 'vue'
import App from './App.vue'
// Import the component library & Stylesheet
import Skeleton from '@brayamvalero/vue3-skeleton'
import '@brayamvalero/vue3-skeleton/dist/style.css'

createApp(App)
    // Install the Skeleton Plugin
    .use(Skeleton)
    .mount('#app')

Or, install the plugin locally, whether be <script> or <script setup>

<script>
    import { Skeleton } from '@brayamvalero/vue3-skeleton'
    import '@brayamvalero/vue3-skeleton/dist/style.css'

    export default {
        components: { Skeleton },
    }
</script>
<script setup>
    import { Skeleton } from '@brayamvalero/vue3-skeleton'
    import '@brayamvalero/vue3-skeleton/dist/style.css'
</script>

Now, you're ready to go

<template>
    <div class="Home">
        <h1>
            <!--Skeleton will inherit <h1> height -->
            <Skeleton />
        </h1>
        <p>
            <!--Skeleton will inherit <p> height -->
            <Skeleton :rows="3" />
        </p>
    </div>
</template>

:sparkles: Features

Adapting to your defined styles seamlessly, The <Skeleton /> module seamlessly integrates into your components, filling the void during loading. Unlike other frameworks where crafting a skeleton screen is a meticulous task of matching font size, line height, and margins, our Skeleton component effortlessly adjusts to the correct dimensions.

Take, for instance:

<template>
    <div class="Home">
        <h1>
            <Skeleton>{{ data.title }}</Skeleton>
        </h1>
        <p>
            <Skeleton :rows="3">{{ data.description }}</Skeleton>
        </p>
    </div>
</template>

This code snippet ensures the generation of precisely proportioned skeletons for both the <h1> and <p> elements without needing any additional configuration. Moreover, it orchestrates a seamless transition, waiting until the content is fully loaded before concealing the Skeleton and unveiling the loaded content gracefully.

:warning: Avoid the creation of dedicated skeleton screens

Instead, craft components equipped with integrated skeleton states.

This methodology offers several advantages:

  • Harmonized Styles: Ensures consistency across styles.
  • Comprehensive Representation: Components should embody all conceivable states, including loading.
  • Enhanced Loading Flexibility: Enables more adaptable loading sequences.

:art: Theming

Customize individual skeletons with props, or render a SkeletonTheme to style all skeletons below it.

<script setup>
    import { Skeleton, SkeletonTheme } from '@brayamvalero/vue3-skeleton'
    import '@brayamvalero/vue3-skeleton/dist/style.css'
</script>

<template>
    <div class="Home">
        <!-- This applies Base Color and Highligh Color to all Skeletons -->
        <SkeletonTheme background-color="#303030">
            <h1>
                <Skeleton>{{ data.title }}</Skeleton>
            </h1>
            <p>
                <Skeleton :rows="3">{{ data.description }}</Skeleton>
            </p>
        </SkeletonTheme>
    </div>
</template>

Props declared inside <Skeleton /> will take priority over <SkeletonTheme /> props.

:page_facing_up: Props Declaration

Down bellow you can take a look at each prop available.

<Skeleton>

| Name | Type | Description | Default | | -------------- | --------- | -------------------------------------------------------------------- | ------- | | rows | number | Set component amount of rows | 1 | | circle | boolean | Set component border-radius to 50%, it replaces borderRadius props | false | | containerClass | string | Set component class to skeleton container | null | | childClass | string | Set component class to each skeleton child | null |

<Skeleton> <SkeletonTheme>

| Name | Type | Description | Default | | ----------------- | ----------------- | ------------------------------------------------------------------------------------------------------ | --------- | | width | string number | Set component width, it can be either number px or string with its corresponding css value | 100% | | height | string number | Set component height, it can be either number px or string with its corresponding css value | inherit | | borderRadius | string number | Set component border-radius, it can be either number px or string with its corresponding css value | 0.25rem | | backgroundColor | string | Set component background-color | #e1e1e1 | | animationDuration | number | Set component animation-duration in seconds | 2 | | enableAnimation | boolean | Set component animation status running or paused | true | | inline | boolean | Set component inline behavior | false |

Troubleshooting

The skeleton width is 0 when the parent has display: flex In the example below, the width of the skeleton will be 0:

<div :style="{ display: 'flex' }">
    <Skeleton :style="{ flex: 1 }" />
</div>

This happens because the skeleton has no intrinsic width. You can fix it by applying flex: 1 to the skeleton container, you can also set this style via the containerClass prop.