mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-20 18:32:30 +01:00
kuhy_credit: shared constants, generator, terminal
Todo: 3a5477b9 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
e9e53341b3
commit
7a3a96b9ac
6
kuhy_credit/credit.json
Normal file
6
kuhy_credit/credit.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"url": "https://kuhy.duckdns.org",
|
||||
"text": "Created by kuhy",
|
||||
"logo": "unified-design-system/logo/final/kuhy.svg",
|
||||
"tokens": "web_ui/src/tokens.css"
|
||||
}
|
||||
139
kuhy_credit/flutter/lib/src/credit_data.g.dart
Normal file
139
kuhy_credit/flutter/lib/src/credit_data.g.dart
Normal file
@ -0,0 +1,139 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND (generated by kuhy_credit/generator/generate.py; DO NOT EDIT).
|
||||
// ignore_for_file: public_member_api_docs
|
||||
|
||||
const String kCreditUrl = "https://kuhy.duckdns.org";
|
||||
const String kCreditText = "Created by kuhy";
|
||||
const double kLogoSize = 512;
|
||||
const int kLogoField = 0xFF211D1B;
|
||||
const List<(int, List<double>)> kLogoShapes = [
|
||||
(
|
||||
0xFFB8862E,
|
||||
<double>[
|
||||
232.45, 126.71, 235.4, 121.83, 236.86, 117.46, 237.16, 113.16, 236.11,
|
||||
108.55, 233.71, 104.34, 230.14, 100.74, 225.62, 97.95, 220.41, 96.16,
|
||||
214.75, 95.51, 208.86, 96.11, 202.89, 97.96, 196.97, 101.02, 191.8,
|
||||
104.61, 186.14, 109.43, 168.83, 127.05, 163.79, 131.69, 158.86,
|
||||
135.08, 156.85, 135.91, 155.0, 136.26, 153.32, 136.1, 151.51, 135.26,
|
||||
150.17, 134.03, 148.74, 131.95, 146.53, 126.68, 142.68, 113.58,
|
||||
140.39, 107.28, 137.47, 101.8, 134.17, 98.03, 131.62, 96.28, 129.3,
|
||||
95.34, 126.82, 94.91, 124.22, 94.99, 121.55, 95.59, 118.85, 96.69,
|
||||
116.18, 98.26, 113.59, 100.29, 110.67, 103.26, 108.46, 106.12, 104.82,
|
||||
112.71, 103.46, 116.33, 102.26, 120.85, 101.33, 129.4, 101.51, 134.83,
|
||||
102.18, 140.16, 107.16, 161.56, 107.92, 166.59, 108.16, 170.93,
|
||||
107.96, 175.3, 107.23, 180.39, 103.3, 196.89, 102.03, 203.6, 101.44,
|
||||
209.71, 101.57, 215.83, 102.56, 221.84, 104.46, 227.54, 106.85,
|
||||
232.14, 110.3, 236.77, 113.3, 239.71, 117.11, 242.44, 120.52, 244.13,
|
||||
124.51, 245.27, 128.36, 245.46, 131.44, 244.86, 134.25, 243.55, 137.1,
|
||||
241.19, 138.84, 238.98, 140.33, 236.37, 142.79, 229.46, 144.26, 222.2,
|
||||
146.91, 203.45, 149.0, 195.46, 150.82, 191.74, 152.78, 189.39, 155.06,
|
||||
187.98, 157.64, 187.54, 160.46, 188.07, 163.46, 189.54, 166.57,
|
||||
191.89, 170.18, 195.54, 176.49, 203.82, 187.93, 221.96, 192.91,
|
||||
229.15, 198.18, 235.26, 203.3, 239.57, 207.07, 241.74, 210.4, 243.03,
|
||||
213.78, 243.76, 217.74, 243.92, 221.07, 243.47, 224.8, 242.29, 228.25,
|
||||
240.44, 230.89, 238.38, 233.17, 235.92, 235.02, 233.11, 236.37, 230.0,
|
||||
237.18, 226.63, 237.42, 223.07, 237.07, 219.35, 236.13, 215.54, 234.6,
|
||||
211.66, 230.9, 205.16, 225.43, 198.15, 219.02, 191.41, 205.04, 178.08,
|
||||
200.57, 173.11, 197.35, 167.98, 196.49, 165.31, 196.29, 163.13,
|
||||
196.57, 160.98, 197.54, 158.44, 199.16, 155.9, 201.39, 153.37, 206.78,
|
||||
148.63, 224.45, 135.06, 228.82, 130.95,
|
||||
],
|
||||
),
|
||||
(
|
||||
0xFFB8862E,
|
||||
<double>[
|
||||
439.15, 304.62, 441.35, 299.45, 442.51, 294.18, 442.42, 288.99,
|
||||
441.16, 284.54, 438.79, 280.56, 435.43, 277.23, 431.27, 274.73,
|
||||
426.09, 273.1, 421.13, 272.75, 416.7, 273.37, 412.03, 275.08, 407.76,
|
||||
277.8, 404.33, 280.97, 400.93, 285.13, 391.39, 300.46, 387.52, 305.61,
|
||||
384.97, 308.13, 382.62, 309.84, 379.82, 311.14, 377.32, 311.67,
|
||||
374.44, 311.56, 371.59, 310.69, 368.84, 309.1, 366.22, 306.86, 361.68,
|
||||
301.2, 353.72, 288.2, 349.9, 282.87, 345.1, 278.03, 339.97, 274.81,
|
||||
336.22, 273.46, 332.8, 272.84, 328.82, 272.8, 324.89, 273.46, 321.18,
|
||||
274.78, 317.81, 276.73, 314.92, 279.23, 312.64, 282.19, 311.36,
|
||||
284.65, 310.49, 287.28, 310.02, 290.04, 309.96, 292.87, 310.28,
|
||||
295.74, 311.1, 299.1, 313.73, 305.2, 316.79, 310.09, 321.01, 315.47,
|
||||
337.3, 332.65, 344.34, 340.99, 350.25, 349.71, 354.13, 357.71, 356.15,
|
||||
364.64, 356.94, 371.76, 356.69, 378.61, 354.92, 395.62, 354.93,
|
||||
400.36, 355.46, 405.02, 356.78, 409.97, 358.95, 414.48, 361.98,
|
||||
418.37, 365.77, 421.42, 369.24, 423.14, 372.98, 424.16, 376.83,
|
||||
424.43, 380.67, 423.95, 384.34, 422.72, 387.71, 420.81, 390.68,
|
||||
418.27, 393.42, 414.79, 394.87, 412.17, 396.16, 408.88, 397.04, 405.4,
|
||||
397.53, 401.79, 397.58, 394.42, 395.86, 378.48, 395.63, 371.63,
|
||||
396.54, 364.05, 398.85, 356.69, 402.9, 348.74, 408.61, 340.49, 415.36,
|
||||
332.56, 431.64, 315.37, 435.86, 309.98,
|
||||
],
|
||||
),
|
||||
(
|
||||
0xFFECEAE9,
|
||||
<double>[
|
||||
272.87, 180.5, 273.78, 191.15, 275.43, 199.68, 277.93, 207.24, 281.46,
|
||||
214.32, 286.01, 220.83, 291.97, 227.15, 298.81, 232.68, 306.29,
|
||||
237.38, 314.83, 241.44, 323.65, 244.37, 331.97, 245.96, 340.33,
|
||||
246.39, 348.69, 245.62, 356.98, 243.7, 365.74, 240.46, 374.17, 236.11,
|
||||
379.85, 232.38, 385.15, 228.16, 389.95, 223.48, 393.76, 218.86,
|
||||
397.03, 213.89, 399.73, 208.6, 401.84, 203.03, 403.53, 196.59, 404.61,
|
||||
189.99, 405.3, 181.99, 405.89, 159.12, 407.09, 137.35, 407.21, 129.01,
|
||||
406.69, 121.27, 405.6, 115.09, 403.79, 109.27, 401.53, 104.61, 398.24,
|
||||
100.21, 394.25, 96.96, 389.72, 95.06, 385.41, 94.63, 381.04, 95.41,
|
||||
376.28, 97.71, 371.95, 101.35, 368.3, 106.12, 366.03, 110.43, 364.13,
|
||||
115.78, 363.07, 120.69, 362.53, 126.4, 362.58, 131.38, 363.12, 136.95,
|
||||
366.62, 155.29, 367.54, 162.94, 367.32, 171.38, 366.55, 176.01, 365.5,
|
||||
179.98, 363.26, 185.87, 360.61, 190.86, 357.41, 195.43, 353.74,
|
||||
199.38, 349.69, 202.52, 345.92, 204.46, 342.02, 205.56, 338.06,
|
||||
205.77, 334.12, 205.08, 330.28, 203.52, 326.61, 201.16, 322.73,
|
||||
197.62, 319.27, 193.35, 316.32, 188.55, 313.95, 183.43, 312.21,
|
||||
178.16, 310.8, 170.23, 310.73, 162.45, 311.59, 155.45, 315.0, 137.8,
|
||||
315.74, 128.01, 315.47, 123.01, 314.68, 118.04, 313.31, 113.22,
|
||||
311.38, 108.68, 308.91, 104.56, 305.95, 101.0, 302.59, 98.14, 298.95,
|
||||
96.07, 295.15, 94.89, 291.33, 94.64, 287.61, 95.31, 284.11, 96.89,
|
||||
281.8, 98.52, 279.7, 100.54, 277.81, 102.91, 275.86, 106.15, 273.2,
|
||||
112.94, 271.66, 120.41, 271.11, 126.72, 271.03, 133.73, 272.32,
|
||||
158.32,
|
||||
],
|
||||
),
|
||||
(
|
||||
0xFFECEAE9,
|
||||
<double>[
|
||||
142.5, 408.93, 144.93, 412.86, 148.33, 416.82, 151.62, 419.58, 155.73,
|
||||
421.94, 159.96, 423.33, 164.11, 423.69, 168.0, 423.04, 171.46, 421.41,
|
||||
173.61, 419.69, 175.81, 417.09, 177.3, 414.53, 178.71, 411.07, 180.34,
|
||||
403.92, 181.9, 389.45, 182.76, 384.3, 184.38, 379.06, 186.6, 375.03,
|
||||
188.42, 372.84, 190.56, 370.93, 193.02, 369.3, 196.36, 367.72, 203.33,
|
||||
365.93, 207.41, 365.55, 211.54, 365.59, 218.2, 366.61, 224.14, 368.79,
|
||||
226.71, 370.32, 228.97, 372.13, 232.2, 376.09, 234.21, 380.29, 235.51,
|
||||
385.06, 237.68, 403.4, 239.06, 409.98, 241.43, 415.72, 243.06, 418.13,
|
||||
244.99, 420.16, 247.7, 422.03, 250.76, 423.22, 254.12, 423.7, 257.08,
|
||||
423.52, 260.7, 422.61, 263.71, 421.29, 267.19, 419.06, 269.9, 416.7,
|
||||
273.71, 412.09, 276.7, 406.63, 278.73, 400.57, 279.77, 394.13, 279.87,
|
||||
387.57, 279.19, 381.08, 277.76, 374.06, 273.42, 357.39, 272.7, 353.01,
|
||||
272.43, 348.73, 272.65, 344.45, 273.45, 339.45, 277.62, 323.51,
|
||||
278.95, 317.31, 279.71, 311.68, 279.93, 306.77, 279.2, 298.62, 277.23,
|
||||
291.66, 274.04, 285.39, 269.78, 280.17, 267.06, 277.83, 263.57,
|
||||
275.63, 260.56, 274.33, 256.94, 273.46, 253.99, 273.3, 250.64, 273.8,
|
||||
248.07, 274.77, 245.32, 276.56, 243.34, 278.53, 241.66, 280.88, 239.2,
|
||||
286.54, 237.66, 293.75, 235.48, 312.08, 233.95, 317.39, 231.82, 321.5,
|
||||
230.08, 323.74, 228.0, 325.7, 225.6, 327.39, 222.9, 328.79, 216.76,
|
||||
330.71, 209.32, 331.48, 201.85, 330.81, 198.02, 329.85, 195.07,
|
||||
328.73, 192.39, 327.32, 190.0, 325.62, 187.94, 323.64, 186.21, 321.39,
|
||||
184.11, 317.26, 182.6, 311.93, 180.42, 293.59, 179.04, 287.01, 177.76,
|
||||
283.44, 176.37, 280.76, 174.68, 278.43, 172.69, 276.48, 169.92,
|
||||
274.72, 167.34, 273.77, 163.98, 273.3, 161.03, 273.48, 157.4, 274.38,
|
||||
154.4, 275.7, 150.92, 277.93, 148.21, 280.29, 143.97, 285.54, 141.1,
|
||||
291.09, 139.19, 297.22, 138.23, 304.49, 138.34, 311.05, 139.18, 317.5,
|
||||
144.55, 338.96, 145.64, 347.04, 145.57, 351.31, 144.91, 356.27,
|
||||
139.77, 376.54, 138.77, 382.07, 138.23, 387.76, 138.29, 393.51,
|
||||
139.06, 399.17, 140.59, 404.59,
|
||||
],
|
||||
),
|
||||
];
|
||||
const int kDarkSurface = 0xFF2B2624;
|
||||
const int kDarkBorder = 0xFF463E3A;
|
||||
const int kDarkText = 0xFFECEAE9;
|
||||
const int kLightSurface = 0xFFFCFBFB;
|
||||
const int kLightBorder = 0xFFE0DAD7;
|
||||
const int kLightText = 0xFF211D1B;
|
||||
const int kFocus = 0xFFB8862E;
|
||||
const double kRadius = 12;
|
||||
const double kSpaceSm = 8;
|
||||
const double kSpaceMd = 16;
|
||||
const double kTextBody = 16;
|
||||
1
kuhy_credit/generator/__init__.py
Normal file
1
kuhy_credit/generator/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
"""Build-time generator: writes every stack's credit data from credit.json."""
|
||||
156
kuhy_credit/generator/emit.py
Normal file
156
kuhy_credit/generator/emit.py
Normal file
@ -0,0 +1,156 @@
|
||||
"""Render the shared credit data as source text for each stack.
|
||||
|
||||
Every emitter returns the full file. Long data (the SVG, the polygon points)
|
||||
is wrapped into short lines so each stack's linter accepts the file as is.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import shlex
|
||||
import textwrap
|
||||
from dataclasses import dataclass
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from generator.svg import Logo
|
||||
from generator.tokens import Palette, Tokens
|
||||
|
||||
MARK = "generated by kuhy_credit/generator/generate.py; DO NOT EDIT"
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Credit:
|
||||
"""Everything a stack needs: the words, the link, the art, the tokens."""
|
||||
|
||||
url: str
|
||||
text: str
|
||||
svg: str
|
||||
logo: Logo
|
||||
tokens: Tokens
|
||||
|
||||
|
||||
def _num(v: float) -> str:
|
||||
return f"{v:g}" if v != int(v) else f"{int(v)}.0"
|
||||
|
||||
|
||||
def _wrap(items: list[str], indent: str, width: int = 76) -> str:
|
||||
joined = ", ".join(items) + ","
|
||||
return textwrap.fill(joined, width, initial_indent=indent, subsequent_indent=indent)
|
||||
|
||||
|
||||
def _points(points: tuple[float, ...], indent: int) -> str:
|
||||
return _wrap([_num(p) for p in points], " " * indent)
|
||||
|
||||
|
||||
def _chunks(text: str, size: int = 60) -> list[str]:
|
||||
return [json.dumps(text[i : i + size]) for i in range(0, len(text), size)]
|
||||
|
||||
|
||||
def _argb(hex_colour: str) -> str:
|
||||
return f"0xFF{hex_colour.lstrip('#').upper()}"
|
||||
|
||||
|
||||
def python(c: Credit) -> str:
|
||||
"""kuhy_credit/_data.py."""
|
||||
shapes = "".join(
|
||||
f' (\n "{s.fill}",\n (\n{_points(s.points, 12)}\n ),\n ),\n'
|
||||
for s in c.logo.shapes
|
||||
)
|
||||
|
||||
def pal(p: Palette) -> str:
|
||||
return f'{{"surface": "{p.surface}", "border": "{p.border}", "text": "{p.text}"}}'
|
||||
|
||||
t = c.tokens
|
||||
return (
|
||||
f'"""The shared credit data ({MARK})."""\n\n'
|
||||
f"URL = {json.dumps(c.url)}\nTEXT = {json.dumps(c.text)}\n"
|
||||
f"LOGO_SIZE = {c.logo.size}\nLOGO_FIELD = {json.dumps(c.logo.field)}\n"
|
||||
f"LOGO_SHAPES: tuple[tuple[str, tuple[float, ...]], ...] = (\n{shapes})\n"
|
||||
f"DARK = {pal(t.dark)}\nLIGHT = {pal(t.light)}\n"
|
||||
f'FOCUS = "{t.focus}"\nRADIUS = {t.radius}\nSPACE_SM = {t.space_sm}\n'
|
||||
f"SPACE_MD = {t.space_md}\nTEXT_BODY = {t.text_body}\n"
|
||||
)
|
||||
|
||||
|
||||
def web(c: Credit) -> str:
|
||||
"""web/src/credit-data.js."""
|
||||
svg = "\n + ".join(_chunks(c.svg))
|
||||
t = c.tokens
|
||||
|
||||
def pal(p: Palette) -> str:
|
||||
return f'{{ surface: "{p.surface}", border: "{p.border}", text: "{p.text}" }}'
|
||||
|
||||
return (
|
||||
f"// The shared credit data ({MARK}).\n"
|
||||
f"export const CREDIT_URL = {json.dumps(c.url)};\n"
|
||||
f"export const CREDIT_TEXT = {json.dumps(c.text)};\n"
|
||||
f"export const LOGO_SVG =\n {svg};\n"
|
||||
f"export const TOKENS = {{\n dark: {pal(t.dark)},\n light: {pal(t.light)},\n"
|
||||
f' focus: "{t.focus}",\n radius: {t.radius},\n spaceSm: {t.space_sm},\n'
|
||||
f" spaceMd: {t.space_md},\n textBody: {t.text_body},\n}};\n"
|
||||
)
|
||||
|
||||
|
||||
def flutter(c: Credit) -> str:
|
||||
"""flutter/lib/src/credit_data.g.dart."""
|
||||
shapes = "".join(
|
||||
f" (\n {_argb(s.fill)},\n <double>[\n{_points(s.points, 6)}\n ],\n ),\n"
|
||||
for s in c.logo.shapes
|
||||
)
|
||||
t = c.tokens
|
||||
return (
|
||||
f"// GENERATED CODE - DO NOT MODIFY BY HAND ({MARK}).\n"
|
||||
"// ignore_for_file: public_member_api_docs\n\n"
|
||||
f"const String kCreditUrl = {json.dumps(c.url)};\n"
|
||||
f"const String kCreditText = {json.dumps(c.text)};\n"
|
||||
f"const double kLogoSize = {c.logo.size};\n"
|
||||
f"const int kLogoField = {_argb(c.logo.field)};\n"
|
||||
f"const List<(int, List<double>)> kLogoShapes = [\n{shapes}];\n"
|
||||
f"const int kDarkSurface = {_argb(t.dark.surface)};\n"
|
||||
f"const int kDarkBorder = {_argb(t.dark.border)};\n"
|
||||
f"const int kDarkText = {_argb(t.dark.text)};\n"
|
||||
f"const int kLightSurface = {_argb(t.light.surface)};\n"
|
||||
f"const int kLightBorder = {_argb(t.light.border)};\n"
|
||||
f"const int kLightText = {_argb(t.light.text)};\n"
|
||||
f"const int kFocus = {_argb(t.focus)};\n"
|
||||
f"const double kRadius = {t.radius};\n"
|
||||
f"const double kSpaceSm = {t.space_sm};\n"
|
||||
f"const double kSpaceMd = {t.space_md};\n"
|
||||
f"const double kTextBody = {t.text_body};\n"
|
||||
)
|
||||
|
||||
|
||||
def godot(c: Credit) -> str:
|
||||
"""godot/addons/kuhy_credit/credit_data.gd."""
|
||||
svg = "\n\t+ ".join(_chunks(c.svg))
|
||||
t = c.tokens
|
||||
|
||||
def pal(p: Palette) -> str:
|
||||
return (
|
||||
f'{{\n\t"surface": Color("{p.surface}"),\n\t"border": Color("{p.border}"),'
|
||||
f'\n\t"text": Color("{p.text}"),\n}}'
|
||||
)
|
||||
|
||||
return (
|
||||
f"## The shared credit data ({MARK}).\n"
|
||||
"extends RefCounted\n\n"
|
||||
f"const URL := {json.dumps(c.url)}\n"
|
||||
f"const TEXT := {json.dumps(c.text)}\n"
|
||||
f"const LOGO_SVG := (\n\t{svg}\n)\n"
|
||||
f"const DARK := {pal(t.dark)}\n"
|
||||
f"const LIGHT := {pal(t.light)}\n"
|
||||
f'const FOCUS := Color("{t.focus}")\n'
|
||||
f"const RADIUS := {t.radius}\nconst SPACE_SM := {t.space_sm}\n"
|
||||
f"const SPACE_MD := {t.space_md}\nconst TEXT_BODY := {t.text_body}\n"
|
||||
)
|
||||
|
||||
|
||||
def terminal(c: Credit) -> str:
|
||||
"""terminal/kuhy-credit.sh."""
|
||||
return (
|
||||
"#!/bin/bash\n"
|
||||
f"# Prints the one-line kuhy credit and opens nothing ({MARK}).\n"
|
||||
"set -euo pipefail\n"
|
||||
f"printf '%s %s\\n' {shlex.quote(c.text)} {shlex.quote(c.url)}\n"
|
||||
)
|
||||
109
kuhy_credit/generator/generate.py
Normal file
109
kuhy_credit/generator/generate.py
Normal file
@ -0,0 +1,109 @@
|
||||
"""Write, or check, every stack's generated credit data.
|
||||
|
||||
python -m generator.generate # rewrite all stacks
|
||||
python -m generator.generate --check # exit 1 and name each drifted stack
|
||||
|
||||
Reads kuhy_credit/credit.json (URL + text), the M1 art and tokens.css; the
|
||||
paths in credit.json are relative to the repo root (the credit dir's parent).
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import sys
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
from generator import emit
|
||||
from generator.svg import parse_logo
|
||||
from generator.tokens import parse_tokens
|
||||
|
||||
CREDIT_DIR = Path(__file__).resolve().parents[1]
|
||||
|
||||
STACKS = {
|
||||
"python": "kuhy_credit/_data.py",
|
||||
"web": "web/src/credit-data.js",
|
||||
"flutter": "flutter/lib/src/credit_data.g.dart",
|
||||
"godot": "godot/addons/kuhy_credit/credit_data.gd",
|
||||
"terminal": "terminal/kuhy-credit.sh",
|
||||
}
|
||||
_EMITTERS = {
|
||||
"python": emit.python,
|
||||
"web": emit.web,
|
||||
"flutter": emit.flutter,
|
||||
"godot": emit.godot,
|
||||
"terminal": emit.terminal,
|
||||
}
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Drift:
|
||||
"""A stack whose generated file differs from what the sources give."""
|
||||
|
||||
stack: str
|
||||
path: str
|
||||
|
||||
|
||||
def load(credit_dir: Path) -> emit.Credit:
|
||||
"""Read credit.json and the files it points at."""
|
||||
data = json.loads((credit_dir / "credit.json").read_text())
|
||||
root = credit_dir.parent
|
||||
svg = (root / data["logo"]).read_text()
|
||||
return emit.Credit(
|
||||
url=data["url"],
|
||||
text=data["text"],
|
||||
svg=svg,
|
||||
logo=parse_logo(svg),
|
||||
tokens=parse_tokens((root / data["tokens"]).read_text()),
|
||||
)
|
||||
|
||||
|
||||
def render(credit_dir: Path) -> dict[str, str]:
|
||||
"""Every stack's expected file content."""
|
||||
credit = load(credit_dir)
|
||||
return {stack: _EMITTERS[stack](credit) for stack in STACKS}
|
||||
|
||||
|
||||
def drift(credit_dir: Path) -> list[Drift]:
|
||||
"""Stacks whose file on disk is missing or differs from render()."""
|
||||
out = []
|
||||
for stack, text in render(credit_dir).items():
|
||||
path = credit_dir / STACKS[stack]
|
||||
if not path.is_file() or path.read_text() != text:
|
||||
out.append(Drift(stack, STACKS[stack]))
|
||||
return out
|
||||
|
||||
|
||||
def write(credit_dir: Path) -> None:
|
||||
"""Rewrite every stack's generated file."""
|
||||
for stack, text in render(credit_dir).items():
|
||||
path = credit_dir / STACKS[stack]
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
path.write_text(text)
|
||||
if stack == "terminal":
|
||||
path.chmod(0o755)
|
||||
|
||||
|
||||
def main(argv: list[str] | None = None) -> int:
|
||||
"""CLI entry point; returns the exit code."""
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--check", action="store_true", help="fail on drift, write nothing")
|
||||
parser.add_argument("--dir", type=Path, default=CREDIT_DIR, help="the kuhy_credit dir")
|
||||
args = parser.parse_args(argv)
|
||||
if not args.check:
|
||||
write(args.dir)
|
||||
print(f"wrote {len(STACKS)} stacks")
|
||||
return 0
|
||||
found = drift(args.dir)
|
||||
for d in found:
|
||||
print(f"drift: {d.stack} ({d.path}) differs from credit.json/logo/tokens")
|
||||
if found:
|
||||
print("fix: python -m generator.generate (from kuhy_credit/)")
|
||||
return 1
|
||||
print(f"all {len(STACKS)} stacks in sync")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
86
kuhy_credit/generator/svg.py
Normal file
86
kuhy_credit/generator/svg.py
Normal file
@ -0,0 +1,86 @@
|
||||
"""Parse the M1 logo SVG into flat polygons every stack can draw.
|
||||
|
||||
The art is a square field rect plus filled paths built only from absolute
|
||||
M/L/Z commands. Each subpath becomes one polygon. The parser refuses anything
|
||||
else (curves, relative commands) and refuses subpaths whose bounding boxes
|
||||
overlap: an overlap could be a hole, which a plain polygon fill would paint
|
||||
over. If the art ever gains a hole, generation fails loudly instead of
|
||||
shipping a wrong logo.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
import xml.etree.ElementTree as ET
|
||||
from dataclasses import dataclass
|
||||
|
||||
_NS = "{http://www.w3.org/2000/svg}"
|
||||
_TOKEN = re.compile(r"[A-Za-z]|-?\d+(?:\.\d+)?")
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Shape:
|
||||
"""One filled polygon: its colour and flat x, y, x, y, ... points."""
|
||||
|
||||
fill: str
|
||||
points: tuple[float, ...]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Logo:
|
||||
"""The logo as a square size, a field colour and polygons on top."""
|
||||
|
||||
size: int
|
||||
field: str
|
||||
shapes: tuple[Shape, ...]
|
||||
|
||||
|
||||
def _subpaths(d: str) -> list[list[float]]:
|
||||
"""Split path data into point lists, one per M ... Z subpath."""
|
||||
out: list[list[float]] = []
|
||||
current: list[float] = []
|
||||
for tok in _TOKEN.findall(d):
|
||||
if tok in {"M", "L"}:
|
||||
continue
|
||||
if tok == "Z":
|
||||
out.append(current)
|
||||
current = []
|
||||
elif tok[0].isalpha():
|
||||
msg = f"unsupported path command {tok!r}: only M, L and Z"
|
||||
raise ValueError(msg)
|
||||
else:
|
||||
current.append(float(tok))
|
||||
return out
|
||||
|
||||
|
||||
def _bbox(points: list[float]) -> tuple[float, float, float, float]:
|
||||
xs, ys = points[0::2], points[1::2]
|
||||
return min(xs), min(ys), max(xs), max(ys)
|
||||
|
||||
|
||||
def _check_disjoint(polys: list[list[float]]) -> None:
|
||||
boxes = [_bbox(p) for p in polys]
|
||||
for i, a in enumerate(boxes):
|
||||
for b in boxes[i + 1 :]:
|
||||
if a[0] < b[2] and b[0] < a[2] and a[1] < b[3] and b[1] < a[3]:
|
||||
msg = "logo subpaths overlap: a hole needs a real path renderer"
|
||||
raise ValueError(msg)
|
||||
|
||||
|
||||
def parse_logo(text: str) -> Logo:
|
||||
"""Parse the SVG text into a :class:`Logo`."""
|
||||
root = ET.fromstring(text) # noqa: S314 - our own checked-in art
|
||||
size = int(float(root.attrib["viewBox"].split()[2]))
|
||||
field = next((r for r in root.iter(f"{_NS}rect") if r.get("id") == "field"), None)
|
||||
field = field if field is not None else root.find("rect[@id='field']")
|
||||
if field is None:
|
||||
msg = "logo has no rect id=field"
|
||||
raise ValueError(msg)
|
||||
shapes: list[Shape] = []
|
||||
polys: list[list[float]] = []
|
||||
for path in [*root.iter(f"{_NS}path"), *root.iter("path")]:
|
||||
for poly in _subpaths(path.attrib["d"]):
|
||||
shapes.append(Shape(path.attrib["fill"], tuple(poly)))
|
||||
polys.append(poly)
|
||||
_check_disjoint(polys)
|
||||
return Logo(size, field.attrib["fill"], tuple(shapes))
|
||||
75
kuhy_credit/generator/tokens.py
Normal file
75
kuhy_credit/generator/tokens.py
Normal file
@ -0,0 +1,75 @@
|
||||
"""Read the few design tokens the credit panel needs from tokens.css.
|
||||
|
||||
tokens.css is the web stack's copy of unified-design-system; palette_check
|
||||
already keeps it equal to the Dart and Tk copies, so reading this one file is
|
||||
reading the shared token set.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
from dataclasses import dataclass
|
||||
|
||||
_ROOT = re.compile(r"^:root\s*\{(.*?)^\}", re.DOTALL | re.MULTILINE)
|
||||
_LIGHT = re.compile(r"@media \(prefers-color-scheme: light\)\s*\{\s*:root\s*\{(.*?)\}", re.DOTALL)
|
||||
_VAR = re.compile(r"(--[a-z0-9-]+):\s*([^;]+);")
|
||||
_COMMENT = re.compile(r"/\*.*?\*/", re.DOTALL)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Palette:
|
||||
"""Panel colours for one theme."""
|
||||
|
||||
surface: str
|
||||
border: str
|
||||
text: str
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Tokens:
|
||||
"""Both palettes plus the theme-free sizes, in px."""
|
||||
|
||||
dark: Palette
|
||||
light: Palette
|
||||
focus: str
|
||||
radius: int
|
||||
space_sm: int
|
||||
space_md: int
|
||||
text_body: int
|
||||
|
||||
|
||||
def _vars(block: str) -> dict[str, str]:
|
||||
return {k: v.strip() for k, v in _VAR.findall(block)}
|
||||
|
||||
|
||||
def _get(table: dict[str, str], name: str) -> str:
|
||||
if name not in table:
|
||||
msg = f"tokens.css has no {name}"
|
||||
raise ValueError(msg)
|
||||
return table[name]
|
||||
|
||||
|
||||
def _palette(table: dict[str, str]) -> Palette:
|
||||
return Palette(_get(table, "--surface-1"), _get(table, "--border"), _get(table, "--text"))
|
||||
|
||||
|
||||
def _px(table: dict[str, str], name: str) -> int:
|
||||
return int(_get(table, name).removesuffix("px"))
|
||||
|
||||
|
||||
def parse_tokens(css: str) -> Tokens:
|
||||
"""Parse the dark default and the light override out of tokens.css."""
|
||||
css = _COMMENT.sub("", css)
|
||||
root_match = _ROOT.search(css) or re.search(r":root\s*\{(.*?)\}", css, re.DOTALL)
|
||||
root = _vars(root_match.group(1)) if root_match else {}
|
||||
light_match = _LIGHT.search(css)
|
||||
light = {**root, **_vars(light_match.group(1) if light_match else "")}
|
||||
return Tokens(
|
||||
dark=_palette(root),
|
||||
light=_palette(light),
|
||||
focus=_get(root, "--focus-ring"),
|
||||
radius=_px(root, "--radius-md"),
|
||||
space_sm=_px(root, "--space-2"),
|
||||
space_md=_px(root, "--space-3"),
|
||||
text_body=_px(root, "--text-body"),
|
||||
)
|
||||
124
kuhy_credit/godot/addons/kuhy_credit/credit_data.gd
Normal file
124
kuhy_credit/godot/addons/kuhy_credit/credit_data.gd
Normal file
@ -0,0 +1,124 @@
|
||||
## The shared credit data (generated by kuhy_credit/generator/generate.py; DO NOT EDIT).
|
||||
extends RefCounted
|
||||
|
||||
const URL := "https://kuhy.duckdns.org"
|
||||
const TEXT := "Created by kuhy"
|
||||
const LOGO_SVG := (
|
||||
"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512"
|
||||
+ "\" width=\"512\" height=\"512\">\n<rect id=\"field\" width=\"512\" hei"
|
||||
+ "ght=\"512\" fill=\"#211D1B\"/>\n<path fill=\"#B8862E\" fill-rule=\"e"
|
||||
+ "venodd\" d=\"M232.45 126.71L235.40 121.83L236.86 117.46L237.16"
|
||||
+ " 113.16L236.11 108.55L233.71 104.34L230.14 100.74L225.62 97."
|
||||
+ "95L220.41 96.16L214.75 95.51L208.86 96.11L202.89 97.96L196.9"
|
||||
+ "7 101.02L191.80 104.61L186.14 109.43L168.83 127.05L163.79 13"
|
||||
+ "1.69L158.86 135.08L156.85 135.91L155.00 136.26L153.32 136.10"
|
||||
+ "L151.51 135.26L150.17 134.03L148.74 131.95L146.53 126.68L142"
|
||||
+ ".68 113.58L140.39 107.28L137.47 101.80L134.17 98.03L131.62 9"
|
||||
+ "6.28L129.30 95.34L126.82 94.91L124.22 94.99L121.55 95.59L118"
|
||||
+ ".85 96.69L116.18 98.26L113.59 100.29L110.67 103.26L108.46 10"
|
||||
+ "6.12L104.82 112.71L103.46 116.33L102.26 120.85L101.33 129.40"
|
||||
+ "L101.51 134.83L102.18 140.16L107.16 161.56L107.92 166.59L108"
|
||||
+ ".16 170.93L107.96 175.30L107.23 180.39L103.30 196.89L102.03 "
|
||||
+ "203.60L101.44 209.71L101.57 215.83L102.56 221.84L104.46 227."
|
||||
+ "54L106.85 232.14L110.30 236.77L113.30 239.71L117.11 242.44L1"
|
||||
+ "20.52 244.13L124.51 245.27L128.36 245.46L131.44 244.86L134.2"
|
||||
+ "5 243.55L137.10 241.19L138.84 238.98L140.33 236.37L142.79 22"
|
||||
+ "9.46L144.26 222.20L146.91 203.45L149.00 195.46L150.82 191.74"
|
||||
+ "L152.78 189.39L155.06 187.98L157.64 187.54L160.46 188.07L163"
|
||||
+ ".46 189.54L166.57 191.89L170.18 195.54L176.49 203.82L187.93 "
|
||||
+ "221.96L192.91 229.15L198.18 235.26L203.30 239.57L207.07 241."
|
||||
+ "74L210.40 243.03L213.78 243.76L217.74 243.92L221.07 243.47L2"
|
||||
+ "24.80 242.29L228.25 240.44L230.89 238.38L233.17 235.92L235.0"
|
||||
+ "2 233.11L236.37 230.00L237.18 226.63L237.42 223.07L237.07 21"
|
||||
+ "9.35L236.13 215.54L234.60 211.66L230.90 205.16L225.43 198.15"
|
||||
+ "L219.02 191.41L205.04 178.08L200.57 173.11L197.35 167.98L196"
|
||||
+ ".49 165.31L196.29 163.13L196.57 160.98L197.54 158.44L199.16 "
|
||||
+ "155.90L201.39 153.37L206.78 148.63L224.45 135.06L228.82 130."
|
||||
+ "95ZM439.15 304.62L441.35 299.45L442.51 294.18L442.42 288.99L"
|
||||
+ "441.16 284.54L438.79 280.56L435.43 277.23L431.27 274.73L426."
|
||||
+ "09 273.10L421.13 272.75L416.70 273.37L412.03 275.08L407.76 2"
|
||||
+ "77.80L404.33 280.97L400.93 285.13L391.39 300.46L387.52 305.6"
|
||||
+ "1L384.97 308.13L382.62 309.84L379.82 311.14L377.32 311.67L37"
|
||||
+ "4.44 311.56L371.59 310.69L368.84 309.10L366.22 306.86L361.68"
|
||||
+ " 301.20L353.72 288.20L349.90 282.87L345.10 278.03L339.97 274"
|
||||
+ ".81L336.22 273.46L332.80 272.84L328.82 272.80L324.89 273.46L"
|
||||
+ "321.18 274.78L317.81 276.73L314.92 279.23L312.64 282.19L311."
|
||||
+ "36 284.65L310.49 287.28L310.02 290.04L309.96 292.87L310.28 2"
|
||||
+ "95.74L311.10 299.10L313.73 305.20L316.79 310.09L321.01 315.4"
|
||||
+ "7L337.30 332.65L344.34 340.99L350.25 349.71L354.13 357.71L35"
|
||||
+ "6.15 364.64L356.94 371.76L356.69 378.61L354.92 395.62L354.93"
|
||||
+ " 400.36L355.46 405.02L356.78 409.97L358.95 414.48L361.98 418"
|
||||
+ ".37L365.77 421.42L369.24 423.14L372.98 424.16L376.83 424.43L"
|
||||
+ "380.67 423.95L384.34 422.72L387.71 420.81L390.68 418.27L393."
|
||||
+ "42 414.79L394.87 412.17L396.16 408.88L397.04 405.40L397.53 4"
|
||||
+ "01.79L397.58 394.42L395.86 378.48L395.63 371.63L396.54 364.0"
|
||||
+ "5L398.85 356.69L402.90 348.74L408.61 340.49L415.36 332.56L43"
|
||||
+ "1.64 315.37L435.86 309.98Z\"/>\n<path fill=\"#ECEAE9\" fill-rule"
|
||||
+ "=\"evenodd\" d=\"M272.87 180.50L273.78 191.15L275.43 199.68L277"
|
||||
+ ".93 207.24L281.46 214.32L286.01 220.83L291.97 227.15L298.81 "
|
||||
+ "232.68L306.29 237.38L314.83 241.44L323.65 244.37L331.97 245."
|
||||
+ "96L340.33 246.39L348.69 245.62L356.98 243.70L365.74 240.46L3"
|
||||
+ "74.17 236.11L379.85 232.38L385.15 228.16L389.95 223.48L393.7"
|
||||
+ "6 218.86L397.03 213.89L399.73 208.60L401.84 203.03L403.53 19"
|
||||
+ "6.59L404.61 189.99L405.30 181.99L405.89 159.12L407.09 137.35"
|
||||
+ "L407.21 129.01L406.69 121.27L405.60 115.09L403.79 109.27L401"
|
||||
+ ".53 104.61L398.24 100.21L394.25 96.96L389.72 95.06L385.41 94"
|
||||
+ ".63L381.04 95.41L376.28 97.71L371.95 101.35L368.30 106.12L36"
|
||||
+ "6.03 110.43L364.13 115.78L363.07 120.69L362.53 126.40L362.58"
|
||||
+ " 131.38L363.12 136.95L366.62 155.29L367.54 162.94L367.32 171"
|
||||
+ ".38L366.55 176.01L365.50 179.98L363.26 185.87L360.61 190.86L"
|
||||
+ "357.41 195.43L353.74 199.38L349.69 202.52L345.92 204.46L342."
|
||||
+ "02 205.56L338.06 205.77L334.12 205.08L330.28 203.52L326.61 2"
|
||||
+ "01.16L322.73 197.62L319.27 193.35L316.32 188.55L313.95 183.4"
|
||||
+ "3L312.21 178.16L310.80 170.23L310.73 162.45L311.59 155.45L31"
|
||||
+ "5.00 137.80L315.74 128.01L315.47 123.01L314.68 118.04L313.31"
|
||||
+ " 113.22L311.38 108.68L308.91 104.56L305.95 101.00L302.59 98."
|
||||
+ "14L298.95 96.07L295.15 94.89L291.33 94.64L287.61 95.31L284.1"
|
||||
+ "1 96.89L281.80 98.52L279.70 100.54L277.81 102.91L275.86 106."
|
||||
+ "15L273.20 112.94L271.66 120.41L271.11 126.72L271.03 133.73L2"
|
||||
+ "72.32 158.32ZM142.50 408.93L144.93 412.86L148.33 416.82L151."
|
||||
+ "62 419.58L155.73 421.94L159.96 423.33L164.11 423.69L168.00 4"
|
||||
+ "23.04L171.46 421.41L173.61 419.69L175.81 417.09L177.30 414.5"
|
||||
+ "3L178.71 411.07L180.34 403.92L181.90 389.45L182.76 384.30L18"
|
||||
+ "4.38 379.06L186.60 375.03L188.42 372.84L190.56 370.93L193.02"
|
||||
+ " 369.30L196.36 367.72L203.33 365.93L207.41 365.55L211.54 365"
|
||||
+ ".59L218.20 366.61L224.14 368.79L226.71 370.32L228.97 372.13L"
|
||||
+ "232.20 376.09L234.21 380.29L235.51 385.06L237.68 403.40L239."
|
||||
+ "06 409.98L241.43 415.72L243.06 418.13L244.99 420.16L247.70 4"
|
||||
+ "22.03L250.76 423.22L254.12 423.70L257.08 423.52L260.70 422.6"
|
||||
+ "1L263.71 421.29L267.19 419.06L269.90 416.70L273.71 412.09L27"
|
||||
+ "6.70 406.63L278.73 400.57L279.77 394.13L279.87 387.57L279.19"
|
||||
+ " 381.08L277.76 374.06L273.42 357.39L272.70 353.01L272.43 348"
|
||||
+ ".73L272.65 344.45L273.45 339.45L277.62 323.51L278.95 317.31L"
|
||||
+ "279.71 311.68L279.93 306.77L279.20 298.62L277.23 291.66L274."
|
||||
+ "04 285.39L269.78 280.17L267.06 277.83L263.57 275.63L260.56 2"
|
||||
+ "74.33L256.94 273.46L253.99 273.30L250.64 273.80L248.07 274.7"
|
||||
+ "7L245.32 276.56L243.34 278.53L241.66 280.88L239.20 286.54L23"
|
||||
+ "7.66 293.75L235.48 312.08L233.95 317.39L231.82 321.50L230.08"
|
||||
+ " 323.74L228.00 325.70L225.60 327.39L222.90 328.79L216.76 330"
|
||||
+ ".71L209.32 331.48L201.85 330.81L198.02 329.85L195.07 328.73L"
|
||||
+ "192.39 327.32L190.00 325.62L187.94 323.64L186.21 321.39L184."
|
||||
+ "11 317.26L182.60 311.93L180.42 293.59L179.04 287.01L177.76 2"
|
||||
+ "83.44L176.37 280.76L174.68 278.43L172.69 276.48L169.92 274.7"
|
||||
+ "2L167.34 273.77L163.98 273.30L161.03 273.48L157.40 274.38L15"
|
||||
+ "4.40 275.70L150.92 277.93L148.21 280.29L143.97 285.54L141.10"
|
||||
+ " 291.09L139.19 297.22L138.23 304.49L138.34 311.05L139.18 317"
|
||||
+ ".50L144.55 338.96L145.64 347.04L145.57 351.31L144.91 356.27L"
|
||||
+ "139.77 376.54L138.77 382.07L138.23 387.76L138.29 393.51L139."
|
||||
+ "06 399.17L140.59 404.59Z\"/>\n</svg>\n"
|
||||
)
|
||||
const DARK := {
|
||||
"surface": Color("#2b2624"),
|
||||
"border": Color("#463e3a"),
|
||||
"text": Color("#eceae9"),
|
||||
}
|
||||
const LIGHT := {
|
||||
"surface": Color("#fcfbfb"),
|
||||
"border": Color("#e0dad7"),
|
||||
"text": Color("#211d1b"),
|
||||
}
|
||||
const FOCUS := Color("#b8862e")
|
||||
const RADIUS := 12
|
||||
const SPACE_SM := 8
|
||||
const SPACE_MD := 16
|
||||
const TEXT_BODY := 16
|
||||
16
kuhy_credit/kuhy_credit/__init__.py
Normal file
16
kuhy_credit/kuhy_credit/__init__.py
Normal file
@ -0,0 +1,16 @@
|
||||
"""The shared "Created by kuhy" credit for Python programs.
|
||||
|
||||
``credit_line()`` is the terminal form; :mod:`kuhy_credit.tk` holds the
|
||||
Tkinter logo widget. The words and the link come from the generated
|
||||
``_data`` module, which comes from ``credit.json``.
|
||||
"""
|
||||
|
||||
from kuhy_credit._data import TEXT, URL
|
||||
|
||||
|
||||
def credit_line() -> str:
|
||||
"""The one-line credit for terminal programs: the text, then the URL."""
|
||||
return f"{TEXT} {URL}"
|
||||
|
||||
|
||||
__all__ = ["TEXT", "URL", "credit_line"]
|
||||
141
kuhy_credit/kuhy_credit/_data.py
Normal file
141
kuhy_credit/kuhy_credit/_data.py
Normal file
@ -0,0 +1,141 @@
|
||||
"""The shared credit data (generated by kuhy_credit/generator/generate.py; DO NOT EDIT)."""
|
||||
|
||||
URL = "https://kuhy.duckdns.org"
|
||||
TEXT = "Created by kuhy"
|
||||
LOGO_SIZE = 512
|
||||
LOGO_FIELD = "#211D1B"
|
||||
LOGO_SHAPES: tuple[tuple[str, tuple[float, ...]], ...] = (
|
||||
(
|
||||
"#B8862E",
|
||||
(
|
||||
232.45, 126.71, 235.4, 121.83, 236.86, 117.46, 237.16, 113.16,
|
||||
236.11, 108.55, 233.71, 104.34, 230.14, 100.74, 225.62, 97.95,
|
||||
220.41, 96.16, 214.75, 95.51, 208.86, 96.11, 202.89, 97.96,
|
||||
196.97, 101.02, 191.8, 104.61, 186.14, 109.43, 168.83, 127.05,
|
||||
163.79, 131.69, 158.86, 135.08, 156.85, 135.91, 155.0, 136.26,
|
||||
153.32, 136.1, 151.51, 135.26, 150.17, 134.03, 148.74, 131.95,
|
||||
146.53, 126.68, 142.68, 113.58, 140.39, 107.28, 137.47, 101.8,
|
||||
134.17, 98.03, 131.62, 96.28, 129.3, 95.34, 126.82, 94.91,
|
||||
124.22, 94.99, 121.55, 95.59, 118.85, 96.69, 116.18, 98.26,
|
||||
113.59, 100.29, 110.67, 103.26, 108.46, 106.12, 104.82, 112.71,
|
||||
103.46, 116.33, 102.26, 120.85, 101.33, 129.4, 101.51, 134.83,
|
||||
102.18, 140.16, 107.16, 161.56, 107.92, 166.59, 108.16, 170.93,
|
||||
107.96, 175.3, 107.23, 180.39, 103.3, 196.89, 102.03, 203.6,
|
||||
101.44, 209.71, 101.57, 215.83, 102.56, 221.84, 104.46, 227.54,
|
||||
106.85, 232.14, 110.3, 236.77, 113.3, 239.71, 117.11, 242.44,
|
||||
120.52, 244.13, 124.51, 245.27, 128.36, 245.46, 131.44, 244.86,
|
||||
134.25, 243.55, 137.1, 241.19, 138.84, 238.98, 140.33, 236.37,
|
||||
142.79, 229.46, 144.26, 222.2, 146.91, 203.45, 149.0, 195.46,
|
||||
150.82, 191.74, 152.78, 189.39, 155.06, 187.98, 157.64, 187.54,
|
||||
160.46, 188.07, 163.46, 189.54, 166.57, 191.89, 170.18, 195.54,
|
||||
176.49, 203.82, 187.93, 221.96, 192.91, 229.15, 198.18, 235.26,
|
||||
203.3, 239.57, 207.07, 241.74, 210.4, 243.03, 213.78, 243.76,
|
||||
217.74, 243.92, 221.07, 243.47, 224.8, 242.29, 228.25, 240.44,
|
||||
230.89, 238.38, 233.17, 235.92, 235.02, 233.11, 236.37, 230.0,
|
||||
237.18, 226.63, 237.42, 223.07, 237.07, 219.35, 236.13, 215.54,
|
||||
234.6, 211.66, 230.9, 205.16, 225.43, 198.15, 219.02, 191.41,
|
||||
205.04, 178.08, 200.57, 173.11, 197.35, 167.98, 196.49, 165.31,
|
||||
196.29, 163.13, 196.57, 160.98, 197.54, 158.44, 199.16, 155.9,
|
||||
201.39, 153.37, 206.78, 148.63, 224.45, 135.06, 228.82, 130.95,
|
||||
),
|
||||
),
|
||||
(
|
||||
"#B8862E",
|
||||
(
|
||||
439.15, 304.62, 441.35, 299.45, 442.51, 294.18, 442.42, 288.99,
|
||||
441.16, 284.54, 438.79, 280.56, 435.43, 277.23, 431.27, 274.73,
|
||||
426.09, 273.1, 421.13, 272.75, 416.7, 273.37, 412.03, 275.08,
|
||||
407.76, 277.8, 404.33, 280.97, 400.93, 285.13, 391.39, 300.46,
|
||||
387.52, 305.61, 384.97, 308.13, 382.62, 309.84, 379.82, 311.14,
|
||||
377.32, 311.67, 374.44, 311.56, 371.59, 310.69, 368.84, 309.1,
|
||||
366.22, 306.86, 361.68, 301.2, 353.72, 288.2, 349.9, 282.87,
|
||||
345.1, 278.03, 339.97, 274.81, 336.22, 273.46, 332.8, 272.84,
|
||||
328.82, 272.8, 324.89, 273.46, 321.18, 274.78, 317.81, 276.73,
|
||||
314.92, 279.23, 312.64, 282.19, 311.36, 284.65, 310.49, 287.28,
|
||||
310.02, 290.04, 309.96, 292.87, 310.28, 295.74, 311.1, 299.1,
|
||||
313.73, 305.2, 316.79, 310.09, 321.01, 315.47, 337.3, 332.65,
|
||||
344.34, 340.99, 350.25, 349.71, 354.13, 357.71, 356.15, 364.64,
|
||||
356.94, 371.76, 356.69, 378.61, 354.92, 395.62, 354.93, 400.36,
|
||||
355.46, 405.02, 356.78, 409.97, 358.95, 414.48, 361.98, 418.37,
|
||||
365.77, 421.42, 369.24, 423.14, 372.98, 424.16, 376.83, 424.43,
|
||||
380.67, 423.95, 384.34, 422.72, 387.71, 420.81, 390.68, 418.27,
|
||||
393.42, 414.79, 394.87, 412.17, 396.16, 408.88, 397.04, 405.4,
|
||||
397.53, 401.79, 397.58, 394.42, 395.86, 378.48, 395.63, 371.63,
|
||||
396.54, 364.05, 398.85, 356.69, 402.9, 348.74, 408.61, 340.49,
|
||||
415.36, 332.56, 431.64, 315.37, 435.86, 309.98,
|
||||
),
|
||||
),
|
||||
(
|
||||
"#ECEAE9",
|
||||
(
|
||||
272.87, 180.5, 273.78, 191.15, 275.43, 199.68, 277.93, 207.24,
|
||||
281.46, 214.32, 286.01, 220.83, 291.97, 227.15, 298.81, 232.68,
|
||||
306.29, 237.38, 314.83, 241.44, 323.65, 244.37, 331.97, 245.96,
|
||||
340.33, 246.39, 348.69, 245.62, 356.98, 243.7, 365.74, 240.46,
|
||||
374.17, 236.11, 379.85, 232.38, 385.15, 228.16, 389.95, 223.48,
|
||||
393.76, 218.86, 397.03, 213.89, 399.73, 208.6, 401.84, 203.03,
|
||||
403.53, 196.59, 404.61, 189.99, 405.3, 181.99, 405.89, 159.12,
|
||||
407.09, 137.35, 407.21, 129.01, 406.69, 121.27, 405.6, 115.09,
|
||||
403.79, 109.27, 401.53, 104.61, 398.24, 100.21, 394.25, 96.96,
|
||||
389.72, 95.06, 385.41, 94.63, 381.04, 95.41, 376.28, 97.71,
|
||||
371.95, 101.35, 368.3, 106.12, 366.03, 110.43, 364.13, 115.78,
|
||||
363.07, 120.69, 362.53, 126.4, 362.58, 131.38, 363.12, 136.95,
|
||||
366.62, 155.29, 367.54, 162.94, 367.32, 171.38, 366.55, 176.01,
|
||||
365.5, 179.98, 363.26, 185.87, 360.61, 190.86, 357.41, 195.43,
|
||||
353.74, 199.38, 349.69, 202.52, 345.92, 204.46, 342.02, 205.56,
|
||||
338.06, 205.77, 334.12, 205.08, 330.28, 203.52, 326.61, 201.16,
|
||||
322.73, 197.62, 319.27, 193.35, 316.32, 188.55, 313.95, 183.43,
|
||||
312.21, 178.16, 310.8, 170.23, 310.73, 162.45, 311.59, 155.45,
|
||||
315.0, 137.8, 315.74, 128.01, 315.47, 123.01, 314.68, 118.04,
|
||||
313.31, 113.22, 311.38, 108.68, 308.91, 104.56, 305.95, 101.0,
|
||||
302.59, 98.14, 298.95, 96.07, 295.15, 94.89, 291.33, 94.64,
|
||||
287.61, 95.31, 284.11, 96.89, 281.8, 98.52, 279.7, 100.54,
|
||||
277.81, 102.91, 275.86, 106.15, 273.2, 112.94, 271.66, 120.41,
|
||||
271.11, 126.72, 271.03, 133.73, 272.32, 158.32,
|
||||
),
|
||||
),
|
||||
(
|
||||
"#ECEAE9",
|
||||
(
|
||||
142.5, 408.93, 144.93, 412.86, 148.33, 416.82, 151.62, 419.58,
|
||||
155.73, 421.94, 159.96, 423.33, 164.11, 423.69, 168.0, 423.04,
|
||||
171.46, 421.41, 173.61, 419.69, 175.81, 417.09, 177.3, 414.53,
|
||||
178.71, 411.07, 180.34, 403.92, 181.9, 389.45, 182.76, 384.3,
|
||||
184.38, 379.06, 186.6, 375.03, 188.42, 372.84, 190.56, 370.93,
|
||||
193.02, 369.3, 196.36, 367.72, 203.33, 365.93, 207.41, 365.55,
|
||||
211.54, 365.59, 218.2, 366.61, 224.14, 368.79, 226.71, 370.32,
|
||||
228.97, 372.13, 232.2, 376.09, 234.21, 380.29, 235.51, 385.06,
|
||||
237.68, 403.4, 239.06, 409.98, 241.43, 415.72, 243.06, 418.13,
|
||||
244.99, 420.16, 247.7, 422.03, 250.76, 423.22, 254.12, 423.7,
|
||||
257.08, 423.52, 260.7, 422.61, 263.71, 421.29, 267.19, 419.06,
|
||||
269.9, 416.7, 273.71, 412.09, 276.7, 406.63, 278.73, 400.57,
|
||||
279.77, 394.13, 279.87, 387.57, 279.19, 381.08, 277.76, 374.06,
|
||||
273.42, 357.39, 272.7, 353.01, 272.43, 348.73, 272.65, 344.45,
|
||||
273.45, 339.45, 277.62, 323.51, 278.95, 317.31, 279.71, 311.68,
|
||||
279.93, 306.77, 279.2, 298.62, 277.23, 291.66, 274.04, 285.39,
|
||||
269.78, 280.17, 267.06, 277.83, 263.57, 275.63, 260.56, 274.33,
|
||||
256.94, 273.46, 253.99, 273.3, 250.64, 273.8, 248.07, 274.77,
|
||||
245.32, 276.56, 243.34, 278.53, 241.66, 280.88, 239.2, 286.54,
|
||||
237.66, 293.75, 235.48, 312.08, 233.95, 317.39, 231.82, 321.5,
|
||||
230.08, 323.74, 228.0, 325.7, 225.6, 327.39, 222.9, 328.79,
|
||||
216.76, 330.71, 209.32, 331.48, 201.85, 330.81, 198.02, 329.85,
|
||||
195.07, 328.73, 192.39, 327.32, 190.0, 325.62, 187.94, 323.64,
|
||||
186.21, 321.39, 184.11, 317.26, 182.6, 311.93, 180.42, 293.59,
|
||||
179.04, 287.01, 177.76, 283.44, 176.37, 280.76, 174.68, 278.43,
|
||||
172.69, 276.48, 169.92, 274.72, 167.34, 273.77, 163.98, 273.3,
|
||||
161.03, 273.48, 157.4, 274.38, 154.4, 275.7, 150.92, 277.93,
|
||||
148.21, 280.29, 143.97, 285.54, 141.1, 291.09, 139.19, 297.22,
|
||||
138.23, 304.49, 138.34, 311.05, 139.18, 317.5, 144.55, 338.96,
|
||||
145.64, 347.04, 145.57, 351.31, 144.91, 356.27, 139.77, 376.54,
|
||||
138.77, 382.07, 138.23, 387.76, 138.29, 393.51, 139.06, 399.17,
|
||||
140.59, 404.59,
|
||||
),
|
||||
),
|
||||
)
|
||||
DARK = {"surface": "#2b2624", "border": "#463e3a", "text": "#eceae9"}
|
||||
LIGHT = {"surface": "#fcfbfb", "border": "#e0dad7", "text": "#211d1b"}
|
||||
FOCUS = "#b8862e"
|
||||
RADIUS = 12
|
||||
SPACE_SM = 8
|
||||
SPACE_MD = 16
|
||||
TEXT_BODY = 16
|
||||
9
kuhy_credit/kuhy_credit/terminal.py
Normal file
9
kuhy_credit/kuhy_credit/terminal.py
Normal file
@ -0,0 +1,9 @@
|
||||
"""``kuhy-credit``: print the one-line credit. Opens nothing."""
|
||||
|
||||
from kuhy_credit import credit_line
|
||||
|
||||
|
||||
def main() -> int:
|
||||
"""Print the credit line; returns the exit code."""
|
||||
print(credit_line())
|
||||
return 0
|
||||
59
kuhy_credit/pyproject.toml
Normal file
59
kuhy_credit/pyproject.toml
Normal file
@ -0,0 +1,59 @@
|
||||
[build-system]
|
||||
requires = ["setuptools>=61"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "kuhy-credit"
|
||||
version = "0.1.0"
|
||||
description = "The shared 'Created by kuhy' logo credit: Tkinter widget and terminal line"
|
||||
requires-python = ">=3.14"
|
||||
dependencies = [] # pure stdlib: tkinter and webbrowser ship with Python
|
||||
|
||||
[project.scripts]
|
||||
kuhy-credit = "kuhy_credit.terminal:main"
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
include = ["kuhy_credit*"]
|
||||
exclude = ["kuhy_credit.tests*"]
|
||||
|
||||
[tool.ruff]
|
||||
target-version = "py314"
|
||||
line-length = 100
|
||||
extend-exclude = ["web", "flutter", "godot"]
|
||||
|
||||
[tool.ruff.lint]
|
||||
select = ["ALL"]
|
||||
ignore = ["D203", "D213", "COM812", "ISC001", "S603", "S607", "CPY001"]
|
||||
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
"tests/*.py" = ["ARG", "D", "PLC0415", "PLR2004", "S101", "SLF001", "E501"]
|
||||
"kuhy_credit/_data.py" = ["E501"]
|
||||
# The generator and the terminal helper are CLIs: printing is their output.
|
||||
"generator/generate.py" = ["T201"]
|
||||
"kuhy_credit/terminal.py" = ["T201"]
|
||||
|
||||
[tool.ruff.lint.pydocstyle]
|
||||
convention = "google"
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
testpaths = ["tests"]
|
||||
pythonpath = ["."]
|
||||
addopts = [
|
||||
"--strict-markers",
|
||||
"--strict-config",
|
||||
"-ra",
|
||||
"--cov=kuhy_credit",
|
||||
"--cov=generator",
|
||||
"--cov-branch",
|
||||
"--cov-report=term-missing",
|
||||
]
|
||||
filterwarnings = ["error"]
|
||||
|
||||
[tool.coverage.run]
|
||||
branch = true
|
||||
omit = ["*/tests/*"]
|
||||
|
||||
[tool.coverage.report]
|
||||
fail_under = 100
|
||||
show_missing = true
|
||||
exclude_lines = ["pragma: no cover", 'if __name__ == "__main__":']
|
||||
4
kuhy_credit/terminal/kuhy-credit.sh
Executable file
4
kuhy_credit/terminal/kuhy-credit.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
# Prints the one-line kuhy credit and opens nothing (generated by kuhy_credit/generator/generate.py; DO NOT EDIT).
|
||||
set -euo pipefail
|
||||
printf '%s %s\n' 'Created by kuhy' https://kuhy.duckdns.org
|
||||
0
kuhy_credit/tests/__init__.py
Normal file
0
kuhy_credit/tests/__init__.py
Normal file
129
kuhy_credit/tests/test_generator.py
Normal file
129
kuhy_credit/tests/test_generator.py
Normal file
@ -0,0 +1,129 @@
|
||||
"""Generator: SVG parsing, token parsing, emitters and the drift check."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from generator import generate, svg, tokens
|
||||
|
||||
CREDIT_DIR = Path(__file__).resolve().parents[1]
|
||||
REPO_ROOT = CREDIT_DIR.parent
|
||||
|
||||
|
||||
def test_logo_parses_into_disjoint_polygons() -> None:
|
||||
logo = svg.parse_logo((REPO_ROOT / "unified-design-system/logo/final/kuhy.svg").read_text())
|
||||
assert logo.size == 512
|
||||
assert logo.field == "#211D1B"
|
||||
assert [s.fill for s in logo.shapes] == ["#B8862E"] * 2 + ["#ECEAE9"] * 2
|
||||
assert all(len(s.points) >= 3 for s in logo.shapes)
|
||||
|
||||
|
||||
def test_overlapping_subpaths_are_rejected() -> None:
|
||||
doc = (
|
||||
'<svg viewBox="0 0 10 10"><rect id="field" fill="#000000"/>'
|
||||
'<path fill="#FFFFFF" d="M1 1L5 1L5 5ZM2 2L6 2L6 6Z"/></svg>'
|
||||
)
|
||||
with pytest.raises(ValueError, match="overlap"):
|
||||
svg.parse_logo(doc)
|
||||
|
||||
|
||||
def test_unsupported_path_command_is_rejected() -> None:
|
||||
doc = (
|
||||
'<svg viewBox="0 0 10 10"><rect id="field" fill="#000000"/>'
|
||||
'<path fill="#FFFFFF" d="M1 1C5 1 5 5 1 1Z"/></svg>'
|
||||
)
|
||||
with pytest.raises(ValueError, match="unsupported"):
|
||||
svg.parse_logo(doc)
|
||||
|
||||
|
||||
def test_missing_field_is_rejected() -> None:
|
||||
with pytest.raises(ValueError, match="field"):
|
||||
svg.parse_logo('<svg viewBox="0 0 10 10"></svg>')
|
||||
|
||||
|
||||
def test_tokens_read_dark_and_light_from_css() -> None:
|
||||
tok = tokens.parse_tokens((REPO_ROOT / "web_ui/src/tokens.css").read_text())
|
||||
assert tok.dark.surface == "#2b2624"
|
||||
assert tok.light.surface == "#fcfbfb"
|
||||
assert tok.dark.text == "#eceae9"
|
||||
assert tok.light.text == "#211d1b"
|
||||
assert tok.focus == "#b8862e"
|
||||
assert (tok.radius, tok.space_sm, tok.space_md, tok.text_body) == (12, 8, 16, 16)
|
||||
|
||||
|
||||
def test_missing_token_is_rejected() -> None:
|
||||
with pytest.raises(ValueError, match="--surface-1"):
|
||||
tokens.parse_tokens(":root { --bg: #000000; }")
|
||||
|
||||
|
||||
def test_every_generated_file_matches_the_sources() -> None:
|
||||
assert generate.drift(CREDIT_DIR) == []
|
||||
|
||||
|
||||
def test_main_check_passes_on_a_clean_tree(capsys: pytest.CaptureFixture[str]) -> None:
|
||||
assert generate.main(["--check"]) == 0
|
||||
assert "in sync" in capsys.readouterr().out
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def copy(tmp_path: Path) -> Path:
|
||||
"""A throwaway copy of the repo bits the generator reads and writes."""
|
||||
root = tmp_path / "repo"
|
||||
for rel in ("unified-design-system/logo/final", "web_ui/src"):
|
||||
(root / rel).mkdir(parents=True)
|
||||
shutil.copy(
|
||||
REPO_ROOT / "unified-design-system/logo/final/kuhy.svg",
|
||||
root / "unified-design-system/logo/final",
|
||||
)
|
||||
shutil.copy(REPO_ROOT / "web_ui/src/tokens.css", root / "web_ui/src")
|
||||
(root / "kuhy_credit").mkdir()
|
||||
shutil.copy(CREDIT_DIR / "credit.json", root / "kuhy_credit")
|
||||
return root / "kuhy_credit"
|
||||
|
||||
|
||||
def test_write_then_check_round_trips(copy: Path) -> None:
|
||||
assert {d.stack for d in generate.drift(copy)} == set(generate.STACKS)
|
||||
generate.write(copy)
|
||||
assert generate.drift(copy) == []
|
||||
|
||||
|
||||
@pytest.mark.parametrize("stack", sorted(generate.STACKS))
|
||||
def test_editing_one_stack_names_that_stack(
|
||||
copy: Path, stack: str, capsys: pytest.CaptureFixture[str]
|
||||
) -> None:
|
||||
generate.write(copy)
|
||||
target = copy / generate.STACKS[stack]
|
||||
target.write_text(target.read_text().replace("https://kuhy.duckdns.org", "https://example.org"))
|
||||
assert [d.stack for d in generate.drift(copy)] == [stack]
|
||||
assert generate.main(["--check", "--dir", str(copy)]) == 1
|
||||
assert stack in capsys.readouterr().out
|
||||
|
||||
|
||||
def test_changing_the_shared_url_drifts_every_stack(copy: Path) -> None:
|
||||
generate.write(copy)
|
||||
data = json.loads((copy / "credit.json").read_text())
|
||||
data["url"] = "https://example.org"
|
||||
(copy / "credit.json").write_text(json.dumps(data))
|
||||
assert {d.stack for d in generate.drift(copy)} == set(generate.STACKS)
|
||||
|
||||
|
||||
def test_main_writes_without_check(copy: Path, capsys: pytest.CaptureFixture[str]) -> None:
|
||||
assert generate.main(["--dir", str(copy)]) == 0
|
||||
assert "wrote" in capsys.readouterr().out
|
||||
assert generate.drift(copy) == []
|
||||
|
||||
|
||||
def test_css_without_root_is_rejected() -> None:
|
||||
with pytest.raises(ValueError, match="--surface-1"):
|
||||
tokens.parse_tokens("")
|
||||
|
||||
|
||||
def test_whole_numbers_keep_a_decimal_point() -> None:
|
||||
from generator import emit
|
||||
|
||||
assert emit._num(12.0) == "12.0"
|
||||
assert emit._num(12.5) == "12.5"
|
||||
25
kuhy_credit/tests/test_terminal.py
Normal file
25
kuhy_credit/tests/test_terminal.py
Normal file
@ -0,0 +1,25 @@
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from kuhy_credit import TEXT, URL, credit_line, terminal
|
||||
|
||||
CREDIT_DIR = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
def test_credit_line_is_text_then_url() -> None:
|
||||
assert credit_line() == "Created by kuhy https://kuhy.duckdns.org"
|
||||
assert (TEXT, URL) == ("Created by kuhy", "https://kuhy.duckdns.org")
|
||||
|
||||
|
||||
def test_main_prints_one_line(capsys: pytest.CaptureFixture[str]) -> None:
|
||||
assert terminal.main() == 0
|
||||
assert capsys.readouterr().out == "Created by kuhy https://kuhy.duckdns.org\n"
|
||||
|
||||
|
||||
def test_shell_helper_prints_the_same_line() -> None:
|
||||
out = subprocess.run(
|
||||
[str(CREDIT_DIR / "terminal/kuhy-credit.sh")], check=True, capture_output=True, text=True
|
||||
).stdout
|
||||
assert out == credit_line() + "\n"
|
||||
115
kuhy_credit/web/src/credit-data.js
Normal file
115
kuhy_credit/web/src/credit-data.js
Normal file
@ -0,0 +1,115 @@
|
||||
// The shared credit data (generated by kuhy_credit/generator/generate.py; DO NOT EDIT).
|
||||
export const CREDIT_URL = "https://kuhy.duckdns.org";
|
||||
export const CREDIT_TEXT = "Created by kuhy";
|
||||
export const LOGO_SVG =
|
||||
"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512"
|
||||
+ "\" width=\"512\" height=\"512\">\n<rect id=\"field\" width=\"512\" hei"
|
||||
+ "ght=\"512\" fill=\"#211D1B\"/>\n<path fill=\"#B8862E\" fill-rule=\"e"
|
||||
+ "venodd\" d=\"M232.45 126.71L235.40 121.83L236.86 117.46L237.16"
|
||||
+ " 113.16L236.11 108.55L233.71 104.34L230.14 100.74L225.62 97."
|
||||
+ "95L220.41 96.16L214.75 95.51L208.86 96.11L202.89 97.96L196.9"
|
||||
+ "7 101.02L191.80 104.61L186.14 109.43L168.83 127.05L163.79 13"
|
||||
+ "1.69L158.86 135.08L156.85 135.91L155.00 136.26L153.32 136.10"
|
||||
+ "L151.51 135.26L150.17 134.03L148.74 131.95L146.53 126.68L142"
|
||||
+ ".68 113.58L140.39 107.28L137.47 101.80L134.17 98.03L131.62 9"
|
||||
+ "6.28L129.30 95.34L126.82 94.91L124.22 94.99L121.55 95.59L118"
|
||||
+ ".85 96.69L116.18 98.26L113.59 100.29L110.67 103.26L108.46 10"
|
||||
+ "6.12L104.82 112.71L103.46 116.33L102.26 120.85L101.33 129.40"
|
||||
+ "L101.51 134.83L102.18 140.16L107.16 161.56L107.92 166.59L108"
|
||||
+ ".16 170.93L107.96 175.30L107.23 180.39L103.30 196.89L102.03 "
|
||||
+ "203.60L101.44 209.71L101.57 215.83L102.56 221.84L104.46 227."
|
||||
+ "54L106.85 232.14L110.30 236.77L113.30 239.71L117.11 242.44L1"
|
||||
+ "20.52 244.13L124.51 245.27L128.36 245.46L131.44 244.86L134.2"
|
||||
+ "5 243.55L137.10 241.19L138.84 238.98L140.33 236.37L142.79 22"
|
||||
+ "9.46L144.26 222.20L146.91 203.45L149.00 195.46L150.82 191.74"
|
||||
+ "L152.78 189.39L155.06 187.98L157.64 187.54L160.46 188.07L163"
|
||||
+ ".46 189.54L166.57 191.89L170.18 195.54L176.49 203.82L187.93 "
|
||||
+ "221.96L192.91 229.15L198.18 235.26L203.30 239.57L207.07 241."
|
||||
+ "74L210.40 243.03L213.78 243.76L217.74 243.92L221.07 243.47L2"
|
||||
+ "24.80 242.29L228.25 240.44L230.89 238.38L233.17 235.92L235.0"
|
||||
+ "2 233.11L236.37 230.00L237.18 226.63L237.42 223.07L237.07 21"
|
||||
+ "9.35L236.13 215.54L234.60 211.66L230.90 205.16L225.43 198.15"
|
||||
+ "L219.02 191.41L205.04 178.08L200.57 173.11L197.35 167.98L196"
|
||||
+ ".49 165.31L196.29 163.13L196.57 160.98L197.54 158.44L199.16 "
|
||||
+ "155.90L201.39 153.37L206.78 148.63L224.45 135.06L228.82 130."
|
||||
+ "95ZM439.15 304.62L441.35 299.45L442.51 294.18L442.42 288.99L"
|
||||
+ "441.16 284.54L438.79 280.56L435.43 277.23L431.27 274.73L426."
|
||||
+ "09 273.10L421.13 272.75L416.70 273.37L412.03 275.08L407.76 2"
|
||||
+ "77.80L404.33 280.97L400.93 285.13L391.39 300.46L387.52 305.6"
|
||||
+ "1L384.97 308.13L382.62 309.84L379.82 311.14L377.32 311.67L37"
|
||||
+ "4.44 311.56L371.59 310.69L368.84 309.10L366.22 306.86L361.68"
|
||||
+ " 301.20L353.72 288.20L349.90 282.87L345.10 278.03L339.97 274"
|
||||
+ ".81L336.22 273.46L332.80 272.84L328.82 272.80L324.89 273.46L"
|
||||
+ "321.18 274.78L317.81 276.73L314.92 279.23L312.64 282.19L311."
|
||||
+ "36 284.65L310.49 287.28L310.02 290.04L309.96 292.87L310.28 2"
|
||||
+ "95.74L311.10 299.10L313.73 305.20L316.79 310.09L321.01 315.4"
|
||||
+ "7L337.30 332.65L344.34 340.99L350.25 349.71L354.13 357.71L35"
|
||||
+ "6.15 364.64L356.94 371.76L356.69 378.61L354.92 395.62L354.93"
|
||||
+ " 400.36L355.46 405.02L356.78 409.97L358.95 414.48L361.98 418"
|
||||
+ ".37L365.77 421.42L369.24 423.14L372.98 424.16L376.83 424.43L"
|
||||
+ "380.67 423.95L384.34 422.72L387.71 420.81L390.68 418.27L393."
|
||||
+ "42 414.79L394.87 412.17L396.16 408.88L397.04 405.40L397.53 4"
|
||||
+ "01.79L397.58 394.42L395.86 378.48L395.63 371.63L396.54 364.0"
|
||||
+ "5L398.85 356.69L402.90 348.74L408.61 340.49L415.36 332.56L43"
|
||||
+ "1.64 315.37L435.86 309.98Z\"/>\n<path fill=\"#ECEAE9\" fill-rule"
|
||||
+ "=\"evenodd\" d=\"M272.87 180.50L273.78 191.15L275.43 199.68L277"
|
||||
+ ".93 207.24L281.46 214.32L286.01 220.83L291.97 227.15L298.81 "
|
||||
+ "232.68L306.29 237.38L314.83 241.44L323.65 244.37L331.97 245."
|
||||
+ "96L340.33 246.39L348.69 245.62L356.98 243.70L365.74 240.46L3"
|
||||
+ "74.17 236.11L379.85 232.38L385.15 228.16L389.95 223.48L393.7"
|
||||
+ "6 218.86L397.03 213.89L399.73 208.60L401.84 203.03L403.53 19"
|
||||
+ "6.59L404.61 189.99L405.30 181.99L405.89 159.12L407.09 137.35"
|
||||
+ "L407.21 129.01L406.69 121.27L405.60 115.09L403.79 109.27L401"
|
||||
+ ".53 104.61L398.24 100.21L394.25 96.96L389.72 95.06L385.41 94"
|
||||
+ ".63L381.04 95.41L376.28 97.71L371.95 101.35L368.30 106.12L36"
|
||||
+ "6.03 110.43L364.13 115.78L363.07 120.69L362.53 126.40L362.58"
|
||||
+ " 131.38L363.12 136.95L366.62 155.29L367.54 162.94L367.32 171"
|
||||
+ ".38L366.55 176.01L365.50 179.98L363.26 185.87L360.61 190.86L"
|
||||
+ "357.41 195.43L353.74 199.38L349.69 202.52L345.92 204.46L342."
|
||||
+ "02 205.56L338.06 205.77L334.12 205.08L330.28 203.52L326.61 2"
|
||||
+ "01.16L322.73 197.62L319.27 193.35L316.32 188.55L313.95 183.4"
|
||||
+ "3L312.21 178.16L310.80 170.23L310.73 162.45L311.59 155.45L31"
|
||||
+ "5.00 137.80L315.74 128.01L315.47 123.01L314.68 118.04L313.31"
|
||||
+ " 113.22L311.38 108.68L308.91 104.56L305.95 101.00L302.59 98."
|
||||
+ "14L298.95 96.07L295.15 94.89L291.33 94.64L287.61 95.31L284.1"
|
||||
+ "1 96.89L281.80 98.52L279.70 100.54L277.81 102.91L275.86 106."
|
||||
+ "15L273.20 112.94L271.66 120.41L271.11 126.72L271.03 133.73L2"
|
||||
+ "72.32 158.32ZM142.50 408.93L144.93 412.86L148.33 416.82L151."
|
||||
+ "62 419.58L155.73 421.94L159.96 423.33L164.11 423.69L168.00 4"
|
||||
+ "23.04L171.46 421.41L173.61 419.69L175.81 417.09L177.30 414.5"
|
||||
+ "3L178.71 411.07L180.34 403.92L181.90 389.45L182.76 384.30L18"
|
||||
+ "4.38 379.06L186.60 375.03L188.42 372.84L190.56 370.93L193.02"
|
||||
+ " 369.30L196.36 367.72L203.33 365.93L207.41 365.55L211.54 365"
|
||||
+ ".59L218.20 366.61L224.14 368.79L226.71 370.32L228.97 372.13L"
|
||||
+ "232.20 376.09L234.21 380.29L235.51 385.06L237.68 403.40L239."
|
||||
+ "06 409.98L241.43 415.72L243.06 418.13L244.99 420.16L247.70 4"
|
||||
+ "22.03L250.76 423.22L254.12 423.70L257.08 423.52L260.70 422.6"
|
||||
+ "1L263.71 421.29L267.19 419.06L269.90 416.70L273.71 412.09L27"
|
||||
+ "6.70 406.63L278.73 400.57L279.77 394.13L279.87 387.57L279.19"
|
||||
+ " 381.08L277.76 374.06L273.42 357.39L272.70 353.01L272.43 348"
|
||||
+ ".73L272.65 344.45L273.45 339.45L277.62 323.51L278.95 317.31L"
|
||||
+ "279.71 311.68L279.93 306.77L279.20 298.62L277.23 291.66L274."
|
||||
+ "04 285.39L269.78 280.17L267.06 277.83L263.57 275.63L260.56 2"
|
||||
+ "74.33L256.94 273.46L253.99 273.30L250.64 273.80L248.07 274.7"
|
||||
+ "7L245.32 276.56L243.34 278.53L241.66 280.88L239.20 286.54L23"
|
||||
+ "7.66 293.75L235.48 312.08L233.95 317.39L231.82 321.50L230.08"
|
||||
+ " 323.74L228.00 325.70L225.60 327.39L222.90 328.79L216.76 330"
|
||||
+ ".71L209.32 331.48L201.85 330.81L198.02 329.85L195.07 328.73L"
|
||||
+ "192.39 327.32L190.00 325.62L187.94 323.64L186.21 321.39L184."
|
||||
+ "11 317.26L182.60 311.93L180.42 293.59L179.04 287.01L177.76 2"
|
||||
+ "83.44L176.37 280.76L174.68 278.43L172.69 276.48L169.92 274.7"
|
||||
+ "2L167.34 273.77L163.98 273.30L161.03 273.48L157.40 274.38L15"
|
||||
+ "4.40 275.70L150.92 277.93L148.21 280.29L143.97 285.54L141.10"
|
||||
+ " 291.09L139.19 297.22L138.23 304.49L138.34 311.05L139.18 317"
|
||||
+ ".50L144.55 338.96L145.64 347.04L145.57 351.31L144.91 356.27L"
|
||||
+ "139.77 376.54L138.77 382.07L138.23 387.76L138.29 393.51L139."
|
||||
+ "06 399.17L140.59 404.59Z\"/>\n</svg>\n";
|
||||
export const TOKENS = {
|
||||
dark: { surface: "#2b2624", border: "#463e3a", text: "#eceae9" },
|
||||
light: { surface: "#fcfbfb", border: "#e0dad7", text: "#211d1b" },
|
||||
focus: "#b8862e",
|
||||
radius: 12,
|
||||
spaceSm: 8,
|
||||
spaceMd: 16,
|
||||
textBody: 16,
|
||||
};
|
||||
Loading…
Reference in New Issue
Block a user