@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
|
|
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
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { transition as
|
|
5
|
-
import { useSsgoi as
|
|
6
|
-
import { forkStyleFromElement as
|
|
7
|
-
const
|
|
8
|
-
children:
|
|
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:
|
|
11
|
-
className:
|
|
12
|
-
...
|
|
10
|
+
as: a,
|
|
11
|
+
className: R,
|
|
12
|
+
...p
|
|
13
13
|
}) => {
|
|
14
|
-
const { getTransition:
|
|
15
|
-
t.current === null && (t.current =
|
|
16
|
-
let
|
|
17
|
-
i.current ?
|
|
18
|
-
|
|
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
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
|
|
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:
|
|
33
|
+
ref: b,
|
|
28
34
|
"data-ssgoi-transition": o,
|
|
29
|
-
className:
|
|
30
|
-
style:
|
|
31
|
-
...
|
|
32
|
-
children:
|
|
35
|
+
className: R,
|
|
36
|
+
style: n,
|
|
37
|
+
...p,
|
|
38
|
+
children: m
|
|
33
39
|
}
|
|
34
40
|
);
|
|
35
41
|
};
|
|
36
42
|
export {
|
|
37
|
-
|
|
43
|
+
h as SsgoiTransition
|
|
38
44
|
};
|