@karan4/frostjs 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +304 -2
- package/dist/angular.cjs +21 -0
- package/dist/angular.d.cts +8 -0
- package/dist/angular.d.ts +8 -0
- package/dist/angular.js +21 -0
- package/dist/chunk-4YG4GVLN.cjs +273 -0
- package/dist/chunk-BQNHIAZG.cjs +64 -0
- package/dist/chunk-LUZ2RD2S.js +64 -0
- package/dist/chunk-M4BLR4QM.js +273 -0
- package/dist/core-BfyKRh3F.d.cts +36 -0
- package/dist/core-BfyKRh3F.d.ts +36 -0
- package/dist/index.cjs +47 -0
- package/dist/index.d.cts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +47 -0
- package/dist/network-Bm_3Ah3R.d.ts +18 -0
- package/dist/network-Dgm73vcC.d.cts +18 -0
- package/dist/react.cjs +22 -0
- package/dist/react.d.cts +12 -0
- package/dist/react.d.ts +12 -0
- package/dist/react.js +22 -0
- package/dist/style.css +170 -0
- package/dist/vue.cjs +24 -0
- package/dist/vue.d.cts +9 -0
- package/dist/vue.d.ts +9 -0
- package/dist/vue.js +24 -0
- package/package.json +73 -4
package/dist/react.d.cts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactElement } from 'react';
|
|
2
|
+
import { Options, Target } from './index.cjs';
|
|
3
|
+
|
|
4
|
+
declare function useFrost(target: Target, loading: boolean, options?: Options): void;
|
|
5
|
+
interface FrostProps extends ComponentPropsWithoutRef<'div'> {
|
|
6
|
+
loading: boolean;
|
|
7
|
+
options?: Options;
|
|
8
|
+
}
|
|
9
|
+
declare function Frost({ loading, options, ...props }: FrostProps): ReactElement;
|
|
10
|
+
|
|
11
|
+
export { Frost, useFrost };
|
|
12
|
+
export type { FrostProps };
|
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactElement } from 'react';
|
|
2
|
+
import { Options, Target } from './index.js';
|
|
3
|
+
|
|
4
|
+
declare function useFrost(target: Target, loading: boolean, options?: Options): void;
|
|
5
|
+
interface FrostProps extends ComponentPropsWithoutRef<'div'> {
|
|
6
|
+
loading: boolean;
|
|
7
|
+
options?: Options;
|
|
8
|
+
}
|
|
9
|
+
declare function Frost({ loading, options, ...props }: FrostProps): ReactElement;
|
|
10
|
+
|
|
11
|
+
export { Frost, useFrost };
|
|
12
|
+
export type { FrostProps };
|
package/dist/react.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
show
|
|
3
|
+
} from "./chunk-M4BLR4QM.js";
|
|
4
|
+
|
|
5
|
+
// src/react.ts
|
|
6
|
+
import { createElement, useEffect, useRef } from "react";
|
|
7
|
+
function useFrost(target, loading, options) {
|
|
8
|
+
const latest = useRef(options);
|
|
9
|
+
latest.current = options;
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (loading) return show(target, latest.current);
|
|
12
|
+
}, [target, loading]);
|
|
13
|
+
}
|
|
14
|
+
function Frost({ loading, options, ...props }) {
|
|
15
|
+
const ref = useRef(null);
|
|
16
|
+
useFrost(ref, loading, options);
|
|
17
|
+
return createElement("div", { ...props, ref });
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
Frost,
|
|
21
|
+
useFrost
|
|
22
|
+
};
|
package/dist/style.css
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
.frost {
|
|
2
|
+
--frost-unit: 2.25rem;
|
|
3
|
+
--frost-solid: #f5f7ff;
|
|
4
|
+
--frost-tint: rgb(245 247 255 / 65%);
|
|
5
|
+
position: absolute;
|
|
6
|
+
inset: 0;
|
|
7
|
+
border-radius: inherit;
|
|
8
|
+
z-index: var(--frost-z-index, 1000);
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
gap: 0.75rem;
|
|
14
|
+
background: var(--frost-backdrop, var(--frost-solid));
|
|
15
|
+
color: var(--frost-color, #3431a6);
|
|
16
|
+
font: 600 0.875rem/1.4 system-ui, sans-serif;
|
|
17
|
+
cursor: progress;
|
|
18
|
+
}
|
|
19
|
+
.frost--page { position: fixed; touch-action: none; }
|
|
20
|
+
.frost--small { --frost-unit: 1.5rem; }
|
|
21
|
+
.frost--large { --frost-unit: 3.25rem; }
|
|
22
|
+
.frost__indicator {
|
|
23
|
+
box-sizing: border-box;
|
|
24
|
+
display: block;
|
|
25
|
+
width: var(--frost-unit);
|
|
26
|
+
height: var(--frost-unit);
|
|
27
|
+
}
|
|
28
|
+
.frost__indicator--spinner {
|
|
29
|
+
border: 0.2rem solid;
|
|
30
|
+
border-right-color: transparent;
|
|
31
|
+
border-radius: 50%;
|
|
32
|
+
animation: frost-spin 0.8s linear infinite;
|
|
33
|
+
}
|
|
34
|
+
.frost__indicator--dots {
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
justify-content: center;
|
|
38
|
+
gap: calc(var(--frost-unit) / 6);
|
|
39
|
+
}
|
|
40
|
+
.frost__indicator--dots > span {
|
|
41
|
+
flex: 0 0 25%;
|
|
42
|
+
aspect-ratio: 1;
|
|
43
|
+
border-radius: 50%;
|
|
44
|
+
background: currentColor;
|
|
45
|
+
animation: frost-pulse 0.9s ease-in-out infinite alternate;
|
|
46
|
+
}
|
|
47
|
+
.frost__indicator--dots > span:nth-child(2) { animation-delay: 0.15s; }
|
|
48
|
+
.frost__indicator--dots > span:nth-child(3) { animation-delay: 0.3s; }
|
|
49
|
+
.frost__indicator--bar {
|
|
50
|
+
width: calc(var(--frost-unit) * 2.5);
|
|
51
|
+
height: 0.35rem;
|
|
52
|
+
overflow: hidden;
|
|
53
|
+
border-radius: 1rem;
|
|
54
|
+
background: color-mix(in srgb, currentColor 18%, transparent);
|
|
55
|
+
}
|
|
56
|
+
.frost__indicator--bar::before {
|
|
57
|
+
content: "";
|
|
58
|
+
display: block;
|
|
59
|
+
height: 100%;
|
|
60
|
+
width: 45%;
|
|
61
|
+
border-radius: inherit;
|
|
62
|
+
background: currentColor;
|
|
63
|
+
animation: frost-slide 0.95s ease-in-out infinite alternate;
|
|
64
|
+
}
|
|
65
|
+
.frost__indicator--pulse {
|
|
66
|
+
border-radius: 50%;
|
|
67
|
+
background: currentColor;
|
|
68
|
+
animation: frost-pulse 0.85s ease-in-out infinite alternate;
|
|
69
|
+
}
|
|
70
|
+
.frost__indicator--material-circular {
|
|
71
|
+
animation: frost-spin 1.5s linear infinite;
|
|
72
|
+
}
|
|
73
|
+
.frost__indicator--material-circular > svg {
|
|
74
|
+
display: block;
|
|
75
|
+
width: 100%;
|
|
76
|
+
height: 100%;
|
|
77
|
+
}
|
|
78
|
+
.frost__indicator--material-circular circle {
|
|
79
|
+
fill: none;
|
|
80
|
+
stroke: currentColor;
|
|
81
|
+
stroke-width: 4;
|
|
82
|
+
stroke-linecap: round;
|
|
83
|
+
stroke-dasharray: 28 72;
|
|
84
|
+
animation: frost-arc 1.5s ease-in-out infinite;
|
|
85
|
+
}
|
|
86
|
+
.frost__indicator--material-linear {
|
|
87
|
+
position: absolute;
|
|
88
|
+
inset: 0 0 auto;
|
|
89
|
+
width: auto;
|
|
90
|
+
height: calc(var(--frost-unit) / 8);
|
|
91
|
+
overflow: hidden;
|
|
92
|
+
background: color-mix(in srgb, currentColor 18%, transparent);
|
|
93
|
+
}
|
|
94
|
+
.frost__indicator--material-linear::before,
|
|
95
|
+
.frost__indicator--material-linear::after {
|
|
96
|
+
content: "";
|
|
97
|
+
position: absolute;
|
|
98
|
+
inset-block: 0;
|
|
99
|
+
left: 0;
|
|
100
|
+
width: 42%;
|
|
101
|
+
border-radius: 999px;
|
|
102
|
+
background: currentColor;
|
|
103
|
+
animation: frost-sweep 1.9s cubic-bezier(0.4, 0, 0.2, 1) infinite;
|
|
104
|
+
}
|
|
105
|
+
.frost__indicator--material-linear::after {
|
|
106
|
+
width: 24%;
|
|
107
|
+
animation-delay: 0.65s;
|
|
108
|
+
}
|
|
109
|
+
.frost__indicator--skeleton {
|
|
110
|
+
display: flex;
|
|
111
|
+
flex-direction: column;
|
|
112
|
+
justify-content: space-between;
|
|
113
|
+
width: min(75%, calc(var(--frost-unit) * 4));
|
|
114
|
+
}
|
|
115
|
+
.frost__indicator--skeleton > span {
|
|
116
|
+
position: relative;
|
|
117
|
+
height: 22%;
|
|
118
|
+
overflow: hidden;
|
|
119
|
+
border-radius: 999px;
|
|
120
|
+
background: color-mix(in srgb, currentColor 16%, transparent);
|
|
121
|
+
}
|
|
122
|
+
.frost__indicator--skeleton > span:last-child { width: 62%; }
|
|
123
|
+
.frost__indicator--skeleton > span::after {
|
|
124
|
+
content: "";
|
|
125
|
+
position: absolute;
|
|
126
|
+
inset: 0;
|
|
127
|
+
background: linear-gradient(90deg, transparent, color-mix(in srgb, currentColor 22%, transparent), transparent);
|
|
128
|
+
animation: frost-shimmer 1.45s ease-in-out infinite;
|
|
129
|
+
}
|
|
130
|
+
@keyframes frost-spin { to { transform: rotate(1turn); } }
|
|
131
|
+
@keyframes frost-pulse { from { opacity: 0.4; transform: scale(0.65); } }
|
|
132
|
+
@keyframes frost-slide { to { transform: translateX(122%); } }
|
|
133
|
+
@keyframes frost-arc {
|
|
134
|
+
from { stroke-dasharray: 5 95; stroke-dashoffset: 0; }
|
|
135
|
+
50% { stroke-dasharray: 72 28; stroke-dashoffset: -18; }
|
|
136
|
+
to { stroke-dasharray: 5 95; stroke-dashoffset: -100; }
|
|
137
|
+
}
|
|
138
|
+
@keyframes frost-sweep {
|
|
139
|
+
from { left: 0; transform: translateX(-100%) scaleX(0.55); }
|
|
140
|
+
45% { transform: translateX(0) scaleX(1); }
|
|
141
|
+
85%, to { left: 100%; transform: translateX(0) scaleX(0.55); }
|
|
142
|
+
}
|
|
143
|
+
@keyframes frost-shimmer {
|
|
144
|
+
from { transform: translateX(-100%); }
|
|
145
|
+
to { transform: translateX(100%); }
|
|
146
|
+
}
|
|
147
|
+
@supports (color: light-dark(#000, #fff)) {
|
|
148
|
+
.frost {
|
|
149
|
+
--frost-solid: light-dark(#f5f7ff, #151627);
|
|
150
|
+
--frost-tint: light-dark(rgb(245 247 255 / 65%), rgb(21 22 39 / 66%));
|
|
151
|
+
color: var(--frost-color, light-dark(#3431a6, #c5c3ff));
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
|
|
155
|
+
.frost {
|
|
156
|
+
background: var(--frost-backdrop, var(--frost-tint));
|
|
157
|
+
-webkit-backdrop-filter: blur(var(--frost-blur, 8px));
|
|
158
|
+
backdrop-filter: blur(var(--frost-blur, 8px));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
@media (prefers-reduced-motion: reduce) {
|
|
162
|
+
.frost__indicator,
|
|
163
|
+
.frost__indicator > span,
|
|
164
|
+
.frost__indicator::before,
|
|
165
|
+
.frost__indicator::after,
|
|
166
|
+
.frost__indicator--material-circular circle { animation: none; }
|
|
167
|
+
.frost__indicator--material-linear::before { left: 29%; }
|
|
168
|
+
.frost__indicator--material-linear::after,
|
|
169
|
+
.frost__indicator--skeleton > span::after { display: none; }
|
|
170
|
+
}
|
package/dist/vue.cjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunk4YG4GVLNcjs = require('./chunk-4YG4GVLN.cjs');
|
|
4
|
+
|
|
5
|
+
// src/vue.ts
|
|
6
|
+
var releases = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
function sync(el, value) {
|
|
8
|
+
const loading = typeof value === "object" ? value.loading : value;
|
|
9
|
+
const done = releases.get(el);
|
|
10
|
+
if (loading && !done) {
|
|
11
|
+
releases.set(el, _chunk4YG4GVLNcjs.show.call(void 0, el, typeof value === "object" ? value : void 0));
|
|
12
|
+
} else if (!loading && done) {
|
|
13
|
+
releases.delete(el);
|
|
14
|
+
done();
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
var vFrost = {
|
|
18
|
+
mounted: (el, { value }) => sync(el, value),
|
|
19
|
+
updated: (el, { value }) => sync(el, value),
|
|
20
|
+
beforeUnmount: (el) => sync(el, false)
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
exports.vFrost = vFrost;
|
package/dist/vue.d.cts
ADDED
package/dist/vue.d.ts
ADDED
package/dist/vue.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
show
|
|
3
|
+
} from "./chunk-M4BLR4QM.js";
|
|
4
|
+
|
|
5
|
+
// src/vue.ts
|
|
6
|
+
var releases = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
function sync(el, value) {
|
|
8
|
+
const loading = typeof value === "object" ? value.loading : value;
|
|
9
|
+
const done = releases.get(el);
|
|
10
|
+
if (loading && !done) {
|
|
11
|
+
releases.set(el, show(el, typeof value === "object" ? value : void 0));
|
|
12
|
+
} else if (!loading && done) {
|
|
13
|
+
releases.delete(el);
|
|
14
|
+
done();
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
var vFrost = {
|
|
18
|
+
mounted: (el, { value }) => sync(el, value),
|
|
19
|
+
updated: (el, { value }) => sync(el, value),
|
|
20
|
+
beforeUnmount: (el) => sync(el, false)
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
vFrost
|
|
24
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,75 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@karan4/frostjs",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Element and full-page loading overlays that follow async work.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"keywords": ["loading", "loader", "overlay", "mask", "spinner", "skeleton", "fetch", "axios", "react", "vue", "angular"],
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"author": "Karan",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/karan4/FrostJS.git"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://github.com/karan4/FrostJS#readme",
|
|
14
|
+
"bugs": { "url": "https://github.com/karan4/FrostJS/issues" },
|
|
15
|
+
"main": "./dist/index.cjs",
|
|
16
|
+
"module": "./dist/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"import": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
|
|
21
|
+
"require": { "types": "./dist/index.d.cts", "default": "./dist/index.cjs" }
|
|
22
|
+
},
|
|
23
|
+
"./angular": {
|
|
24
|
+
"import": { "types": "./dist/angular.d.ts", "default": "./dist/angular.js" },
|
|
25
|
+
"require": { "types": "./dist/angular.d.cts", "default": "./dist/angular.cjs" }
|
|
26
|
+
},
|
|
27
|
+
"./react": {
|
|
28
|
+
"import": { "types": "./dist/react.d.ts", "default": "./dist/react.js" },
|
|
29
|
+
"require": { "types": "./dist/react.d.cts", "default": "./dist/react.cjs" }
|
|
30
|
+
},
|
|
31
|
+
"./vue": {
|
|
32
|
+
"import": { "types": "./dist/vue.d.ts", "default": "./dist/vue.js" },
|
|
33
|
+
"require": { "types": "./dist/vue.d.cts", "default": "./dist/vue.cjs" }
|
|
34
|
+
},
|
|
35
|
+
"./style.css": "./dist/style.css"
|
|
36
|
+
},
|
|
37
|
+
"files": ["dist"],
|
|
38
|
+
"sideEffects": ["**/*.css"],
|
|
39
|
+
"engines": { "node": ">=18" },
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "tsup && cp src/style.css dist/style.css",
|
|
42
|
+
"lint": "tsc --noEmit",
|
|
43
|
+
"test": "vitest run",
|
|
44
|
+
"demo": "vite"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"@angular/common": ">=17",
|
|
48
|
+
"@angular/core": ">=17",
|
|
49
|
+
"react": ">=18",
|
|
50
|
+
"rxjs": ">=7",
|
|
51
|
+
"vue": ">=3"
|
|
52
|
+
},
|
|
53
|
+
"peerDependenciesMeta": {
|
|
54
|
+
"@angular/common": { "optional": true },
|
|
55
|
+
"@angular/core": { "optional": true },
|
|
56
|
+
"react": { "optional": true },
|
|
57
|
+
"rxjs": { "optional": true },
|
|
58
|
+
"vue": { "optional": true }
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@angular/common": "^20.0.0",
|
|
62
|
+
"@angular/compiler": "^20.0.0",
|
|
63
|
+
"@angular/core": "^20.0.0",
|
|
64
|
+
"@types/node": "^22.0.0",
|
|
65
|
+
"@types/react": "^19.0.0",
|
|
66
|
+
"jsdom": "^26.0.0",
|
|
67
|
+
"react": "^19.0.0",
|
|
68
|
+
"rxjs": "^7.8.0",
|
|
69
|
+
"tsup": "^9.0.0",
|
|
70
|
+
"typescript": "~5.8.3",
|
|
71
|
+
"vite": "^8.4.1",
|
|
72
|
+
"vitest": "^5.1.2",
|
|
73
|
+
"vue": "^3.5.0"
|
|
74
|
+
}
|
|
75
|
+
}
|