@typespec/playground 0.14.0-dev.3 → 0.14.0-dev.4

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.
@@ -1,20 +1,26 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { lazy, Suspense } from 'react';
3
- import 'swagger-ui-dist/swagger-ui.css';
4
-
5
- const style = {
6
- "swagger-ui-container": "_swagger-ui-container_1c81n_1"
1
+ import { Suspense, lazy } from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import "swagger-ui-dist/swagger-ui.css";
4
+ //#region src/react/viewers/swagger-ui.module.css
5
+ var swagger_ui_module_default = { "swagger-ui-container": "_swagger-ui-container_1c81n_1" };
6
+ //#endregion
7
+ //#region src/react/viewers/swagger-ui.tsx
8
+ var LazySwaggerUI = lazy(() => import("../../react-wrapper-B-poU4Lv.js"));
9
+ var SwaggerUI = (props) => {
10
+ return /* @__PURE__ */ jsx(Suspense, {
11
+ fallback: /* @__PURE__ */ jsx("div", {}),
12
+ children: /* @__PURE__ */ jsx("div", {
13
+ className: swagger_ui_module_default["swagger-ui-container"],
14
+ children: /* @__PURE__ */ jsx(LazySwaggerUI, { spec: props.spec })
15
+ })
16
+ });
7
17
  };
8
-
9
- const LazySwaggerUI = lazy(() => import('../../react-wrapper-BE4armyk.js'));
10
- const SwaggerUI = (props) => {
11
- return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", {}), children: /* @__PURE__ */ jsx("div", { className: style["swagger-ui-container"], children: /* @__PURE__ */ jsx(LazySwaggerUI, { spec: props.spec }) }) });
18
+ //#endregion
19
+ //#region src/react/viewers/index.tsx
20
+ var SwaggerUIViewer = {
21
+ key: "swaggerUI",
22
+ label: "Swagger UI",
23
+ render: ({ content }) => /* @__PURE__ */ jsx(SwaggerUI, { spec: content })
12
24
  };
13
-
14
- const SwaggerUIViewer = {
15
- key: "swaggerUI",
16
- label: "Swagger UI",
17
- render: ({ content }) => /* @__PURE__ */ jsx(SwaggerUI, { spec: content })
18
- };
19
-
25
+ //#endregion
20
26
  export { SwaggerUIViewer };
@@ -0,0 +1,18 @@
1
+ import { useEffect, useRef } from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import SwaggerUIBundle from "swagger-ui-dist/swagger-ui-es-bundle.js";
4
+ //#region src/react/viewers/react-wrapper.tsx
5
+ var react_wrapper_default = (props) => {
6
+ const uiRef = useRef(null);
7
+ const uiInstance = useRef(null);
8
+ useEffect(() => {
9
+ if (uiInstance.current === null) uiInstance.current = SwaggerUIBundle({
10
+ domNode: uiRef.current,
11
+ spec: {}
12
+ });
13
+ uiInstance.current.specActions.updateSpec(props.spec);
14
+ }, [props.spec]);
15
+ return /* @__PURE__ */ jsx("div", { ref: uiRef });
16
+ };
17
+ //#endregion
18
+ export { react_wrapper_default as default };