hero-animate 1.0.0 → 1.0.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 +15 -0
- package/dist/{heroTransition-CND4UQtc.js → heroTransition-KNWyrgvQ.js} +6 -6
- package/dist/index.js +1 -1
- package/dist/react.js +44 -43
- package/dist/vue.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -215,6 +215,21 @@ npm publish # 发布(prepublishOnly 会自动构建)
|
|
|
215
215
|
|
|
216
216
|
文档站通过 [deploy-docs.yml](./.github/workflows/deploy-docs.yml) 在 push 到 `main` 时自动发布到 GitHub Pages。首次部署前需在仓库 **Settings → Pages → Build and deployment** 将 Source 设为 **GitHub Actions**(`GITHUB_TOKEN` 无权自动创建 Pages 站点)。
|
|
217
217
|
|
|
218
|
+
### 发布 Release
|
|
219
|
+
|
|
220
|
+
版本号以 `package.json` 为准,推送 `v*` tag 即触发 [release.yml](./.github/workflows/release.yml):
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
npm version patch # 或 minor / major,自动提交并创建 vX.Y.Z tag
|
|
224
|
+
git push --follow-tags # 推送提交与 tag
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
工作流会校验 tag 与 `package.json` 版本一致、构建 `dist/`、执行 `npm pack`,并用自动生成的 release notes 创建 GitHub Release,同时附上打包好的 `.tgz`。需要发布到 npm 时再执行:
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
npm publish
|
|
231
|
+
```
|
|
232
|
+
|
|
218
233
|
## License
|
|
219
234
|
|
|
220
235
|
[MIT](./LICENSE) © SinJayXie
|
|
@@ -125,8 +125,8 @@ function b(t, r = {}) {
|
|
|
125
125
|
e instanceof HTMLInputElement && n instanceof HTMLInputElement && (n.checked = e.checked, n.indeterminate = e.indeterminate), n.value !== e.value && (n.value = e.value);
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
|
-
function z(e) {
|
|
129
|
-
e.style.removeProperty("transform"), e.style.removeProperty("transform-origin"), e.style.removeProperty("border-radius"), e.style.removeProperty("opacity");
|
|
128
|
+
function z(e, t = !1) {
|
|
129
|
+
e.style.removeProperty("transform"), e.style.removeProperty("transform-origin"), e.style.removeProperty("border-radius"), t ? e.style.opacity = "0" : e.style.removeProperty("opacity");
|
|
130
130
|
}
|
|
131
131
|
function B(t, r) {
|
|
132
132
|
let i = t, s = N(t);
|
|
@@ -231,13 +231,13 @@ function b(t, r = {}) {
|
|
|
231
231
|
x?.cancel(), b++, P(), s && z(s), o && (i.style.removeProperty("background-color"), i.style.removeProperty("backdrop-filter"), i.style.removeProperty("opacity"), i.style.pointerEvents = "none");
|
|
232
232
|
let d = o ? y(i) : v;
|
|
233
233
|
if (c() || !s) {
|
|
234
|
-
u();
|
|
234
|
+
s && (s.style.opacity = "0"), u();
|
|
235
235
|
return;
|
|
236
236
|
}
|
|
237
237
|
let p = s.getBoundingClientRect(), m = F();
|
|
238
238
|
if (!m) {
|
|
239
239
|
x = e({ onComplete: () => {
|
|
240
|
-
z(s), u();
|
|
240
|
+
z(s, !0), u();
|
|
241
241
|
} }), x.add(s, {
|
|
242
242
|
scaleX: [1, a.dismiss],
|
|
243
243
|
scaleY: [1, a.dismiss],
|
|
@@ -259,7 +259,7 @@ function b(t, r = {}) {
|
|
|
259
259
|
width: p.width,
|
|
260
260
|
height: p.height
|
|
261
261
|
}, 2), R(s, S), S.style.borderRadius = `${A}px`, l ? (s.style.opacity = "0", x = e({ onComplete: () => {
|
|
262
|
-
P(), z(s), u();
|
|
262
|
+
P(), z(s, !0), u();
|
|
263
263
|
} }), o && x.add(i, {
|
|
264
264
|
opacity: 0,
|
|
265
265
|
duration: n.panel,
|
|
@@ -277,7 +277,7 @@ function b(t, r = {}) {
|
|
|
277
277
|
duration: n.panel,
|
|
278
278
|
ease: f
|
|
279
279
|
}, 0)) : (C = L(t, w ?? s, m, 1), C.style.transform = `translate(${-E}px, ${-D}px) scale(${1 / h}, ${1 / T})`, C.style.opacity = "0", s.style.opacity = "0", x = e({ onComplete: () => {
|
|
280
|
-
P(), z(s), u();
|
|
280
|
+
P(), z(s, !0), u();
|
|
281
281
|
} }), o && x.add(i, {
|
|
282
282
|
backgroundColor: [_, g],
|
|
283
283
|
backdropFilter: [d, v],
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { i as SPRING_PARAMS, t as createDialogHero, n as createHeroTransition, r as installModalSourceTracking } from "./heroTransition-
|
|
1
|
+
export { i as SPRING_PARAMS, t as createDialogHero, n as createHeroTransition, r as installModalSourceTracking } from "./heroTransition-KNWyrgvQ.js";
|
package/dist/react.js
CHANGED
|
@@ -1,64 +1,65 @@
|
|
|
1
|
-
import { n as e } from "./heroTransition-
|
|
2
|
-
import { useEffect as t,
|
|
3
|
-
import { jsx as
|
|
1
|
+
import { n as e } from "./heroTransition-KNWyrgvQ.js";
|
|
2
|
+
import { useEffect as t, useLayoutEffect as n, useMemo as r, useRef as i, useState as a } from "react";
|
|
3
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
4
4
|
// lib/react.tsx
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
var s = typeof window < "u" ? n : t;
|
|
6
|
+
function c({ open: n, masked: c = !0, ghostOnly: l = !1, panelSelector: u = ".modal-panel", anchor: d, spring: f, springAccel: p, onEntered: m, onExited: h, className: g, style: _, children: v }) {
|
|
7
|
+
let [y, b] = a(n), x = i(null), S = i("closed"), C = i(0), w = i(d), T = i(m), E = i(h);
|
|
8
|
+
s(() => {
|
|
9
|
+
w.current = d, T.current = m, E.current = h;
|
|
9
10
|
});
|
|
10
|
-
let
|
|
11
|
-
masked:
|
|
12
|
-
ghostOnly:
|
|
13
|
-
panelSelector:
|
|
14
|
-
anchor: () =>
|
|
15
|
-
spring:
|
|
16
|
-
springAccel:
|
|
11
|
+
let D = JSON.stringify(f ?? null), O = JSON.stringify(p ?? null), k = r(() => e((e) => e instanceof HTMLElement ? e.querySelector(u) : null, {
|
|
12
|
+
masked: c,
|
|
13
|
+
ghostOnly: l,
|
|
14
|
+
panelSelector: u,
|
|
15
|
+
anchor: () => w.current?.() ?? null,
|
|
16
|
+
spring: f,
|
|
17
|
+
springAccel: p
|
|
17
18
|
}), [
|
|
18
|
-
s,
|
|
19
19
|
c,
|
|
20
20
|
l,
|
|
21
|
-
|
|
22
|
-
D
|
|
21
|
+
u,
|
|
22
|
+
D,
|
|
23
|
+
O
|
|
23
24
|
]);
|
|
24
|
-
return
|
|
25
|
-
if (
|
|
26
|
-
if (!
|
|
27
|
-
|
|
25
|
+
return s(() => {
|
|
26
|
+
if (n) {
|
|
27
|
+
if (!y) {
|
|
28
|
+
b(!0);
|
|
28
29
|
return;
|
|
29
30
|
}
|
|
30
|
-
let e =
|
|
31
|
+
let e = x.current;
|
|
31
32
|
if (!e) return;
|
|
32
|
-
let t =
|
|
33
|
+
let t = S.current;
|
|
33
34
|
if (t === "entering" || t === "open") return;
|
|
34
|
-
let n = ++
|
|
35
|
-
|
|
36
|
-
n ===
|
|
35
|
+
let n = ++C.current;
|
|
36
|
+
S.current = "entering", k.onEnter(e, () => {
|
|
37
|
+
n === C.current && (S.current = "open", T.current?.());
|
|
37
38
|
});
|
|
38
39
|
return;
|
|
39
40
|
}
|
|
40
|
-
if (!
|
|
41
|
-
let e =
|
|
41
|
+
if (!y) return;
|
|
42
|
+
let e = x.current;
|
|
42
43
|
if (!e) {
|
|
43
|
-
|
|
44
|
+
b(!1);
|
|
44
45
|
return;
|
|
45
46
|
}
|
|
46
|
-
if (
|
|
47
|
-
let t = ++
|
|
48
|
-
|
|
49
|
-
t ===
|
|
47
|
+
if (S.current === "leaving") return;
|
|
48
|
+
let t = ++C.current;
|
|
49
|
+
S.current = "leaving", k.onLeave(e, () => {
|
|
50
|
+
t === C.current && (S.current = "closed", b(!1), E.current?.());
|
|
50
51
|
});
|
|
51
52
|
}, [
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
n,
|
|
54
|
+
y,
|
|
55
|
+
k
|
|
55
56
|
]), t(() => () => {
|
|
56
|
-
|
|
57
|
-
}, [
|
|
58
|
-
ref:
|
|
59
|
-
className:
|
|
60
|
-
style:
|
|
61
|
-
children:
|
|
57
|
+
C.current++, S.current = "closed", k.cancel();
|
|
58
|
+
}, [k]), y ? /* @__PURE__ */ o("div", {
|
|
59
|
+
ref: x,
|
|
60
|
+
className: g,
|
|
61
|
+
style: _,
|
|
62
|
+
children: v
|
|
62
63
|
}) : null;
|
|
63
64
|
}
|
|
64
|
-
export {
|
|
65
|
+
export { c as HeroTransition };
|
package/dist/vue.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as e } from "./heroTransition-
|
|
1
|
+
import { n as e } from "./heroTransition-KNWyrgvQ.js";
|
|
2
2
|
import "./index.js";
|
|
3
3
|
import { defineComponent as t, h as n, nextTick as r, onBeforeUnmount as i, onMounted as a, ref as o, watch as s } from "vue";
|
|
4
4
|
// lib/vue.ts
|