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 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-CND4UQtc.js";
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-CND4UQtc.js";
2
- import { useEffect as t, useMemo as n, useRef as r, useState as i } from "react";
3
- import { jsx as a } from "react/jsx-runtime";
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
- function o({ open: o, masked: s = !0, ghostOnly: c = !1, panelSelector: l = ".modal-panel", anchor: u, spring: d, springAccel: f, onEntered: p, onExited: m, className: h, style: g, children: _ }) {
6
- let [v, y] = i(o), b = r(null), x = r("closed"), S = r(0), C = r(u), w = r(p), T = r(m);
7
- t(() => {
8
- C.current = u, w.current = p, T.current = m;
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 E = JSON.stringify(d ?? null), D = JSON.stringify(f ?? null), O = n(() => e((e) => e instanceof HTMLElement ? e.querySelector(l) : null, {
11
- masked: s,
12
- ghostOnly: c,
13
- panelSelector: l,
14
- anchor: () => C.current?.() ?? null,
15
- spring: d,
16
- springAccel: f
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
- E,
22
- D
21
+ u,
22
+ D,
23
+ O
23
24
  ]);
24
- return t(() => {
25
- if (o) {
26
- if (!v) {
27
- y(!0);
25
+ return s(() => {
26
+ if (n) {
27
+ if (!y) {
28
+ b(!0);
28
29
  return;
29
30
  }
30
- let e = b.current;
31
+ let e = x.current;
31
32
  if (!e) return;
32
- let t = x.current;
33
+ let t = S.current;
33
34
  if (t === "entering" || t === "open") return;
34
- let n = ++S.current;
35
- x.current = "entering", O.onEnter(e, () => {
36
- n === S.current && (x.current = "open", w.current?.());
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 (!v) return;
41
- let e = b.current;
41
+ if (!y) return;
42
+ let e = x.current;
42
43
  if (!e) {
43
- y(!1);
44
+ b(!1);
44
45
  return;
45
46
  }
46
- if (x.current === "leaving") return;
47
- let t = ++S.current;
48
- x.current = "leaving", O.onLeave(e, () => {
49
- t === S.current && (x.current = "closed", y(!1), T.current?.());
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
- o,
53
- v,
54
- O
53
+ n,
54
+ y,
55
+ k
55
56
  ]), t(() => () => {
56
- S.current++, x.current = "closed", O.cancel();
57
- }, [O]), v ? /* @__PURE__ */ a("div", {
58
- ref: b,
59
- className: h,
60
- style: g,
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 { o as HeroTransition };
65
+ export { c as HeroTransition };
package/dist/vue.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as e } from "./heroTransition-CND4UQtc.js";
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hero-animate",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "type": "module",
5
5
  "description": "iOS 风格「图标 ⇄ 窗口」形变转场,框架无关核心 + Vue/React 组件",
6
6
  "author": "SinJayXie",