@tanstack/redact 0.0.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.
Files changed (233) hide show
  1. package/dist/core/index.d.ts +2 -0
  2. package/dist/core/index.js +4 -0
  3. package/dist/core/index.js.map +7 -0
  4. package/dist/core/internal.d.ts +76 -0
  5. package/dist/core/internal.js +59 -0
  6. package/dist/core/internal.js.map +7 -0
  7. package/dist/core/types.d.ts +21 -0
  8. package/dist/core/types.js +10 -0
  9. package/dist/core/types.js.map +7 -0
  10. package/dist/dom/_all.d.ts +17 -0
  11. package/dist/dom/_all.js +51 -0
  12. package/dist/dom/_all.js.map +7 -0
  13. package/dist/dom/client.d.ts +3 -0
  14. package/dist/dom/client.js +8 -0
  15. package/dist/dom/client.js.map +7 -0
  16. package/dist/dom/dispatcher.d.ts +20 -0
  17. package/dist/dom/dispatcher.js +267 -0
  18. package/dist/dom/dispatcher.js.map +7 -0
  19. package/dist/dom/dom.d.ts +10 -0
  20. package/dist/dom/dom.js +262 -0
  21. package/dist/dom/dom.js.map +7 -0
  22. package/dist/dom/event-replay.d.ts +13 -0
  23. package/dist/dom/event-replay.js +46 -0
  24. package/dist/dom/event-replay.js.map +7 -0
  25. package/dist/dom/features/class/full.d.ts +1 -0
  26. package/dist/dom/features/class/full.js +91 -0
  27. package/dist/dom/features/class/full.js.map +7 -0
  28. package/dist/dom/features/class/index.d.ts +1 -0
  29. package/dist/dom/features/class/index.js +3 -0
  30. package/dist/dom/features/class/index.js.map +7 -0
  31. package/dist/dom/features/class/stub.d.ts +1 -0
  32. package/dist/dom/features/class/stub.js +50 -0
  33. package/dist/dom/features/class/stub.js.map +7 -0
  34. package/dist/dom/features/context/full.d.ts +1 -0
  35. package/dist/dom/features/context/full.js +49 -0
  36. package/dist/dom/features/context/full.js.map +7 -0
  37. package/dist/dom/features/context/index.d.ts +1 -0
  38. package/dist/dom/features/context/index.js +3 -0
  39. package/dist/dom/features/context/index.js.map +7 -0
  40. package/dist/dom/features/context/stub.d.ts +1 -0
  41. package/dist/dom/features/context/stub.js +22 -0
  42. package/dist/dom/features/context/stub.js.map +7 -0
  43. package/dist/dom/features/forward-ref/full.d.ts +1 -0
  44. package/dist/dom/features/forward-ref/full.js +51 -0
  45. package/dist/dom/features/forward-ref/full.js.map +7 -0
  46. package/dist/dom/features/forward-ref/index.d.ts +1 -0
  47. package/dist/dom/features/forward-ref/index.js +3 -0
  48. package/dist/dom/features/forward-ref/index.js.map +7 -0
  49. package/dist/dom/features/forward-ref/stub.d.ts +1 -0
  50. package/dist/dom/features/forward-ref/stub.js +22 -0
  51. package/dist/dom/features/forward-ref/stub.js.map +7 -0
  52. package/dist/dom/features/hydration/full.d.ts +61 -0
  53. package/dist/dom/features/hydration/full.js +264 -0
  54. package/dist/dom/features/hydration/full.js.map +7 -0
  55. package/dist/dom/features/hydration/index.d.ts +1 -0
  56. package/dist/dom/features/hydration/index.js +3 -0
  57. package/dist/dom/features/hydration/index.js.map +7 -0
  58. package/dist/dom/features/hydration/stub.d.ts +28 -0
  59. package/dist/dom/features/hydration/stub.js +66 -0
  60. package/dist/dom/features/hydration/stub.js.map +7 -0
  61. package/dist/dom/features/index.d.ts +7 -0
  62. package/dist/dom/features/index.js +9 -0
  63. package/dist/dom/features/index.js.map +7 -0
  64. package/dist/dom/features/lazy/full.d.ts +1 -0
  65. package/dist/dom/features/lazy/full.js +78 -0
  66. package/dist/dom/features/lazy/full.js.map +7 -0
  67. package/dist/dom/features/lazy/index.d.ts +1 -0
  68. package/dist/dom/features/lazy/index.js +3 -0
  69. package/dist/dom/features/lazy/index.js.map +7 -0
  70. package/dist/dom/features/lazy/stub.d.ts +1 -0
  71. package/dist/dom/features/lazy/stub.js +36 -0
  72. package/dist/dom/features/lazy/stub.js.map +7 -0
  73. package/dist/dom/features/memo/full.d.ts +1 -0
  74. package/dist/dom/features/memo/full.js +59 -0
  75. package/dist/dom/features/memo/full.js.map +7 -0
  76. package/dist/dom/features/memo/index.d.ts +1 -0
  77. package/dist/dom/features/memo/index.js +3 -0
  78. package/dist/dom/features/memo/index.js.map +7 -0
  79. package/dist/dom/features/memo/stub.d.ts +1 -0
  80. package/dist/dom/features/memo/stub.js +36 -0
  81. package/dist/dom/features/memo/stub.js.map +7 -0
  82. package/dist/dom/features/portal/full.d.ts +1 -0
  83. package/dist/dom/features/portal/full.js +19 -0
  84. package/dist/dom/features/portal/full.js.map +7 -0
  85. package/dist/dom/features/portal/index.d.ts +1 -0
  86. package/dist/dom/features/portal/index.js +3 -0
  87. package/dist/dom/features/portal/index.js.map +7 -0
  88. package/dist/dom/features/portal/stub.d.ts +1 -0
  89. package/dist/dom/features/portal/stub.js +7 -0
  90. package/dist/dom/features/portal/stub.js.map +7 -0
  91. package/dist/dom/features/suspense/full.d.ts +1 -0
  92. package/dist/dom/features/suspense/full.js +146 -0
  93. package/dist/dom/features/suspense/full.js.map +7 -0
  94. package/dist/dom/features/suspense/index.d.ts +1 -0
  95. package/dist/dom/features/suspense/index.js +3 -0
  96. package/dist/dom/features/suspense/index.js.map +7 -0
  97. package/dist/dom/features/suspense/stub.d.ts +1 -0
  98. package/dist/dom/features/suspense/stub.js +6 -0
  99. package/dist/dom/features/suspense/stub.js.map +7 -0
  100. package/dist/dom/index.d.ts +25 -0
  101. package/dist/dom/index.js +45 -0
  102. package/dist/dom/index.js.map +7 -0
  103. package/dist/dom/portal.d.ts +2 -0
  104. package/dist/dom/portal.js +15 -0
  105. package/dist/dom/portal.js.map +7 -0
  106. package/dist/dom/reconcile.d.ts +40 -0
  107. package/dist/dom/reconcile.js +795 -0
  108. package/dist/dom/reconcile.js.map +7 -0
  109. package/dist/dom/root.d.ts +15 -0
  110. package/dist/dom/root.js +85 -0
  111. package/dist/dom/root.js.map +7 -0
  112. package/dist/dom/test-utils.d.ts +1 -0
  113. package/dist/dom/test-utils.js +10 -0
  114. package/dist/dom/test-utils.js.map +7 -0
  115. package/dist/react/children.d.ts +8 -0
  116. package/dist/react/children.js +75 -0
  117. package/dist/react/children.js.map +7 -0
  118. package/dist/react/class.d.ts +31 -0
  119. package/dist/react/class.js +40 -0
  120. package/dist/react/class.js.map +7 -0
  121. package/dist/react/context.d.ts +27 -0
  122. package/dist/react/context.js +31 -0
  123. package/dist/react/context.js.map +7 -0
  124. package/dist/react/element.d.ts +10 -0
  125. package/dist/react/element.js +64 -0
  126. package/dist/react/element.js.map +7 -0
  127. package/dist/react/hooks.d.ts +37 -0
  128. package/dist/react/hooks.js +146 -0
  129. package/dist/react/hooks.js.map +7 -0
  130. package/dist/react/index.d.ts +76 -0
  131. package/dist/react/index.js +187 -0
  132. package/dist/react/index.js.map +7 -0
  133. package/dist/react/jsx-runtime.d.ts +5 -0
  134. package/dist/react/jsx-runtime.js +21 -0
  135. package/dist/react/jsx-runtime.js.map +7 -0
  136. package/dist/react/memo.d.ts +29 -0
  137. package/dist/react/memo.js +47 -0
  138. package/dist/react/memo.js.map +7 -0
  139. package/dist/react/portal.d.ts +1 -0
  140. package/dist/react/portal.js +6 -0
  141. package/dist/react/portal.js.map +7 -0
  142. package/dist/react/shared-internals.d.ts +33 -0
  143. package/dist/react/shared-internals.js +29 -0
  144. package/dist/react/shared-internals.js.map +7 -0
  145. package/dist/react/suspense.d.ts +15 -0
  146. package/dist/react/suspense.js +16 -0
  147. package/dist/react/suspense.js.map +7 -0
  148. package/dist/scheduler/index.d.ts +44 -0
  149. package/dist/scheduler/index.js +109 -0
  150. package/dist/scheduler/index.js.map +7 -0
  151. package/dist/server/bootstrap-script.d.ts +22 -0
  152. package/dist/server/bootstrap-script.js +16 -0
  153. package/dist/server/bootstrap-script.js.map +7 -0
  154. package/dist/server/dispatcher.d.ts +37 -0
  155. package/dist/server/dispatcher.js +140 -0
  156. package/dist/server/dispatcher.js.map +7 -0
  157. package/dist/server/escape.d.ts +7 -0
  158. package/dist/server/escape.js +159 -0
  159. package/dist/server/escape.js.map +7 -0
  160. package/dist/server/index.d.ts +16 -0
  161. package/dist/server/index.js +26 -0
  162. package/dist/server/index.js.map +7 -0
  163. package/dist/server/renderToString.d.ts +7 -0
  164. package/dist/server/renderToString.js +29 -0
  165. package/dist/server/renderToString.js.map +7 -0
  166. package/dist/server/stream.d.ts +40 -0
  167. package/dist/server/stream.js +200 -0
  168. package/dist/server/stream.js.map +7 -0
  169. package/dist/server/walk.d.ts +33 -0
  170. package/dist/server/walk.js +298 -0
  171. package/dist/server/walk.js.map +7 -0
  172. package/dist/vite/index.d.ts +96 -0
  173. package/dist/vite/index.js +217 -0
  174. package/dist/vite/index.js.map +7 -0
  175. package/package.json +83 -0
  176. package/src/core/index.ts +2 -0
  177. package/src/core/internal.ts +107 -0
  178. package/src/core/types.ts +36 -0
  179. package/src/dom/_all.ts +54 -0
  180. package/src/dom/client.ts +4 -0
  181. package/src/dom/dispatcher.ts +318 -0
  182. package/src/dom/dom.ts +316 -0
  183. package/src/dom/event-replay.ts +55 -0
  184. package/src/dom/features/class/full.ts +104 -0
  185. package/src/dom/features/class/index.ts +1 -0
  186. package/src/dom/features/class/stub.ts +65 -0
  187. package/src/dom/features/context/full.ts +57 -0
  188. package/src/dom/features/context/index.ts +1 -0
  189. package/src/dom/features/context/stub.ts +32 -0
  190. package/src/dom/features/forward-ref/full.ts +54 -0
  191. package/src/dom/features/forward-ref/index.ts +1 -0
  192. package/src/dom/features/forward-ref/stub.ts +28 -0
  193. package/src/dom/features/hydration/full.ts +345 -0
  194. package/src/dom/features/hydration/index.ts +1 -0
  195. package/src/dom/features/hydration/stub.ts +72 -0
  196. package/src/dom/features/index.ts +11 -0
  197. package/src/dom/features/lazy/full.ts +98 -0
  198. package/src/dom/features/lazy/index.ts +1 -0
  199. package/src/dom/features/lazy/stub.ts +45 -0
  200. package/src/dom/features/memo/full.ts +74 -0
  201. package/src/dom/features/memo/index.ts +1 -0
  202. package/src/dom/features/memo/stub.ts +42 -0
  203. package/src/dom/features/portal/full.ts +22 -0
  204. package/src/dom/features/portal/index.ts +1 -0
  205. package/src/dom/features/portal/stub.ts +11 -0
  206. package/src/dom/features/suspense/full.ts +191 -0
  207. package/src/dom/features/suspense/index.ts +1 -0
  208. package/src/dom/features/suspense/stub.ts +12 -0
  209. package/src/dom/index.ts +33 -0
  210. package/src/dom/portal.ts +16 -0
  211. package/src/dom/reconcile.ts +1169 -0
  212. package/src/dom/root.ts +107 -0
  213. package/src/dom/test-utils.ts +6 -0
  214. package/src/react/children.ts +85 -0
  215. package/src/react/class.ts +56 -0
  216. package/src/react/context.ts +50 -0
  217. package/src/react/element.ts +80 -0
  218. package/src/react/hooks.ts +190 -0
  219. package/src/react/index.ts +132 -0
  220. package/src/react/jsx-runtime.ts +16 -0
  221. package/src/react/memo.ts +45 -0
  222. package/src/react/portal.ts +1 -0
  223. package/src/react/shared-internals.ts +79 -0
  224. package/src/react/suspense.ts +18 -0
  225. package/src/scheduler/index.ts +124 -0
  226. package/src/server/bootstrap-script.ts +52 -0
  227. package/src/server/dispatcher.ts +158 -0
  228. package/src/server/escape.ts +187 -0
  229. package/src/server/index.ts +26 -0
  230. package/src/server/renderToString.ts +33 -0
  231. package/src/server/stream.ts +302 -0
  232. package/src/server/walk.ts +448 -0
  233. package/src/vite/index.ts +401 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/react/element.ts"],
4
+ "sourcesContent": ["import {\n REACT_ELEMENT_TYPE,\n REACT_LEGACY_ELEMENT_TYPE,\n REACT_FRAGMENT_TYPE,\n type ReactElement,\n type ReactNode,\n} from '../core'\n\nexport const Fragment = REACT_FRAGMENT_TYPE as unknown as (props: {\n children?: ReactNode\n}) => ReactElement\n\nconst RESERVED_PROPS: Record<string, 1> = { key: 1, ref: 1, __self: 1, __source: 1 }\n\nexport function createElement(\n type: any,\n config: Record<string, any> | null,\n ...children: ReactNode[]\n): ReactElement {\n let key: string | null = null\n let ref: any = null\n const props: Record<string, any> = {}\n\n if (config != null) {\n if (config.key !== undefined && config.key !== null) key = '' + config.key\n if (config.ref !== undefined) ref = config.ref\n for (const k in config) {\n if (!RESERVED_PROPS[k] && Object.prototype.hasOwnProperty.call(config, k)) {\n props[k] = config[k]\n }\n }\n }\n\n if (children.length === 1) props.children = children[0]\n else if (children.length > 1) props.children = children\n\n if (type && type.defaultProps) {\n const dp = type.defaultProps\n for (const k in dp) {\n if (props[k] === undefined) props[k] = dp[k]\n }\n }\n\n return { $$typeof: REACT_ELEMENT_TYPE, type, key, ref, props }\n}\n\nexport function cloneElement(\n element: ReactElement,\n config: Record<string, any> | null,\n ...children: ReactNode[]\n): ReactElement {\n let key = element.key\n let ref = element.ref\n const props = { ...element.props }\n\n if (config != null) {\n if (config.ref !== undefined) ref = config.ref\n if (config.key !== undefined) key = '' + config.key\n const defaultProps = element.type?.defaultProps\n for (const k in config) {\n if (RESERVED_PROPS[k] || !Object.prototype.hasOwnProperty.call(config, k)) continue\n props[k] = config[k] === undefined && defaultProps ? defaultProps[k] : config[k]\n }\n }\n\n if (children.length === 1) props.children = children[0]\n else if (children.length > 1) props.children = children\n\n return { $$typeof: REACT_ELEMENT_TYPE, type: element.type, key, ref, props }\n}\n\nexport function isValidElement(obj: any): obj is ReactElement {\n if (typeof obj !== 'object' || obj === null) return false\n const t = obj.$$typeof\n return t === REACT_ELEMENT_TYPE || t === REACT_LEGACY_ELEMENT_TYPE\n}\n\nexport function createRef<T = any>() {\n return { current: null as T | null }\n}\n"],
5
+ "mappings": ";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AAEA,IAAM,WAAW;AAIxB,IAAM,iBAAoC,EAAE,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,UAAU,EAAE;AAE5E,SAAS,cACd,MACA,WACG,UACW;AACd,MAAI,MAAqB;AACzB,MAAI,MAAW;AACf,QAAM,QAA6B,CAAC;AAEpC,MAAI,UAAU,MAAM;AAClB,QAAI,OAAO,QAAQ,UAAa,OAAO,QAAQ,KAAM,OAAM,KAAK,OAAO;AACvE,QAAI,OAAO,QAAQ,OAAW,OAAM,O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AY,QAAQ,KAAM,QAAO;AACpD,QAAM,IAAI,IAAI;AACd,SAAO,MAAM,sBAAsB,MAAM;AAC3C;AAEO,SAAS,YAAqB;AACnC,SAAO,EAAE,SAAS,KAAiB;AACrC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,37 @@
1
+ import type { Dispatch, SetStateAction, EffectCallback, DependencyList } from '../core';
2
+ import type { Context } from './context';
3
+ export declare function useState<S>(initial: S | (() => S)): [S, Dispatch<SetStateAction<S>>];
4
+ export declare function useReducer<S, A>(reducer: (s: S, a: A) => S, initial: any, init?: (a: any) => S): [S, Dispatch<A>];
5
+ export declare function useEffect(create: EffectCallback, deps?: DependencyList): void;
6
+ export declare function useLayoutEffect(create: EffectCallback, deps?: DependencyList): void;
7
+ export declare function useInsertionEffect(create: EffectCallback, deps?: DependencyList): void;
8
+ export declare function useRef<T>(initial: T): {
9
+ current: T;
10
+ };
11
+ export declare function useRef<T>(initial: T | null): {
12
+ current: T | null;
13
+ };
14
+ export declare function useRef<T = undefined>(): {
15
+ current: T | undefined;
16
+ };
17
+ export declare function useMemo<T>(factory: () => T, deps?: DependencyList): T;
18
+ export declare function useCallback<T extends Function>(fn: T, deps?: DependencyList): T;
19
+ export declare function useContext<T>(ctx: Context<T>): T;
20
+ export declare function useImperativeHandle<T>(ref: any, factory: () => T, deps?: DependencyList): void;
21
+ export declare function useDebugValue<T>(value: T, formatter?: (v: T) => any): void;
22
+ export declare function useId(): string;
23
+ export declare function useTransition(): [boolean, (fn: () => void) => void];
24
+ export declare function useDeferredValue<T>(v: T): T;
25
+ export declare function useSyncExternalStore<T>(subscribe: (cb: () => void) => () => void, getSnapshot: () => T, getServerSnapshot?: () => T): T;
26
+ export declare function use<T>(resource: any): T;
27
+ export declare function startTransition(fn: () => void): void;
28
+ export declare function useActionState<S, P>(_action: (state: Awaited<S>, payload: P) => S | Promise<S>, initial: Awaited<S>): [Awaited<S>, (payload: P) => void, boolean];
29
+ export declare function useFormStatus(): {
30
+ pending: boolean;
31
+ data: any;
32
+ method: any;
33
+ action: any;
34
+ };
35
+ export declare function useOptimistic<S, A = S>(state: S, _updateFn?: (s: S, a: A) => S): [S, (action: A) => void];
36
+ export declare function useEffectEvent<Args extends unknown[], Return>(fn: (...args: Args) => Return): (...args: Args) => Return;
37
+ export declare function useSyncExternalStoreWithSelector<Snapshot, Selection>(subscribe: (cb: () => void) => () => void, getSnapshot: () => Snapshot, getServerSnapshot: (() => Snapshot) | undefined, selector: (snapshot: Snapshot) => Selection, isEqual?: (a: Selection, b: Selection) => boolean): Selection;
@@ -0,0 +1,146 @@
1
+ // packages/redact/src/react/hooks.ts
2
+ import { getDispatcher } from "./shared-internals";
3
+ function useState(initial) {
4
+ return getDispatcher().useState(initial);
5
+ }
6
+ function useReducer(reducer, initial, init) {
7
+ return getDispatcher().useReducer(reducer, initial, init);
8
+ }
9
+ function useEffect(create, deps) {
10
+ getDispatcher().useEffect(create, deps);
11
+ }
12
+ function useLayoutEffect(create, deps) {
13
+ getDispatcher().useLayoutEffect(create, deps);
14
+ }
15
+ function useInsertionEffect(create, deps) {
16
+ getDispatcher().useInsertionEffect(create, deps);
17
+ }
18
+ function useRef(initial) {
19
+ return getDispatcher().useRef(initial);
20
+ }
21
+ function useMemo(factory, deps) {
22
+ return getDispatcher().useMemo(factory, deps);
23
+ }
24
+ function useCallback(fn, deps) {
25
+ return getDispatcher().useCallback(fn, deps);
26
+ }
27
+ function useContext(ctx) {
28
+ return getDispatcher().useContext(ctx);
29
+ }
30
+ function useImperativeHandle(ref, factory, deps) {
31
+ getDispatcher().useImperativeHandle(ref, factory, deps);
32
+ }
33
+ function useDebugValue(value, formatter) {
34
+ getDispatcher().useDebugValue(value, formatter);
35
+ }
36
+ function useId() {
37
+ return getDispatcher().useId();
38
+ }
39
+ function useTransition() {
40
+ return getDispatcher().useTransition();
41
+ }
42
+ function useDeferredValue(v) {
43
+ return getDispatcher().useDeferredValue(v);
44
+ }
45
+ function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
46
+ return getDispatcher().useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
47
+ }
48
+ function use(resource) {
49
+ return getDispatcher().use(resource);
50
+ }
51
+ function startTransition(fn) {
52
+ fn();
53
+ }
54
+ function useActionState(_action, initial) {
55
+ return [initial, () => {
56
+ }, false];
57
+ }
58
+ function useFormStatus() {
59
+ return { pending: false, data: null, method: null, action: null };
60
+ }
61
+ function useOptimistic(state, _updateFn) {
62
+ return [state, () => {
63
+ }];
64
+ }
65
+ function useEffectEvent(fn) {
66
+ const ref = useRef(fn);
67
+ useInsertionEffect(() => {
68
+ ref.current = fn;
69
+ });
70
+ return useCallback(
71
+ ((...args) => ref.current(...args)),
72
+ []
73
+ );
74
+ }
75
+ function useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
76
+ const instRef = useRef(null);
77
+ let inst;
78
+ if (instRef.current === null) {
79
+ inst = { hasValue: false, value: null };
80
+ instRef.current = inst;
81
+ } else {
82
+ inst = instRef.current;
83
+ }
84
+ const [getSelection, getServerSelection] = useMemo(() => {
85
+ let hasMemo = false;
86
+ let memoizedSnapshot;
87
+ let memoizedSelection;
88
+ const memoizedSelector = (nextSnapshot) => {
89
+ if (!hasMemo) {
90
+ hasMemo = true;
91
+ memoizedSnapshot = nextSnapshot;
92
+ const nextSelection2 = selector(nextSnapshot);
93
+ if (isEqual !== void 0 && inst.hasValue) {
94
+ const currentSelection = inst.value;
95
+ if (isEqual(currentSelection, nextSelection2)) {
96
+ memoizedSelection = currentSelection;
97
+ return currentSelection;
98
+ }
99
+ }
100
+ memoizedSelection = nextSelection2;
101
+ return nextSelection2;
102
+ }
103
+ const prevSnapshot = memoizedSnapshot;
104
+ const prevSelection = memoizedSelection;
105
+ if (Object.is(prevSnapshot, nextSnapshot)) return prevSelection;
106
+ const nextSelection = selector(nextSnapshot);
107
+ if (isEqual !== void 0 && isEqual(prevSelection, nextSelection)) return prevSelection;
108
+ memoizedSnapshot = nextSnapshot;
109
+ memoizedSelection = nextSelection;
110
+ return nextSelection;
111
+ };
112
+ const get = () => memoizedSelector(getSnapshot());
113
+ const getServer = getServerSnapshot === void 0 ? void 0 : () => memoizedSelector(getServerSnapshot());
114
+ return [get, getServer];
115
+ }, [getSnapshot, getServerSnapshot, selector, isEqual]);
116
+ const value = useSyncExternalStore(subscribe, getSelection, getServerSelection);
117
+ useDebugValue(value);
118
+ inst.hasValue = true;
119
+ inst.value = value;
120
+ return value;
121
+ }
122
+ export {
123
+ startTransition,
124
+ use,
125
+ useActionState,
126
+ useCallback,
127
+ useContext,
128
+ useDebugValue,
129
+ useDeferredValue,
130
+ useEffect,
131
+ useEffectEvent,
132
+ useFormStatus,
133
+ useId,
134
+ useImperativeHandle,
135
+ useInsertionEffect,
136
+ useLayoutEffect,
137
+ useMemo,
138
+ useOptimistic,
139
+ useReducer,
140
+ useRef,
141
+ useState,
142
+ useSyncExternalStore,
143
+ useSyncExternalStoreWithSelector,
144
+ useTransition
145
+ };
146
+ //# sourceMappingURL=hooks.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/react/hooks.ts"],
4
+ "sourcesContent": ["import type {\n Dispatch,\n SetStateAction,\n EffectCallback,\n DependencyList,\n} from '../core'\nimport type { Context } from './context'\nimport { getDispatcher } from './shared-internals'\n\nexport function useState<S>(initial: S | (() => S)): [S, Dispatch<SetStateAction<S>>] {\n return getDispatcher().useState(initial)\n}\n\nexport function useReducer<S, A>(\n reducer: (s: S, a: A) => S,\n initial: any,\n init?: (a: any) => S,\n): [S, Dispatch<A>] {\n return getDispatcher().useReducer(reducer, initial, init)\n}\n\nexport function useEffect(create: EffectCallback, deps?: DependencyList): void {\n getDispatcher().useEffect(create, deps)\n}\n\nexport function useLayoutEffect(create: EffectCallback, deps?: DependencyList): void {\n getDispatcher().useLayoutEffect(create, deps)\n}\n\nexport function useInsertionEffect(create: EffectCallback, deps?: DependencyList): void {\n getDispatcher().useInsertionEffect(create, deps)\n}\n\nexport function useRef<T>(initial: T): { current: T }\nexport function useRef<T>(initial: T | null): { current: T | null }\nexport function useRef<T = undefined>(): { current: T | undefined }\nexport function useRef(initial?: any): { current: any } {\n return getDispatcher().useRef(initial)\n}\n\nexport function useMemo<T>(factory: () => T, deps?: DependencyList): T {\n return getDispatcher().useMemo(factory, deps)\n}\n\nexport function useCallback<T extends Function>(fn: T, deps?: DependencyList): T {\n return getDispatcher().useCallback(fn, deps)\n}\n\nexport function useContext<T>(ctx: Context<T>): T {\n return getDispatcher().useContext(ctx)\n}\n\nexport function useImperativeHandle<T>(\n ref: any,\n factory: () => T,\n deps?: DependencyList,\n): void {\n getDispatcher().useImperativeHandle(ref, factory, deps)\n}\n\nexport function useDebugValue<T>(value: T, formatter?: (v: T) => any): void {\n getDispatcher().useDebugValue(value, formatter)\n}\n\nexport function useId(): string {\n return getDispatcher().useId()\n}\n\nexport function useTransition(): [boolean, (fn: () => void) => void] {\n return getDispatcher().useTransition()\n}\n\nexport function useDeferredValue<T>(v: T): T {\n return getDispatcher().useDeferredValue(v)\n}\n\nexport function useSyncExternalStore<T>(\n subscribe: (cb: () => void) => () => void,\n getSnapshot: () => T,\n getServerSnapshot?: () => T,\n): T {\n return getDispatcher().useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot)\n}\n\nexport function use<T>(resource: any): T {\n return getDispatcher().use(resource)\n}\n\nexport function startTransition(fn: () => void): void {\n fn()\n}\n\nexport function useActionState<S, P>(\n _action: (state: Awaited<S>, payload: P) => S | Promise<S>,\n initial: Awaited<S>,\n): [Awaited<S>, (payload: P) => void, boolean] {\n return [initial, () => {}, false]\n}\n\nexport function useFormStatus() {\n return { pending: false, data: null, method: null, action: null }\n}\n\nexport function useOptimistic<S, A = S>(\n state: S,\n _updateFn?: (s: S, a: A) => S,\n): [S, (action: A) => void] {\n return [state, () => {}]\n}\n\n// Composed hook \u2014 returns a stable callback that always invokes the latest\n// `fn`. The ref is updated in useInsertionEffect so any useLayoutEffect /\n// useEffect reading ref.current in the next commit sees the fresh function.\nexport function useEffectEvent<Args extends unknown[], Return>(\n fn: (...args: Args) => Return,\n): (...args: Args) => Return {\n const ref = useRef(fn)\n useInsertionEffect(() => {\n ref.current = fn\n })\n return useCallback(\n ((...args: Args) => ref.current(...args)) as (...args: Args) => Return,\n [],\n )\n}\n\n// `useSyncExternalStoreWithSelector` \u2014 provided here so consumers (like\n// @tanstack/react-store) that historically import from\n// `use-sync-external-store/shim/with-selector` can be aliased to this\n// package via the @tanstack/redact/vite plugin. The CJS shim is unsuitable\n// for Cloudflare Workers (it does `var React = require('react')` which\n// fails in workerd). Implementation matches React's reference impl \u2014\n// selector + isEqual gate to avoid re-renders when the selected slice is\n// unchanged across snapshots.\nexport function useSyncExternalStoreWithSelector<Snapshot, Selection>(\n subscribe: (cb: () => void) => () => void,\n getSnapshot: () => Snapshot,\n getServerSnapshot: (() => Snapshot) | undefined,\n selector: (snapshot: Snapshot) => Selection,\n isEqual?: (a: Selection, b: Selection) => boolean,\n): Selection {\n const instRef = useRef<{ hasValue: boolean; value: Selection | null } | null>(null)\n let inst: { hasValue: boolean; value: Selection | null }\n if (instRef.current === null) {\n inst = { hasValue: false, value: null }\n instRef.current = inst\n } else {\n inst = instRef.current\n }\n\n const [getSelection, getServerSelection] = useMemo(() => {\n let hasMemo = false\n let memoizedSnapshot: Snapshot\n let memoizedSelection: Selection\n const memoizedSelector = (nextSnapshot: Snapshot): Selection => {\n if (!hasMemo) {\n hasMemo = true\n memoizedSnapshot = nextSnapshot\n const nextSelection = selector(nextSnapshot)\n if (isEqual !== undefined && inst.hasValue) {\n const currentSelection = inst.value as Selection\n if (isEqual(currentSelection, nextSelection)) {\n memoizedSelection = currentSelection\n return currentSelection\n }\n }\n memoizedSelection = nextSelection\n return nextSelection\n }\n const prevSnapshot: Snapshot = memoizedSnapshot\n const prevSelection: Selection = memoizedSelection\n if (Object.is(prevSnapshot, nextSnapshot)) return prevSelection\n const nextSelection = selector(nextSnapshot)\n if (isEqual !== undefined && isEqual(prevSelection, nextSelection)) return prevSelection\n memoizedSnapshot = nextSnapshot\n memoizedSelection = nextSelection\n return nextSelection\n }\n const get = () => memoizedSelector(getSnapshot())\n const getServer =\n getServerSnapshot === undefined ? undefined : () => memoizedSelector(getServerSnapshot())\n return [get, getServer] as const\n }, [getSnapshot, getServerSnapshot, selector, isEqual])\n\n const value = useSyncExternalStore(subscribe, getSelection, getServerSelection)\n useDebugValue(value)\n inst.hasValue = true\n inst.value = value\n return value\n}\n"],
5
+ "mappings": ";AAOA,SAAS,qBAAqB;AAEvB,SAAS,SAAY,SAA0D;AACpF,SAAO,cAAc,EAAE,SAAS,OAAO;AACzC;AAEO,SAAS,WACd,SACA,SACA,MACkB;AAClB,SAAO,cAAc,EAAE,WAAW,SAAS,SAAS,IAAI;AAC1D;AAEO,SAAS,UAAU,QAAwB,MAA6B;AAC7E,gBAAc,EAAE,UAAU,QAAQ,IAAI;AACxC;AAEO,SAAS,gBAAgB,QAAwB,MAA6B;AACnF,gBAAc,EAAE,gBAAgB,QAAQ,IAAI;AAC9C;AAEO,SAAS,mBAAmB,QAAwB,MAA6B;AACtF,gBAAc,EAAE,mBAAmB,QAAQ,IAAI;AACjD;AAKO,SAAS,OAAO,SAAiC;AACtD,SAAO,cAAc,EAAE,OAAO,OAAO;AACvC;AAEO,SAAS,QAAW,SAAkB,MAA0B;AACrE,SAAO,cAAc,EAAE,QAAQ,SAAS,IAAI;AAC9C;AAEO,SAAS,YAAgC,IAAO,MAA0B;AAC/E,SAAO,cAAc,EAAE,YAAY,IAAI,IAAI;AAC7C;AAEO,SAAS,WAAc,KAAoB;AAChD,SAAO,cAAc,EAAE,WAAW,GAAG;AACvC;AAEO,SAAS,oBACd,KACA,SACA,MACM;AACN,gBAAc,EAAE,oBAAoB,KAAK,SAAS,IAAI;AACxD;AAEO,SAAS,cAAiB,OAAU,WAAiC;AAC1E,gBAAc,EAAE,cAAc,OAAO,SAAS;AAChD;AAEO,SAAS,QAAgB;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Z,kBAAU;AACV,2BAAmB;AACnB,cAAMA,iBAAgB,SAAS,YAAY;AAC3C,YAAI,YAAY,UAAa,KAAK,UAAU;AAC1C,gBAAM,mBAAmB,KAAK;AAC9B,cAAI,QAAQ,kBAAkBA,cAAa,GAAG;AAC5C,gCAAoB;AACpB,mBAAO;AAAA,UACT;AAAA,QACF;AACA,4BAAoBA;AACpB,eAAOA;AAAA,MACT;AACA,YAAM,eAAyB;AAC/B,YAAM,gBAA2B;AACjC,UAAI,OAAO,GAAG,cAAc,YAAY,EAAG,QAAO;AAClD,YAAM,gBAAgB,SAAS,YAAY;AAC3C,UAAI,YAAY,UAAa,QAAQ,eAAe,aAAa,EAAG,QAAO;AAC3E,yBAAmB;AACnB,0BAAoB;AACpB,aAAO;AAAA,IACT;AACA,UAAM,MAAM,MAAM,iBAAiB,YAAY,CAAC;AAChD,UAAM,YACJ,sBAAsB,SAAY,SAAY,MAAM,iBAAiB,kBAAkB,CAAC;AAC1F,WAAO,CAAC,KAAK,SAAS;AAAA,EACxB,GAAG,CAAC,aAAa,mBAAmB,UAAU,OAAO,CAAC;AAEtD,QAAM,QAAQ,qBAAqB,WAAW,cAAc,kBAAkB;AAC9E,gBAAc,KAAK;AACnB,OAAK,WAAW;AAChB,OAAK,QAAQ;AACb,SAAO;AACT;",
6
+ "names": ["nextSelection"]
7
+ }
@@ -0,0 +1,76 @@
1
+ export { createElement, cloneElement, isValidElement, createRef, Fragment } from './element';
2
+ export { useState, useReducer, useEffect, useLayoutEffect, useInsertionEffect, useRef, useMemo, useCallback, useContext, useImperativeHandle, useDebugValue, useId, useTransition, useDeferredValue, useSyncExternalStore, useSyncExternalStoreWithSelector, use, useActionState, useFormStatus, useOptimistic, useEffectEvent, startTransition, } from './hooks';
3
+ export { createContext, REACT_CONTEXT_TYPE, REACT_PROVIDER_TYPE, REACT_CONSUMER_TYPE, type Context, type ProviderExoticComponent, type ConsumerExoticComponent, } from './context';
4
+ export { Component, PureComponent } from './class';
5
+ export { memo, forwardRef, lazy, REACT_MEMO_TYPE, REACT_FORWARD_REF_TYPE, REACT_LAZY_TYPE, } from './memo';
6
+ export { Suspense, StrictMode, Profiler, REACT_SUSPENSE_TYPE, REACT_STRICT_MODE_TYPE, REACT_PROFILER_TYPE, } from './suspense';
7
+ export { REACT_PORTAL_TYPE } from './portal';
8
+ export { Children } from './children';
9
+ export { ReactSharedInternals } from './shared-internals';
10
+ export declare const cache: <T extends Function>(fn: T) => T;
11
+ export declare const act: (fn: () => any) => Promise<void>;
12
+ export declare function taintUniqueValue(_msg: string, _lifetime: any, _value: any): void;
13
+ export declare function taintObjectReference(_msg: string, _object: any): void;
14
+ export declare const version = "19.2.3";
15
+ import { createElement, cloneElement, isValidElement, createRef } from './element';
16
+ import { useState, useReducer, useEffect, useLayoutEffect, useInsertionEffect, useRef, useMemo, useCallback, useContext, useImperativeHandle, useDebugValue, useId, useTransition, useDeferredValue, useSyncExternalStore, use, useActionState, useFormStatus, useOptimistic, useEffectEvent, startTransition } from './hooks';
17
+ import { createContext } from './context';
18
+ import { Component, PureComponent } from './class';
19
+ import { memo, forwardRef, lazy } from './memo';
20
+ declare const _default: {
21
+ createElement: typeof createElement;
22
+ cloneElement: typeof cloneElement;
23
+ isValidElement: typeof isValidElement;
24
+ createRef: typeof createRef;
25
+ Fragment: (props: {
26
+ children?: import("../core").ReactNode;
27
+ }) => import("../core").ReactElement;
28
+ useState: typeof useState;
29
+ useReducer: typeof useReducer;
30
+ useEffect: typeof useEffect;
31
+ useLayoutEffect: typeof useLayoutEffect;
32
+ useInsertionEffect: typeof useInsertionEffect;
33
+ useRef: typeof useRef;
34
+ useMemo: typeof useMemo;
35
+ useCallback: typeof useCallback;
36
+ useContext: typeof useContext;
37
+ useImperativeHandle: typeof useImperativeHandle;
38
+ useDebugValue: typeof useDebugValue;
39
+ useId: typeof useId;
40
+ useTransition: typeof useTransition;
41
+ useDeferredValue: typeof useDeferredValue;
42
+ useSyncExternalStore: typeof useSyncExternalStore;
43
+ use: typeof use;
44
+ useActionState: typeof useActionState;
45
+ useFormStatus: typeof useFormStatus;
46
+ useOptimistic: typeof useOptimistic;
47
+ useEffectEvent: typeof useEffectEvent;
48
+ startTransition: typeof startTransition;
49
+ createContext: typeof createContext;
50
+ Component: typeof Component;
51
+ PureComponent: typeof PureComponent;
52
+ memo: typeof memo;
53
+ forwardRef: typeof forwardRef;
54
+ lazy: typeof lazy;
55
+ Suspense: (props: {
56
+ children?: any;
57
+ fallback?: any;
58
+ }) => any;
59
+ StrictMode: (props: {
60
+ children?: any;
61
+ }) => any;
62
+ Profiler: (props: {
63
+ id: string;
64
+ onRender?: any;
65
+ children?: any;
66
+ }) => any;
67
+ Children: {
68
+ map(children: import("../core").ReactNode, fn: (child: import("../core").ReactNode, index: number) => any): any[] | null;
69
+ forEach(children: import("../core").ReactNode, fn: (child: import("../core").ReactNode, index: number) => void): void;
70
+ count(children: import("../core").ReactNode): number;
71
+ toArray(children: import("../core").ReactNode): any[];
72
+ only(children: import("../core").ReactNode): import("../core").ReactElement;
73
+ };
74
+ version: string;
75
+ };
76
+ export default _default;
@@ -0,0 +1,187 @@
1
+ // packages/redact/src/react/index.ts
2
+ import { createElement, cloneElement, isValidElement, createRef, Fragment } from "./element";
3
+ import {
4
+ useState,
5
+ useReducer,
6
+ useEffect,
7
+ useLayoutEffect,
8
+ useInsertionEffect,
9
+ useRef,
10
+ useMemo,
11
+ useCallback,
12
+ useContext,
13
+ useImperativeHandle,
14
+ useDebugValue,
15
+ useId,
16
+ useTransition,
17
+ useDeferredValue,
18
+ useSyncExternalStore,
19
+ useSyncExternalStoreWithSelector,
20
+ use,
21
+ useActionState,
22
+ useFormStatus,
23
+ useOptimistic,
24
+ useEffectEvent,
25
+ startTransition
26
+ } from "./hooks";
27
+ import {
28
+ createContext,
29
+ REACT_CONTEXT_TYPE,
30
+ REACT_PROVIDER_TYPE,
31
+ REACT_CONSUMER_TYPE
32
+ } from "./context";
33
+ import { Component, PureComponent } from "./class";
34
+ import {
35
+ memo,
36
+ forwardRef,
37
+ lazy,
38
+ REACT_MEMO_TYPE,
39
+ REACT_FORWARD_REF_TYPE,
40
+ REACT_LAZY_TYPE
41
+ } from "./memo";
42
+ import {
43
+ Suspense,
44
+ StrictMode,
45
+ Profiler,
46
+ REACT_SUSPENSE_TYPE,
47
+ REACT_STRICT_MODE_TYPE,
48
+ REACT_PROFILER_TYPE
49
+ } from "./suspense";
50
+ import { REACT_PORTAL_TYPE } from "./portal";
51
+ import { Children } from "./children";
52
+ import { ReactSharedInternals } from "./shared-internals";
53
+ import { createElement as createElement2, cloneElement as cloneElement2, isValidElement as isValidElement2, createRef as createRef2, Fragment as Fragment2 } from "./element";
54
+ import {
55
+ useState as useState2,
56
+ useReducer as useReducer2,
57
+ useEffect as useEffect2,
58
+ useLayoutEffect as useLayoutEffect2,
59
+ useInsertionEffect as useInsertionEffect2,
60
+ useRef as useRef2,
61
+ useMemo as useMemo2,
62
+ useCallback as useCallback2,
63
+ useContext as useContext2,
64
+ useImperativeHandle as useImperativeHandle2,
65
+ useDebugValue as useDebugValue2,
66
+ useId as useId2,
67
+ useTransition as useTransition2,
68
+ useDeferredValue as useDeferredValue2,
69
+ useSyncExternalStore as useSyncExternalStore2,
70
+ use as use2,
71
+ useActionState as useActionState2,
72
+ useFormStatus as useFormStatus2,
73
+ useOptimistic as useOptimistic2,
74
+ useEffectEvent as useEffectEvent2,
75
+ startTransition as startTransition2
76
+ } from "./hooks";
77
+ import { createContext as createContext2 } from "./context";
78
+ import { Component as Component2, PureComponent as PureComponent2 } from "./class";
79
+ import { memo as memo2, forwardRef as forwardRef2, lazy as lazy2 } from "./memo";
80
+ import { Suspense as Suspense2, StrictMode as StrictMode2, Profiler as Profiler2 } from "./suspense";
81
+ import { Children as Children2 } from "./children";
82
+ var cache = (fn) => fn;
83
+ var act = async (fn) => {
84
+ const r = fn();
85
+ if (r && typeof r.then === "function") await r;
86
+ };
87
+ function taintUniqueValue(_msg, _lifetime, _value) {
88
+ }
89
+ function taintObjectReference(_msg, _object) {
90
+ }
91
+ var version = "19.2.3";
92
+ var react_default = {
93
+ createElement: createElement2,
94
+ cloneElement: cloneElement2,
95
+ isValidElement: isValidElement2,
96
+ createRef: createRef2,
97
+ Fragment: Fragment2,
98
+ useState: useState2,
99
+ useReducer: useReducer2,
100
+ useEffect: useEffect2,
101
+ useLayoutEffect: useLayoutEffect2,
102
+ useInsertionEffect: useInsertionEffect2,
103
+ useRef: useRef2,
104
+ useMemo: useMemo2,
105
+ useCallback: useCallback2,
106
+ useContext: useContext2,
107
+ useImperativeHandle: useImperativeHandle2,
108
+ useDebugValue: useDebugValue2,
109
+ useId: useId2,
110
+ useTransition: useTransition2,
111
+ useDeferredValue: useDeferredValue2,
112
+ useSyncExternalStore: useSyncExternalStore2,
113
+ use: use2,
114
+ useActionState: useActionState2,
115
+ useFormStatus: useFormStatus2,
116
+ useOptimistic: useOptimistic2,
117
+ useEffectEvent: useEffectEvent2,
118
+ startTransition: startTransition2,
119
+ createContext: createContext2,
120
+ Component: Component2,
121
+ PureComponent: PureComponent2,
122
+ memo: memo2,
123
+ forwardRef: forwardRef2,
124
+ lazy: lazy2,
125
+ Suspense: Suspense2,
126
+ StrictMode: StrictMode2,
127
+ Profiler: Profiler2,
128
+ Children: Children2,
129
+ version: "19.2.3"
130
+ };
131
+ export {
132
+ Children,
133
+ Component,
134
+ Fragment,
135
+ Profiler,
136
+ PureComponent,
137
+ REACT_CONSUMER_TYPE,
138
+ REACT_CONTEXT_TYPE,
139
+ REACT_FORWARD_REF_TYPE,
140
+ REACT_LAZY_TYPE,
141
+ REACT_MEMO_TYPE,
142
+ REACT_PORTAL_TYPE,
143
+ REACT_PROFILER_TYPE,
144
+ REACT_PROVIDER_TYPE,
145
+ REACT_STRICT_MODE_TYPE,
146
+ REACT_SUSPENSE_TYPE,
147
+ ReactSharedInternals,
148
+ StrictMode,
149
+ Suspense,
150
+ act,
151
+ cache,
152
+ cloneElement,
153
+ createContext,
154
+ createElement,
155
+ createRef,
156
+ react_default as default,
157
+ forwardRef,
158
+ isValidElement,
159
+ lazy,
160
+ memo,
161
+ startTransition,
162
+ taintObjectReference,
163
+ taintUniqueValue,
164
+ use,
165
+ useActionState,
166
+ useCallback,
167
+ useContext,
168
+ useDebugValue,
169
+ useDeferredValue,
170
+ useEffect,
171
+ useEffectEvent,
172
+ useFormStatus,
173
+ useId,
174
+ useImperativeHandle,
175
+ useInsertionEffect,
176
+ useLayoutEffect,
177
+ useMemo,
178
+ useOptimistic,
179
+ useReducer,
180
+ useRef,
181
+ useState,
182
+ useSyncExternalStore,
183
+ useSyncExternalStoreWithSelector,
184
+ useTransition,
185
+ version
186
+ };
187
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/react/index.ts"],
4
+ "sourcesContent": ["export { createElement, cloneElement, isValidElement, createRef, Fragment } from './element'\nexport {\n useState,\n useReducer,\n useEffect,\n useLayoutEffect,\n useInsertionEffect,\n useRef,\n useMemo,\n useCallback,\n useContext,\n useImperativeHandle,\n useDebugValue,\n useId,\n useTransition,\n useDeferredValue,\n useSyncExternalStore,\n useSyncExternalStoreWithSelector,\n use,\n useActionState,\n useFormStatus,\n useOptimistic,\n useEffectEvent,\n startTransition,\n} from './hooks'\nexport {\n createContext,\n REACT_CONTEXT_TYPE,\n REACT_PROVIDER_TYPE,\n REACT_CONSUMER_TYPE,\n type Context,\n type ProviderExoticComponent,\n type ConsumerExoticComponent,\n} from './context'\nexport { Component, PureComponent } from './class'\nexport {\n memo, forwardRef, lazy,\n REACT_MEMO_TYPE,\n REACT_FORWARD_REF_TYPE,\n REACT_LAZY_TYPE,\n} from './memo'\nexport {\n Suspense, StrictMode, Profiler,\n REACT_SUSPENSE_TYPE,\n REACT_STRICT_MODE_TYPE,\n REACT_PROFILER_TYPE,\n} from './suspense'\nexport { REACT_PORTAL_TYPE } from './portal'\nexport { Children } from './children'\nexport { ReactSharedInternals } from './shared-internals'\n\n// Stub exports\nexport const cache = <T extends Function>(fn: T): T => fn\nexport const act = async (fn: () => any) => {\n const r = fn()\n if (r && typeof r.then === 'function') await r\n}\nexport function taintUniqueValue(_msg: string, _lifetime: any, _value: any): void {}\nexport function taintObjectReference(_msg: string, _object: any): void {}\n\nexport const version = '19.2.3'\n\n// Default export for `import React from 'react'` usage\nimport { createElement, cloneElement, isValidElement, createRef, Fragment } from './element'\nimport {\n useState,\n useReducer,\n useEffect,\n useLayoutEffect,\n useInsertionEffect,\n useRef,\n useMemo,\n useCallback,\n useContext,\n useImperativeHandle,\n useDebugValue,\n useId,\n useTransition,\n useDeferredValue,\n useSyncExternalStore,\n use,\n useActionState,\n useFormStatus,\n useOptimistic,\n useEffectEvent,\n startTransition,\n} from './hooks'\nimport { createContext } from './context'\nimport { Component, PureComponent } from './class'\nimport { memo, forwardRef, lazy } from './memo'\nimport { Suspense, StrictMode, Profiler } from './suspense'\nimport { Children } from './children'\n\nexport default {\n createElement,\n cloneElement,\n isValidElement,\n createRef,\n Fragment,\n useState,\n useReducer,\n useEffect,\n useLayoutEffect,\n useInsertionEffect,\n useRef,\n useMemo,\n useCallback,\n useContext,\n useImperativeHandle,\n useDebugValue,\n useId,\n useTransition,\n useDeferredValue,\n useSyncExternalStore,\n use,\n useActionState,\n useFormStatus,\n useOptimistic,\n useEffectEvent,\n startTransition,\n createContext,\n Component,\n PureComponent,\n memo,\n forwardRef,\n lazy,\n Suspense,\n StrictMode,\n Profiler,\n Children,\n version: '19.2.3',\n}\n"],
5
+ "mappings": ";AAAA,SAAS,eAAe,cAAc,gBAAgB,WAAW,gBAAgB;AACjF;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAA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5E,SAAS,qBAAqB,MAAc,SAAoB;AAAC;AAEjE,IAAM,UAAU;AAiCvB,IAAO,gBAAQ;AAAA,EACb,eAAAnC;AAAA,EACA,cAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,QAAAC;AAAA,EACA,SAAAC;AAAA,EACA,aAAAC;AAAA,EACA,YAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,OAAAC;AAAA,EACA,eAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,sBAAAC;AAAA,EACA,KAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,MAAAC;AAAA,EACA,YAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAS;AACX;",
6
+ "names": ["createElement", "cloneElement", "isValidElement", "createRef", "Fragment", "useState", "useReducer", "useEffect", "useLayoutEffect", "useInsertionEffect", "useRef", "useMemo", "useCallback", "useContext", "useImperativeHandle", "useDebugValue", "useId", "useTransition", "useDeferredValue", "useSyncExternalStore", "use", "useActionState", "useFormStatus", "useOptimistic", "useEffectEvent", "startTransition", "createContext", "Component", "PureComponent", "memo", "forwardRef", "lazy", "Suspense", "StrictMode", "Profiler", "Children"]
7
+ }
@@ -0,0 +1,5 @@
1
+ import { type ReactElement } from '../core';
2
+ export { Fragment } from './element';
3
+ export declare function jsx(type: any, props: any, key?: any): ReactElement;
4
+ export declare const jsxs: typeof jsx;
5
+ export declare const jsxDEV: typeof jsx;
@@ -0,0 +1,21 @@
1
+ // packages/redact/src/react/jsx-runtime.ts
2
+ import { REACT_ELEMENT_TYPE } from "../core";
3
+ import { Fragment } from "./element";
4
+ function jsx(type, props, key) {
5
+ return {
6
+ $$typeof: REACT_ELEMENT_TYPE,
7
+ type,
8
+ key: key == null ? null : "" + key,
9
+ ref: props?.ref ?? null,
10
+ props
11
+ };
12
+ }
13
+ var jsxs = jsx;
14
+ var jsxDEV = jsx;
15
+ export {
16
+ Fragment,
17
+ jsx,
18
+ jsxDEV,
19
+ jsxs
20
+ };
21
+ //# sourceMappingURL=jsx-runtime.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/react/jsx-runtime.ts"],
4
+ "sourcesContent": ["import { REACT_ELEMENT_TYPE, type ReactElement } from '../core'\n\nexport { Fragment } from './element'\n\nexport function jsx(type: any, props: any, key?: any): ReactElement {\n return {\n $$typeof: REACT_ELEMENT_TYPE,\n type,\n key: key == null ? null : '' + key,\n ref: props?.ref ?? null,\n props,\n }\n}\n\nexport const jsxs = jsx\nexport const jsxDEV = jsx\n"],
5
+ "mappings": ";AAAA,SAAS,0BAA6C;AAEtD,SAAS,gBAAgB;AAElB,SAAS,IAAI,MAAW,OAAY,KAAyB;AAClE,SAAO;AAAA,IACL,UAAU;AAAA,IACV;AAAA,IACA,KAAK,OAAO,OAAO,OAAO,KAAK;AAAA,IAC/B,KAAK,OAAO,OAAO;AAAA,IACnB;AAAA,EACF;AACF;AAEO,IAAM,OAAO;AACb,IAAM,SAAS;",
6
+ "names": []
7
+ }
@@ -0,0 +1,29 @@
1
+ export declare const REACT_MEMO_TYPE: unique symbol;
2
+ export declare const REACT_FORWARD_REF_TYPE: unique symbol;
3
+ export declare const REACT_LAZY_TYPE: unique symbol;
4
+ export declare function memo<P>(type: (props: P) => any, areEqual?: (prev: Readonly<P>, next: Readonly<P>) => boolean): {
5
+ $$typeof: symbol;
6
+ type: (props: P) => any;
7
+ compare: (prev: Readonly<P>, next: Readonly<P>) => boolean;
8
+ };
9
+ export declare function forwardRef<R, P = {}>(render: (props: P, ref: {
10
+ current: R | null;
11
+ } | ((r: R | null) => void) | null) => any): {
12
+ $$typeof: symbol;
13
+ render: (props: P, ref: {
14
+ current: R | null;
15
+ } | ((r: R | null) => void) | null) => any;
16
+ };
17
+ export declare function lazy<T extends {
18
+ default: any;
19
+ }>(ctor: () => Promise<T>): {
20
+ $$typeof: symbol;
21
+ _payload: {
22
+ status: -1 | 0 | 1 | 2;
23
+ result: any;
24
+ };
25
+ _init: (p: {
26
+ status: -1 | 0 | 1 | 2;
27
+ result: any;
28
+ }) => any;
29
+ };
@@ -0,0 +1,47 @@
1
+ // packages/redact/src/react/memo.ts
2
+ var REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo");
3
+ var REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref");
4
+ var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
5
+ function memo(type, areEqual) {
6
+ return { $$typeof: REACT_MEMO_TYPE, type, compare: areEqual ?? null };
7
+ }
8
+ function forwardRef(render) {
9
+ return { $$typeof: REACT_FORWARD_REF_TYPE, render };
10
+ }
11
+ function lazy(ctor) {
12
+ const payload = {
13
+ status: -1,
14
+ result: void 0
15
+ };
16
+ return {
17
+ $$typeof: REACT_LAZY_TYPE,
18
+ _payload: payload,
19
+ _init: (p) => {
20
+ if (p.status === 1) return p.result;
21
+ if (p.status === 2) throw p.result;
22
+ if (p.status === 0) throw p.result;
23
+ const thenable = ctor().then(
24
+ (mod) => {
25
+ p.status = 1;
26
+ p.result = mod.default;
27
+ },
28
+ (err) => {
29
+ p.status = 2;
30
+ p.result = err;
31
+ }
32
+ );
33
+ p.status = 0;
34
+ p.result = thenable;
35
+ throw thenable;
36
+ }
37
+ };
38
+ }
39
+ export {
40
+ REACT_FORWARD_REF_TYPE,
41
+ REACT_LAZY_TYPE,
42
+ REACT_MEMO_TYPE,
43
+ forwardRef,
44
+ lazy,
45
+ memo
46
+ };
47
+ //# sourceMappingURL=memo.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/react/memo.ts"],
4
+ "sourcesContent": ["export const REACT_MEMO_TYPE = Symbol.for('react.memo')\nexport const REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref')\nexport const REACT_LAZY_TYPE = Symbol.for('react.lazy')\n\nexport function memo<P>(\n type: (props: P) => any,\n areEqual?: (prev: Readonly<P>, next: Readonly<P>) => boolean,\n) {\n return { $$typeof: REACT_MEMO_TYPE, type, compare: areEqual ?? null }\n}\n\nexport function forwardRef<R, P = {}>(\n render: (props: P, ref: { current: R | null } | ((r: R | null) => void) | null) => any,\n) {\n return { $$typeof: REACT_FORWARD_REF_TYPE, render }\n}\n\nexport function lazy<T extends { default: any }>(ctor: () => Promise<T>) {\n const payload = {\n status: -1 as -1 | 0 | 1 | 2,\n result: undefined as any,\n }\n return {\n $$typeof: REACT_LAZY_TYPE,\n _payload: payload,\n _init: (p: typeof payload): any => {\n if (p.status === 1) return p.result\n if (p.status === 2) throw p.result\n if (p.status === 0) throw p.result // pending promise\n const thenable = ctor().then(\n (mod) => {\n p.status = 1\n p.result = mod.default\n },\n (err) => {\n p.status = 2\n p.result = err\n },\n )\n p.status = 0\n p.result = thenable\n throw thenable\n },\n }\n}\n"],
5
+ "mappings": ";AAAO,IAAM,kBAAkB,uBAAO,IAAI,YAAY;AAC/C,IAAM,yBAAyB,uBAAO,IAAI,mBAAmB;AAC7D,IAAM,kBAAkB,uBAAO,IAAI,YAAY;AAE/C,SAAS,KACd,MACA,UACA;AACA,SAAO,EAAE,UAAU,iBAAiB,MAAM,SAAS,YAAY,KAAK;AACtE;AAEO,SAAS,WACd,QACA;AACA,SAAO,EAAE,UAAU,wBAAwB,OAAO;AACpD;AAEO,SAAS,KAAiC,MAAwB;AACvE,QAAM,UAAU;AAAA,IACd,QAAQ;AAAA,IACR,QAAQ;AAAA,EACV;AACA,SAAO;AAAA,IACL,UAAU;AAAA,IACV,UAAU;AAAA,IACV,OAAO,CAAC,MAA2B;AACjC,UAAI,EAAE,WAAW,EAAG,QAAO,EAAE;AAC7B,UAAI,EAAE,WAAW,EAAG,OAAM,EAAE;AAC5B,UAAI,EAAE,WAAW,EAAG,OAAM,EAAE;AAC5B,YAAM,WAAW,KAAK,EAAE;AAAA,QACtB,CAAC,QAAQ;AACP,YAAE,SAAS;AACX,YAAE,SAAS,IAAI;AAAA,QACjB;AAAA,QACA,CAAC,QAAQ;AACP,YAAE,SAAS;AACX,YAAE,SAAS;AAAA,QACb;AAAA,MACF;AACA,QAAE,SAAS;AACX,QAAE,SAAS;AACX,YAAM;AAAA,IACR;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1 @@
1
+ export declare const REACT_PORTAL_TYPE: unique symbol;
@@ -0,0 +1,6 @@
1
+ // packages/redact/src/react/portal.ts
2
+ var REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal");
3
+ export {
4
+ REACT_PORTAL_TYPE
5
+ };
6
+ //# sourceMappingURL=portal.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/react/portal.ts"],
4
+ "sourcesContent": ["export const REACT_PORTAL_TYPE = Symbol.for('react.portal')\n"],
5
+ "mappings": ";AAAO,IAAM,oBAAoB,uBAAO,IAAI,cAAc;",
6
+ "names": []
7
+ }