@shopify/ui-extensions-server-kit 0.0.0-experimental-20260902222805

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 (202) hide show
  1. package/CHANGELOG.md +157 -0
  2. package/README.md +75 -0
  3. package/dist/ExtensionServerClient/ExtensionServerClient.d.ts +27 -0
  4. package/dist/ExtensionServerClient/ExtensionServerClient.test.d.ts +9 -0
  5. package/dist/ExtensionServerClient/index.d.ts +2 -0
  6. package/dist/ExtensionServerClient/server-types.d.ts +66 -0
  7. package/dist/ExtensionServerClient/types.d.ts +124 -0
  8. package/dist/_virtual/jsx-runtime.cjs.js +1 -0
  9. package/dist/_virtual/jsx-runtime.cjs2.js +1 -0
  10. package/dist/_virtual/jsx-runtime.es.js +5 -0
  11. package/dist/_virtual/jsx-runtime.es2.js +4 -0
  12. package/dist/_virtual/react-jsx-runtime.development.cjs.js +1 -0
  13. package/dist/_virtual/react-jsx-runtime.development.es.js +4 -0
  14. package/dist/_virtual/react-jsx-runtime.production.min.cjs.js +1 -0
  15. package/dist/_virtual/react-jsx-runtime.production.min.es.js +4 -0
  16. package/dist/context/ExtensionServerProvider.d.ts +3 -0
  17. package/dist/context/ExtensionServerProvider.test.d.ts +1 -0
  18. package/dist/context/constants.d.ts +2 -0
  19. package/dist/context/index.d.ts +3 -0
  20. package/dist/context/types.d.ts +12 -0
  21. package/dist/hooks/index.d.ts +3 -0
  22. package/dist/hooks/useExtensionServerContext.d.ts +1 -0
  23. package/dist/hooks/useExtensionServerState.d.ts +1 -0
  24. package/dist/hooks/useIsomorphicLayoutEffect.d.ts +2 -0
  25. package/dist/i18n.d.ts +68 -0
  26. package/dist/i18n.test.d.ts +1 -0
  27. package/dist/index.cjs.js +1 -0
  28. package/dist/index.cjs2.js +1 -0
  29. package/dist/index.d.ts +7 -0
  30. package/dist/index.es.js +46 -0
  31. package/dist/index.es2.js +8 -0
  32. package/dist/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.development.cjs.js +22 -0
  33. package/dist/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.development.es.js +604 -0
  34. package/dist/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.production.min.cjs.js +9 -0
  35. package/dist/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.production.min.es.js +28 -0
  36. package/dist/node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.cjs.js +1 -0
  37. package/dist/node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.es.js +10 -0
  38. package/dist/packages/ui-extensions-server-kit/src/ExtensionServerClient/ExtensionServerClient.cjs.js +1 -0
  39. package/dist/packages/ui-extensions-server-kit/src/ExtensionServerClient/ExtensionServerClient.es.js +136 -0
  40. package/dist/packages/ui-extensions-server-kit/src/ExtensionServerClient/types.cjs.js +1 -0
  41. package/dist/packages/ui-extensions-server-kit/src/ExtensionServerClient/types.es.js +4 -0
  42. package/dist/packages/ui-extensions-server-kit/src/context/ExtensionServerProvider.cjs.js +1 -0
  43. package/dist/packages/ui-extensions-server-kit/src/context/ExtensionServerProvider.es.js +30 -0
  44. package/dist/packages/ui-extensions-server-kit/src/context/constants.cjs.js +1 -0
  45. package/dist/packages/ui-extensions-server-kit/src/context/constants.es.js +13 -0
  46. package/dist/packages/ui-extensions-server-kit/src/hooks/useExtensionServerContext.cjs.js +1 -0
  47. package/dist/packages/ui-extensions-server-kit/src/hooks/useExtensionServerContext.es.js +7 -0
  48. package/dist/packages/ui-extensions-server-kit/src/hooks/useExtensionServerState.cjs.js +1 -0
  49. package/dist/packages/ui-extensions-server-kit/src/hooks/useExtensionServerState.es.js +9 -0
  50. package/dist/packages/ui-extensions-server-kit/src/hooks/useIsomorphicLayoutEffect.cjs.js +1 -0
  51. package/dist/packages/ui-extensions-server-kit/src/hooks/useIsomorphicLayoutEffect.es.js +5 -0
  52. package/dist/packages/ui-extensions-server-kit/src/i18n.cjs.js +1 -0
  53. package/dist/packages/ui-extensions-server-kit/src/i18n.es.js +60 -0
  54. package/dist/packages/ui-extensions-server-kit/src/state/actions/actions.cjs.js +1 -0
  55. package/dist/packages/ui-extensions-server-kit/src/state/actions/actions.es.js +37 -0
  56. package/dist/packages/ui-extensions-server-kit/src/state/reducers/constants.cjs.js +1 -0
  57. package/dist/packages/ui-extensions-server-kit/src/state/reducers/constants.es.js +7 -0
  58. package/dist/packages/ui-extensions-server-kit/src/state/reducers/extensionServerReducer.cjs.js +1 -0
  59. package/dist/packages/ui-extensions-server-kit/src/state/reducers/extensionServerReducer.es.js +57 -0
  60. package/dist/packages/ui-extensions-server-kit/src/testing/MockExtensionServerProvider.cjs.js +1 -0
  61. package/dist/packages/ui-extensions-server-kit/src/testing/MockExtensionServerProvider.es.js +25 -0
  62. package/dist/packages/ui-extensions-server-kit/src/testing/app.cjs.js +1 -0
  63. package/dist/packages/ui-extensions-server-kit/src/testing/app.es.js +16 -0
  64. package/dist/packages/ui-extensions-server-kit/src/testing/extensions.cjs.js +1 -0
  65. package/dist/packages/ui-extensions-server-kit/src/testing/extensions.es.js +66 -0
  66. package/dist/packages/ui-extensions-server-kit/src/types.cjs.js +1 -0
  67. package/dist/packages/ui-extensions-server-kit/src/types.es.js +4 -0
  68. package/dist/packages/ui-extensions-server-kit/src/utilities/assetToString.cjs.js +1 -0
  69. package/dist/packages/ui-extensions-server-kit/src/utilities/assetToString.es.js +7 -0
  70. package/dist/packages/ui-extensions-server-kit/src/utilities/isUIExtension.cjs.js +1 -0
  71. package/dist/packages/ui-extensions-server-kit/src/utilities/isUIExtension.es.js +7 -0
  72. package/dist/packages/ui-extensions-server-kit/src/utilities/isValidSurface.cjs.js +1 -0
  73. package/dist/packages/ui-extensions-server-kit/src/utilities/isValidSurface.es.js +7 -0
  74. package/dist/packages/ui-extensions-server-kit/src/utilities/noop.cjs.js +1 -0
  75. package/dist/packages/ui-extensions-server-kit/src/utilities/noop.es.js +5 -0
  76. package/dist/packages/ui-extensions-server-kit/src/utilities/replaceUpdated.cjs.js +1 -0
  77. package/dist/packages/ui-extensions-server-kit/src/utilities/replaceUpdated.es.js +14 -0
  78. package/dist/packages/ui-extensions-server-kit/src/utilities/set.cjs.js +1 -0
  79. package/dist/packages/ui-extensions-server-kit/src/utilities/set.es.js +18 -0
  80. package/dist/state/actions/actions.d.ts +6 -0
  81. package/dist/state/actions/index.d.ts +2 -0
  82. package/dist/state/actions/types.d.ts +21 -0
  83. package/dist/state/index.d.ts +2 -0
  84. package/dist/state/reducers/constants.d.ts +2 -0
  85. package/dist/state/reducers/extensionServerReducer.d.ts +3 -0
  86. package/dist/state/reducers/extensionServerReducer.test.d.ts +1 -0
  87. package/dist/state/reducers/index.d.ts +3 -0
  88. package/dist/state/reducers/types.d.ts +6 -0
  89. package/dist/testing/MockExtensionServerProvider.d.ts +8 -0
  90. package/dist/testing/app.d.ts +2 -0
  91. package/dist/testing/extensions.d.ts +6 -0
  92. package/dist/testing/index.d.ts +3 -0
  93. package/dist/types.d.ts +196 -0
  94. package/dist/utilities/assetToString.d.ts +2 -0
  95. package/dist/utilities/assetToString.test.d.ts +1 -0
  96. package/dist/utilities/index.d.ts +6 -0
  97. package/dist/utilities/isUIExtension.d.ts +1 -0
  98. package/dist/utilities/isValidSurface.d.ts +2 -0
  99. package/dist/utilities/noop.d.ts +1 -0
  100. package/dist/utilities/replaceUpdated.d.ts +1 -0
  101. package/dist/utilities/replaceUpdated.test.d.ts +1 -0
  102. package/dist/utilities/set.d.ts +4 -0
  103. package/dist/utilities/set.test.d.ts +1 -0
  104. package/index.d.ts +1 -0
  105. package/index.js +1 -0
  106. package/index.mjs +1 -0
  107. package/node_modules/@testing-library/react/LICENSE +20 -0
  108. package/node_modules/@testing-library/react/README.md +692 -0
  109. package/node_modules/@testing-library/react/dist/@testing-library/react.cjs.js +537 -0
  110. package/node_modules/@testing-library/react/dist/@testing-library/react.esm.js +497 -0
  111. package/node_modules/@testing-library/react/dist/@testing-library/react.pure.cjs.js +501 -0
  112. package/node_modules/@testing-library/react/dist/@testing-library/react.pure.esm.js +461 -0
  113. package/node_modules/@testing-library/react/dist/@testing-library/react.pure.umd.js +502 -0
  114. package/node_modules/@testing-library/react/dist/@testing-library/react.pure.umd.js.map +1 -0
  115. package/node_modules/@testing-library/react/dist/@testing-library/react.pure.umd.min.js +2 -0
  116. package/node_modules/@testing-library/react/dist/@testing-library/react.pure.umd.min.js.map +1 -0
  117. package/node_modules/@testing-library/react/dist/@testing-library/react.umd.js +538 -0
  118. package/node_modules/@testing-library/react/dist/@testing-library/react.umd.js.map +1 -0
  119. package/node_modules/@testing-library/react/dist/@testing-library/react.umd.min.js +2 -0
  120. package/node_modules/@testing-library/react/dist/@testing-library/react.umd.min.js.map +1 -0
  121. package/node_modules/@testing-library/react/dist/act-compat.js +80 -0
  122. package/node_modules/@testing-library/react/dist/config.js +33 -0
  123. package/node_modules/@testing-library/react/dist/fire-event.js +70 -0
  124. package/node_modules/@testing-library/react/dist/index.js +52 -0
  125. package/node_modules/@testing-library/react/dist/pure.js +356 -0
  126. package/node_modules/@testing-library/react/dont-cleanup-after-each.js +1 -0
  127. package/node_modules/@testing-library/react/package.json +116 -0
  128. package/node_modules/@testing-library/react/pure.d.ts +1 -0
  129. package/node_modules/@testing-library/react/pure.js +2 -0
  130. package/node_modules/@testing-library/react/types/index.d.ts +287 -0
  131. package/node_modules/@testing-library/react/types/pure.d.ts +1 -0
  132. package/node_modules/@types/react/LICENSE +21 -0
  133. package/node_modules/@types/react/README.md +15 -0
  134. package/node_modules/@types/react/canary.d.ts +166 -0
  135. package/node_modules/@types/react/experimental.d.ts +127 -0
  136. package/node_modules/@types/react/global.d.ts +160 -0
  137. package/node_modules/@types/react/index.d.ts +4543 -0
  138. package/node_modules/@types/react/jsx-dev-runtime.d.ts +45 -0
  139. package/node_modules/@types/react/jsx-runtime.d.ts +36 -0
  140. package/node_modules/@types/react/package.json +206 -0
  141. package/node_modules/@types/react/ts5.0/canary.d.ts +166 -0
  142. package/node_modules/@types/react/ts5.0/experimental.d.ts +127 -0
  143. package/node_modules/@types/react/ts5.0/global.d.ts +160 -0
  144. package/node_modules/@types/react/ts5.0/index.d.ts +4530 -0
  145. package/node_modules/@types/react/ts5.0/jsx-dev-runtime.d.ts +44 -0
  146. package/node_modules/@types/react/ts5.0/jsx-runtime.d.ts +35 -0
  147. package/node_modules/@vitejs/plugin-react/LICENSE +21 -0
  148. package/node_modules/@vitejs/plugin-react/README.md +159 -0
  149. package/node_modules/@vitejs/plugin-react/dist/index.d.ts +75 -0
  150. package/node_modules/@vitejs/plugin-react/dist/index.js +401 -0
  151. package/node_modules/@vitejs/plugin-react/dist/refresh-runtime.js +663 -0
  152. package/node_modules/@vitejs/plugin-react/package.json +77 -0
  153. package/node_modules/@vitejs/plugin-react/types/preamble.d.ts +1 -0
  154. package/package.json +64 -0
  155. package/project.json +40 -0
  156. package/scripts/create-entry-files.ts +44 -0
  157. package/src/ExtensionServerClient/ExtensionServerClient.test.ts +1238 -0
  158. package/src/ExtensionServerClient/ExtensionServerClient.ts +320 -0
  159. package/src/ExtensionServerClient/index.ts +2 -0
  160. package/src/ExtensionServerClient/server-types.ts +65 -0
  161. package/src/ExtensionServerClient/types.ts +159 -0
  162. package/src/context/ExtensionServerProvider.test.tsx +318 -0
  163. package/src/context/ExtensionServerProvider.tsx +48 -0
  164. package/src/context/constants.ts +16 -0
  165. package/src/context/index.ts +3 -0
  166. package/src/context/types.ts +14 -0
  167. package/src/hooks/index.ts +3 -0
  168. package/src/hooks/useExtensionServerContext.ts +4 -0
  169. package/src/hooks/useExtensionServerState.ts +6 -0
  170. package/src/hooks/useIsomorphicLayoutEffect.ts +6 -0
  171. package/src/i18n.test.ts +417 -0
  172. package/src/i18n.ts +205 -0
  173. package/src/index.ts +7 -0
  174. package/src/state/actions/actions.ts +36 -0
  175. package/src/state/actions/index.ts +2 -0
  176. package/src/state/actions/types.ts +26 -0
  177. package/src/state/index.ts +2 -0
  178. package/src/state/reducers/constants.ts +6 -0
  179. package/src/state/reducers/extensionServerReducer.test.ts +165 -0
  180. package/src/state/reducers/extensionServerReducer.ts +87 -0
  181. package/src/state/reducers/index.ts +3 -0
  182. package/src/state/reducers/types.ts +7 -0
  183. package/src/testing/MockExtensionServerProvider.tsx +36 -0
  184. package/src/testing/app.ts +15 -0
  185. package/src/testing/extensions.ts +71 -0
  186. package/src/testing/index.ts +3 -0
  187. package/src/types.ts +204 -0
  188. package/src/utilities/assetToString.test.ts +16 -0
  189. package/src/utilities/assetToString.ts +7 -0
  190. package/src/utilities/index.ts +6 -0
  191. package/src/utilities/isUIExtension.ts +8 -0
  192. package/src/utilities/isValidSurface.ts +6 -0
  193. package/src/utilities/noop.ts +1 -0
  194. package/src/utilities/replaceUpdated.test.ts +26 -0
  195. package/src/utilities/replaceUpdated.ts +15 -0
  196. package/src/utilities/set.test.ts +19 -0
  197. package/src/utilities/set.ts +35 -0
  198. package/testing.d.ts +1 -0
  199. package/testing.js +1 -0
  200. package/testing.mjs +1 -0
  201. package/tests/setup.ts +3 -0
  202. package/vite.config.mts +57 -0
@@ -0,0 +1,45 @@
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;
@@ -0,0 +1,36 @@
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;
@@ -0,0 +1,206 @@
1
+ {
2
+ "name": "@types/react",
3
+ "version": "18.3.12",
4
+ "description": "TypeScript definitions for react",
5
+ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react",
6
+ "license": "MIT",
7
+ "contributors": [
8
+ {
9
+ "name": "Asana",
10
+ "url": "https://asana.com"
11
+ },
12
+ {
13
+ "name": "AssureSign",
14
+ "url": "http://www.assuresign.com"
15
+ },
16
+ {
17
+ "name": "Microsoft",
18
+ "url": "https://microsoft.com"
19
+ },
20
+ {
21
+ "name": "John Reilly",
22
+ "githubUsername": "johnnyreilly",
23
+ "url": "https://github.com/johnnyreilly"
24
+ },
25
+ {
26
+ "name": "Benoit Benezech",
27
+ "githubUsername": "bbenezech",
28
+ "url": "https://github.com/bbenezech"
29
+ },
30
+ {
31
+ "name": "Patricio Zavolinsky",
32
+ "githubUsername": "pzavolinsky",
33
+ "url": "https://github.com/pzavolinsky"
34
+ },
35
+ {
36
+ "name": "Eric Anderson",
37
+ "githubUsername": "ericanderson",
38
+ "url": "https://github.com/ericanderson"
39
+ },
40
+ {
41
+ "name": "Dovydas Navickas",
42
+ "githubUsername": "DovydasNavickas",
43
+ "url": "https://github.com/DovydasNavickas"
44
+ },
45
+ {
46
+ "name": "Josh Rutherford",
47
+ "githubUsername": "theruther4d",
48
+ "url": "https://github.com/theruther4d"
49
+ },
50
+ {
51
+ "name": "Guilherme Hübner",
52
+ "githubUsername": "guilhermehubner",
53
+ "url": "https://github.com/guilhermehubner"
54
+ },
55
+ {
56
+ "name": "Ferdy Budhidharma",
57
+ "githubUsername": "ferdaber",
58
+ "url": "https://github.com/ferdaber"
59
+ },
60
+ {
61
+ "name": "Johann Rakotoharisoa",
62
+ "githubUsername": "jrakotoharisoa",
63
+ "url": "https://github.com/jrakotoharisoa"
64
+ },
65
+ {
66
+ "name": "Olivier Pascal",
67
+ "githubUsername": "pascaloliv",
68
+ "url": "https://github.com/pascaloliv"
69
+ },
70
+ {
71
+ "name": "Martin Hochel",
72
+ "githubUsername": "hotell",
73
+ "url": "https://github.com/hotell"
74
+ },
75
+ {
76
+ "name": "Frank Li",
77
+ "githubUsername": "franklixuefei",
78
+ "url": "https://github.com/franklixuefei"
79
+ },
80
+ {
81
+ "name": "Jessica Franco",
82
+ "githubUsername": "Jessidhia",
83
+ "url": "https://github.com/Jessidhia"
84
+ },
85
+ {
86
+ "name": "Saransh Kataria",
87
+ "githubUsername": "saranshkataria",
88
+ "url": "https://github.com/saranshkataria"
89
+ },
90
+ {
91
+ "name": "Kanitkorn Sujautra",
92
+ "githubUsername": "lukyth",
93
+ "url": "https://github.com/lukyth"
94
+ },
95
+ {
96
+ "name": "Sebastian Silbermann",
97
+ "githubUsername": "eps1lon",
98
+ "url": "https://github.com/eps1lon"
99
+ },
100
+ {
101
+ "name": "Kyle Scully",
102
+ "githubUsername": "zieka",
103
+ "url": "https://github.com/zieka"
104
+ },
105
+ {
106
+ "name": "Cong Zhang",
107
+ "githubUsername": "dancerphil",
108
+ "url": "https://github.com/dancerphil"
109
+ },
110
+ {
111
+ "name": "Dimitri Mitropoulos",
112
+ "githubUsername": "dimitropoulos",
113
+ "url": "https://github.com/dimitropoulos"
114
+ },
115
+ {
116
+ "name": "JongChan Choi",
117
+ "githubUsername": "disjukr",
118
+ "url": "https://github.com/disjukr"
119
+ },
120
+ {
121
+ "name": "Victor Magalhães",
122
+ "githubUsername": "vhfmag",
123
+ "url": "https://github.com/vhfmag"
124
+ },
125
+ {
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"
139
+ }
140
+ ],
141
+ "main": "",
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
+ },
193
+ "repository": {
194
+ "type": "git",
195
+ "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
196
+ "directory": "types/react"
197
+ },
198
+ "scripts": {},
199
+ "dependencies": {
200
+ "@types/prop-types": "*",
201
+ "csstype": "^3.0.2"
202
+ },
203
+ "peerDependencies": {},
204
+ "typesPublisherContentHash": "d59942da5433cf6c9d66442070074fa48ef9c823a4175da6e4d183d0a70ccc72",
205
+ "typeScriptVersion": "4.8"
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
+ }