veload 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -3
- package/dist/components/VLoader/types.d.ts +0 -11
- package/dist/components/VLoading/types.d.ts +0 -21
- package/dist/components/VLoadingButton/types.d.ts +0 -22
- package/dist/components/VPatternSkeleton/presets.d.ts +0 -7
- package/dist/components/VPatternSkeleton/types.d.ts +0 -14
- package/dist/components/VProgress/types.d.ts +0 -35
- package/dist/components/VSkeleton/types.d.ts +0 -28
- package/dist/components/VSkeletonGroup/types.d.ts +0 -3
- package/dist/components/VSkeletonSwitch/types.d.ts +0 -1
- package/dist/components/VSpinner/types.d.ts +0 -23
- package/dist/composables/useDelayedLoading.d.ts +0 -25
- package/dist/composables/useLoading.d.ts +0 -21
- package/dist/composables/useLoadingGroup.d.ts +0 -18
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
# Veload
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/veload)
|
|
4
|
+
[](https://github.com/Shehab-Mu/veload/blob/main/pcakage/LICENSE)
|
|
5
|
+
[](https://veload-playground.vercel.app)
|
|
6
|
+
|
|
3
7
|
Accessible loading UI for Vue 3: animated loaders, skeleton placeholders, progress indicators, and loading-state components with TypeScript support.
|
|
4
8
|
|
|
9
|
+
Explore interactive demos and documentation in the [Veload playground](https://veload-playground.vercel.app).
|
|
10
|
+
|
|
5
11
|
## Key features
|
|
6
12
|
|
|
7
13
|
- `VSpinner`, `VLoader`, and 36 individually importable loader components.
|
|
@@ -24,9 +30,19 @@ npm install veload
|
|
|
24
30
|
Import the stylesheet once in your application entry point:
|
|
25
31
|
|
|
26
32
|
```ts
|
|
33
|
+
// Vite / Webpack (main.ts)
|
|
27
34
|
import "veload/style.css";
|
|
28
35
|
```
|
|
29
36
|
|
|
37
|
+
For Nuxt, register the stylesheet in `nuxt.config.ts`:
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
// nuxt.config.ts
|
|
41
|
+
export default defineNuxtConfig({
|
|
42
|
+
css: ["veload/style.css"],
|
|
43
|
+
});
|
|
44
|
+
```
|
|
45
|
+
|
|
30
46
|
## Quick Start
|
|
31
47
|
|
|
32
48
|
Use Veload in a Vue 3 + TypeScript single-file component. This example simulates an async operation; replace it with your application’s work.
|
|
@@ -35,7 +51,6 @@ Use Veload in a Vue 3 + TypeScript single-file component. This example simulates
|
|
|
35
51
|
<script setup lang="ts">
|
|
36
52
|
import { ref } from "vue";
|
|
37
53
|
import { VLoading, useLoading } from "veload";
|
|
38
|
-
import "veload/style.css";
|
|
39
54
|
|
|
40
55
|
const { isLoading, execute } = useLoading();
|
|
41
56
|
const message = ref("Not loaded yet");
|
|
@@ -131,8 +146,8 @@ Veload components can render with Vue SSR and Nuxt; they do not require a client
|
|
|
131
146
|
|
|
132
147
|
Explore the components and examples in the [Veload playground](https://veload-playground.vercel.app). Browse the [installation guide](https://veload-playground.vercel.app/docs/installation), [API guide](https://veload-playground.vercel.app/docs/api), and [accessibility guide](https://veload-playground.vercel.app/docs/accessibility).
|
|
133
148
|
|
|
134
|
-
The source repository is [Shehab-
|
|
149
|
+
The source repository is [Shehab-Mu/veload](https://github.com/Shehab-Mu/veload).
|
|
135
150
|
|
|
136
151
|
## License
|
|
137
152
|
|
|
138
|
-
[MIT](https://github.com/Shehab-
|
|
153
|
+
[MIT](https://github.com/Shehab-Mu/veload/blob/main/pcakage/LICENSE)
|
|
@@ -1,28 +1,17 @@
|
|
|
1
1
|
export declare const loaderVariants: readonly ["bars", "blob", "bounce", "breathing", "card-flip", "dot-sweep", "dots", "dual-arc", "element", "equalizer", "fallback", "flow", "gradient-ring", "grid", "hashtag", "heatmap", "liquid", "logo-spin", "morph", "orbit-dots", "orbit", "plane", "progress-ring", "pulse", "ring", "ripple", "rotate", "signal", "sliding-bars", "snake", "spin-dots", "spin", "squares", "stair", "typing", "wave"];
|
|
2
2
|
export type LoaderVariant = (typeof loaderVariants)[number];
|
|
3
3
|
export interface VLoaderProps {
|
|
4
|
-
/** Visual treatment used by the loader. */
|
|
5
4
|
variant?: LoaderVariant;
|
|
6
|
-
/** Primary color. @default "currentColor" */
|
|
7
5
|
color?: string;
|
|
8
|
-
/** Base size in pixels; repeated treatments may grow to fit count. @default 40 */
|
|
9
6
|
size?: number;
|
|
10
|
-
/** Animation duration in milliseconds. @default 1000 */
|
|
11
7
|
duration?: number;
|
|
12
|
-
/** Accessible name announced by the status region. @default "Loading" */
|
|
13
8
|
label?: string;
|
|
14
|
-
/** Hides the loader from assistive technology. @default false */
|
|
15
9
|
decorative?: boolean;
|
|
16
|
-
/** Repeated marks, rounded and clamped to 1–12. Fixed-shape treatments ignore it. @default 4 */
|
|
17
10
|
count?: number;
|
|
18
|
-
/** Optional completion value for the progress-ring treatment, from 0 to 100. */
|
|
19
11
|
value?: number | null;
|
|
20
12
|
}
|
|
21
13
|
export type NamedLoaderProps = Omit<VLoaderProps, "variant">;
|
|
22
|
-
/** Props shared by treatments that render repeated marks. */
|
|
23
14
|
export type VMarkLoaderProps = Omit<NamedLoaderProps, "value">;
|
|
24
|
-
/** Props specific to the determinate or indeterminate progress-ring treatment. */
|
|
25
15
|
export interface VProgressRingLoaderProps extends Omit<NamedLoaderProps, "value"> {
|
|
26
|
-
/** Completion percentage from 0 to 100. Omit for an indeterminate ring. */
|
|
27
16
|
value?: number | null;
|
|
28
17
|
}
|
|
@@ -1,27 +1,6 @@
|
|
|
1
1
|
export interface VLoadingProps {
|
|
2
|
-
/**
|
|
3
|
-
* Whether the loading overlay is active.
|
|
4
|
-
*
|
|
5
|
-
* @default false
|
|
6
|
-
*/
|
|
7
2
|
loading?: boolean;
|
|
8
|
-
/**
|
|
9
|
-
* Accessible loading message. The text is visually hidden by default.
|
|
10
|
-
*
|
|
11
|
-
* @default "Loading"
|
|
12
|
-
*/
|
|
13
3
|
label?: string;
|
|
14
|
-
/**
|
|
15
|
-
* Makes the wrapped content inert while the overlay is active. This prevents
|
|
16
|
-
* pointer and keyboard interaction with content beneath the overlay.
|
|
17
|
-
*
|
|
18
|
-
* @default true
|
|
19
|
-
*/
|
|
20
4
|
inertContent?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Diameter of the default spinner in pixels.
|
|
23
|
-
*
|
|
24
|
-
* @default 28
|
|
25
|
-
*/
|
|
26
5
|
indicatorSize?: number;
|
|
27
6
|
}
|
|
@@ -1,29 +1,7 @@
|
|
|
1
1
|
export type LoadingButtonType = "button" | "submit" | "reset";
|
|
2
2
|
export interface VLoadingButtonProps {
|
|
3
|
-
/**
|
|
4
|
-
* Whether the button is performing work. While loading, the button is
|
|
5
|
-
* disabled, exposes `aria-busy`, and shows an indicator.
|
|
6
|
-
*
|
|
7
|
-
* @default false
|
|
8
|
-
*/
|
|
9
3
|
loading?: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Native disabled state. The button is also disabled while loading.
|
|
12
|
-
*
|
|
13
|
-
* @default false
|
|
14
|
-
*/
|
|
15
4
|
disabled?: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Native button type. Defaults to `"button"` so the component does not
|
|
18
|
-
* accidentally submit a surrounding form.
|
|
19
|
-
*
|
|
20
|
-
* @default "button"
|
|
21
|
-
*/
|
|
22
5
|
type?: LoadingButtonType;
|
|
23
|
-
/**
|
|
24
|
-
* Diameter of the default indicator in pixels.
|
|
25
|
-
*
|
|
26
|
-
* @default 16
|
|
27
|
-
*/
|
|
28
6
|
indicatorSize?: number;
|
|
29
7
|
}
|
|
@@ -15,12 +15,5 @@ export declare const VMediaCardSkeleton: DefineComponent<VMediaCardSkeletonProps
|
|
|
15
15
|
export declare const VProductCardSkeleton: DefineComponent<VProductCardSkeletonProps>;
|
|
16
16
|
export declare const VProfileSkeleton: DefineComponent<VProfileSkeletonProps>;
|
|
17
17
|
export declare const VTableSkeleton: DefineComponent<VTableSkeletonProps>;
|
|
18
|
-
/**
|
|
19
|
-
* A safe content switcher for Vue skeleton states.
|
|
20
|
-
*
|
|
21
|
-
* Unlike React Loadly's experimental DOM-inference API, this component never
|
|
22
|
-
* executes or inspects slot content. It renders a supplied skeleton slot or a
|
|
23
|
-
* selected Veload pattern while loading, then renders the default slot.
|
|
24
|
-
*/
|
|
25
18
|
export type VAutoSkeletonProps = VSkeletonSwitchProps;
|
|
26
19
|
export declare const VAutoSkeleton: DefineComponent<VAutoSkeletonProps>;
|
|
@@ -6,33 +6,19 @@ export interface SkeletonAppearanceProps {
|
|
|
6
6
|
label?: string;
|
|
7
7
|
}
|
|
8
8
|
export interface VPatternSkeletonProps extends SkeletonAppearanceProps {
|
|
9
|
-
/** Layout pattern. @default "lines" */
|
|
10
9
|
pattern?: SkeletonPattern;
|
|
11
|
-
/** Repeated lines, items, fields, or data rows (1–12). Table/dashboard headers are separate; dashboard always includes one header. @default 3 */
|
|
12
10
|
rows?: number;
|
|
13
|
-
/** Table column count. @default 3 */
|
|
14
11
|
columns?: number;
|
|
15
|
-
/** Image or media height in pixels or a CSS length. */
|
|
16
12
|
mediaHeight?: number | string;
|
|
17
|
-
/** Avatar diameter in pixels. */
|
|
18
13
|
avatarSize?: number;
|
|
19
|
-
/** Enables optional media blocks where the pattern supports them. @default true */
|
|
20
14
|
showMedia?: boolean;
|
|
21
|
-
/** Enables optional avatar blocks where the pattern supports them. @default true */
|
|
22
15
|
showAvatar?: boolean;
|
|
23
|
-
/** Enables a table header. @default true */
|
|
24
16
|
showHeader?: boolean;
|
|
25
|
-
/** Enables the dashboard chart block. @default true */
|
|
26
17
|
showChart?: boolean;
|
|
27
|
-
/** Enables profile or dashboard statistic blocks. @default true */
|
|
28
18
|
showStats?: boolean;
|
|
29
|
-
/** Enables the form submit block. @default true */
|
|
30
19
|
showSubmit?: boolean;
|
|
31
|
-
/** Enables the product rating block. @default true */
|
|
32
20
|
showRating?: boolean;
|
|
33
|
-
/** Enables the product price block. @default true */
|
|
34
21
|
showPrice?: boolean;
|
|
35
|
-
/** Enables the product call-to-action block. @default true */
|
|
36
22
|
showCta?: boolean;
|
|
37
23
|
}
|
|
38
24
|
export type NamedSkeletonProps = Omit<VPatternSkeletonProps, "pattern">;
|
|
@@ -1,45 +1,10 @@
|
|
|
1
1
|
export interface VProgressProps {
|
|
2
|
-
/**
|
|
3
|
-
* Current progress value. Omit, pass `null`, or pass a non-finite value to
|
|
4
|
-
* render an indeterminate progress bar.
|
|
5
|
-
*/
|
|
6
2
|
value?: number | null;
|
|
7
|
-
/**
|
|
8
|
-
* Lower bound of the value range.
|
|
9
|
-
*
|
|
10
|
-
* @default 0
|
|
11
|
-
*/
|
|
12
3
|
min?: number;
|
|
13
|
-
/**
|
|
14
|
-
* Upper bound of the value range. When `max` is not greater than `min`, the
|
|
15
|
-
* bar renders as indeterminate.
|
|
16
|
-
*
|
|
17
|
-
* @default 100
|
|
18
|
-
*/
|
|
19
4
|
max?: number;
|
|
20
|
-
/**
|
|
21
|
-
* Accessible name for the progress bar.
|
|
22
|
-
*
|
|
23
|
-
* @default "Progress"
|
|
24
|
-
*/
|
|
25
5
|
label?: string;
|
|
26
|
-
/**
|
|
27
|
-
* Optional human-readable value text, for example `"3 of 10 files"`.
|
|
28
|
-
* Only applied while determinate.
|
|
29
|
-
*/
|
|
30
6
|
valueText?: string;
|
|
31
|
-
/**
|
|
32
|
-
* Thickness of the bar as a pixel number or any CSS length.
|
|
33
|
-
*
|
|
34
|
-
* @default 8
|
|
35
|
-
*/
|
|
36
7
|
height?: number | string;
|
|
37
|
-
/**
|
|
38
|
-
* Color of the filled portion. Overrides `--v-progress-color`.
|
|
39
|
-
*/
|
|
40
8
|
color?: string;
|
|
41
|
-
/**
|
|
42
|
-
* Color of the unfilled track. Overrides `--v-progress-track-color`.
|
|
43
|
-
*/
|
|
44
9
|
trackColor?: string;
|
|
45
10
|
}
|
|
@@ -1,37 +1,9 @@
|
|
|
1
1
|
export type SkeletonVariant = "text" | "rect" | "circle";
|
|
2
2
|
export interface VSkeletonProps {
|
|
3
|
-
/**
|
|
4
|
-
* Shape of the placeholder.
|
|
5
|
-
*
|
|
6
|
-
* @default "text"
|
|
7
|
-
*/
|
|
8
3
|
variant?: SkeletonVariant;
|
|
9
|
-
/**
|
|
10
|
-
* Width as a pixel number or any CSS length. Defaults to `100%`, except for
|
|
11
|
-
* circular skeletons, which default to `40px`.
|
|
12
|
-
*/
|
|
13
4
|
width?: number | string;
|
|
14
|
-
/**
|
|
15
|
-
* Height as a pixel number or any CSS length. Circular skeletons use a
|
|
16
|
-
* square aspect ratio when no height is supplied.
|
|
17
|
-
*/
|
|
18
5
|
height?: number | string;
|
|
19
|
-
/**
|
|
20
|
-
* Border radius as a pixel number or any CSS length. When omitted, a shape
|
|
21
|
-
* appropriate default is used.
|
|
22
|
-
*/
|
|
23
6
|
borderRadius?: number | string;
|
|
24
|
-
/**
|
|
25
|
-
* Enables the shimmer animation. Reduced-motion preferences always disable
|
|
26
|
-
* the animation in CSS.
|
|
27
|
-
*
|
|
28
|
-
* @default true
|
|
29
|
-
*/
|
|
30
7
|
animated?: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Optional accessible name. When supplied, the skeleton becomes a
|
|
33
|
-
* `role="status"` placeholder. When omitted, it is decorative and hidden
|
|
34
|
-
* from assistive technology.
|
|
35
|
-
*/
|
|
36
8
|
label?: string;
|
|
37
9
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
export interface VSkeletonGroupProps {
|
|
2
|
-
/** Accessible loading message for the complete group. */
|
|
3
2
|
label?: string;
|
|
4
|
-
/** CSS gap between child placeholders. @default "0.75rem" */
|
|
5
3
|
gap?: string;
|
|
6
|
-
/** Hides the entire group from assistive technology. @default false */
|
|
7
4
|
decorative?: boolean;
|
|
8
5
|
}
|
|
@@ -1,29 +1,6 @@
|
|
|
1
1
|
export interface VSpinnerProps {
|
|
2
|
-
/**
|
|
3
|
-
* Diameter of the spinner in pixels. Non-finite and negative values are
|
|
4
|
-
* safely normalized.
|
|
5
|
-
*
|
|
6
|
-
* @default 24
|
|
7
|
-
*/
|
|
8
2
|
size?: number;
|
|
9
|
-
/**
|
|
10
|
-
* Accent color of the active edge. The remaining track uses
|
|
11
|
-
* `--v-spinner-track-color` (falling back to `currentColor`).
|
|
12
|
-
*
|
|
13
|
-
* @default "currentColor"
|
|
14
|
-
*/
|
|
15
3
|
color?: string;
|
|
16
|
-
/**
|
|
17
|
-
* Accessible name announced by the status element.
|
|
18
|
-
*
|
|
19
|
-
* @default "Loading"
|
|
20
|
-
*/
|
|
21
4
|
label?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Hides the spinner from assistive technology. Use this when an ancestor
|
|
24
|
-
* already exposes a loading status, such as `VLoading`.
|
|
25
|
-
*
|
|
26
|
-
* @default false
|
|
27
|
-
*/
|
|
28
5
|
decorative?: boolean;
|
|
29
6
|
}
|
|
@@ -1,32 +1,7 @@
|
|
|
1
1
|
import type { UseLoadingReturn } from "./useLoading";
|
|
2
2
|
export interface UseDelayedLoadingOptions {
|
|
3
|
-
/**
|
|
4
|
-
* Delay in milliseconds before the loading indicator becomes visible.
|
|
5
|
-
* Negative values are treated as `0`; non-finite values use the default.
|
|
6
|
-
*
|
|
7
|
-
* @default 200
|
|
8
|
-
*/
|
|
9
3
|
delay?: number;
|
|
10
|
-
/**
|
|
11
|
-
* Minimum time in milliseconds the loading indicator remains visible once
|
|
12
|
-
* it has appeared. This prevents a brief flash when an operation finishes
|
|
13
|
-
* just after the delay. `0` disables the minimum.
|
|
14
|
-
*
|
|
15
|
-
* The minimum is measured from the moment the indicator becomes visible,
|
|
16
|
-
* not from the moment the operation starts.
|
|
17
|
-
*
|
|
18
|
-
* @default 0
|
|
19
|
-
*/
|
|
20
4
|
minVisibleDuration?: number;
|
|
21
5
|
}
|
|
22
6
|
export type UseDelayedLoadingReturn = UseLoadingReturn;
|
|
23
|
-
/**
|
|
24
|
-
* Tracks asynchronous operations like {@link useLoading}, but delays showing
|
|
25
|
-
* the loading indicator until the work has remained pending for `delay`
|
|
26
|
-
* milliseconds.
|
|
27
|
-
*
|
|
28
|
-
* The operation itself starts immediately. Once visible, the indicator can be
|
|
29
|
-
* kept on screen for at least `minVisibleDuration` milliseconds to avoid a
|
|
30
|
-
* short flash.
|
|
31
|
-
*/
|
|
32
7
|
export declare function useDelayedLoading(options?: UseDelayedLoadingOptions | number): UseDelayedLoadingReturn;
|
|
@@ -1,28 +1,7 @@
|
|
|
1
1
|
import { type Ref } from "vue";
|
|
2
|
-
/**
|
|
3
|
-
* Reactive state returned by {@link useLoading}.
|
|
4
|
-
*/
|
|
5
2
|
export interface UseLoadingReturn {
|
|
6
|
-
/**
|
|
7
|
-
* `true` while at least one tracked operation is pending.
|
|
8
|
-
*/
|
|
9
3
|
isLoading: Readonly<Ref<boolean>>;
|
|
10
|
-
/**
|
|
11
|
-
* Number of currently pending operations for this instance.
|
|
12
|
-
*/
|
|
13
4
|
pendingCount: Readonly<Ref<number>>;
|
|
14
|
-
/**
|
|
15
|
-
* Runs an asynchronous operation and tracks it until it settles.
|
|
16
|
-
*
|
|
17
|
-
* The operation's return value and rejection reason are preserved.
|
|
18
|
-
*/
|
|
19
5
|
execute: <T>(operation: () => Promise<T>) => Promise<T>;
|
|
20
6
|
}
|
|
21
|
-
/**
|
|
22
|
-
* Tracks concurrent asynchronous operations for a single loading state.
|
|
23
|
-
*
|
|
24
|
-
* Each call to `execute` increments the pending count before invoking the
|
|
25
|
-
* operation and decrements it in a `finally` block. The operation result or
|
|
26
|
-
* error is passed through unchanged.
|
|
27
|
-
*/
|
|
28
7
|
export declare function useLoading(): UseLoadingReturn;
|
|
@@ -1,25 +1,7 @@
|
|
|
1
1
|
import { type ComputedRef, type Ref } from "vue";
|
|
2
|
-
/**
|
|
3
|
-
* A reactive boolean source or a getter that returns one.
|
|
4
|
-
*
|
|
5
|
-
* Typically this is the `isLoading` ref from another composable instance.
|
|
6
|
-
*/
|
|
7
2
|
export type LoadingSource = Readonly<Ref<boolean>> | (() => boolean);
|
|
8
3
|
export interface UseLoadingGroupReturn {
|
|
9
|
-
/**
|
|
10
|
-
* `true` when at least one source is active.
|
|
11
|
-
*/
|
|
12
4
|
isLoading: ComputedRef<boolean>;
|
|
13
|
-
/**
|
|
14
|
-
* Number of sources that are currently active.
|
|
15
|
-
*/
|
|
16
5
|
activeCount: ComputedRef<number>;
|
|
17
6
|
}
|
|
18
|
-
/**
|
|
19
|
-
* Aggregates independent loading sources into a single loading state.
|
|
20
|
-
*
|
|
21
|
-
* Pass an array for a fixed set of sources, or a getter when the set of
|
|
22
|
-
* sources changes dynamically. The group does not own the sources; it only
|
|
23
|
-
* reads them.
|
|
24
|
-
*/
|
|
25
7
|
export declare function useLoadingGroup(sources: readonly LoadingSource[] | (() => readonly LoadingSource[])): UseLoadingGroupReturn;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "veload",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Accessible Vue 3 loaders, skeletons, progress indicators, and loading-state composables.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"homepage": "https://veload-playground.vercel.app",
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|
|
27
|
-
"url": "git+https://github.com/Shehab-
|
|
27
|
+
"url": "git+https://github.com/Shehab-Mu/veload.git"
|
|
28
28
|
},
|
|
29
29
|
"bugs": {
|
|
30
|
-
"url": "https://github.com/Shehab-
|
|
30
|
+
"url": "https://github.com/Shehab-Mu/veload/issues"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|