@scalar/api-reference-react 0.4.30 → 0.4.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 CHANGED
@@ -1,5 +1,32 @@
1
1
  # @scalar/api-reference-react
2
2
 
3
+ ## 0.4.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 [50388ea]
10
+ - Updated dependencies [43031e7]
11
+ - Updated dependencies [946a5df]
12
+ - Updated dependencies [b22f554]
13
+ - Updated dependencies [c10bbf5]
14
+ - Updated dependencies [0ba190a]
15
+ - Updated dependencies [4f7b767]
16
+ - Updated dependencies [78f0cdf]
17
+ - Updated dependencies [bd70ab6]
18
+ - Updated dependencies [577602f]
19
+ - Updated dependencies [875ee2c]
20
+ - Updated dependencies [cf14cbb]
21
+ - Updated dependencies [e55bfd2]
22
+ - @scalar/api-reference@1.25.123
23
+
24
+ ## 0.4.31
25
+
26
+ ### Patch Changes
27
+
28
+ - @scalar/api-reference@1.25.122
29
+
3
30
  ## 0.4.30
4
31
 
5
32
  ### Patch Changes
package/README.md CHANGED
@@ -11,11 +11,6 @@
11
11
  npm install @scalar/api-reference-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 `0.3.166` of this package.
18
-
19
14
  ## Usage
20
15
 
21
16
  The API Reference package is written in Vue. That shouldn’t stop you from using it in React, though. We have created a client side wrapper in React:
@@ -0,0 +1,7 @@
1
+ import type { ReferenceProps } from '@scalar/api-reference';
2
+ import './style.css';
3
+ /**
4
+ * React wrapper around the Scalar API Reference
5
+ */
6
+ export declare const ApiReferenceReact: (props: ReferenceProps) => import("react/jsx-runtime").JSX.Element;
7
+ //# sourceMappingURL=ApiReferenceReact.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApiReferenceReact.d.ts","sourceRoot":"","sources":["../src/ApiReferenceReact.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAI3D,OAAO,aAAa,CAAA;AAOpB;;GAEG;AACH,eAAO,MAAM,iBAAiB,UAAW,cAAc,4CAiCtD,CAAA"}
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ import { jsx as a } from "react/jsx-runtime";
3
+ import { createScalarReferences as _ } from "@scalar/api-reference";
4
+ import { useRef as c, useState as l, useEffect as r } from "react";
5
+ /* empty css */
6
+ globalThis.__VUE_OPTIONS_API__ = !0;
7
+ globalThis.__VUE_PROD_HYDRATION_MISMATCH_DETAILS__ = !0;
8
+ globalThis.__VUE_PROD_DEVTOOLS__ = !1;
9
+ const C = (e) => {
10
+ const n = c(null), [t, u] = l(null);
11
+ return r(() => {
12
+ if (!n.current) return t == null ? void 0 : t.unmount;
13
+ const o = { ...{
14
+ _integration: "react"
15
+ }, ...e.configuration }, i = _(n.current, o);
16
+ return u(i), i.unmount;
17
+ }, [n]), r(() => {
18
+ const o = { ...{ _integration: "react" }, ...e.configuration };
19
+ t == null || t.updateConfig(
20
+ o,
21
+ /** For React we will just replace the config if it changes */
22
+ !1
23
+ );
24
+ }, [e.configuration]), /* @__PURE__ */ a("div", { ref: n });
25
+ };
26
+ export {
27
+ C as ApiReferenceReact
28
+ };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,3 @@
1
- import { JSX } from 'react/jsx-runtime';
2
- import { ReferenceProps } from '@scalar/api-reference';
3
-
4
- /**
5
- * React wrapper around the Scalar API Reference
6
- */
7
- export declare const ApiReferenceReact: (props: ReferenceProps) => JSX.Element;
8
-
9
- export { ReferenceProps }
10
-
11
- export { }
1
+ export * from './ApiReferenceReact.js';
2
+ export type { ReferenceProps } from '@scalar/api-reference';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA"}
package/dist/index.js CHANGED
@@ -1,463 +1,4 @@
1
- import ye, { useRef as Oe, useState as Se, useEffect as fe } from "react";
2
- import { createScalarReferences as je } from "@scalar/api-reference";
3
- var q = { exports: {} }, O = {};
4
- /**
5
- * @license React
6
- * react-jsx-runtime.production.js
7
- *
8
- * Copyright (c) Meta Platforms, Inc. and affiliates.
9
- *
10
- * This source code is licensed under the MIT license found in the
11
- * LICENSE file in the root directory of this source tree.
12
- */
13
- var se;
14
- function Ae() {
15
- if (se) return O;
16
- se = 1;
17
- var i = Symbol.for("react.transitional.element"), v = Symbol.for("react.fragment");
18
- function s(R, c, f) {
19
- var E = null;
20
- if (f !== void 0 && (E = "" + f), c.key !== void 0 && (E = "" + c.key), "key" in c) {
21
- f = {};
22
- for (var C in c)
23
- C !== "key" && (f[C] = c[C]);
24
- } else f = c;
25
- return c = f.ref, {
26
- $$typeof: i,
27
- type: R,
28
- key: E,
29
- ref: c !== void 0 ? c : null,
30
- props: f
31
- };
32
- }
33
- return O.Fragment = v, O.jsx = s, O.jsxs = s, O;
34
- }
35
- var S = {};
36
- /**
37
- * @license React
38
- * react-jsx-runtime.development.js
39
- *
40
- * Copyright (c) Meta Platforms, Inc. and affiliates.
41
- *
42
- * This source code is licensed under the MIT license found in the
43
- * LICENSE file in the root directory of this source tree.
44
- */
45
- var Ee;
46
- function he() {
47
- return Ee || (Ee = 1, process.env.NODE_ENV !== "production" && function() {
48
- function i(e) {
49
- if (e == null) return null;
50
- if (typeof e == "function")
51
- return e.$$typeof === Ce ? null : e.displayName || e.name || null;
52
- if (typeof e == "string") return e;
53
- switch (e) {
54
- case N:
55
- return "Fragment";
56
- case Te:
57
- return "Portal";
58
- case B:
59
- return "Profiler";
60
- case X:
61
- return "StrictMode";
62
- case Y:
63
- return "Suspense";
64
- case M:
65
- return "SuspenseList";
66
- }
67
- if (typeof e == "object")
68
- switch (typeof e.tag == "number" && console.error(
69
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
70
- ), e.$$typeof) {
71
- case F:
72
- return (e.displayName || "Context") + ".Provider";
73
- case L:
74
- return (e._context.displayName || "Context") + ".Consumer";
75
- case P:
76
- var r = e.render;
77
- return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
78
- case $:
79
- return r = e.displayName || null, r !== null ? r : i(e.type) || "Memo";
80
- case U:
81
- r = e._payload, e = e._init;
82
- try {
83
- return i(e(r));
84
- } catch {
85
- }
86
- }
87
- return null;
88
- }
89
- function v(e) {
90
- return "" + e;
91
- }
92
- function s(e) {
93
- try {
94
- v(e);
95
- var r = !1;
96
- } catch {
97
- r = !0;
98
- }
99
- if (r) {
100
- r = console;
101
- var o = r.error, n = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
102
- return o.call(
103
- r,
104
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
105
- n
106
- ), v(e);
107
- }
108
- }
109
- function R() {
110
- }
111
- function c() {
112
- if (x === 0) {
113
- K = console.log, D = console.info, ee = console.warn, re = console.error, oe = console.group, te = console.groupCollapsed, ne = console.groupEnd;
114
- var e = {
115
- configurable: !0,
116
- enumerable: !0,
117
- value: R,
118
- writable: !0
119
- };
120
- Object.defineProperties(console, {
121
- info: e,
122
- log: e,
123
- warn: e,
124
- error: e,
125
- group: e,
126
- groupCollapsed: e,
127
- groupEnd: e
128
- });
129
- }
130
- x++;
131
- }
132
- function f() {
133
- if (x--, x === 0) {
134
- var e = { configurable: !0, enumerable: !0, writable: !0 };
135
- Object.defineProperties(console, {
136
- log: _({}, e, { value: K }),
137
- info: _({}, e, { value: D }),
138
- warn: _({}, e, { value: ee }),
139
- error: _({}, e, { value: re }),
140
- group: _({}, e, { value: oe }),
141
- groupCollapsed: _({}, e, { value: te }),
142
- groupEnd: _({}, e, { value: ne })
143
- });
144
- }
145
- 0 > x && console.error(
146
- "disabledDepth fell below zero. This is a bug in React. Please file an issue."
147
- );
148
- }
149
- function E(e) {
150
- if (V === void 0)
151
- try {
152
- throw Error();
153
- } catch (o) {
154
- var r = o.stack.trim().match(/\n( *(at )?)/);
155
- V = r && r[1] || "", ae = -1 < o.stack.indexOf(`
156
- at`) ? " (<anonymous>)" : -1 < o.stack.indexOf("@") ? "@unknown:0:0" : "";
157
- }
158
- return `
159
- ` + V + e + ae;
160
- }
161
- function C(e, r) {
162
- if (!e || z) return "";
163
- var o = H.get(e);
164
- if (o !== void 0) return o;
165
- z = !0, o = Error.prepareStackTrace, Error.prepareStackTrace = void 0;
166
- var n = null;
167
- n = m.H, m.H = null, c();
168
- try {
169
- var u = {
170
- DetermineComponentFrameRoot: function() {
171
- try {
172
- if (r) {
173
- var b = function() {
174
- throw Error();
175
- };
176
- if (Object.defineProperty(b.prototype, "props", {
177
- set: function() {
178
- throw Error();
179
- }
180
- }), typeof Reflect == "object" && Reflect.construct) {
181
- try {
182
- Reflect.construct(b, []);
183
- } catch (g) {
184
- var j = g;
185
- }
186
- Reflect.construct(e, [], b);
187
- } else {
188
- try {
189
- b.call();
190
- } catch (g) {
191
- j = g;
192
- }
193
- e.call(b.prototype);
194
- }
195
- } else {
196
- try {
197
- throw Error();
198
- } catch (g) {
199
- j = g;
200
- }
201
- (b = e()) && typeof b.catch == "function" && b.catch(function() {
202
- });
203
- }
204
- } catch (g) {
205
- if (g && j && typeof g.stack == "string")
206
- return [g.stack, j.stack];
207
- }
208
- return [null, null];
209
- }
210
- };
211
- u.DetermineComponentFrameRoot.displayName = "DetermineComponentFrameRoot";
212
- var a = Object.getOwnPropertyDescriptor(
213
- u.DetermineComponentFrameRoot,
214
- "name"
215
- );
216
- a && a.configurable && Object.defineProperty(
217
- u.DetermineComponentFrameRoot,
218
- "name",
219
- { value: "DetermineComponentFrameRoot" }
220
- );
221
- var t = u.DetermineComponentFrameRoot(), d = t[0], w = t[1];
222
- if (d && w) {
223
- var l = d.split(`
224
- `), T = w.split(`
225
- `);
226
- for (t = a = 0; a < l.length && !l[a].includes(
227
- "DetermineComponentFrameRoot"
228
- ); )
229
- a++;
230
- for (; t < T.length && !T[t].includes(
231
- "DetermineComponentFrameRoot"
232
- ); )
233
- t++;
234
- if (a === l.length || t === T.length)
235
- for (a = l.length - 1, t = T.length - 1; 1 <= a && 0 <= t && l[a] !== T[t]; )
236
- t--;
237
- for (; 1 <= a && 0 <= t; a--, t--)
238
- if (l[a] !== T[t]) {
239
- if (a !== 1 || t !== 1)
240
- do
241
- if (a--, t--, 0 > t || l[a] !== T[t]) {
242
- var y = `
243
- ` + l[a].replace(
244
- " at new ",
245
- " at "
246
- );
247
- return e.displayName && y.includes("<anonymous>") && (y = y.replace("<anonymous>", e.displayName)), typeof e == "function" && H.set(e, y), y;
248
- }
249
- while (1 <= a && 0 <= t);
250
- break;
251
- }
252
- }
253
- } finally {
254
- z = !1, m.H = n, f(), Error.prepareStackTrace = o;
255
- }
256
- return l = (l = e ? e.displayName || e.name : "") ? E(l) : "", typeof e == "function" && H.set(e, l), l;
257
- }
258
- function A(e) {
259
- if (e == null) return "";
260
- if (typeof e == "function") {
261
- var r = e.prototype;
262
- return C(
263
- e,
264
- !(!r || !r.isReactComponent)
265
- );
266
- }
267
- if (typeof e == "string") return E(e);
268
- switch (e) {
269
- case Y:
270
- return E("Suspense");
271
- case M:
272
- return E("SuspenseList");
273
- }
274
- if (typeof e == "object")
275
- switch (e.$$typeof) {
276
- case P:
277
- return e = C(e.render, !1), e;
278
- case $:
279
- return A(e.type);
280
- case U:
281
- r = e._payload, e = e._init;
282
- try {
283
- return A(e(r));
284
- } catch {
285
- }
286
- }
287
- return "";
288
- }
289
- function h() {
290
- var e = m.A;
291
- return e === null ? null : e.getOwner();
292
- }
293
- function ve(e) {
294
- if (Q.call(e, "key")) {
295
- var r = Object.getOwnPropertyDescriptor(e, "key").get;
296
- if (r && r.isReactWarning) return !1;
297
- }
298
- return e.key !== void 0;
299
- }
300
- function de(e, r) {
301
- function o() {
302
- ue || (ue = !0, console.error(
303
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
304
- r
305
- ));
306
- }
307
- o.isReactWarning = !0, Object.defineProperty(e, "key", {
308
- get: o,
309
- configurable: !0
310
- });
311
- }
312
- function ge() {
313
- var e = i(this.type);
314
- return le[e] || (le[e] = !0, console.error(
315
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
316
- )), e = this.props.ref, e !== void 0 ? e : null;
317
- }
318
- function be(e, r, o, n, u, a) {
319
- return o = a.ref, e = {
320
- $$typeof: k,
321
- type: e,
322
- key: r,
323
- props: a,
324
- _owner: u
325
- }, (o !== void 0 ? o : null) !== null ? Object.defineProperty(e, "ref", {
326
- enumerable: !1,
327
- get: ge
328
- }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
329
- configurable: !1,
330
- enumerable: !1,
331
- writable: !0,
332
- value: 0
333
- }), Object.defineProperty(e, "_debugInfo", {
334
- configurable: !1,
335
- enumerable: !1,
336
- writable: !0,
337
- value: null
338
- }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
339
- }
340
- function G(e, r, o, n, u, a) {
341
- if (typeof e == "string" || typeof e == "function" || e === N || e === B || e === X || e === Y || e === M || e === Re || typeof e == "object" && e !== null && (e.$$typeof === U || e.$$typeof === $ || e.$$typeof === F || e.$$typeof === L || e.$$typeof === P || e.$$typeof === we || e.getModuleId !== void 0)) {
342
- var t = r.children;
343
- if (t !== void 0)
344
- if (n)
345
- if (W(t)) {
346
- for (n = 0; n < t.length; n++)
347
- J(t[n], e);
348
- Object.freeze && Object.freeze(t);
349
- } else
350
- console.error(
351
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
352
- );
353
- else J(t, e);
354
- } else
355
- t = "", (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (t += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."), e === null ? n = "null" : W(e) ? n = "array" : e !== void 0 && e.$$typeof === k ? (n = "<" + (i(e.type) || "Unknown") + " />", t = " Did you accidentally export a JSX literal instead of a component?") : n = typeof e, console.error(
356
- "React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",
357
- n,
358
- t
359
- );
360
- if (Q.call(r, "key")) {
361
- t = i(e);
362
- var d = Object.keys(r).filter(function(l) {
363
- return l !== "key";
364
- });
365
- n = 0 < d.length ? "{key: someKey, " + d.join(": ..., ") + ": ...}" : "{key: someKey}", ie[t + n] || (d = 0 < d.length ? "{" + d.join(": ..., ") + ": ...}" : "{}", console.error(
366
- `A props object containing a "key" prop is being spread into JSX:
367
- let props = %s;
368
- <%s {...props} />
369
- React keys must be passed directly to JSX without using spread:
370
- let props = %s;
371
- <%s key={someKey} {...props} />`,
372
- n,
373
- t,
374
- d,
375
- t
376
- ), ie[t + n] = !0);
377
- }
378
- if (t = null, o !== void 0 && (s(o), t = "" + o), ve(r) && (s(r.key), t = "" + r.key), "key" in r) {
379
- o = {};
380
- for (var w in r)
381
- w !== "key" && (o[w] = r[w]);
382
- } else o = r;
383
- return t && de(
384
- o,
385
- typeof e == "function" ? e.displayName || e.name || "Unknown" : e
386
- ), be(e, t, a, u, h(), o);
387
- }
388
- function J(e, r) {
389
- if (typeof e == "object" && e && e.$$typeof !== xe) {
390
- if (W(e))
391
- for (var o = 0; o < e.length; o++) {
392
- var n = e[o];
393
- p(n) && I(n, r);
394
- }
395
- else if (p(e))
396
- e._store && (e._store.validated = 1);
397
- else if (e === null || typeof e != "object" ? o = null : (o = Z && e[Z] || e["@@iterator"], o = typeof o == "function" ? o : null), typeof o == "function" && o !== e.entries && (o = o.call(e), o !== e))
398
- for (; !(e = o.next()).done; )
399
- p(e.value) && I(e.value, r);
400
- }
401
- }
402
- function p(e) {
403
- return typeof e == "object" && e !== null && e.$$typeof === k;
404
- }
405
- function I(e, r) {
406
- if (e._store && !e._store.validated && e.key == null && (e._store.validated = 1, r = me(r), !ce[r])) {
407
- ce[r] = !0;
408
- var o = "";
409
- e && e._owner != null && e._owner !== h() && (o = null, typeof e._owner.tag == "number" ? o = i(e._owner.type) : typeof e._owner.name == "string" && (o = e._owner.name), o = " It was passed a child from " + o + ".");
410
- var n = m.getCurrentStack;
411
- m.getCurrentStack = function() {
412
- var u = A(e.type);
413
- return n && (u += n() || ""), u;
414
- }, console.error(
415
- 'Each child in a list should have a unique "key" prop.%s%s See https://react.dev/link/warning-keys for more information.',
416
- r,
417
- o
418
- ), m.getCurrentStack = n;
419
- }
420
- }
421
- function me(e) {
422
- var r = "", o = h();
423
- return o && (o = i(o.type)) && (r = `
424
-
425
- Check the render method of \`` + o + "`."), r || (e = i(e)) && (r = `
426
-
427
- Check the top-level render call using <` + e + ">."), r;
428
- }
429
- var _e = ye, k = Symbol.for("react.transitional.element"), Te = Symbol.for("react.portal"), N = Symbol.for("react.fragment"), X = Symbol.for("react.strict_mode"), B = Symbol.for("react.profiler"), L = Symbol.for("react.consumer"), F = Symbol.for("react.context"), P = Symbol.for("react.forward_ref"), Y = Symbol.for("react.suspense"), M = Symbol.for("react.suspense_list"), $ = Symbol.for("react.memo"), U = Symbol.for("react.lazy"), Re = Symbol.for("react.offscreen"), Z = Symbol.iterator, Ce = Symbol.for("react.client.reference"), m = _e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Q = Object.prototype.hasOwnProperty, _ = Object.assign, we = Symbol.for("react.client.reference"), W = Array.isArray, x = 0, K, D, ee, re, oe, te, ne;
430
- R.__reactDisabledLog = !0;
431
- var V, ae, z = !1, H = new (typeof WeakMap == "function" ? WeakMap : Map)(), xe = Symbol.for("react.client.reference"), ue, le = {}, ie = {}, ce = {};
432
- S.Fragment = N, S.jsx = function(e, r, o, n, u) {
433
- return G(e, r, o, !1, n, u);
434
- }, S.jsxs = function(e, r, o, n, u) {
435
- return G(e, r, o, !0, n, u);
436
- };
437
- }()), S;
438
- }
439
- process.env.NODE_ENV === "production" ? q.exports = Ae() : q.exports = he();
440
- var pe = q.exports;
441
- globalThis.__VUE_OPTIONS_API__ = !0;
442
- globalThis.__VUE_PROD_HYDRATION_MISMATCH_DETAILS__ = !0;
443
- globalThis.__VUE_PROD_DEVTOOLS__ = !1;
444
- const Pe = (i) => {
445
- const v = Oe(null), [s, R] = Se(null);
446
- return fe(() => {
447
- if (!v.current) return s == null ? void 0 : s.unmount;
448
- const f = { ...{
449
- _integration: "react"
450
- }, ...i.configuration }, E = je(v.current, f);
451
- return R(E), E.unmount;
452
- }, [v]), fe(() => {
453
- const f = { ...{ _integration: "react" }, ...i.configuration };
454
- s == null || s.updateConfig(
455
- f,
456
- /** For React we will just replace the config if it changes */
457
- !1
458
- );
459
- }, [i.configuration]), /* @__PURE__ */ pe.jsx("div", { ref: v });
460
- };
1
+ import { ApiReferenceReact as c } from "./ApiReferenceReact.js";
461
2
  export {
462
- Pe as ApiReferenceReact
3
+ c as ApiReferenceReact
463
4
  };