diff options
Diffstat (limited to 'venv/lib/python3.11/site-packages/litestar/middleware/exceptions/templates')
4 files changed, 180 insertions, 0 deletions
diff --git a/venv/lib/python3.11/site-packages/litestar/middleware/exceptions/templates/body.html b/venv/lib/python3.11/site-packages/litestar/middleware/exceptions/templates/body.html new file mode 100644 index 0000000..1c6705c --- /dev/null +++ b/venv/lib/python3.11/site-packages/litestar/middleware/exceptions/templates/body.html @@ -0,0 +1,20 @@ +<!doctype html> + +<html lang="en"> +  <head> +    <meta charset="utf-8" /> +    <style type="text/css"> +      {styles} +    </style> +    <title>Litestar exception page</title> +  </head> +  <body> +    <h4>{error}</h4> +    <h3><span>{error_description}</span></h3> +    {exception_data} +    <script type="text/javascript"> +      // prettier-ignore +      {scripts} // NOSONAR +    </script> +  </body> +</html> diff --git a/venv/lib/python3.11/site-packages/litestar/middleware/exceptions/templates/frame.html b/venv/lib/python3.11/site-packages/litestar/middleware/exceptions/templates/frame.html new file mode 100644 index 0000000..2ead8dd --- /dev/null +++ b/venv/lib/python3.11/site-packages/litestar/middleware/exceptions/templates/frame.html @@ -0,0 +1,12 @@ +<div class="frame {frame_class}"> +  <div class="frame-name"> +    <span class="expander">▼</span> +    <span class="breakable">{file}</span> in <span>{symbol_name}</span> at line +    <span>{line}</span> +  </div> +  <div class="code-snippet-wrapper"> +    <table role="presentation" class="code-snippet"> +      {code} +    </table> +  </div> +</div> diff --git a/venv/lib/python3.11/site-packages/litestar/middleware/exceptions/templates/scripts.js b/venv/lib/python3.11/site-packages/litestar/middleware/exceptions/templates/scripts.js new file mode 100644 index 0000000..014a256 --- /dev/null +++ b/venv/lib/python3.11/site-packages/litestar/middleware/exceptions/templates/scripts.js @@ -0,0 +1,27 @@ +const expanders = document.querySelectorAll(".frame .expander"); + +for (const expander of expanders) { +  expander.addEventListener("click", (evt) => { +    const currentSnippet = evt.currentTarget.closest(".frame"); +    const snippetWrapper = currentSnippet.querySelector( +      ".code-snippet-wrapper", +    ); +    if (currentSnippet.classList.contains("collapsed")) { +      snippetWrapper.style.height = `${snippetWrapper.scrollHeight}px`; +      currentSnippet.classList.remove("collapsed"); +    } else { +      currentSnippet.classList.add("collapsed"); +      snippetWrapper.style.height = "0px"; +    } +  }); +} + +// init height for non-collapsed code snippets so animation will be show +// their first collapse +const nonCollapsedSnippets = document.querySelectorAll( +  ".frame:not(.collapsed) .code-snippet-wrapper", +); + +for (const snippet of nonCollapsedSnippets) { +  snippet.style.height = `${snippet.scrollHeight}px`; +} diff --git a/venv/lib/python3.11/site-packages/litestar/middleware/exceptions/templates/styles.css b/venv/lib/python3.11/site-packages/litestar/middleware/exceptions/templates/styles.css new file mode 100644 index 0000000..6b98b89 --- /dev/null +++ b/venv/lib/python3.11/site-packages/litestar/middleware/exceptions/templates/styles.css @@ -0,0 +1,121 @@ +:root { +  --code-background-color: #f5f5f5; +  --code-background-color-dark: #b8b8b8; +  --code-color: #1d2534; +  --code-color-light: #546996; +  --code-font-family: Consolas, monospace; +  --header-color: #303b55; +  --warn-color: hsl(356, 92%, 60%); +  --text-font-family: -apple-system, BlinkMacSystemFont, Helvetica, Arial, +    sans-serif; +} + +html { +  font-size: 20px; +} + +body { +  font-family: var(--text-font-family); +  font-size: 0.8rem; +} + +h1, +h2, +h3, +h4 { +  color: var(--header-color); +} + +h4 { +  font-size: 1rem; +} + +h3 { +  font-size: 1.35rem; +} + +h2 { +  font-size: 1.83rem; +} + +h3 span, +h4 span { +  color: var(--warn-color); +} + +.frame { +  background-color: var(--code-background-color); +  border-radius: 0.2rem; +  margin-bottom: 20px; +} + +.frame-name { +  border-bottom: 1px solid var(--code-color-light); +  padding: 10px 16px; +} + +.frame.collapsed .frame-name { +  border-bottom: none; +} + +.frame-name span { +  font-weight: 700; +} + +span.expander { +  display: inline-block; +  margin-right: 10px; +  cursor: pointer; +  transition: transform 0.33s ease-in-out; +} + +.frame.collapsed span.expander { +  transform: rotate(-90deg); +} + +.frame-name span.breakable { +  word-break: break-all; +} + +.code-snippet-wrapper { +  height: auto; +  overflow-y: hidden; +  transition: height 0.33s ease-in-out; +} + +.frame.collapsed .code-snippet-wrapper { +  height: 0; +} + +.code-snippet { +  margin: 10px 16px; +  border-spacing: 0 0; +  color: var(--code-color); +  font-family: var(--code-font-family); +  font-size: 0.68rem; +} + +.code-snippet td { +  padding: 0; +  text-align: left; +} + +td.line_no { +  color: var(--code-color-light); +  min-width: 4ch; +  padding-right: 20px; +  text-align: right; +  user-select: none; +} + +td.code_line { +  width: 99%; +} + +tr.executed-line { +  background-color: var(--code-background-color-dark); +} + +.cause-wrapper { +  margin-top: 50px; +}  | 
