@tanstack/redact 0.0.21 → 0.1.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.
- package/dist/core/attributes.js +2 -1
- package/dist/core/attributes.js.map +2 -2
- package/dist/core/browser.d.ts +9 -0
- package/dist/core/browser.js +35 -0
- package/dist/core/browser.js.map +7 -0
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +3 -3
- package/dist/core/internal.d.ts +31 -8
- package/dist/core/internal.js +3 -1
- package/dist/core/internal.js.map +2 -2
- package/dist/core/resource-hints.d.ts +7 -0
- package/dist/core/resource-hints.js +19 -0
- package/dist/core/resource-hints.js.map +7 -0
- package/dist/core/types.js +1 -1
- package/dist/dom/_all.d.ts +11 -16
- package/dist/dom/_all.js +9 -20
- package/dist/dom/_all.js.map +2 -2
- package/dist/dom/client.d.ts +4 -4
- package/dist/dom/client.js +4 -4
- package/dist/dom/commit.d.ts +23 -0
- package/dist/dom/commit.js +191 -0
- package/dist/dom/commit.js.map +7 -0
- package/dist/dom/dispatcher.d.ts +4 -22
- package/dist/dom/dispatcher.js +184 -126
- package/dist/dom/dispatcher.js.map +3 -3
- package/dist/dom/dom.d.ts +2 -0
- package/dist/dom/dom.js +72 -52
- package/dist/dom/dom.js.map +2 -2
- package/dist/dom/error-info.d.ts +2 -0
- package/dist/dom/error-info.js +16 -0
- package/dist/dom/error-info.js.map +7 -0
- package/dist/dom/event-replay.js +1 -1
- package/dist/dom/features/activity/full.d.ts +1 -0
- package/dist/dom/features/activity/full.js +162 -0
- package/dist/dom/features/activity/full.js.map +7 -0
- package/dist/dom/features/activity/index.d.ts +1 -0
- package/dist/dom/features/activity/index.js +3 -0
- package/dist/dom/features/activity/index.js.map +7 -0
- package/dist/dom/features/activity/stub.d.ts +1 -0
- package/dist/dom/features/activity/stub.js +12 -0
- package/dist/dom/features/activity/stub.js.map +7 -0
- package/dist/dom/features/class/full.js +87 -27
- package/dist/dom/features/class/full.js.map +2 -2
- package/dist/dom/features/class/index.d.ts +1 -1
- package/dist/dom/features/class/index.js +2 -2
- package/dist/dom/features/class/stub.js +3 -3
- package/dist/dom/features/context/full.d.ts +4 -1
- package/dist/dom/features/context/full.js +72 -15
- package/dist/dom/features/context/full.js.map +2 -2
- package/dist/dom/features/context/index.d.ts +1 -1
- package/dist/dom/features/context/index.js +2 -2
- package/dist/dom/features/context/stub.d.ts +4 -1
- package/dist/dom/features/context/stub.js +17 -8
- package/dist/dom/features/context/stub.js.map +2 -2
- package/dist/dom/features/forward-ref/full.js +12 -21
- package/dist/dom/features/forward-ref/full.js.map +2 -2
- package/dist/dom/features/forward-ref/index.d.ts +1 -1
- package/dist/dom/features/forward-ref/index.js +2 -2
- package/dist/dom/features/forward-ref/stub.js +4 -4
- package/dist/dom/features/fragment-refs/index.d.ts +1 -0
- package/dist/dom/features/fragment-refs/index.js +8 -0
- package/dist/dom/features/fragment-refs/index.js.map +7 -0
- package/dist/dom/features/fragment-refs/stub.d.ts +3 -0
- package/dist/dom/features/fragment-refs/stub.js +14 -0
- package/dist/dom/features/fragment-refs/stub.js.map +7 -0
- package/dist/dom/features/hydration/full.d.ts +11 -6
- package/dist/dom/features/hydration/full.js +76 -77
- package/dist/dom/features/hydration/full.js.map +2 -2
- package/dist/dom/features/hydration/index.d.ts +1 -1
- package/dist/dom/features/hydration/index.js +2 -2
- package/dist/dom/features/hydration/stub.d.ts +7 -2
- package/dist/dom/features/hydration/stub.js +1 -1
- package/dist/dom/features/hydration/stub.js.map +1 -1
- package/dist/dom/features/index.d.ts +8 -7
- package/dist/dom/features/index.js +9 -8
- package/dist/dom/features/index.js.map +2 -2
- package/dist/dom/features/lazy/full.js +4 -4
- package/dist/dom/features/lazy/index.d.ts +1 -1
- package/dist/dom/features/lazy/index.js +2 -2
- package/dist/dom/features/lazy/stub.js +4 -4
- package/dist/dom/features/memo/full.js +8 -6
- package/dist/dom/features/memo/full.js.map +2 -2
- package/dist/dom/features/memo/index.d.ts +1 -1
- package/dist/dom/features/memo/index.js +2 -2
- package/dist/dom/features/memo/stub.js +4 -4
- package/dist/dom/features/portal/full.js +4 -4
- package/dist/dom/features/portal/index.d.ts +1 -1
- package/dist/dom/features/portal/index.js +2 -2
- package/dist/dom/features/portal/stub.js +4 -4
- package/dist/dom/features/suspense/full.js +197 -52
- package/dist/dom/features/suspense/full.js.map +2 -2
- package/dist/dom/features/suspense/index.d.ts +1 -1
- package/dist/dom/features/suspense/index.js +2 -2
- package/dist/dom/features/suspense/stub.js +4 -4
- package/dist/dom/features/view-transition/full.d.ts +6 -0
- package/dist/dom/features/view-transition/full.js +280 -0
- package/dist/dom/features/view-transition/full.js.map +7 -0
- package/dist/dom/features/view-transition/index.d.ts +1 -0
- package/dist/dom/features/view-transition/index.js +3 -0
- package/dist/dom/features/view-transition/index.js.map +7 -0
- package/dist/dom/features/view-transition/resources.d.ts +11 -0
- package/dist/dom/features/view-transition/resources.js +108 -0
- package/dist/dom/features/view-transition/resources.js.map +7 -0
- package/dist/dom/features/view-transition/stub.d.ts +6 -0
- package/dist/dom/features/view-transition/stub.js +22 -0
- package/dist/dom/features/view-transition/stub.js.map +7 -0
- package/dist/dom/features/view-transition/visual.d.ts +14 -0
- package/dist/dom/features/view-transition/visual.js +356 -0
- package/dist/dom/features/view-transition/visual.js.map +7 -0
- package/dist/dom/fragment-instance.d.ts +40 -0
- package/dist/dom/fragment-instance.js +324 -0
- package/dist/dom/fragment-instance.js.map +7 -0
- package/dist/dom/index.d.ts +11 -11
- package/dist/dom/index.js +11 -18
- package/dist/dom/index.js.map +3 -3
- package/dist/dom/portal.d.ts +2 -2
- package/dist/dom/portal.js +2 -2
- package/dist/dom/portal.js.map +1 -1
- package/dist/dom/reconcile.d.ts +32 -3
- package/dist/dom/reconcile.js +689 -221
- package/dist/dom/reconcile.js.map +2 -2
- package/dist/dom/resource-hints.d.ts +6 -0
- package/dist/dom/resource-hints.js +115 -0
- package/dist/dom/resource-hints.js.map +7 -0
- package/dist/dom/resource-store.d.ts +13 -0
- package/dist/dom/resource-store.js +43 -0
- package/dist/dom/resource-store.js.map +7 -0
- package/dist/dom/resources.d.ts +1 -0
- package/dist/dom/resources.js +44 -0
- package/dist/dom/resources.js.map +7 -0
- package/dist/dom/retained-effects.d.ts +6 -0
- package/dist/dom/retained-effects.js +49 -0
- package/dist/dom/retained-effects.js.map +7 -0
- package/dist/dom/root-internal.d.ts +4 -4
- package/dist/dom/root-internal.js +2 -2
- package/dist/dom/root-internal.js.map +2 -2
- package/dist/dom/root.d.ts +5 -5
- package/dist/dom/root.js +11 -11
- package/dist/dom/root.js.map +2 -2
- package/dist/dom/test-utils.js +1 -1
- package/dist/react/activity.d.ts +7 -0
- package/dist/react/activity.js +8 -0
- package/dist/react/activity.js.map +7 -0
- package/dist/react/children.d.ts +1 -1
- package/dist/react/children.js +3 -3
- package/dist/react/children.js.map +1 -1
- package/dist/react/class.d.ts +1 -1
- package/dist/react/class.js +3 -3
- package/dist/react/class.js.map +1 -1
- package/dist/react/compiler-runtime.js +2 -2
- package/dist/react/context.d.ts +7 -2
- package/dist/react/context.js +3 -11
- package/dist/react/context.js.map +3 -3
- package/dist/react/element.d.ts +6 -3
- package/dist/react/element.js +7 -11
- package/dist/react/element.js.map +2 -2
- package/dist/react/hooks.d.ts +26 -7
- package/dist/react/hooks.js +13 -3
- package/dist/react/hooks.js.map +2 -2
- package/dist/react/index.d.ts +39 -24
- package/dist/react/index.js +39 -19
- package/dist/react/index.js.map +3 -3
- package/dist/react/jsx-runtime.d.ts +2 -2
- package/dist/react/jsx-runtime.js +3 -3
- package/dist/react/memo.d.ts +1 -1
- package/dist/react/memo.js +1 -1
- package/dist/react/portal.js +1 -1
- package/dist/react/shared-internals.d.ts +15 -5
- package/dist/react/shared-internals.js +2 -3
- package/dist/react/shared-internals.js.map +2 -2
- package/dist/react/suspense.js +1 -1
- package/dist/react/view-transition.d.ts +32 -0
- package/dist/react/view-transition.js +13 -0
- package/dist/react/view-transition.js.map +7 -0
- package/dist/scheduler/index.js +1 -1
- package/dist/server/bootstrap-script.d.ts +1 -23
- package/dist/server/bootstrap-script.js +7 -6
- package/dist/server/bootstrap-script.js.map +2 -2
- package/dist/server/dispatcher.d.ts +28 -6
- package/dist/server/dispatcher.js +33 -15
- package/dist/server/dispatcher.js.map +2 -2
- package/dist/server/escape.js +16 -15
- package/dist/server/escape.js.map +2 -2
- package/dist/server/index.d.ts +6 -6
- package/dist/server/index.js +7 -7
- package/dist/server/renderToString.d.ts +1 -1
- package/dist/server/renderToString.js +12 -8
- package/dist/server/renderToString.js.map +2 -2
- package/dist/server/resource-hints.d.ts +22 -0
- package/dist/server/resource-hints.js +148 -0
- package/dist/server/resource-hints.js.map +7 -0
- package/dist/server/stream.d.ts +15 -2
- package/dist/server/stream.js +155 -63
- package/dist/server/stream.js.map +2 -2
- package/dist/server/walk.d.ts +15 -2
- package/dist/server/walk.js +150 -110
- package/dist/server/walk.js.map +2 -2
- package/dist/vite/index.d.ts +6 -0
- package/dist/vite/index.js +22 -6
- package/dist/vite/index.js.map +2 -2
- package/package.json +1 -1
- package/src/core/attributes.ts +1 -0
- package/src/core/browser.ts +33 -0
- package/src/core/internal.ts +24 -6
- package/src/core/resource-hints.ts +36 -0
- package/src/dom/_all.ts +1 -7
- package/src/dom/commit.ts +186 -0
- package/src/dom/dispatcher.ts +190 -134
- package/src/dom/dom.ts +70 -54
- package/src/dom/error-info.ts +15 -0
- package/src/dom/features/activity/full.ts +166 -0
- package/src/dom/features/activity/index.ts +1 -0
- package/src/dom/features/activity/stub.ts +14 -0
- package/src/dom/features/class/full.ts +72 -28
- package/src/dom/features/context/full.ts +70 -13
- package/src/dom/features/context/stub.ts +10 -5
- package/src/dom/features/forward-ref/full.ts +9 -19
- package/src/dom/features/fragment-refs/index.ts +1 -0
- package/src/dom/features/fragment-refs/stub.ts +3 -0
- package/src/dom/features/hydration/full.ts +84 -85
- package/src/dom/features/hydration/stub.ts +1 -1
- package/src/dom/features/index.ts +1 -0
- package/src/dom/features/memo/full.ts +4 -3
- package/src/dom/features/suspense/full.ts +192 -55
- package/src/dom/features/view-transition/full.ts +288 -0
- package/src/dom/features/view-transition/index.ts +1 -0
- package/src/dom/features/view-transition/resources.ts +107 -0
- package/src/dom/features/view-transition/stub.ts +7 -0
- package/src/dom/features/view-transition/visual.ts +406 -0
- package/src/dom/fragment-instance.ts +337 -0
- package/src/dom/index.ts +6 -7
- package/src/dom/portal.ts +1 -1
- package/src/dom/reconcile.ts +695 -242
- package/src/dom/resource-hints.ts +115 -0
- package/src/dom/resource-store.ts +52 -0
- package/src/dom/resources.ts +39 -0
- package/src/dom/retained-effects.ts +38 -0
- package/src/dom/root-internal.ts +4 -4
- package/src/dom/root.ts +12 -14
- package/src/react/activity.ts +10 -0
- package/src/react/context.ts +4 -11
- package/src/react/element.ts +11 -12
- package/src/react/hooks.ts +12 -3
- package/src/react/index.ts +18 -0
- package/src/react/shared-internals.ts +3 -3
- package/src/react/view-transition.ts +41 -0
- package/src/server/bootstrap-script.ts +36 -5
- package/src/server/dispatcher.ts +35 -13
- package/src/server/escape.ts +15 -12
- package/src/server/renderToString.ts +7 -5
- package/src/server/resource-hints.ts +165 -0
- package/src/server/stream.ts +154 -62
- package/src/server/walk.ts +79 -26
- package/src/vite/index.ts +30 -13
package/dist/react/hooks.d.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import type { Dispatch, SetStateAction, EffectCallback, DependencyList } from
|
|
2
|
-
import type { Context } from
|
|
3
|
-
|
|
4
|
-
export declare function
|
|
1
|
+
import type { Dispatch, SetStateAction, EffectCallback, DependencyList } from "../core/index.js";
|
|
2
|
+
import type { Context } from "./context.js";
|
|
3
|
+
import type { BrowserToken } from "../core/browser.js";
|
|
4
|
+
export declare function useState<S>(initial: S | (() => S)): [
|
|
5
|
+
S,
|
|
6
|
+
Dispatch<SetStateAction<S>>
|
|
7
|
+
];
|
|
8
|
+
export declare function useReducer<S, A>(reducer: (s: S, a: A) => S, initial: any, init?: (a: any) => S): [
|
|
9
|
+
S,
|
|
10
|
+
Dispatch<A>
|
|
11
|
+
];
|
|
5
12
|
export declare function useEffect(create: EffectCallback, deps?: DependencyList): void;
|
|
6
13
|
export declare function useLayoutEffect(create: EffectCallback, deps?: DependencyList): void;
|
|
7
14
|
export declare function useInsertionEffect(create: EffectCallback, deps?: DependencyList): void;
|
|
@@ -20,23 +27,35 @@ export declare function useContext<T>(ctx: Context<T>): T;
|
|
|
20
27
|
export declare function useImperativeHandle<T>(ref: any, factory: () => T, deps?: DependencyList): void;
|
|
21
28
|
export declare function useDebugValue<T>(value: T, formatter?: (v: T) => any): void;
|
|
22
29
|
export declare function useId(): string;
|
|
23
|
-
export declare function useTransition(): [
|
|
30
|
+
export declare function useTransition(): [
|
|
31
|
+
boolean,
|
|
32
|
+
(fn: () => void) => void
|
|
33
|
+
];
|
|
24
34
|
export declare function useDeferredValue<T>(v: T): T;
|
|
25
35
|
export declare function useSyncExternalStore<T>(subscribe: (cb: () => void) => () => void, getSnapshot: () => T, getServerSnapshot?: () => T): T;
|
|
36
|
+
export declare function use(resource: BrowserToken): undefined;
|
|
26
37
|
export declare function use<T>(resource: PromiseLike<T> | {
|
|
27
38
|
_currentValue: T;
|
|
28
39
|
} | {
|
|
29
40
|
$$typeof: symbol;
|
|
30
41
|
_currentValue: T;
|
|
31
42
|
}): T;
|
|
43
|
+
export declare function unstable_useCacheRefresh(): () => void;
|
|
32
44
|
export declare function startTransition(fn: () => void): void;
|
|
33
|
-
export declare function useActionState<S, P>(_action: (state: Awaited<S>, payload: P) => S | Promise<S>, initial: Awaited<S>): [
|
|
45
|
+
export declare function useActionState<S, P>(_action: (state: Awaited<S>, payload: P) => S | Promise<S>, initial: Awaited<S>): [
|
|
46
|
+
Awaited<S>,
|
|
47
|
+
(payload: P) => void,
|
|
48
|
+
boolean
|
|
49
|
+
];
|
|
34
50
|
export declare function useFormStatus(): {
|
|
35
51
|
pending: boolean;
|
|
36
52
|
data: any;
|
|
37
53
|
method: any;
|
|
38
54
|
action: any;
|
|
39
55
|
};
|
|
40
|
-
export declare function useOptimistic<S, A = S>(state: S, _updateFn?: (s: S, a: A) => S): [
|
|
56
|
+
export declare function useOptimistic<S, A = S>(state: S, _updateFn?: (s: S, a: A) => S): [
|
|
57
|
+
S,
|
|
58
|
+
(action: A) => void
|
|
59
|
+
];
|
|
41
60
|
export declare function useEffectEvent<Args extends unknown[], Return>(fn: (...args: Args) => Return): (...args: Args) => Return;
|
|
42
61
|
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;
|
package/dist/react/hooks.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
//
|
|
2
|
-
import { getDispatcher } from "./shared-internals";
|
|
1
|
+
// src/react/hooks.ts
|
|
2
|
+
import { getDispatcher, ReactSharedInternals } from "./shared-internals.js";
|
|
3
3
|
function useState(initial) {
|
|
4
4
|
return getDispatcher().useState(initial);
|
|
5
5
|
}
|
|
@@ -48,8 +48,17 @@ function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
|
|
48
48
|
function use(resource) {
|
|
49
49
|
return getDispatcher().use(resource);
|
|
50
50
|
}
|
|
51
|
+
function unstable_useCacheRefresh() {
|
|
52
|
+
return getDispatcher().useCacheRefresh();
|
|
53
|
+
}
|
|
51
54
|
function startTransition(fn) {
|
|
52
|
-
|
|
55
|
+
const previous = ReactSharedInternals.T;
|
|
56
|
+
ReactSharedInternals.T = previous || /* @__PURE__ */ new Set();
|
|
57
|
+
try {
|
|
58
|
+
fn();
|
|
59
|
+
} finally {
|
|
60
|
+
ReactSharedInternals.T = previous;
|
|
61
|
+
}
|
|
53
62
|
}
|
|
54
63
|
function useActionState(_action, initial) {
|
|
55
64
|
return [initial, () => {
|
|
@@ -121,6 +130,7 @@ function useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnaps
|
|
|
121
130
|
}
|
|
122
131
|
export {
|
|
123
132
|
startTransition,
|
|
133
|
+
unstable_useCacheRefresh,
|
|
124
134
|
use,
|
|
125
135
|
useActionState,
|
|
126
136
|
useCallback,
|
package/dist/react/hooks.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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: PromiseLike<T> | { _currentValue: T } | { $$typeof: symbol; _currentValue: T }): 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,
|
|
4
|
+
"sourcesContent": ["import type {\n Dispatch,\n SetStateAction,\n EffectCallback,\n DependencyList,\n} from '../core'\nimport type { Context } from './context'\nimport { getDispatcher, ReactSharedInternals } from './shared-internals'\nimport type { BrowserToken } from '../core/browser'\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(resource: BrowserToken): undefined\nexport function use<T>(resource: PromiseLike<T> | { _currentValue: T } | { $$typeof: symbol; _currentValue: T }): T\nexport function use<T>(resource: BrowserToken | PromiseLike<T> | { _currentValue: T } | { $$typeof: symbol; _currentValue: T }): T {\n return getDispatcher().use(resource)\n}\n\nexport function unstable_useCacheRefresh(): () => void {\n return getDispatcher().useCacheRefresh()\n}\n\nexport function startTransition(fn: () => void): void {\n const previous = ReactSharedInternals.T\n ReactSharedInternals.T = previous || new Set()\n try { fn() } finally { ReactSharedInternals.T = previous }\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": "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",
|
|
6
6
|
"names": ["nextSelection"]
|
|
7
7
|
}
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,34 +1,43 @@
|
|
|
1
|
-
export { createElement, cloneElement, isValidElement, createRef, Fragment } from
|
|
2
|
-
export type { ReactElement, ReactNode, Key, Ref, RefObject, RefCallback, Dispatch, SetStateAction, EffectCallback, DependencyList, } from
|
|
1
|
+
export { createElement, cloneElement, isValidElement, createRef, Fragment } from "./element.js";
|
|
2
|
+
export type { ReactElement, ReactNode, Key, Ref, RefObject, RefCallback, Dispatch, SetStateAction, EffectCallback, DependencyList, } from "../core/index.js";
|
|
3
3
|
export type FC<P = {}> = (props: P & {
|
|
4
|
-
children?: import(
|
|
5
|
-
}) => import(
|
|
6
|
-
export { useState, useReducer, useEffect, useLayoutEffect, useInsertionEffect, useRef, useMemo, useCallback, useContext, useImperativeHandle, useDebugValue, useId, useTransition, useDeferredValue, useSyncExternalStore, useSyncExternalStoreWithSelector, use, useActionState, useFormStatus, useOptimistic, useEffectEvent, startTransition, } from
|
|
7
|
-
export { createContext, REACT_CONTEXT_TYPE, REACT_PROVIDER_TYPE, REACT_CONSUMER_TYPE, type Context, type ProviderExoticComponent, type ConsumerExoticComponent, } from
|
|
8
|
-
export { Component, PureComponent } from
|
|
9
|
-
export { memo, forwardRef, lazy, REACT_MEMO_TYPE, REACT_FORWARD_REF_TYPE, REACT_LAZY_TYPE, } from
|
|
10
|
-
export { Suspense, StrictMode, Profiler, REACT_SUSPENSE_TYPE, REACT_STRICT_MODE_TYPE, REACT_PROFILER_TYPE, } from
|
|
11
|
-
export { REACT_PORTAL_TYPE } from
|
|
12
|
-
export { Children } from
|
|
13
|
-
export {
|
|
4
|
+
children?: import("../core/index.js").ReactNode;
|
|
5
|
+
}) => import("../core/index.js").ReactElement | null;
|
|
6
|
+
export { useState, useReducer, useEffect, useLayoutEffect, useInsertionEffect, useRef, useMemo, useCallback, useContext, useImperativeHandle, useDebugValue, useId, useTransition, useDeferredValue, useSyncExternalStore, useSyncExternalStoreWithSelector, use, useActionState, useFormStatus, useOptimistic, useEffectEvent, startTransition, unstable_useCacheRefresh, } from "./hooks.js";
|
|
7
|
+
export { createContext, REACT_CONTEXT_TYPE, REACT_PROVIDER_TYPE, REACT_CONSUMER_TYPE, type Context, type ProviderExoticComponent, type ConsumerExoticComponent, } from "./context.js";
|
|
8
|
+
export { Component, PureComponent } from "./class.js";
|
|
9
|
+
export { memo, forwardRef, lazy, REACT_MEMO_TYPE, REACT_FORWARD_REF_TYPE, REACT_LAZY_TYPE, } from "./memo.js";
|
|
10
|
+
export { Suspense, StrictMode, Profiler, REACT_SUSPENSE_TYPE, REACT_STRICT_MODE_TYPE, REACT_PROFILER_TYPE, } from "./suspense.js";
|
|
11
|
+
export { REACT_PORTAL_TYPE } from "./portal.js";
|
|
12
|
+
export { Children } from "./children.js";
|
|
13
|
+
export { ViewTransition, addTransitionType, REACT_VIEW_TRANSITION_TYPE } from "./view-transition.js";
|
|
14
|
+
export type { ViewTransitionProps, ViewTransitionClass, ViewTransitionInstance, ViewTransitionPseudoElement } from "./view-transition.js";
|
|
15
|
+
export { Activity, REACT_ACTIVITY_TYPE } from "./activity.js";
|
|
16
|
+
export type { ActivityProps } from "./activity.js";
|
|
17
|
+
export type { FragmentInstance } from "../dom/fragment-instance.js";
|
|
18
|
+
export { ReactSharedInternals } from "./shared-internals.js";
|
|
14
19
|
export declare const cache: <T extends Function>(fn: T) => T;
|
|
20
|
+
export declare const cacheSignal: () => AbortSignal | null;
|
|
15
21
|
export declare const act: (fn: () => any) => Promise<void>;
|
|
16
22
|
export declare function taintUniqueValue(_msg: string, _lifetime: any, _value: any): void;
|
|
17
23
|
export declare function taintObjectReference(_msg: string, _object: any): void;
|
|
18
24
|
export declare const version = "19.2.3";
|
|
19
|
-
import { createElement, cloneElement, isValidElement, createRef } from
|
|
20
|
-
import { useState, useReducer, useEffect, useLayoutEffect, useInsertionEffect, useRef, useMemo, useCallback, useContext, useImperativeHandle, useDebugValue, useId, useTransition, useDeferredValue, useSyncExternalStore, use, useActionState, useFormStatus, useOptimistic, useEffectEvent, startTransition } from
|
|
21
|
-
import { createContext } from
|
|
22
|
-
import { Component, PureComponent } from
|
|
23
|
-
import { memo, forwardRef, lazy } from
|
|
25
|
+
import { createElement, cloneElement, isValidElement, createRef } from "./element.js";
|
|
26
|
+
import { useState, useReducer, useEffect, useLayoutEffect, useInsertionEffect, useRef, useMemo, useCallback, useContext, useImperativeHandle, useDebugValue, useId, useTransition, useDeferredValue, useSyncExternalStore, use, useActionState, useFormStatus, useOptimistic, useEffectEvent, startTransition, unstable_useCacheRefresh } from "./hooks.js";
|
|
27
|
+
import { createContext } from "./context.js";
|
|
28
|
+
import { Component, PureComponent } from "./class.js";
|
|
29
|
+
import { memo, forwardRef, lazy } from "./memo.js";
|
|
30
|
+
import { addTransitionType } from "./view-transition.js";
|
|
24
31
|
declare const _default: {
|
|
25
32
|
createElement: typeof createElement;
|
|
26
33
|
cloneElement: typeof cloneElement;
|
|
27
34
|
isValidElement: typeof isValidElement;
|
|
28
35
|
createRef: typeof createRef;
|
|
29
36
|
Fragment: (props: {
|
|
30
|
-
children?: import(".").ReactNode;
|
|
31
|
-
|
|
37
|
+
children?: import("./index.js").ReactNode;
|
|
38
|
+
key?: string | number;
|
|
39
|
+
ref?: import("./index.js").Ref<import("./index.js").FragmentInstance>;
|
|
40
|
+
}) => import("./index.js").ReactElement;
|
|
32
41
|
useState: typeof useState;
|
|
33
42
|
useReducer: typeof useReducer;
|
|
34
43
|
useEffect: typeof useEffect;
|
|
@@ -50,6 +59,7 @@ declare const _default: {
|
|
|
50
59
|
useOptimistic: typeof useOptimistic;
|
|
51
60
|
useEffectEvent: typeof useEffectEvent;
|
|
52
61
|
startTransition: typeof startTransition;
|
|
62
|
+
unstable_useCacheRefresh: typeof unstable_useCacheRefresh;
|
|
53
63
|
createContext: typeof createContext;
|
|
54
64
|
Component: typeof Component;
|
|
55
65
|
PureComponent: typeof PureComponent;
|
|
@@ -69,12 +79,17 @@ declare const _default: {
|
|
|
69
79
|
children?: any;
|
|
70
80
|
}) => any;
|
|
71
81
|
Children: {
|
|
72
|
-
map(children: import(".").ReactNode, fn: (child: import(".").ReactNode, index: number) => any): any[] | null;
|
|
73
|
-
forEach(children: import(".").ReactNode, fn: (child: import(".").ReactNode, index: number) => void): void;
|
|
74
|
-
count(children: import(".").ReactNode): number;
|
|
75
|
-
toArray(children: import(".").ReactNode): any[];
|
|
76
|
-
only(children: import(".").ReactNode): import(".").ReactElement;
|
|
82
|
+
map(children: import("./index.js").ReactNode, fn: (child: import("./index.js").ReactNode, index: number) => any): any[] | null;
|
|
83
|
+
forEach(children: import("./index.js").ReactNode, fn: (child: import("./index.js").ReactNode, index: number) => void): void;
|
|
84
|
+
count(children: import("./index.js").ReactNode): number;
|
|
85
|
+
toArray(children: import("./index.js").ReactNode): any[];
|
|
86
|
+
only(children: import("./index.js").ReactNode): import("./index.js").ReactElement;
|
|
77
87
|
};
|
|
88
|
+
ViewTransition: (props: import("./view-transition.js").ViewTransitionProps) => any;
|
|
89
|
+
Activity: (props: import("./activity.js").ActivityProps) => any;
|
|
90
|
+
addTransitionType: typeof addTransitionType;
|
|
91
|
+
cache: <T extends Function>(fn: T) => T;
|
|
92
|
+
cacheSignal: () => AbortSignal | null;
|
|
78
93
|
version: string;
|
|
79
94
|
};
|
|
80
95
|
export default _default;
|
package/dist/react/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
//
|
|
2
|
-
import { createElement, cloneElement, isValidElement, createRef, Fragment } from "./element";
|
|
1
|
+
// src/react/index.ts
|
|
2
|
+
import { createElement, cloneElement, isValidElement, createRef, Fragment } from "./element.js";
|
|
3
3
|
import {
|
|
4
4
|
useState,
|
|
5
5
|
useReducer,
|
|
@@ -22,15 +22,16 @@ import {
|
|
|
22
22
|
useFormStatus,
|
|
23
23
|
useOptimistic,
|
|
24
24
|
useEffectEvent,
|
|
25
|
-
startTransition
|
|
26
|
-
|
|
25
|
+
startTransition,
|
|
26
|
+
unstable_useCacheRefresh
|
|
27
|
+
} from "./hooks.js";
|
|
27
28
|
import {
|
|
28
29
|
createContext,
|
|
29
30
|
REACT_CONTEXT_TYPE,
|
|
30
31
|
REACT_PROVIDER_TYPE,
|
|
31
32
|
REACT_CONSUMER_TYPE
|
|
32
|
-
} from "./context";
|
|
33
|
-
import { Component, PureComponent } from "./class";
|
|
33
|
+
} from "./context.js";
|
|
34
|
+
import { Component, PureComponent } from "./class.js";
|
|
34
35
|
import {
|
|
35
36
|
memo,
|
|
36
37
|
forwardRef,
|
|
@@ -38,7 +39,7 @@ import {
|
|
|
38
39
|
REACT_MEMO_TYPE,
|
|
39
40
|
REACT_FORWARD_REF_TYPE,
|
|
40
41
|
REACT_LAZY_TYPE
|
|
41
|
-
} from "./memo";
|
|
42
|
+
} from "./memo.js";
|
|
42
43
|
import {
|
|
43
44
|
Suspense,
|
|
44
45
|
StrictMode,
|
|
@@ -46,11 +47,13 @@ import {
|
|
|
46
47
|
REACT_SUSPENSE_TYPE,
|
|
47
48
|
REACT_STRICT_MODE_TYPE,
|
|
48
49
|
REACT_PROFILER_TYPE
|
|
49
|
-
} from "./suspense";
|
|
50
|
-
import { REACT_PORTAL_TYPE } from "./portal";
|
|
51
|
-
import { Children } from "./children";
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
50
|
+
} from "./suspense.js";
|
|
51
|
+
import { REACT_PORTAL_TYPE } from "./portal.js";
|
|
52
|
+
import { Children } from "./children.js";
|
|
53
|
+
import { ViewTransition, addTransitionType, REACT_VIEW_TRANSITION_TYPE } from "./view-transition.js";
|
|
54
|
+
import { Activity, REACT_ACTIVITY_TYPE } from "./activity.js";
|
|
55
|
+
import { ReactSharedInternals } from "./shared-internals.js";
|
|
56
|
+
import { createElement as createElement2, cloneElement as cloneElement2, isValidElement as isValidElement2, createRef as createRef2, Fragment as Fragment2 } from "./element.js";
|
|
54
57
|
import {
|
|
55
58
|
useState as useState2,
|
|
56
59
|
useReducer as useReducer2,
|
|
@@ -72,14 +75,18 @@ import {
|
|
|
72
75
|
useFormStatus as useFormStatus2,
|
|
73
76
|
useOptimistic as useOptimistic2,
|
|
74
77
|
useEffectEvent as useEffectEvent2,
|
|
75
|
-
startTransition as startTransition2
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
import {
|
|
79
|
-
import {
|
|
80
|
-
import {
|
|
81
|
-
import {
|
|
78
|
+
startTransition as startTransition2,
|
|
79
|
+
unstable_useCacheRefresh as unstable_useCacheRefresh2
|
|
80
|
+
} from "./hooks.js";
|
|
81
|
+
import { createContext as createContext2 } from "./context.js";
|
|
82
|
+
import { Component as Component2, PureComponent as PureComponent2 } from "./class.js";
|
|
83
|
+
import { memo as memo2, forwardRef as forwardRef2, lazy as lazy2 } from "./memo.js";
|
|
84
|
+
import { Suspense as Suspense2, StrictMode as StrictMode2, Profiler as Profiler2 } from "./suspense.js";
|
|
85
|
+
import { Children as Children2 } from "./children.js";
|
|
86
|
+
import { ViewTransition as ViewTransition2, addTransitionType as addTransitionType2 } from "./view-transition.js";
|
|
87
|
+
import { Activity as Activity2 } from "./activity.js";
|
|
82
88
|
var cache = (fn) => fn;
|
|
89
|
+
var cacheSignal = () => null;
|
|
83
90
|
var act = async (fn) => {
|
|
84
91
|
const r = fn();
|
|
85
92
|
if (r && typeof r.then == "function") await r;
|
|
@@ -116,6 +123,7 @@ var react_default = {
|
|
|
116
123
|
useOptimistic: useOptimistic2,
|
|
117
124
|
useEffectEvent: useEffectEvent2,
|
|
118
125
|
startTransition: startTransition2,
|
|
126
|
+
unstable_useCacheRefresh: unstable_useCacheRefresh2,
|
|
119
127
|
createContext: createContext2,
|
|
120
128
|
Component: Component2,
|
|
121
129
|
PureComponent: PureComponent2,
|
|
@@ -126,14 +134,21 @@ var react_default = {
|
|
|
126
134
|
StrictMode: StrictMode2,
|
|
127
135
|
Profiler: Profiler2,
|
|
128
136
|
Children: Children2,
|
|
137
|
+
ViewTransition: ViewTransition2,
|
|
138
|
+
Activity: Activity2,
|
|
139
|
+
addTransitionType: addTransitionType2,
|
|
140
|
+
cache,
|
|
141
|
+
cacheSignal,
|
|
129
142
|
version: "19.2.3"
|
|
130
143
|
};
|
|
131
144
|
export {
|
|
145
|
+
Activity,
|
|
132
146
|
Children,
|
|
133
147
|
Component,
|
|
134
148
|
Fragment,
|
|
135
149
|
Profiler,
|
|
136
150
|
PureComponent,
|
|
151
|
+
REACT_ACTIVITY_TYPE,
|
|
137
152
|
REACT_CONSUMER_TYPE,
|
|
138
153
|
REACT_CONTEXT_TYPE,
|
|
139
154
|
REACT_FORWARD_REF_TYPE,
|
|
@@ -144,11 +159,15 @@ export {
|
|
|
144
159
|
REACT_PROVIDER_TYPE,
|
|
145
160
|
REACT_STRICT_MODE_TYPE,
|
|
146
161
|
REACT_SUSPENSE_TYPE,
|
|
162
|
+
REACT_VIEW_TRANSITION_TYPE,
|
|
147
163
|
ReactSharedInternals,
|
|
148
164
|
StrictMode,
|
|
149
165
|
Suspense,
|
|
166
|
+
ViewTransition,
|
|
150
167
|
act,
|
|
168
|
+
addTransitionType,
|
|
151
169
|
cache,
|
|
170
|
+
cacheSignal,
|
|
152
171
|
cloneElement,
|
|
153
172
|
createContext,
|
|
154
173
|
createElement,
|
|
@@ -161,6 +180,7 @@ export {
|
|
|
161
180
|
startTransition,
|
|
162
181
|
taintObjectReference,
|
|
163
182
|
taintUniqueValue,
|
|
183
|
+
unstable_useCacheRefresh,
|
|
164
184
|
use,
|
|
165
185
|
useActionState,
|
|
166
186
|
useCallback,
|
package/dist/react/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/react/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { createElement, cloneElement, isValidElement, createRef, Fragment } from './element'\nexport type {\n ReactElement,\n ReactNode,\n Key,\n Ref,\n RefObject,\n RefCallback,\n Dispatch,\n SetStateAction,\n EffectCallback,\n DependencyList,\n} from '../core'\n\n// Lightweight functional-component alias \u2014 matches React's FC shape closely\n// enough for the common `const X: FC<P> = (props) => \u2026` pattern used in\n// tests and downstream consumer code.\nexport type FC<P = {}> = (props: P & { children?: import('../core').ReactNode }) => import('../core').ReactElement | null\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;AAkBjF;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;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP,SAAS,WAAW,qBAAqB;AACzC;AAAA,EACE;AAAA,EAAM;AAAA,EAAY;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EAAU;AAAA,EAAY;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,yBAAyB;AAClC,SAAS,gBAAgB;AACzB,SAAS,4BAA4B;
|
|
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"]
|
|
4
|
+
"sourcesContent": ["export { createElement, cloneElement, isValidElement, createRef, Fragment } from './element'\nexport type {\n ReactElement,\n ReactNode,\n Key,\n Ref,\n RefObject,\n RefCallback,\n Dispatch,\n SetStateAction,\n EffectCallback,\n DependencyList,\n} from '../core'\n\n// Lightweight functional-component alias \u2014 matches React's FC shape closely\n// enough for the common `const X: FC<P> = (props) => \u2026` pattern used in\n// tests and downstream consumer code.\nexport type FC<P = {}> = (props: P & { children?: import('../core').ReactNode }) => import('../core').ReactElement | null\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 unstable_useCacheRefresh,\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 { ViewTransition, addTransitionType, REACT_VIEW_TRANSITION_TYPE } from './view-transition'\nexport type { ViewTransitionProps, ViewTransitionClass, ViewTransitionInstance, ViewTransitionPseudoElement } from './view-transition'\nexport { Activity, REACT_ACTIVITY_TYPE } from './activity'\nexport type { ActivityProps } from './activity'\nexport type { FragmentInstance } from '../dom/fragment-instance'\nexport { ReactSharedInternals } from './shared-internals'\n\n// Stub exports\nexport const cache = <T extends Function>(fn: T): T => fn\n// The client/DOM-server entry has no RSC cache lifetime, matching React's\n// client export. The upstream Flight renderer remains responsible for RSC.\nexport const cacheSignal = (): AbortSignal | null => null\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 unstable_useCacheRefresh,\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'\nimport { ViewTransition, addTransitionType } from './view-transition'\nimport { Activity } from './activity'\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 unstable_useCacheRefresh,\n createContext,\n Component,\n PureComponent,\n memo,\n forwardRef,\n lazy,\n Suspense,\n StrictMode,\n Profiler,\n Children,\n ViewTransition,\n Activity,\n addTransitionType,\n cache,\n cacheSignal,\n version: '19.2.3',\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
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", "unstable_useCacheRefresh", "createContext", "Component", "PureComponent", "memo", "forwardRef", "lazy", "Suspense", "StrictMode", "Profiler", "Children", "ViewTransition", "addTransitionType", "Activity"]
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type ReactElement } from
|
|
2
|
-
export { Fragment } from
|
|
1
|
+
import { type ReactElement } from "../core/index.js";
|
|
2
|
+
export { Fragment } from "./element.js";
|
|
3
3
|
export declare function jsx(type: any, props: any, key?: any): ReactElement;
|
|
4
4
|
export declare const jsxs: typeof jsx;
|
|
5
5
|
export declare const jsxDEV: typeof jsx;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//
|
|
2
|
-
import { REACT_ELEMENT_TYPE } from "../core";
|
|
3
|
-
import { Fragment } from "./element";
|
|
1
|
+
// src/react/jsx-runtime.ts
|
|
2
|
+
import { REACT_ELEMENT_TYPE } from "../core/index.js";
|
|
3
|
+
import { Fragment } from "./element.js";
|
|
4
4
|
function jsx(type, props, key) {
|
|
5
5
|
return {
|
|
6
6
|
$$typeof: REACT_ELEMENT_TYPE,
|
package/dist/react/memo.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ReactElement, ReactNode, Ref } from
|
|
1
|
+
import type { ReactElement, ReactNode, Ref } from "../core/index.js";
|
|
2
2
|
export declare const REACT_MEMO_TYPE: unique symbol;
|
|
3
3
|
export declare const REACT_FORWARD_REF_TYPE: unique symbol;
|
|
4
4
|
export declare const REACT_LAZY_TYPE: unique symbol;
|
package/dist/react/memo.js
CHANGED
package/dist/react/portal.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import type { Fiber
|
|
1
|
+
import type { Fiber } from "../core/index.js";
|
|
2
2
|
export interface Dispatcher {
|
|
3
|
-
useState<S>(initial: S | (() => S)): [
|
|
4
|
-
|
|
3
|
+
useState<S>(initial: S | (() => S)): [
|
|
4
|
+
S,
|
|
5
|
+
(s: S | ((p: S) => S)) => void
|
|
6
|
+
];
|
|
7
|
+
useReducer<S, A>(reducer: (s: S, a: A) => S, initial: S | any, init?: (a: any) => S): [
|
|
8
|
+
S,
|
|
9
|
+
(a: A) => void
|
|
10
|
+
];
|
|
5
11
|
useEffect(create: () => any, deps?: ReadonlyArray<unknown>): void;
|
|
6
12
|
useLayoutEffect(create: () => any, deps?: ReadonlyArray<unknown>): void;
|
|
7
13
|
useInsertionEffect(create: () => any, deps?: ReadonlyArray<unknown>): void;
|
|
@@ -14,16 +20,20 @@ export interface Dispatcher {
|
|
|
14
20
|
useImperativeHandle<T>(ref: any, factory: () => T, deps?: ReadonlyArray<unknown>): void;
|
|
15
21
|
useDebugValue<T>(value: T, formatter?: (v: T) => any): void;
|
|
16
22
|
useId(): string;
|
|
17
|
-
useTransition(): [
|
|
23
|
+
useTransition(): [
|
|
24
|
+
boolean,
|
|
25
|
+
(fn: () => void) => void
|
|
26
|
+
];
|
|
18
27
|
useDeferredValue<T>(v: T): T;
|
|
19
28
|
useSyncExternalStore<T>(subscribe: (cb: () => void) => () => void, getSnapshot: () => T, getServerSnapshot?: () => T): T;
|
|
20
29
|
use<T>(promiseOrContext: any): T;
|
|
30
|
+
useCacheRefresh(): () => void;
|
|
21
31
|
}
|
|
22
32
|
interface SharedInternals {
|
|
23
33
|
H: Dispatcher | null;
|
|
24
34
|
F: Fiber | null;
|
|
25
|
-
K: Hook | null;
|
|
26
35
|
I: number;
|
|
36
|
+
T?: Set<string> | null | undefined;
|
|
27
37
|
}
|
|
28
38
|
export declare const ReactSharedInternals: SharedInternals;
|
|
29
39
|
export declare function getDispatcher(): Dispatcher;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
//
|
|
1
|
+
// src/react/shared-internals.ts
|
|
2
2
|
var KEY = /* @__PURE__ */ Symbol.for("@tanstack/redact.ReactSharedInternals");
|
|
3
3
|
var g = globalThis;
|
|
4
4
|
var ReactSharedInternals = g[KEY] ?? (g[KEY] = {
|
|
5
5
|
H: null,
|
|
6
6
|
F: null,
|
|
7
|
-
K: null,
|
|
8
7
|
I: 0
|
|
9
8
|
});
|
|
10
9
|
function getDispatcher() {
|
|
11
10
|
const d = ReactSharedInternals.H;
|
|
12
11
|
if (!d) {
|
|
13
|
-
if (
|
|
12
|
+
if (process.env.NODE_ENV !== "production") {
|
|
14
13
|
throw new Error(
|
|
15
14
|
'Hooks can only be called inside a function component. If this fires during SSR/RSC, the most common cause is a component that uses client-only hooks (useState, useContext, useRouter, etc.) being rendered in the RSC server environment without a "use client" directive at the top of its file.'
|
|
16
15
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/react/shared-internals.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Fiber
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["import type { Fiber } from '../core'\n\nexport interface Dispatcher {\n useState<S>(initial: S | (() => S)): [S, (s: S | ((p: S) => S)) => void]\n useReducer<S, A>(\n reducer: (s: S, a: A) => S,\n initial: S | any,\n init?: (a: any) => S,\n ): [S, (a: A) => void]\n useEffect(create: () => any, deps?: ReadonlyArray<unknown>): void\n useLayoutEffect(create: () => any, deps?: ReadonlyArray<unknown>): void\n useInsertionEffect(create: () => any, deps?: ReadonlyArray<unknown>): void\n useRef<T>(initial: T): { current: T }\n useMemo<T>(factory: () => T, deps?: ReadonlyArray<unknown>): T\n useCallback<T extends Function>(fn: T, deps?: ReadonlyArray<unknown>): T\n useContext<T>(ctx: any): T\n useImperativeHandle<T>(ref: any, factory: () => T, deps?: ReadonlyArray<unknown>): void\n useDebugValue<T>(value: T, formatter?: (v: T) => any): void\n useId(): string\n useTransition(): [boolean, (fn: () => void) => void]\n useDeferredValue<T>(v: T): T\n useSyncExternalStore<T>(\n subscribe: (cb: () => void) => () => void,\n getSnapshot: () => T,\n getServerSnapshot?: () => T,\n ): T\n use<T>(promiseOrContext: any): T\n useCacheRefresh(): () => void\n}\n\ninterface SharedInternals {\n H: Dispatcher | null\n F: Fiber | null\n I: number\n T?: Set<string> | null | undefined\n}\n\n// Stash the singleton on `globalThis` under a registered symbol. Module-scoped\n// state goes wrong fast in environments that end up with multiple copies of\n// `@tanstack/redact` in flight \u2014 most notably Cloudflare's `vite-plugin` dev\n// mode, where the worker entry inlines `@tanstack/redact` once via `noExternal`\n// while user code reaches a separate pre-bundled `deps_ssr/redact.js` copy.\n// Each copy would otherwise have its own `ReactSharedInternals.H`, so the SSR\n// dispatcher installed by one would be invisible to hooks called through the\n// other and `useContext` would explode with \"Hooks can only be called inside a\n// function component\". `Symbol.for` survives module re-evaluation and isolate\n// boundaries, giving every copy the same backing object.\nconst KEY = Symbol.for('@tanstack/redact.ReactSharedInternals')\nconst g = globalThis as unknown as { [k: symbol]: SharedInternals | undefined }\n\nexport const ReactSharedInternals: SharedInternals =\n g[KEY] ??\n (g[KEY] = {\n H: null,\n F: null,\n I: 0,\n })\n\nexport function getDispatcher(): Dispatcher {\n const d = ReactSharedInternals.H\n if (!d) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n 'Hooks can only be called inside a function component. ' +\n 'If this fires during SSR/RSC, the most common cause is a component that uses client-only hooks ' +\n '(useState, useContext, useRouter, etc.) being rendered in the RSC server environment without a ' +\n '\"use client\" directive at the top of its file.',\n )\n }\n throw new Error()\n }\n return d\n}\n"],
|
|
5
|
+
"mappings": ";AA+CA,IAAM,MAAM,uBAAO,IAAI,uCAAuC;AAC9D,IAAM,IAAI;AAEH,IAAM,uBACX,EAAE,GAAG,MACJ,EAAE,GAAG,IAAI;AAAA,EACR,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEK,SAAS,gBAA4B;AAC1C,QAAM,IAAI,qBAAqB;AAC/B,MAAI,CAAC,GAAG;AACN,QAAI,yBAAyB,cAAc;AACzC,YAAM,IAAI;AAAA,QACR;AAAA,MAIF;AAAA,IACF;AACA,UAAM,IAAI,MAAM;AAAA,EAClB;AACA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/react/suspense.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// src/react/suspense.ts
|
|
2
2
|
var REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense");
|
|
3
3
|
var REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode");
|
|
4
4
|
var REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler");
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ReactNode } from "../core/index.js";
|
|
2
|
+
export declare const REACT_VIEW_TRANSITION_TYPE: unique symbol;
|
|
3
|
+
export type ViewTransitionClass = string | Record<string, string>;
|
|
4
|
+
export interface ViewTransitionPseudoElement {
|
|
5
|
+
animate(keyframes: Keyframe[] | PropertyIndexedKeyframes | null, options?: number | KeyframeAnimationOptions): Animation;
|
|
6
|
+
getAnimations(): Animation[];
|
|
7
|
+
getComputedStyle(): CSSStyleDeclaration;
|
|
8
|
+
}
|
|
9
|
+
export interface ViewTransitionInstance {
|
|
10
|
+
name: string;
|
|
11
|
+
group: ViewTransitionPseudoElement;
|
|
12
|
+
imagePair: ViewTransitionPseudoElement;
|
|
13
|
+
old: ViewTransitionPseudoElement;
|
|
14
|
+
new: ViewTransitionPseudoElement;
|
|
15
|
+
}
|
|
16
|
+
type ViewTransitionEvent = (instance: ViewTransitionInstance, types: string[]) => void | (() => void);
|
|
17
|
+
export interface ViewTransitionProps {
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
name?: string | Record<string, string> | undefined;
|
|
20
|
+
default?: ViewTransitionClass | undefined;
|
|
21
|
+
enter?: ViewTransitionClass | undefined;
|
|
22
|
+
exit?: ViewTransitionClass | undefined;
|
|
23
|
+
update?: ViewTransitionClass | undefined;
|
|
24
|
+
share?: ViewTransitionClass | undefined;
|
|
25
|
+
onEnter?: ViewTransitionEvent | undefined;
|
|
26
|
+
onExit?: ViewTransitionEvent | undefined;
|
|
27
|
+
onUpdate?: ViewTransitionEvent | undefined;
|
|
28
|
+
onShare?: ViewTransitionEvent | undefined;
|
|
29
|
+
}
|
|
30
|
+
export declare const ViewTransition: (props: ViewTransitionProps) => any;
|
|
31
|
+
export declare function addTransitionType(type: string): void;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// src/react/view-transition.ts
|
|
2
|
+
import { ReactSharedInternals } from "./shared-internals.js";
|
|
3
|
+
var REACT_VIEW_TRANSITION_TYPE = /* @__PURE__ */ Symbol.for("react.view_transition");
|
|
4
|
+
var ViewTransition = REACT_VIEW_TRANSITION_TYPE;
|
|
5
|
+
function addTransitionType(type) {
|
|
6
|
+
ReactSharedInternals.T?.add(type);
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
REACT_VIEW_TRANSITION_TYPE,
|
|
10
|
+
ViewTransition,
|
|
11
|
+
addTransitionType
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=view-transition.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/react/view-transition.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ReactNode } from '../core'\nimport { ReactSharedInternals } from './shared-internals'\n\nexport const REACT_VIEW_TRANSITION_TYPE = Symbol.for('react.view_transition')\n\nexport type ViewTransitionClass = string | Record<string, string>\nexport interface ViewTransitionPseudoElement {\n animate(keyframes: Keyframe[] | PropertyIndexedKeyframes | null, options?: number | KeyframeAnimationOptions): Animation\n getAnimations(): Animation[]\n getComputedStyle(): CSSStyleDeclaration\n}\n\nexport interface ViewTransitionInstance {\n name: string\n group: ViewTransitionPseudoElement\n imagePair: ViewTransitionPseudoElement\n old: ViewTransitionPseudoElement\n new: ViewTransitionPseudoElement\n}\n\ntype ViewTransitionEvent = (instance: ViewTransitionInstance, types: string[]) => void | (() => void)\nexport interface ViewTransitionProps {\n children?: ReactNode\n name?: string | Record<string, string> | undefined\n default?: ViewTransitionClass | undefined\n enter?: ViewTransitionClass | undefined\n exit?: ViewTransitionClass | undefined\n update?: ViewTransitionClass | undefined\n share?: ViewTransitionClass | undefined\n onEnter?: ViewTransitionEvent | undefined\n onExit?: ViewTransitionEvent | undefined\n onUpdate?: ViewTransitionEvent | undefined\n onShare?: ViewTransitionEvent | undefined\n}\n\n// Animation support belongs to the optional DOM feature, not this public entry.\nexport const ViewTransition = REACT_VIEW_TRANSITION_TYPE as unknown as (props: ViewTransitionProps) => any\n\nexport function addTransitionType(type: string): void {\n ReactSharedInternals.T?.add(type)\n}\n"],
|
|
5
|
+
"mappings": ";AACA,SAAS,4BAA4B;AAE9B,IAAM,6BAA6B,uBAAO,IAAI,uBAAuB;AAiCrE,IAAM,iBAAiB;AAEvB,SAAS,kBAAkB,MAAoB;AACpD,uBAAqB,GAAG,IAAI,IAAI;AAClC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/scheduler/index.js
CHANGED