@ceed/ads 1.41.2 → 1.41.3-next.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.
@@ -0,0 +1,22 @@
1
+ import type React from 'react';
2
+ /**
3
+ * 여러 ref를 하나로 합친다.
4
+ * 살아있는 ref가 하나뿐이면 그 ref를 그대로 돌려주어 identity를 유지한다(매 렌더 재부착 방지).
5
+ * 둘 이상이면 새 클로저가 나오므로, 렌더 중에 쓸 때는 `useMergedRef`로 감싸 identity를 고정해야 한다.
6
+ */
7
+ export declare function mergeRefs<T>(...refs: (React.Ref<T> | undefined)[]): React.Ref<T> | undefined;
8
+ /**
9
+ * `mergeRefs`를 두 ref의 identity 기준으로 memo한다.
10
+ * memo하지 않으면 합친 ref가 매 렌더 새 함수가 되어 React가 ref를 떼고 다시 붙인다.
11
+ * 이때 콜백 ref는 렌더마다 `null`로 한 번 호출되므로 `(el) => el.offsetHeight` 같은 콜백이 터진다.
12
+ */
13
+ export declare function useMergedRef<T>(a: React.Ref<T> | undefined, b: React.Ref<T> | undefined): React.Ref<T> | undefined;
14
+ /**
15
+ * slotProps의 특정 슬롯에 ref를 주입한다.
16
+ * Joy의 slotProps 값은 객체이거나 ownerState를 받는 함수라 두 형태를 모두 보존한다.
17
+ * 호출자가 이미 슬롯에 ref를 넘겼다면 덮어쓰지 않고 합친다.
18
+ *
19
+ * 객체 형태는 `useMergedRef`로 ref identity를 고정한다. 함수 형태는 Joy가 렌더마다 다시 호출해
20
+ * 새 객체를 돌려주므로 고정할 방법이 없다 — 함수형 slotProps에 콜백 ref를 넣는 건 피해야 한다.
21
+ */
22
+ export declare function useSlotRef<S>(slotProp: S, ref: React.Ref<any>): S;