@ssgoi/react 4.2.0 → 4.2.1

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.
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),r=require("react"),q=require("./transition.cjs"),b=require("./context.cjs"),o=require("./utils.cjs"),T=({children:c,id:i,as:u,className:l,...f})=>{const{getTransition:a,getInitialStyle:R}=b.useSsgoi(),S=u||"div",t=r.useRef(null),s=r.useRef(!0),e=r.useRef(null);e.current===null&&(e.current=R());let n;s.current?n=e.current:t.current&&e.current&&(n=o.forkStyleFromElement(t.current,e.current));const g=q.transition(a(i)),m=o.combineRefs(y=>{t.current=y,s.current=!1},g);return d.jsx(S,{ref:m,"data-ssgoi-transition":i,className:l,style:n,...f,children:c})};exports.SsgoiTransition=T;
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("react/jsx-runtime"),e=require("react"),T=require("./transition.cjs"),j=require("./context.cjs"),f=require("./utils.cjs"),x=({children:a,id:s,as:R,className:m,...g})=>{const{getTransition:S,getInitialStyle:y}=j.useSsgoi(),b=R||"div",n=e.useRef(null),i=e.useRef(!0),t=e.useRef(null);t.current===null&&(t.current=y());let r;i.current?r=t.current:n.current&&t.current&&(r=f.forkStyleFromElement(n.current,t.current));const o=e.useCallback(l=>{n.current=l,l&&(i.current=!1)},[]),c=S(s),u=e.useMemo(()=>T.transition(c),[c]),d=e.useMemo(()=>f.combineRefs(o,u),[o,u]);return q.jsx(b,{ref:d,"data-ssgoi-transition":s,className:m,style:r,...g,children:a})};exports.SsgoiTransition=x;
@@ -1,38 +1,44 @@
1
1
  "use client";
2
- import { jsx as g } from "react/jsx-runtime";
3
- import { useRef as n } from "react";
4
- import { transition as y } from "./transition.js";
5
- import { useSsgoi as d } from "./context.js";
6
- import { forkStyleFromElement as b, combineRefs as x } from "./utils.js";
7
- const C = ({
8
- children: s,
2
+ import { jsx as d } from "react/jsx-runtime";
3
+ import { useRef as r, useCallback as C, useMemo as u } from "react";
4
+ import { transition as k } from "./transition.js";
5
+ import { useSsgoi as x } from "./context.js";
6
+ import { forkStyleFromElement as E, combineRefs as F } from "./utils.js";
7
+ const h = ({
8
+ children: m,
9
9
  id: o,
10
- as: c,
11
- className: f,
12
- ...l
10
+ as: a,
11
+ className: R,
12
+ ...p
13
13
  }) => {
14
- const { getTransition: u, getInitialStyle: m } = d(), a = c || "div", r = n(null), i = n(!0), t = n(null);
15
- t.current === null && (t.current = m());
16
- let e;
17
- i.current ? e = t.current : r.current && t.current && (e = b(
18
- r.current,
14
+ const { getTransition: g, getInitialStyle: S } = x(), y = a || "div", e = r(null), i = r(!0), t = r(null);
15
+ t.current === null && (t.current = S());
16
+ let n;
17
+ i.current ? n = t.current : e.current && t.current && (n = E(
18
+ e.current,
19
19
  t.current
20
20
  ));
21
- const R = y(u(o)), p = x((S) => {
22
- r.current = S, i.current = !1;
23
- }, R);
24
- return /* @__PURE__ */ g(
25
- a,
21
+ const s = C((l) => {
22
+ e.current = l, l && (i.current = !1);
23
+ }, []), c = g(o), f = u(
24
+ () => k(c),
25
+ [c]
26
+ ), b = u(
27
+ () => F(s, f),
28
+ [s, f]
29
+ );
30
+ return /* @__PURE__ */ d(
31
+ y,
26
32
  {
27
- ref: p,
33
+ ref: b,
28
34
  "data-ssgoi-transition": o,
29
- className: f,
30
- style: e,
31
- ...l,
32
- children: s
35
+ className: R,
36
+ style: n,
37
+ ...p,
38
+ children: m
33
39
  }
34
40
  );
35
41
  };
36
42
  export {
37
- C as SsgoiTransition
43
+ h as SsgoiTransition
38
44
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ssgoi/react",
3
- "version": "4.2.0",
3
+ "version": "4.2.1",
4
4
  "description": "React bindings for SSGOI - Native app-like page transitions for React applications",
5
5
  "private": false,
6
6
  "type": "module",