Skip to content

Commit 04d85b3

Browse files
committed
chore: revert to non-react
1 parent 245bdee commit 04d85b3

File tree

6 files changed

+12
-46
lines changed

6 files changed

+12
-46
lines changed

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Also check out [Holy Time](https://github.com/badosz0/holy-time), yet another (t
1515

1616
- Easy to integrate with any React application.
1717
- Highly customizable with sensible defaults.
18-
- Utilizes NProgress for smooth, aesthetic progress indications.
18+
- Utilizes a custom implementation for smooth, aesthetic progress indications.
1919
- Supports dynamic configuration for color, height, speed, easing, and more.
2020

2121
## Installation
@@ -97,13 +97,11 @@ onClick={(e) => {
9797

9898
## API
9999

100-
Holy Loader accepts the following props for customization:
100+
`<HolyLoader />` accepts the following props for customization:
101101

102102
- `color` (string): Specifies the color of the top-loading bar. Default: "#59a2ff" (a shade of blue).
103103
- `initialPosition` (number): Sets the initial position of the top-loading bar as a percentage of the total width. Default: 0.08 (8% of the total width).
104-
- `trickleSpeed` (number): Determines the delay speed for the incremental movement of the top-loading bar, in milliseconds. Default: 200 milliseconds.
105104
- `height` (number | string): Defines the height of the top-loading bar in pixels or css unit. Default: 4 pixels.
106-
- `trickle` (boolean): Enables or disables the automatic incremental movement of the top-loading bar. Default: true (enabled).
107105
- `easing` (string): Specifies the easing function to use for the loading animation. Accepts any valid CSS easing string. Default: "ease".
108106
- `speed` (number): Sets the animation speed of the top-loading bar in milliseconds. Default: 200 milliseconds.
109107
- `zIndex` (number): Defines the z-index property of the top-loading bar, controlling its stacking order. Default: 2147483647.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "holy-loader",
3-
"version": "2.1.0",
3+
"version": "2.2.0",
44
"description": "Holy Loader is a lightweight, customizable top-loading progress bar component for React applications.",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
@@ -27,7 +27,7 @@
2727
"single-page-application"
2828
],
2929
"scripts": {
30-
"build": "tsup && sed -i '' '1s/^/\"use client\";/' dist/index.js",
30+
"build": "tsup",
3131
"lint:fix": "eslint --ignore-path .eslintignore --fix --ext .js,.ts . && npm run format:fix",
3232
"format:fix": "prettier --ignore-path .gitignore --write \"src/**/*.{ts,tsx}\"",
3333
"test": "vitest -c ./vitest.config.ts"

src/HolyProgress.ts

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,6 @@ type HolyProgressProps = {
1717
*/
1818
speed: number;
1919

20-
/**
21-
* Specifies if the bar should increment automatically.
22-
* Default: true
23-
*/
24-
trickle: boolean;
25-
26-
/**
27-
* Specifies the speed of the automatic incrementation.
28-
* Default: 200
29-
*/
30-
trickleSpeed: number;
31-
3220
/**
3321
* Specifies the color of the progress bar.
3422
* Default: '#59a2ff'
@@ -77,8 +65,6 @@ export class HolyProgress {
7765
initialPosition: 0.08,
7866
easing: 'linear',
7967
speed: 200,
80-
trickle: true,
81-
trickleSpeed: 200,
8268
color: '#59a2ff',
8369
height: 4,
8470
zIndex: 2147483647,
@@ -192,27 +178,25 @@ export class HolyProgress {
192178
this.setTo(0);
193179
}
194180

195-
if (this.settings.trickle) {
196-
this.startTrickle();
197-
}
181+
this.startTrickle();
198182

199183
return this;
200184
};
201185

202186
/**
203187
* Performs automatic incrementation of the progress bar.
204-
* This function is recursive and continues to increment the progress at intervals defined by `trickleSpeed`.
188+
* This function is recursive and continues to increment the progress at intervals defined by `sppeed`.
205189
* @private
206190
*/
207191
private readonly startTrickle = (): void => {
208192
const run = (): void => {
209193
if (this.status === null) return;
210194

211195
this.increment();
212-
setTimeout(run, this.settings.trickleSpeed);
196+
setTimeout(run, this.settings.speed);
213197
};
214198

215-
setTimeout(run, this.settings.trickleSpeed);
199+
setTimeout(run, this.settings.speed);
216200
};
217201

218202
/**

src/constants.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
export const DEFAULTS = {
22
color: '#59a2ff',
33
initialPosition: 0.08,
4-
trickleSpeed: 200,
54
height: 4,
6-
trickle: true,
75
easing: 'ease',
86
speed: 200,
97
zIndex: 2147483647,

src/index.tsx

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use client';
2+
13
import * as React from 'react';
24
import { HolyProgress } from './HolyProgress';
35
import { DEFAULTS } from './constants';
@@ -15,24 +17,12 @@ export interface HolyLoaderProps {
1517
*/
1618
initialPosition?: number;
1719

18-
/**
19-
* Determines the delay speed for the incremental movement of the top-loading bar, in milliseconds.
20-
* Default: 200 milliseconds
21-
*/
22-
trickleSpeed?: number;
23-
2420
/**
2521
* Specifies the height of the top-loading bar in either pixels (number) or css unit (string).
2622
* Default: 4 pixels
2723
*/
2824
height?: number | string;
2925

30-
/**
31-
* Enables or disables the automatic incremental movement of the top-loading bar.
32-
* Default: true (enabled)
33-
*/
34-
trickle?: boolean;
35-
3626
/**
3727
* Specifies the easing function to use for the loading animation. Accepts any valid CSS easing string.
3828
* Default: "ease"
@@ -110,9 +100,7 @@ export const isSameHost = (currentUrl: string, newUrl: string): boolean => {
110100
const HolyLoader = ({
111101
color = DEFAULTS.color,
112102
initialPosition = DEFAULTS.initialPosition,
113-
trickleSpeed = DEFAULTS.trickleSpeed,
114103
height = DEFAULTS.height,
115-
trickle = DEFAULTS.trickle,
116104
easing = DEFAULTS.easing,
117105
speed = DEFAULTS.speed,
118106
zIndex = DEFAULTS.zIndex,
@@ -181,8 +169,6 @@ const HolyLoader = ({
181169
holyProgress = new HolyProgress({
182170
color,
183171
height,
184-
trickleSpeed,
185-
trickle,
186172
initialPosition,
187173
easing,
188174
speed,

0 commit comments

Comments
 (0)