@shopify/ui-extensions-server-kit 0.0.0-nightly-20250925061112 → 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 CHANGED
@@ -1,6 +1,12 @@
1
1
  # @shopify/ui-extensions-server-kit
2
2
 
3
- ## 0.0.0-nightly-20250925061112
3
+ ## 0.0.0-nightly-20260124060818
4
+
5
+ ### Minor Changes
6
+
7
+ - 7680a16: Added supportedFeatures to ExtensionPayload
8
+
9
+ ## 5.3.1
4
10
 
5
11
  ### Patch Changes
6
12
 
package/README.md CHANGED
@@ -57,7 +57,8 @@ Learn more in the docs: [Shopify CLI for Hydrogen storefronts](https://shopify.d
57
57
 
58
58
  If you encounter issues using the CLI or have feedback you'd like to share with us, below are some options:
59
59
 
60
- - [Open a GitHub issue](https://github.com/Shopify/cli/issues) - To report bugs or request new features, open an issue in the Shopify CLI repository
60
+ - [File a bug report](https://community.shopify.dev/c/shopify-cli-libraries/14) - To report bugs create a post in Shopify CLI and Libraries on the dev community
61
+ - [Ask a question or request a new feature](https://community.shopify.dev/c/dev-platform/32) - To ask a question or request a new feature create a post in Dev Platform on the dev community
61
62
  - [Shopify Community Forums](https://community.shopify.com/) - Visit our forums to connect with the community and learn more about Shopify CLI development
62
63
  - [CLI Documentation - Apps](https://shopify.dev/apps/tools/cli) - To view CLI documentation for app development
63
64
  - [CLI Documentation - Themes](https://shopify.dev/themes/tools/cli) - To view CLI documentation for theme development
@@ -1,2 +1,3 @@
1
+ import React from 'react';
1
2
  import type { ExtensionServerProviderProps } from './types';
2
- export declare function ExtensionServerProvider({ children, options: defaultOptions }: ExtensionServerProviderProps): JSX.Element;
3
+ export declare function ExtensionServerProvider({ children, options: defaultOptions }: ExtensionServerProviderProps): React.JSX.Element;
@@ -1,7 +1,8 @@
1
+ import React from 'react';
1
2
  import type { ExtensionServerProviderProps, ExtensionServerContext } from '../context';
2
3
  interface InternalProviderProps extends Partial<ExtensionServerContext> {
3
4
  children?: ExtensionServerProviderProps['children'];
4
5
  }
5
6
  type MockExtensionServerProviderProps = Partial<ExtensionServerProviderProps> & InternalProviderProps;
6
- export declare function MockExtensionServerProvider({ children, options, ...props }: MockExtensionServerProviderProps): JSX.Element;
7
+ export declare function MockExtensionServerProvider({ children, options, ...props }: MockExtensionServerProviderProps): React.JSX.Element;
7
8
  export {};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../types.cjs.js");let i=0;function a(e){return`00000000000${e}`.slice(-12)}function r(e={}){const t=`00000000-0000-0000-0000-${a(i++)}`,n=Date.now();return{handle:"my-extension",name:"My extension",description:"My extension description",surface:"admin",type:"purchase_option",externalType:"external_type",uuid:t,version:"extension version",...e,assets:{main:{name:"main",url:`https://secure-link.com/extensions/${t}/assets/handle.js?lastUpdated=${n}`,lastUpdated:n},...e.assets??{}},development:{hidden:!1,status:s.Status.Success,resource:{url:"resourceUrl"},root:{url:`https://secure-link.com/extensions/${t}`},renderer:{name:"render name",version:"1.0.0"},...e.development??{}},extensionPoints:e.extensionPoints,capabilities:e.capabilities,localization:e.localization,authenticatedRedirectStartUrl:e.authenticatedRedirectStartUrl,authenticatedRedirectRedirectUrls:e.authenticatedRedirectRedirectUrls,settings:{fields:[{key:"sample-key",name:"sample_name",type:"sample_type"}]}}}exports.mockExtension=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../types.cjs.js");let i=0;function a(e){return`00000000000${e}`.slice(-12)}function r(e={}){const t=`00000000-0000-0000-0000-${a(i++)}`,n=Date.now();return{handle:"my-extension",name:"My extension",description:"My extension description",surface:"admin",type:"purchase_option",externalType:"external_type",uuid:t,version:"extension version",...e,assets:{main:{name:"main",url:`https://secure-link.com/extensions/${t}/assets/handle.js?lastUpdated=${n}`,lastUpdated:n},...e.assets??{}},development:{hidden:!1,status:s.Status.Success,resource:{url:"resourceUrl"},root:{url:`https://secure-link.com/extensions/${t}`},renderer:{name:"render name",version:"1.0.0"},...e.development??{}},extensionPoints:e.extensionPoints,capabilities:e.capabilities,supportedFeatures:e.supportedFeatures,localization:e.localization,authenticatedRedirectStartUrl:e.authenticatedRedirectStartUrl,authenticatedRedirectRedirectUrls:e.authenticatedRedirectRedirectUrls,settings:{fields:[{key:"sample-key",name:"sample_name",type:"sample_type"}]}}}exports.mockExtension=r;
@@ -3,7 +3,7 @@ let i = 0;
3
3
  function a(e) {
4
4
  return `00000000000${e}`.slice(-12);
5
5
  }
6
- function c(e = {}) {
6
+ function o(e = {}) {
7
7
  const t = `00000000-0000-0000-0000-${a(i++)}`, n = Date.now();
8
8
  return {
9
9
  handle: "my-extension",
@@ -46,6 +46,7 @@ function c(e = {}) {
46
46
  // in a generalized, non-surprising way
47
47
  extensionPoints: e.extensionPoints,
48
48
  capabilities: e.capabilities,
49
+ supportedFeatures: e.supportedFeatures,
49
50
  localization: e.localization,
50
51
  authenticatedRedirectStartUrl: e.authenticatedRedirectStartUrl,
51
52
  authenticatedRedirectRedirectUrls: e.authenticatedRedirectRedirectUrls,
@@ -61,5 +62,5 @@ function c(e = {}) {
61
62
  };
62
63
  }
63
64
  export {
64
- c as mockExtension
65
+ o as mockExtension
65
66
  };
package/dist/types.d.ts CHANGED
@@ -141,6 +141,7 @@ export interface ExtensionPayload {
141
141
  handle: string;
142
142
  extensionPoints: ExtensionPoints;
143
143
  capabilities?: Capabilities;
144
+ supportedFeatures: ExtensionSupportedFeatures;
144
145
  authenticatedRedirectStartUrl?: string;
145
146
  authenticatedRedirectRedirectUrls?: string[];
146
147
  localization?: FlattenedLocalization | Localization | null;
@@ -155,6 +156,9 @@ export interface ExtensionPayload {
155
156
  }[];
156
157
  };
157
158
  }
159
+ export interface ExtensionSupportedFeatures {
160
+ offlineMode: boolean;
161
+ }
158
162
  export declare enum Status {
159
163
  Success = "success"
160
164
  }
@@ -1,2 +1,2 @@
1
1
  import React from 'react';
2
- export declare function render<TProps, TProviderProps>(element: React.ReactElement<TProps>, Providers?: React.ComponentType<TProviderProps>, options?: Omit<TProviderProps, 'children'>): import("@shopify/react-testing").Root<any>;
2
+ export declare function render<TProps, TProviderProps>(element: React.ReactElement<TProps>, Providers?: React.ComponentType<React.PropsWithChildren<TProviderProps>>, options?: Omit<TProviderProps, 'children'>): import("@shopify/react-testing").Root<any>;
@@ -14,4 +14,4 @@ export interface HookWrapper<T> {
14
14
  act<TR>(callback: (currentResult: T) => TR): TR;
15
15
  forceUpdate(): void;
16
16
  }
17
- export declare function renderHook<T, TP>(hook: () => T, Providers?: React.ComponentType<TP>, options?: Omit<TP, 'children'>): HookWrapper<T>;
17
+ export declare function renderHook<T, TP>(hook: () => T, Providers?: React.ComponentType<React.PropsWithChildren<TP>>, options?: Omit<TP, 'children'>): HookWrapper<T>;
@@ -2,15 +2,14 @@
2
2
  > `npm install --save @types/react`
3
3
 
4
4
  # Summary
5
- This package contains type definitions for React (http://facebook.github.io/react/).
5
+ This package contains type definitions for react (https://react.dev/).
6
6
 
7
7
  # Details
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Fri, 12 Feb 2021 18:02:47 GMT
12
- * Dependencies: [@types/csstype](https://npmjs.com/package/@types/csstype), [@types/prop-types](https://npmjs.com/package/@types/prop-types)
13
- * Global values: `React`
11
+ * Last updated: Wed, 23 Oct 2024 03:36:41 GMT
12
+ * Dependencies: [@types/prop-types](https://npmjs.com/package/@types/prop-types), [csstype](https://npmjs.com/package/csstype)
14
13
 
15
14
  # Credits
16
- These definitions were written by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com), [John Reilly](https://github.com/johnnyreilly), [Benoit Benezech](https://github.com/bbenezech), [Patricio Zavolinsky](https://github.com/pzavolinsky), [Digiguru](https://github.com/digiguru), [Eric Anderson](https://github.com/ericanderson), [Dovydas Navickas](https://github.com/DovydasNavickas), [Josh Rutherford](https://github.com/theruther4d), [Guilherme Hübner](https://github.com/guilhermehubner), [Ferdy Budhidharma](https://github.com/ferdaber), [Johann Rakotoharisoa](https://github.com/jrakotoharisoa), [Olivier Pascal](https://github.com/pascaloliv), [Martin Hochel](https://github.com/hotell), [Frank Li](https://github.com/franklixuefei), [Jessica Franco](https://github.com/Jessidhia), [Saransh Kataria](https://github.com/saranshkataria), [Kanitkorn Sujautra](https://github.com/lukyth), [Sebastian Silbermann](https://github.com/eps1lon), [Kyle Scully](https://github.com/zieka), [Cong Zhang](https://github.com/dancerphil), [Dimitri Mitropoulos](https://github.com/dimitropoulos), [JongChan Choi](https://github.com/disjukr), [Victor Magalhães](https://github.com/vhfmag), and [Dale Tan](https://github.com/hellatan).
15
+ These definitions were written by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com), [John Reilly](https://github.com/johnnyreilly), [Benoit Benezech](https://github.com/bbenezech), [Patricio Zavolinsky](https://github.com/pzavolinsky), [Eric Anderson](https://github.com/ericanderson), [Dovydas Navickas](https://github.com/DovydasNavickas), [Josh Rutherford](https://github.com/theruther4d), [Guilherme Hübner](https://github.com/guilhermehubner), [Ferdy Budhidharma](https://github.com/ferdaber), [Johann Rakotoharisoa](https://github.com/jrakotoharisoa), [Olivier Pascal](https://github.com/pascaloliv), [Martin Hochel](https://github.com/hotell), [Frank Li](https://github.com/franklixuefei), [Jessica Franco](https://github.com/Jessidhia), [Saransh Kataria](https://github.com/saranshkataria), [Kanitkorn Sujautra](https://github.com/lukyth), [Sebastian Silbermann](https://github.com/eps1lon), [Kyle Scully](https://github.com/zieka), [Cong Zhang](https://github.com/dancerphil), [Dimitri Mitropoulos](https://github.com/dimitropoulos), [JongChan Choi](https://github.com/disjukr), [Victor Magalhães](https://github.com/vhfmag), [Priyanshu Rav](https://github.com/priyanshurav), [Dmitry Semigradsky](https://github.com/Semigradsky), and [Matt Pocock](https://github.com/mattpocock).
@@ -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
+ }
@@ -34,25 +34,25 @@
34
34
  //
35
35
  // Suspense-related handling can be found in ReactFiberThrow.js.
36
36
 
37
- import React = require('.');
37
+ import React = require("./canary");
38
38
 
39
39
  export {};
40
40
 
41
41
  declare const UNDEFINED_VOID_ONLY: unique symbol;
42
42
  type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
43
43
 
44
- declare module '.' {
44
+ declare module "." {
45
45
  export interface SuspenseProps {
46
46
  /**
47
47
  * The presence of this prop indicates that the content is computationally expensive to render.
48
48
  * In other words, the tree is CPU bound and not I/O bound (e.g. due to fetching data).
49
49
  * @see {@link https://github.com/facebook/react/pull/19936}
50
50
  */
51
- unstable_expectedLoadTime?: number;
51
+ unstable_expectedLoadTime?: number | undefined;
52
52
  }
53
53
 
54
- export type SuspenseListRevealOrder = 'forwards' | 'backwards' | 'together';
55
- export type SuspenseListTailMode = 'collapsed' | 'hidden';
54
+ export type SuspenseListRevealOrder = "forwards" | "backwards" | "together";
55
+ export type SuspenseListTailMode = "collapsed" | "hidden";
56
56
 
57
57
  export interface SuspenseListCommonProps {
58
58
  /**
@@ -69,7 +69,7 @@ declare module '.' {
69
69
  /**
70
70
  * Defines the order in which the `SuspenseList` children should be revealed.
71
71
  */
72
- revealOrder: 'forwards' | 'backwards';
72
+ revealOrder: "forwards" | "backwards";
73
73
  /**
74
74
  * Dictates how unloaded items in a SuspenseList is shown.
75
75
  *
@@ -77,18 +77,18 @@ declare module '.' {
77
77
  * - `collapsed` shows only the next fallback in the list.
78
78
  * - `hidden` doesn’t show any unloaded items.
79
79
  */
80
- tail?: SuspenseListTailMode;
80
+ tail?: SuspenseListTailMode | undefined;
81
81
  }
82
82
 
83
83
  interface NonDirectionalSuspenseListProps extends SuspenseListCommonProps {
84
84
  /**
85
85
  * Defines the order in which the `SuspenseList` children should be revealed.
86
86
  */
87
- revealOrder?: Exclude<SuspenseListRevealOrder, DirectionalSuspenseListProps['revealOrder']>;
87
+ revealOrder?: Exclude<SuspenseListRevealOrder, DirectionalSuspenseListProps["revealOrder"]> | undefined;
88
88
  /**
89
89
  * The tail property is invalid when not using the `forwards` or `backwards` reveal orders.
90
90
  */
91
- tail?: never;
91
+ tail?: never | undefined;
92
92
  }
93
93
 
94
94
  export type SuspenseListProps = DirectionalSuspenseListProps | NonDirectionalSuspenseListProps;
@@ -106,87 +106,22 @@ declare module '.' {
106
106
  */
107
107
  export const unstable_SuspenseList: ExoticComponent<SuspenseListProps>;
108
108
 
109
- export interface SuspenseConfig {
110
- busyDelayMs?: number;
111
- busyMinDurationMs?: number;
112
- }
109
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
110
+ export function experimental_useEffectEvent<T extends Function>(event: T): T;
113
111
 
114
- // undocumented, considered for removal
115
- export function unstable_withSuspenseConfig(
116
- scope: () => VoidOrUndefinedOnly,
117
- config: SuspenseConfig | null | undefined,
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
118
  ): void;
119
+ function experimental_taintObjectReference(message: string | undefined, object: Reference): void;
119
120
 
120
- // must be synchronous
121
- export type TransitionFunction = () => VoidOrUndefinedOnly;
122
- // strange definition to allow vscode to show documentation on the invocation
123
- export interface TransitionStartFunction {
121
+ export interface HTMLAttributes<T> {
124
122
  /**
125
- * State updates caused inside the callback are allowed to be deferred.
126
- *
127
- * **If some state update causes a component to suspend, that state update should be wrapped in a transition.**
128
- *
129
- * @param callback A _synchronous_ function which causes state updates that can be deferred.
123
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert
130
124
  */
131
- (callback: TransitionFunction): void;
125
+ inert?: boolean | undefined;
132
126
  }
133
-
134
- /**
135
- * Returns a deferred version of the value that may “lag behind” it for at most `timeoutMs`.
136
- *
137
- * This is commonly used to keep the interface responsive when you have something that renders immediately
138
- * based on user input and something that needs to wait for a data fetch.
139
- *
140
- * A good example of this is a text input.
141
- *
142
- * @param value The value that is going to be deferred
143
- *
144
- * @see https://reactjs.org/docs/concurrent-mode-reference.html#usedeferredvalue
145
- */
146
- export function unstable_useDeferredValue<T>(value: T): T;
147
-
148
- /**
149
- * Allows components to avoid undesirable loading states by waiting for content to load
150
- * before transitioning to the next screen. It also allows components to defer slower,
151
- * data fetching updates until subsequent renders so that more crucial updates can be
152
- * rendered immediately.
153
- *
154
- * The `useTransition` hook returns two values in an array.
155
- *
156
- * The first is a function that takes a callback. We can use it to tell React which state we want to defer.
157
- * The seconda boolean. It’s React’s way of informing us whether we’re waiting for the transition to finish.
158
- *
159
- * **If some state update causes a component to suspend, that state update should be wrapped in a transition.**
160
- *
161
- * @param config An optional object with `timeoutMs`
162
- *
163
- * @see https://reactjs.org/docs/concurrent-mode-reference.html#usetransition
164
- */
165
- export function unstable_useTransition(config?: SuspenseConfig | null): [TransitionStartFunction, boolean];
166
-
167
- const opaqueIdentifierBranding: unique symbol;
168
- /**
169
- * WARNING: Don't use this as a `string`.
170
- *
171
- * This is an opaque type that is not supposed to type-check structurally.
172
- * It is only valid if returned from React methods and passed to React e.g. `<button aria-labelledby={opaqueIdentifier} />`
173
- */
174
- // We can't create a type that would be rejected for string concatenation or `.toString()` calls.
175
- // So in order to not have to add `string | OpaqueIdentifier` to every react-dom host prop we intersect it with `string`.
176
- type OpaqueIdentifier = string & {
177
- readonly [opaqueIdentifierBranding]: unknown;
178
- // While this would cause `const stringified: string = opaqueIdentifier.toString()` to not type-check it also adds completions while typing.
179
- // It would also still allow string concatenation.
180
- // Unsure which is better. Not type-checking or not suggesting.
181
- // toString(): void;
182
- };
183
-
184
- export function unstable_useOpaqueIdentifier(): OpaqueIdentifier;
185
-
186
- /**
187
- * Similar to `useTransition` but allows uses where hooks are not available.
188
- *
189
- * @param callback A _synchronous_ function which causes state updates that can be deferred.
190
- */
191
- export function unstable_startTransition(scope: TransitionFunction): void;
192
127
  }