Add color changes

This commit is contained in:
Adam Hopkins 2023-02-16 14:59:09 +02:00
parent 26e999dec0
commit d9f7086ee6
No known key found for this signature in database
GPG Key ID: 9F85EE6C807303FB
8 changed files with 45 additions and 26 deletions

View File

@ -1 +1 @@
__version__ = "22.12.0" __version__ = "23.3.0"

View File

@ -157,6 +157,7 @@ class Sanic(StaticHandleMixin, BaseSanic, StartupMixin, metaclass=TouchUpMeta):
"strict_slashes", "strict_slashes",
"websocket_enabled", "websocket_enabled",
"websocket_tasks", "websocket_tasks",
"wrappers",
) )
_app_registry: Dict[str, "Sanic"] = {} _app_registry: Dict[str, "Sanic"] = {}

View File

@ -105,6 +105,7 @@ class Blueprint(BaseSanic):
"version", "version",
"version_prefix", "version_prefix",
"websocket_routes", "websocket_routes",
"wrappers",
) )
def __init__( def __init__(

View File

@ -14,6 +14,7 @@ class MiddlewareMixin(metaclass=SanicMeta):
def __init__(self, *args, **kwargs) -> None: def __init__(self, *args, **kwargs) -> None:
self._future_middleware: List[FutureMiddleware] = [] self._future_middleware: List[FutureMiddleware] = []
self.wrappers = []
def _apply_middleware(self, middleware: FutureMiddleware): def _apply_middleware(self, middleware: FutureMiddleware):
raise NotImplementedError # noqa raise NotImplementedError # noqa
@ -140,3 +141,7 @@ class MiddlewareMixin(metaclass=SanicMeta):
reverse=True, reverse=True,
)[::-1] )[::-1]
) )
def wrap(self, handler):
self.wrappers.append(handler)
return handler

View File

@ -267,11 +267,11 @@ class StartupMixin(metaclass=SanicMeta):
if single_process and legacy: if single_process and legacy:
raise RuntimeError("Cannot run single process and legacy mode") raise RuntimeError("Cannot run single process and legacy mode")
if register_sys_signals is False and not (single_process or legacy): # if register_sys_signals is False and not (single_process or legacy):
raise RuntimeError( # raise RuntimeError(
"Cannot run Sanic.serve with register_sys_signals=False. " # "Cannot run Sanic.serve with register_sys_signals=False. "
"Use either Sanic.serve_single or Sanic.serve_legacy." # "Use either Sanic.serve_single or Sanic.serve_legacy."
) # )
if motd_display: if motd_display:
self.config.MOTD_DISPLAY.update(motd_display) self.config.MOTD_DISPLAY.update(motd_display)

View File

@ -2,10 +2,10 @@
:root { :root {
--sanic: #ff0d68; --sanic: #ff0d68;
--sanic-blue: #0369a1; --sanic-blue: #0092FF;
--sanic-yellow: #ffde41; --sanic-yellow: #FFE900;
--sanic-purple: #7e22ce; --sanic-purple: #833FE3;
--sanic-green: #4d7c0f; --sanic-green: #37ae6f;
--sanic-background: #f1f5f9; --sanic-background: #f1f5f9;
--sanic-text: #1f2937; --sanic-text: #1f2937;
--sanic-tab-background: #fff; --sanic-tab-background: #fff;
@ -18,13 +18,9 @@
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
:root { :root {
--sanic: #ff0d68; --sanic-purple: #D246DE;
--sanic-blue: #f08d49; --sanic-green: #16DB93;
--sanic-yellow: #ffde41; --sanic-background: #111;
--sanic-purple: #cc99cd;
--sanic-green: #7ec699;
--sanic-background: #2d2d2d;
/*--sanic-background: #111;*/
--sanic-text: #e7e7e7; --sanic-text: #e7e7e7;
--sanic-tab-background: #484848; --sanic-tab-background: #484848;
--sanic-tab-text: #e1e1e1; --sanic-tab-text: #e1e1e1;
@ -49,12 +45,12 @@ body {
line-height: 125%; line-height: 125%;
} }
body > * { body>* {
padding: 1rem 2vw; padding: 1rem 2vw;
} }
@media (max-width: 1000px) { @media (max-width: 1000px) {
body > * { body>* {
padding: 0.5rem 1.5vw; padding: 0.5rem 1.5vw;
} }
@ -65,8 +61,10 @@ body > * {
} }
main { main {
min-height: 70vh; /* Make sure the footer is closer to bottom */ min-height: 70vh;
padding: 1rem 2.5rem; /* Generous padding for readability */ /* Make sure the footer is closer to bottom */
padding: 1rem 2.5rem;
/* Generous padding for readability */
} }
.smalltext { .smalltext {

View File

@ -22,15 +22,15 @@ summary {
.tracerite { .tracerite {
--tracerite-var: var(--sanic-blue); --tracerite-var: var(--sanic-blue);
--tracerite-val: var(--sanic-green); --tracerite-val: var(--sanic-text);
--tracerite-type: var(--sanic-purple); --tracerite-type: var(--sanic-green);
--tracerite-exception: var(--sanic); --tracerite-exception: var(--sanic);
--tracerite-highlight: var(--sanic-yellow); --tracerite-highlight: var(--sanic-yellow);
--tracerite-tab: var(--sanic-tab-background); --tracerite-tab: var(--sanic-tab-background);
--tracerite-tab-text: var(--sanic-tab-text); --tracerite-tab-text: var(--sanic-tab-text);
} }
.tracerite > h3 { .tracerite>h3 {
margin: 0.5rem 0 !important; margin: 0.5rem 0 !important;
} }
@ -46,6 +46,7 @@ summary {
.tracerite .traceback-labels { .tracerite .traceback-labels {
padding-top: 5px; padding-top: 5px;
} }
.tracerite .traceback-labels button:hover { .tracerite .traceback-labels button:hover {
filter: contrast(150%) brightness(120%) drop-shadow(0 -0 2px var(--sanic-tab-shadow)); filter: contrast(150%) brightness(120%) drop-shadow(0 -0 2px var(--sanic-tab-shadow));
} }
@ -88,5 +89,17 @@ dl.key-value-table dt {
} }
dl.key-value-table dd { dl.key-value-table dd {
word-break: break-all; /* Better breaking for cookies header and such */ word-break: break-all;
/* Better breaking for cookies header and such */
}
.tracerite .codeline {
font-family:
"Fira Code",
"Source Code Pro",
Menlo,
Monaco,
Consolas,
Lucida Console,
monospace;
} }

View File

@ -130,13 +130,14 @@ def _setup_system_signals(
register_sys_signals: bool, register_sys_signals: bool,
loop: asyncio.AbstractEventLoop, loop: asyncio.AbstractEventLoop,
) -> None: # no cov ) -> None: # no cov
print(">>>>>>>>>>>>>>>>>.", run_multiple)
# Ignore SIGINT when run_multiple # Ignore SIGINT when run_multiple
if run_multiple: if run_multiple:
signal_func(SIGINT, SIG_IGN) signal_func(SIGINT, SIG_IGN)
os.environ["SANIC_WORKER_PROCESS"] = "true" os.environ["SANIC_WORKER_PROCESS"] = "true"
# Register signals for graceful termination # Register signals for graceful termination
if register_sys_signals: if register_sys_signals and False:
if OS_IS_WINDOWS: if OS_IS_WINDOWS:
ctrlc_workaround_for_windows(app) ctrlc_workaround_for_windows(app)
else: else: