@scalar/api-client-react 1.1.30 → 1.1.32
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 +31 -0
- package/README.md +2 -8
- package/dist/ApiClientModalProvider.d.ts +20 -0
- package/dist/ApiClientModalProvider.d.ts.map +1 -0
- package/dist/ApiClientModalProvider.js +2 -10
- package/dist/client-store.d.ts +12 -0
- package/dist/client-store.d.ts.map +1 -0
- package/dist/index.d.ts +2 -3614
- package/dist/index.d.ts.map +1 -0
- package/dist/style.css +1 -1
- package/package.json +8 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @scalar/api-client-react
|
|
2
2
|
|
|
3
|
+
## 1.1.32
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ed5dd8c: fix: react packages to work with react 18 and 19
|
|
8
|
+
- c10bbf5: chore: code style
|
|
9
|
+
- Updated dependencies [7833331]
|
|
10
|
+
- Updated dependencies [f61e986]
|
|
11
|
+
- Updated dependencies [8173889]
|
|
12
|
+
- Updated dependencies [8d9a2c0]
|
|
13
|
+
- Updated dependencies [8d9a2c0]
|
|
14
|
+
- Updated dependencies [2be8986]
|
|
15
|
+
- Updated dependencies [7017639]
|
|
16
|
+
- Updated dependencies [143d2a9]
|
|
17
|
+
- Updated dependencies [e52ecd2]
|
|
18
|
+
- Updated dependencies [c10bbf5]
|
|
19
|
+
- Updated dependencies [eed78eb]
|
|
20
|
+
- Updated dependencies [875ee2c]
|
|
21
|
+
- Updated dependencies [4a0e6b7]
|
|
22
|
+
- Updated dependencies [5a46f1c]
|
|
23
|
+
- Updated dependencies [a89510b]
|
|
24
|
+
- Updated dependencies [48f24c9]
|
|
25
|
+
- @scalar/api-client@2.2.52
|
|
26
|
+
|
|
27
|
+
## 1.1.31
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [58a8efd]
|
|
32
|
+
- @scalar/api-client@2.2.51
|
|
33
|
+
|
|
3
34
|
## 1.1.30
|
|
4
35
|
|
|
5
36
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -11,19 +11,14 @@
|
|
|
11
11
|
npm install @scalar/api-client-react
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
## Compatibility
|
|
15
|
-
|
|
16
|
-
This package is compatible with React 19 and is untested on React 18. If you want guaranteed React 18 support please use
|
|
17
|
-
version `1.0.107` of this package.
|
|
18
|
-
|
|
19
14
|
## Usage
|
|
20
15
|
|
|
21
16
|
First we need to add the provider, you should add it in the highest place you have a unique spec.
|
|
22
17
|
|
|
23
18
|
```tsx
|
|
24
19
|
import { ApiClientModalProvider } from '@scalar/api-client-react'
|
|
25
|
-
import '@scalar/api-client-react/style.css'
|
|
26
20
|
|
|
21
|
+
import '@scalar/api-client-react/style.css'
|
|
27
22
|
;<ApiClientModalProvider
|
|
28
23
|
configuration={{
|
|
29
24
|
spec: {
|
|
@@ -42,8 +37,7 @@ import { useApiClientModal } from '@scalar/api-client-react'
|
|
|
42
37
|
const client = useApiClientModal()
|
|
43
38
|
|
|
44
39
|
return (
|
|
45
|
-
<button
|
|
46
|
-
onClick={() => client?.open({ path: '/auth/token', method: 'get' })}>
|
|
40
|
+
<button onClick={() => client?.open({ path: '/auth/token', method: 'get' })}>
|
|
47
41
|
Click me to open the Api Client
|
|
48
42
|
</button>
|
|
49
43
|
)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { createApiClientModalSync as CreateApiClientModalSync } from '@scalar/api-client/layouts/Modal';
|
|
2
|
+
import type { ClientConfiguration, OpenClientPayload } from '@scalar/api-client/libs';
|
|
3
|
+
import type { PropsWithChildren } from 'react';
|
|
4
|
+
import './style.css';
|
|
5
|
+
type Props = PropsWithChildren<{
|
|
6
|
+
/** Choose a request to initially route to */
|
|
7
|
+
initialRequest?: OpenClientPayload;
|
|
8
|
+
/** Configuration for the Api Client */
|
|
9
|
+
configuration?: ClientConfiguration;
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* Api Client Modal React
|
|
13
|
+
*
|
|
14
|
+
* Provider which mounts the Scalar Api Client Modal vue app.
|
|
15
|
+
* Rebuilt to support multiple instances when using a unique spec.url
|
|
16
|
+
*/
|
|
17
|
+
export declare const ApiClientModalProvider: ({ children, initialRequest, configuration }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare const useApiClientModal: () => ReturnType<typeof CreateApiClientModalSync> | null;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=ApiClientModalProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiClientModalProvider.d.ts","sourceRoot":"","sources":["../src/ApiClientModalProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,IAAI,wBAAwB,EAAE,MAAM,kCAAkC,CAAA;AAC5G,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AACrF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAK9C,OAAO,aAAa,CAAA;AAIpB,KAAK,KAAK,GAAG,iBAAiB,CAAC;IAC7B,6CAA6C;IAC7C,cAAc,CAAC,EAAE,iBAAiB,CAAA;IAClC,uCAAuC;IACvC,aAAa,CAAC,EAAE,mBAAmB,CAAA;CACpC,CAAC,CAAA;AAQF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,gDAAsD,KAAK,4CAuD7F,CAAA;AAED,eAAO,MAAM,iBAAiB,QAAO,UAAU,CAAC,OAAO,wBAAwB,CAAC,GAAG,IAChD,CAAA"}
|
|
@@ -5,17 +5,9 @@ import { clientStore as n } from "./client-store.js";
|
|
|
5
5
|
/* empty css */
|
|
6
6
|
const d = S(null);
|
|
7
7
|
let u = !1;
|
|
8
|
-
const a = {}, j = ({
|
|
9
|
-
children: C,
|
|
10
|
-
initialRequest: r,
|
|
11
|
-
configuration: l = {}
|
|
12
|
-
}) => {
|
|
8
|
+
const a = {}, j = ({ children: C, initialRequest: r, configuration: l = {} }) => {
|
|
13
9
|
var i;
|
|
14
|
-
const t = ((i = l.spec) == null ? void 0 : i.url) || "default", c = x(null), s = A(
|
|
15
|
-
n.subscribe,
|
|
16
|
-
n.getSnapshot,
|
|
17
|
-
n.getSnapshot
|
|
18
|
-
);
|
|
10
|
+
const t = ((i = l.spec) == null ? void 0 : i.url) || "default", c = x(null), s = A(n.subscribe, n.getSnapshot, n.getSnapshot);
|
|
19
11
|
return p(() => {
|
|
20
12
|
u || (async () => {
|
|
21
13
|
u = !0;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { createApiClientModalSync as CreateApiClientModalSync } from '@scalar/api-client/layouts/Modal';
|
|
2
|
+
export declare const clientStore: {
|
|
3
|
+
getSnapshot: () => {
|
|
4
|
+
createClient: typeof CreateApiClientModalSync | null;
|
|
5
|
+
clientDict: Record<string, ReturnType<typeof CreateApiClientModalSync>>;
|
|
6
|
+
};
|
|
7
|
+
subscribe: (listener: () => void) => () => boolean;
|
|
8
|
+
setCreateClient: (client: typeof CreateApiClientModalSync) => void;
|
|
9
|
+
addClient: (url: string, client: ReturnType<typeof CreateApiClientModalSync>) => void;
|
|
10
|
+
removeClient: (url: string) => void;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=client-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-store.d.ts","sourceRoot":"","sources":["../src/client-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,IAAI,wBAAwB,EAAE,MAAM,kCAAkC,CAAA;AA+C5G,eAAO,MAAM,WAAW;;sBAtCA,OAAO,wBAAwB,GAAG,IAAI;oBAC1C,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC;;0BAOlD,MAAM,IAAI;8BAYN,OAAO,wBAAwB;qBAMxC,MAAM,UAAU,UAAU,CAAC,OAAO,wBAAwB,CAAC;wBAMxD,MAAM;CAYhC,CAAA"}
|