diff --git a/webapp/openapi-playground/mod/openapi/SchemaView.tsx b/webapp/openapi-playground/mod/openapi/SchemaView.tsx index 90311db..ea98fbc 100644 --- a/webapp/openapi-playground/mod/openapi/SchemaView.tsx +++ b/webapp/openapi-playground/mod/openapi/SchemaView.tsx @@ -2,6 +2,7 @@ import { component, component$, createProvider, + observableRef, RouterLink, Schema, t, @@ -11,7 +12,7 @@ import { import { isUndefined } from "@innoai-tech/lodash"; import { styled } from "@innoai-tech/vueuikit"; import { Markdown } from "@innoai-tech/vuemarkdown"; -import { Icon, Tooltip } from "@innoai-tech/vuematerial"; +import { Dialog, Icon, Tooltip } from "@innoai-tech/vuematerial"; import { mdiHelpBox } from "@mdi/js"; export const Token = styled("div")({ @@ -78,10 +79,6 @@ export const Description = styled<{ const title = Schema.metaProp(props.schema, "title") ?? ""; const description = Schema.metaProp(props.schema, "description") ?? ""; - if (!(title || description)) { - return null; - } - return ( {title} {description ? ( @@ -232,6 +229,9 @@ const SchemaViewLink = component$<{ schema: Type, }>((props) => { const node = SchemaRenderProvider.use(); + const ident = IntentContextProvider.use(); + + const open$ = observableRef(false); return () => { let schema = props.schema; @@ -242,15 +242,73 @@ const SchemaViewLink = component$<{ const needID = schema.type == "intersection" || schema.type == "object" || schema.type == "union" || schema.type == "record" || schema.type == "array" || schema.type == "union"; + const $inline = node.safe(id) && ( + <> +   + + + ); + return ( - {needID && {id} } - {node.safe(id) && } + {needID ? ( + ident.indent < 3 ? ( + <> + + {id} + + {ident.indent < 3 && $inline} + + ) : ( + <> + { + e.preventDefault(); + open$.next(true); + }} + > + {id} + + {node.safe(id) && ( + { + open$.next(false); + }} + > + + + {id} + + {$inline} + + + + + )} + + ) + ) : ( + $inline + )} ); }; }); +const DialogContainer = styled("div")({ + display: "flex", + containerStyle: "sys.surface", + height: "100vh", + width: "36vw", + roundedLeft: "sm", + px: 16, + py: 36, + top: 0, + right: 0, + position: "absolute", + overflow: "auto" +}); export const SchemaView = component$<{ schema: Type,