@shopify/ui-extensions-server-kit 0.0.0-nightly-20250924132627 → 0.0.0-nightly-20260124060818
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/CHANGELOG.md +7 -1
- package/README.md +2 -1
- package/dist/context/ExtensionServerProvider.d.ts +2 -1
- package/dist/testing/MockExtensionServerProvider.d.ts +2 -1
- package/dist/testing/extensions.cjs.js +1 -1
- package/dist/testing/extensions.es.js +3 -2
- package/dist/types.d.ts +4 -0
- package/node_modules/@shopify/ui-extensions-test-utils/dist/render.d.ts +1 -1
- package/node_modules/@shopify/ui-extensions-test-utils/dist/renderHook.d.ts +1 -1
- package/node_modules/@types/react/README.md +4 -5
- package/node_modules/@types/react/canary.d.ts +166 -0
- package/node_modules/@types/react/experimental.d.ts +21 -86
- package/node_modules/@types/react/global.d.ts +146 -137
- package/node_modules/@types/react/index.d.ts +2738 -1370
- package/node_modules/@types/react/jsx-dev-runtime.d.ts +45 -2
- package/node_modules/@types/react/jsx-runtime.d.ts +36 -2
- package/node_modules/@types/react/package.json +111 -54
- package/node_modules/@types/react/ts5.0/canary.d.ts +166 -0
- package/node_modules/@types/react/ts5.0/experimental.d.ts +127 -0
- package/node_modules/@types/react/ts5.0/global.d.ts +160 -0
- package/node_modules/@types/react/ts5.0/index.d.ts +4530 -0
- package/node_modules/@types/react/ts5.0/jsx-dev-runtime.d.ts +44 -0
- package/node_modules/@types/react/ts5.0/jsx-runtime.d.ts +35 -0
- package/package.json +2 -2
- package/src/testing/extensions.ts +1 -0
- package/src/types.ts +5 -0
|
@@ -1,2 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import * as React from "./";
|
|
2
|
+
export { Fragment } from "./";
|
|
3
|
+
|
|
4
|
+
export namespace JSX {
|
|
5
|
+
type ElementType = React.JSX.ElementType;
|
|
6
|
+
interface Element extends React.JSX.Element {}
|
|
7
|
+
interface ElementClass extends React.JSX.ElementClass {}
|
|
8
|
+
interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {}
|
|
9
|
+
interface ElementChildrenAttribute extends React.JSX.ElementChildrenAttribute {}
|
|
10
|
+
type LibraryManagedAttributes<C, P> = React.JSX.LibraryManagedAttributes<C, P>;
|
|
11
|
+
interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {}
|
|
12
|
+
interface IntrinsicClassAttributes<T> extends React.JSX.IntrinsicClassAttributes<T> {}
|
|
13
|
+
interface IntrinsicElements extends React.JSX.IntrinsicElements {}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface JSXSource {
|
|
17
|
+
/**
|
|
18
|
+
* The source file where the element originates from.
|
|
19
|
+
*/
|
|
20
|
+
fileName?: string | undefined;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The line number where the element was created.
|
|
24
|
+
*/
|
|
25
|
+
lineNumber?: number | undefined;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The column number where the element was created.
|
|
29
|
+
*/
|
|
30
|
+
columnNumber?: number | undefined;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Create a React element.
|
|
35
|
+
*
|
|
36
|
+
* You should not use this function directly. Use JSX and a transpiler instead.
|
|
37
|
+
*/
|
|
38
|
+
export function jsxDEV(
|
|
39
|
+
type: React.ElementType,
|
|
40
|
+
props: unknown,
|
|
41
|
+
key: React.Key | undefined,
|
|
42
|
+
isStatic: boolean,
|
|
43
|
+
source?: JSXSource,
|
|
44
|
+
self?: unknown,
|
|
45
|
+
): React.ReactElement;
|
|
@@ -1,2 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import * as React from "./";
|
|
2
|
+
export { Fragment } from "./";
|
|
3
|
+
|
|
4
|
+
export namespace JSX {
|
|
5
|
+
type ElementType = React.JSX.ElementType;
|
|
6
|
+
interface Element extends React.JSX.Element {}
|
|
7
|
+
interface ElementClass extends React.JSX.ElementClass {}
|
|
8
|
+
interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {}
|
|
9
|
+
interface ElementChildrenAttribute extends React.JSX.ElementChildrenAttribute {}
|
|
10
|
+
type LibraryManagedAttributes<C, P> = React.JSX.LibraryManagedAttributes<C, P>;
|
|
11
|
+
interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {}
|
|
12
|
+
interface IntrinsicClassAttributes<T> extends React.JSX.IntrinsicClassAttributes<T> {}
|
|
13
|
+
interface IntrinsicElements extends React.JSX.IntrinsicElements {}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Create a React element.
|
|
18
|
+
*
|
|
19
|
+
* You should not use this function directly. Use JSX and a transpiler instead.
|
|
20
|
+
*/
|
|
21
|
+
export function jsx(
|
|
22
|
+
type: React.ElementType,
|
|
23
|
+
props: unknown,
|
|
24
|
+
key?: React.Key,
|
|
25
|
+
): React.ReactElement;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Create a React element.
|
|
29
|
+
*
|
|
30
|
+
* You should not use this function directly. Use JSX and a transpiler instead.
|
|
31
|
+
*/
|
|
32
|
+
export function jsxs(
|
|
33
|
+
type: React.ElementType,
|
|
34
|
+
props: unknown,
|
|
35
|
+
key?: React.Key,
|
|
36
|
+
): React.ReactElement;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/react",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "TypeScript definitions for
|
|
3
|
+
"version": "18.3.12",
|
|
4
|
+
"description": "TypeScript definitions for react",
|
|
5
|
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react",
|
|
5
6
|
"license": "MIT",
|
|
6
7
|
"contributors": [
|
|
7
8
|
{
|
|
@@ -18,122 +19,177 @@
|
|
|
18
19
|
},
|
|
19
20
|
{
|
|
20
21
|
"name": "John Reilly",
|
|
21
|
-
"
|
|
22
|
-
"
|
|
22
|
+
"githubUsername": "johnnyreilly",
|
|
23
|
+
"url": "https://github.com/johnnyreilly"
|
|
23
24
|
},
|
|
24
25
|
{
|
|
25
26
|
"name": "Benoit Benezech",
|
|
26
|
-
"
|
|
27
|
-
"
|
|
27
|
+
"githubUsername": "bbenezech",
|
|
28
|
+
"url": "https://github.com/bbenezech"
|
|
28
29
|
},
|
|
29
30
|
{
|
|
30
31
|
"name": "Patricio Zavolinsky",
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"name": "Digiguru",
|
|
36
|
-
"url": "https://github.com/digiguru",
|
|
37
|
-
"githubUsername": "digiguru"
|
|
32
|
+
"githubUsername": "pzavolinsky",
|
|
33
|
+
"url": "https://github.com/pzavolinsky"
|
|
38
34
|
},
|
|
39
35
|
{
|
|
40
36
|
"name": "Eric Anderson",
|
|
41
|
-
"
|
|
42
|
-
"
|
|
37
|
+
"githubUsername": "ericanderson",
|
|
38
|
+
"url": "https://github.com/ericanderson"
|
|
43
39
|
},
|
|
44
40
|
{
|
|
45
41
|
"name": "Dovydas Navickas",
|
|
46
|
-
"
|
|
47
|
-
"
|
|
42
|
+
"githubUsername": "DovydasNavickas",
|
|
43
|
+
"url": "https://github.com/DovydasNavickas"
|
|
48
44
|
},
|
|
49
45
|
{
|
|
50
46
|
"name": "Josh Rutherford",
|
|
51
|
-
"
|
|
52
|
-
"
|
|
47
|
+
"githubUsername": "theruther4d",
|
|
48
|
+
"url": "https://github.com/theruther4d"
|
|
53
49
|
},
|
|
54
50
|
{
|
|
55
51
|
"name": "Guilherme Hübner",
|
|
56
|
-
"
|
|
57
|
-
"
|
|
52
|
+
"githubUsername": "guilhermehubner",
|
|
53
|
+
"url": "https://github.com/guilhermehubner"
|
|
58
54
|
},
|
|
59
55
|
{
|
|
60
56
|
"name": "Ferdy Budhidharma",
|
|
61
|
-
"
|
|
62
|
-
"
|
|
57
|
+
"githubUsername": "ferdaber",
|
|
58
|
+
"url": "https://github.com/ferdaber"
|
|
63
59
|
},
|
|
64
60
|
{
|
|
65
61
|
"name": "Johann Rakotoharisoa",
|
|
66
|
-
"
|
|
67
|
-
"
|
|
62
|
+
"githubUsername": "jrakotoharisoa",
|
|
63
|
+
"url": "https://github.com/jrakotoharisoa"
|
|
68
64
|
},
|
|
69
65
|
{
|
|
70
66
|
"name": "Olivier Pascal",
|
|
71
|
-
"
|
|
72
|
-
"
|
|
67
|
+
"githubUsername": "pascaloliv",
|
|
68
|
+
"url": "https://github.com/pascaloliv"
|
|
73
69
|
},
|
|
74
70
|
{
|
|
75
71
|
"name": "Martin Hochel",
|
|
76
|
-
"
|
|
77
|
-
"
|
|
72
|
+
"githubUsername": "hotell",
|
|
73
|
+
"url": "https://github.com/hotell"
|
|
78
74
|
},
|
|
79
75
|
{
|
|
80
76
|
"name": "Frank Li",
|
|
81
|
-
"
|
|
82
|
-
"
|
|
77
|
+
"githubUsername": "franklixuefei",
|
|
78
|
+
"url": "https://github.com/franklixuefei"
|
|
83
79
|
},
|
|
84
80
|
{
|
|
85
81
|
"name": "Jessica Franco",
|
|
86
|
-
"
|
|
87
|
-
"
|
|
82
|
+
"githubUsername": "Jessidhia",
|
|
83
|
+
"url": "https://github.com/Jessidhia"
|
|
88
84
|
},
|
|
89
85
|
{
|
|
90
86
|
"name": "Saransh Kataria",
|
|
91
|
-
"
|
|
92
|
-
"
|
|
87
|
+
"githubUsername": "saranshkataria",
|
|
88
|
+
"url": "https://github.com/saranshkataria"
|
|
93
89
|
},
|
|
94
90
|
{
|
|
95
91
|
"name": "Kanitkorn Sujautra",
|
|
96
|
-
"
|
|
97
|
-
"
|
|
92
|
+
"githubUsername": "lukyth",
|
|
93
|
+
"url": "https://github.com/lukyth"
|
|
98
94
|
},
|
|
99
95
|
{
|
|
100
96
|
"name": "Sebastian Silbermann",
|
|
101
|
-
"
|
|
102
|
-
"
|
|
97
|
+
"githubUsername": "eps1lon",
|
|
98
|
+
"url": "https://github.com/eps1lon"
|
|
103
99
|
},
|
|
104
100
|
{
|
|
105
101
|
"name": "Kyle Scully",
|
|
106
|
-
"
|
|
107
|
-
"
|
|
102
|
+
"githubUsername": "zieka",
|
|
103
|
+
"url": "https://github.com/zieka"
|
|
108
104
|
},
|
|
109
105
|
{
|
|
110
106
|
"name": "Cong Zhang",
|
|
111
|
-
"
|
|
112
|
-
"
|
|
107
|
+
"githubUsername": "dancerphil",
|
|
108
|
+
"url": "https://github.com/dancerphil"
|
|
113
109
|
},
|
|
114
110
|
{
|
|
115
111
|
"name": "Dimitri Mitropoulos",
|
|
116
|
-
"
|
|
117
|
-
"
|
|
112
|
+
"githubUsername": "dimitropoulos",
|
|
113
|
+
"url": "https://github.com/dimitropoulos"
|
|
118
114
|
},
|
|
119
115
|
{
|
|
120
116
|
"name": "JongChan Choi",
|
|
121
|
-
"
|
|
122
|
-
"
|
|
117
|
+
"githubUsername": "disjukr",
|
|
118
|
+
"url": "https://github.com/disjukr"
|
|
123
119
|
},
|
|
124
120
|
{
|
|
125
121
|
"name": "Victor Magalhães",
|
|
126
|
-
"
|
|
127
|
-
"
|
|
122
|
+
"githubUsername": "vhfmag",
|
|
123
|
+
"url": "https://github.com/vhfmag"
|
|
128
124
|
},
|
|
129
125
|
{
|
|
130
|
-
"name": "
|
|
131
|
-
"
|
|
132
|
-
"
|
|
126
|
+
"name": "Priyanshu Rav",
|
|
127
|
+
"githubUsername": "priyanshurav",
|
|
128
|
+
"url": "https://github.com/priyanshurav"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"name": "Dmitry Semigradsky",
|
|
132
|
+
"githubUsername": "Semigradsky",
|
|
133
|
+
"url": "https://github.com/Semigradsky"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"name": "Matt Pocock",
|
|
137
|
+
"githubUsername": "mattpocock",
|
|
138
|
+
"url": "https://github.com/mattpocock"
|
|
133
139
|
}
|
|
134
140
|
],
|
|
135
141
|
"main": "",
|
|
136
142
|
"types": "index.d.ts",
|
|
143
|
+
"typesVersions": {
|
|
144
|
+
"<=5.0": {
|
|
145
|
+
"*": [
|
|
146
|
+
"ts5.0/*"
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
"exports": {
|
|
151
|
+
".": {
|
|
152
|
+
"types@<=5.0": {
|
|
153
|
+
"default": "./ts5.0/index.d.ts"
|
|
154
|
+
},
|
|
155
|
+
"types": {
|
|
156
|
+
"default": "./index.d.ts"
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
"./canary": {
|
|
160
|
+
"types@<=5.0": {
|
|
161
|
+
"default": "./ts5.0/canary.d.ts"
|
|
162
|
+
},
|
|
163
|
+
"types": {
|
|
164
|
+
"default": "./canary.d.ts"
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
"./experimental": {
|
|
168
|
+
"types@<=5.0": {
|
|
169
|
+
"default": "./ts5.0/experimental.d.ts"
|
|
170
|
+
},
|
|
171
|
+
"types": {
|
|
172
|
+
"default": "./experimental.d.ts"
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
"./jsx-runtime": {
|
|
176
|
+
"types@<=5.0": {
|
|
177
|
+
"default": "./ts5.0/jsx-runtime.d.ts"
|
|
178
|
+
},
|
|
179
|
+
"types": {
|
|
180
|
+
"default": "./jsx-runtime.d.ts"
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
"./jsx-dev-runtime": {
|
|
184
|
+
"types@<=5.0": {
|
|
185
|
+
"default": "./ts5.0/jsx-dev-runtime.d.ts"
|
|
186
|
+
},
|
|
187
|
+
"types": {
|
|
188
|
+
"default": "./jsx-dev-runtime.d.ts"
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
"./package.json": "./package.json"
|
|
192
|
+
},
|
|
137
193
|
"repository": {
|
|
138
194
|
"type": "git",
|
|
139
195
|
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
|
@@ -144,6 +200,7 @@
|
|
|
144
200
|
"@types/prop-types": "*",
|
|
145
201
|
"csstype": "^3.0.2"
|
|
146
202
|
},
|
|
147
|
-
"
|
|
148
|
-
"
|
|
203
|
+
"peerDependencies": {},
|
|
204
|
+
"typesPublisherContentHash": "d59942da5433cf6c9d66442070074fa48ef9c823a4175da6e4d183d0a70ccc72",
|
|
205
|
+
"typeScriptVersion": "4.8"
|
|
149
206
|
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* These are types for things that are present in the React `canary` release channel.
|
|
3
|
+
*
|
|
4
|
+
* To load the types declared here in an actual project, there are three ways. The easiest one,
|
|
5
|
+
* if your `tsconfig.json` already has a `"types"` array in the `"compilerOptions"` section,
|
|
6
|
+
* is to add `"react/canary"` to the `"types"` array.
|
|
7
|
+
*
|
|
8
|
+
* Alternatively, a specific import syntax can to be used from a typescript file.
|
|
9
|
+
* This module does not exist in reality, which is why the {} is important:
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* import {} from 'react/canary'
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* It is also possible to include it through a triple-slash reference:
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* /// <reference types="react/canary" />
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* Either the import or the reference only needs to appear once, anywhere in the project.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
// See https://github.com/facebook/react/blob/main/packages/react/src/React.js to see how the exports are declared,
|
|
25
|
+
|
|
26
|
+
import React = require(".");
|
|
27
|
+
|
|
28
|
+
export {};
|
|
29
|
+
|
|
30
|
+
declare const UNDEFINED_VOID_ONLY: unique symbol;
|
|
31
|
+
type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
|
|
32
|
+
|
|
33
|
+
type NativeToggleEvent = ToggleEvent;
|
|
34
|
+
|
|
35
|
+
declare module "." {
|
|
36
|
+
export type Usable<T> = PromiseLike<T> | Context<T>;
|
|
37
|
+
|
|
38
|
+
export function use<T>(usable: Usable<T>): T;
|
|
39
|
+
|
|
40
|
+
interface ServerContextJSONArray extends ReadonlyArray<ServerContextJSONValue> {}
|
|
41
|
+
export type ServerContextJSONValue =
|
|
42
|
+
| string
|
|
43
|
+
| boolean
|
|
44
|
+
| number
|
|
45
|
+
| null
|
|
46
|
+
| ServerContextJSONArray
|
|
47
|
+
| { [key: string]: ServerContextJSONValue };
|
|
48
|
+
export interface ServerContext<T extends ServerContextJSONValue> {
|
|
49
|
+
Provider: Provider<T>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Accepts a context object (the value returned from `React.createContext` or `React.createServerContext`) and returns the current
|
|
53
|
+
* context value, as given by the nearest context provider for the given context.
|
|
54
|
+
*
|
|
55
|
+
* @version 16.8.0
|
|
56
|
+
* @see https://react.dev/reference/react/useContext
|
|
57
|
+
*/
|
|
58
|
+
function useContext<T extends ServerContextJSONValue>(context: ServerContext<T>): T;
|
|
59
|
+
export function createServerContext<T extends ServerContextJSONValue>(
|
|
60
|
+
globalName: string,
|
|
61
|
+
defaultValue: T,
|
|
62
|
+
): ServerContext<T>;
|
|
63
|
+
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
65
|
+
export function cache<CachedFunction extends Function>(fn: CachedFunction): CachedFunction;
|
|
66
|
+
|
|
67
|
+
export function unstable_useCacheRefresh(): () => void;
|
|
68
|
+
|
|
69
|
+
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS {
|
|
70
|
+
functions: (formData: FormData) => void | Promise<void>;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface TransitionStartFunction {
|
|
74
|
+
/**
|
|
75
|
+
* Marks all state updates inside the async function as transitions
|
|
76
|
+
*
|
|
77
|
+
* @see {https://react.dev/reference/react/useTransition#starttransition}
|
|
78
|
+
*
|
|
79
|
+
* @param callback
|
|
80
|
+
*/
|
|
81
|
+
(callback: () => Promise<VoidOrUndefinedOnly>): void;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Similar to `useTransition` but allows uses where hooks are not available.
|
|
86
|
+
*
|
|
87
|
+
* @param callback An _asynchronous_ function which causes state updates that can be deferred.
|
|
88
|
+
*/
|
|
89
|
+
export function startTransition(scope: () => Promise<VoidOrUndefinedOnly>): void;
|
|
90
|
+
|
|
91
|
+
export function useOptimistic<State>(
|
|
92
|
+
passthrough: State,
|
|
93
|
+
): [State, (action: State | ((pendingState: State) => State)) => void];
|
|
94
|
+
export function useOptimistic<State, Action>(
|
|
95
|
+
passthrough: State,
|
|
96
|
+
reducer: (state: State, action: Action) => State,
|
|
97
|
+
): [State, (action: Action) => void];
|
|
98
|
+
|
|
99
|
+
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES {
|
|
100
|
+
cleanup: () => VoidOrUndefinedOnly;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export function useActionState<State>(
|
|
104
|
+
action: (state: Awaited<State>) => State | Promise<State>,
|
|
105
|
+
initialState: Awaited<State>,
|
|
106
|
+
permalink?: string,
|
|
107
|
+
): [state: Awaited<State>, dispatch: () => void, isPending: boolean];
|
|
108
|
+
export function useActionState<State, Payload>(
|
|
109
|
+
action: (state: Awaited<State>, payload: Payload) => State | Promise<State>,
|
|
110
|
+
initialState: Awaited<State>,
|
|
111
|
+
permalink?: string,
|
|
112
|
+
): [state: Awaited<State>, dispatch: (payload: Payload) => void, isPending: boolean];
|
|
113
|
+
|
|
114
|
+
interface DOMAttributes<T> {
|
|
115
|
+
// Transition Events
|
|
116
|
+
onTransitionCancel?: TransitionEventHandler<T> | undefined;
|
|
117
|
+
onTransitionCancelCapture?: TransitionEventHandler<T> | undefined;
|
|
118
|
+
onTransitionRun?: TransitionEventHandler<T> | undefined;
|
|
119
|
+
onTransitionRunCapture?: TransitionEventHandler<T> | undefined;
|
|
120
|
+
onTransitionStart?: TransitionEventHandler<T> | undefined;
|
|
121
|
+
onTransitionStartCapture?: TransitionEventHandler<T> | undefined;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
type ToggleEventHandler<T = Element> = EventHandler<ToggleEvent<T>>;
|
|
125
|
+
|
|
126
|
+
interface HTMLAttributes<T> {
|
|
127
|
+
popover?: "" | "auto" | "manual" | undefined;
|
|
128
|
+
popoverTargetAction?: "toggle" | "show" | "hide" | undefined;
|
|
129
|
+
popoverTarget?: string | undefined;
|
|
130
|
+
onToggle?: ToggleEventHandler<T> | undefined;
|
|
131
|
+
onBeforeToggle?: ToggleEventHandler<T> | undefined;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
interface ToggleEvent<T = Element> extends SyntheticEvent<T, NativeToggleEvent> {
|
|
135
|
+
oldState: "closed" | "open";
|
|
136
|
+
newState: "closed" | "open";
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
interface LinkHTMLAttributes<T> {
|
|
140
|
+
precedence?: string | undefined;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
interface StyleHTMLAttributes<T> {
|
|
144
|
+
href?: string | undefined;
|
|
145
|
+
precedence?: string | undefined;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* @internal Use `Awaited<ReactNode>` instead
|
|
150
|
+
*/
|
|
151
|
+
// Helper type to enable `Awaited<ReactNode>`.
|
|
152
|
+
// Must be a copy of the non-thenables of `ReactNode`.
|
|
153
|
+
type AwaitedReactNode =
|
|
154
|
+
| ReactElement
|
|
155
|
+
| string
|
|
156
|
+
| number
|
|
157
|
+
| Iterable<AwaitedReactNode>
|
|
158
|
+
| ReactPortal
|
|
159
|
+
| boolean
|
|
160
|
+
| null
|
|
161
|
+
| undefined;
|
|
162
|
+
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES {
|
|
163
|
+
promises: Promise<AwaitedReactNode>;
|
|
164
|
+
bigints: bigint;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* These are types for things that are present in the `experimental` builds of React but not yet
|
|
3
|
+
* on a stable build.
|
|
4
|
+
*
|
|
5
|
+
* Once they are promoted to stable they can just be moved to the main index file.
|
|
6
|
+
*
|
|
7
|
+
* To load the types declared here in an actual project, there are three ways. The easiest one,
|
|
8
|
+
* if your `tsconfig.json` already has a `"types"` array in the `"compilerOptions"` section,
|
|
9
|
+
* is to add `"react/experimental"` to the `"types"` array.
|
|
10
|
+
*
|
|
11
|
+
* Alternatively, a specific import syntax can to be used from a typescript file.
|
|
12
|
+
* This module does not exist in reality, which is why the {} is important:
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* import {} from 'react/experimental'
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* It is also possible to include it through a triple-slash reference:
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* /// <reference types="react/experimental" />
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* Either the import or the reference only needs to appear once, anywhere in the project.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
// See https://github.com/facebook/react/blob/master/packages/react/src/React.js to see how the exports are declared,
|
|
28
|
+
// and https://github.com/facebook/react/blob/master/packages/shared/ReactFeatureFlags.js to verify which APIs are
|
|
29
|
+
// flagged experimental or not. Experimental APIs will be tagged with `__EXPERIMENTAL__`.
|
|
30
|
+
//
|
|
31
|
+
// For the inputs of types exported as simply a fiber tag, the `beginWork` function of ReactFiberBeginWork.js
|
|
32
|
+
// is a good place to start looking for details; it generally calls prop validation functions or delegates
|
|
33
|
+
// all tasks done as part of the render phase (the concurrent part of the React update cycle).
|
|
34
|
+
//
|
|
35
|
+
// Suspense-related handling can be found in ReactFiberThrow.js.
|
|
36
|
+
|
|
37
|
+
import React = require("./canary");
|
|
38
|
+
|
|
39
|
+
export {};
|
|
40
|
+
|
|
41
|
+
declare const UNDEFINED_VOID_ONLY: unique symbol;
|
|
42
|
+
type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
|
|
43
|
+
|
|
44
|
+
declare module "." {
|
|
45
|
+
export interface SuspenseProps {
|
|
46
|
+
/**
|
|
47
|
+
* The presence of this prop indicates that the content is computationally expensive to render.
|
|
48
|
+
* In other words, the tree is CPU bound and not I/O bound (e.g. due to fetching data).
|
|
49
|
+
* @see {@link https://github.com/facebook/react/pull/19936}
|
|
50
|
+
*/
|
|
51
|
+
unstable_expectedLoadTime?: number | undefined;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type SuspenseListRevealOrder = "forwards" | "backwards" | "together";
|
|
55
|
+
export type SuspenseListTailMode = "collapsed" | "hidden";
|
|
56
|
+
|
|
57
|
+
export interface SuspenseListCommonProps {
|
|
58
|
+
/**
|
|
59
|
+
* Note that SuspenseList require more than one child;
|
|
60
|
+
* it is a runtime warning to provide only a single child.
|
|
61
|
+
*
|
|
62
|
+
* It does, however, allow those children to be wrapped inside a single
|
|
63
|
+
* level of `<React.Fragment>`.
|
|
64
|
+
*/
|
|
65
|
+
children: ReactElement | Iterable<ReactElement>;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
interface DirectionalSuspenseListProps extends SuspenseListCommonProps {
|
|
69
|
+
/**
|
|
70
|
+
* Defines the order in which the `SuspenseList` children should be revealed.
|
|
71
|
+
*/
|
|
72
|
+
revealOrder: "forwards" | "backwards";
|
|
73
|
+
/**
|
|
74
|
+
* Dictates how unloaded items in a SuspenseList is shown.
|
|
75
|
+
*
|
|
76
|
+
* - By default, `SuspenseList` will show all fallbacks in the list.
|
|
77
|
+
* - `collapsed` shows only the next fallback in the list.
|
|
78
|
+
* - `hidden` doesn’t show any unloaded items.
|
|
79
|
+
*/
|
|
80
|
+
tail?: SuspenseListTailMode | undefined;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
interface NonDirectionalSuspenseListProps extends SuspenseListCommonProps {
|
|
84
|
+
/**
|
|
85
|
+
* Defines the order in which the `SuspenseList` children should be revealed.
|
|
86
|
+
*/
|
|
87
|
+
revealOrder?: Exclude<SuspenseListRevealOrder, DirectionalSuspenseListProps["revealOrder"]> | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* The tail property is invalid when not using the `forwards` or `backwards` reveal orders.
|
|
90
|
+
*/
|
|
91
|
+
tail?: never | undefined;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export type SuspenseListProps = DirectionalSuspenseListProps | NonDirectionalSuspenseListProps;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* `SuspenseList` helps coordinate many components that can suspend by orchestrating the order
|
|
98
|
+
* in which these components are revealed to the user.
|
|
99
|
+
*
|
|
100
|
+
* When multiple components need to fetch data, this data may arrive in an unpredictable order.
|
|
101
|
+
* However, if you wrap these items in a `SuspenseList`, React will not show an item in the list
|
|
102
|
+
* until previous items have been displayed (this behavior is adjustable).
|
|
103
|
+
*
|
|
104
|
+
* @see https://reactjs.org/docs/concurrent-mode-reference.html#suspenselist
|
|
105
|
+
* @see https://reactjs.org/docs/concurrent-mode-patterns.html#suspenselist
|
|
106
|
+
*/
|
|
107
|
+
export const unstable_SuspenseList: ExoticComponent<SuspenseListProps>;
|
|
108
|
+
|
|
109
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
110
|
+
export function experimental_useEffectEvent<T extends Function>(event: T): T;
|
|
111
|
+
|
|
112
|
+
type Reference = object;
|
|
113
|
+
type TaintableUniqueValue = string | bigint | ArrayBufferView;
|
|
114
|
+
function experimental_taintUniqueValue(
|
|
115
|
+
message: string | undefined,
|
|
116
|
+
lifetime: Reference,
|
|
117
|
+
value: TaintableUniqueValue,
|
|
118
|
+
): void;
|
|
119
|
+
function experimental_taintObjectReference(message: string | undefined, object: Reference): void;
|
|
120
|
+
|
|
121
|
+
export interface HTMLAttributes<T> {
|
|
122
|
+
/**
|
|
123
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert
|
|
124
|
+
*/
|
|
125
|
+
inert?: boolean | undefined;
|
|
126
|
+
}
|
|
127
|
+
}
|