abilian-ds 0.1.0__py3-none-any.whl
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.
- abilian_ds/__init__.py +3 -0
- abilian_ds/allowlist.txt +11 -0
- abilian_ds/cli.py +291 -0
- abilian_ds/css/ads.css +39 -0
- abilian_ds/css/base.css +89 -0
- abilian_ds/css/derive.css +242 -0
- abilian_ds/css/knobs.css +113 -0
- abilian_ds/css/parts/alert.css +25 -0
- abilian_ds/css/parts/button.css +103 -0
- abilian_ds/css/parts/card.css +123 -0
- abilian_ds/css/parts/content.css +515 -0
- abilian_ds/css/parts/forced-colors.css +62 -0
- abilian_ds/css/parts/form.css +340 -0
- abilian_ds/css/parts/indicator.css +391 -0
- abilian_ds/css/parts/layout.css +320 -0
- abilian_ds/css/parts/nav.css +249 -0
- abilian_ds/css/parts/overlay.css +359 -0
- abilian_ds/css/parts/shell.css +419 -0
- abilian_ds/css/parts/table.css +116 -0
- abilian_ds/lint.py +819 -0
- abilian_ds/shell.js +231 -0
- abilian_ds/situ.css +108 -0
- abilian_ds/templates/ads/form.html +94 -0
- abilian_ds/templates/ads/nav.html +52 -0
- abilian_ds/templates/ads/shell.html +119 -0
- abilian_ds/tokens.py +271 -0
- abilian_ds-0.1.0.dist-info/METADATA +128 -0
- abilian_ds-0.1.0.dist-info/RECORD +31 -0
- abilian_ds-0.1.0.dist-info/WHEEL +4 -0
- abilian_ds-0.1.0.dist-info/entry_points.txt +2 -0
- abilian_ds-0.1.0.dist-info/licenses/LICENSE +202 -0
abilian_ds/__init__.py
ADDED
abilian_ds/allowlist.txt
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Classes no stylesheet here defines, and so cannot be checked against it — they
|
|
2
|
+
# come from a library that sets them at runtime. Every entry needs a reason. A
|
|
3
|
+
# growing list is a bug in the design system, not a normal cost of doing business.
|
|
4
|
+
#
|
|
5
|
+
# Projects add their own in .abilian-ds-allow, same format.
|
|
6
|
+
|
|
7
|
+
htmx-indicator # htmx shows this while a request is in flight
|
|
8
|
+
htmx-request # htmx sets this on the element issuing a request
|
|
9
|
+
htmx-added # htmx sets this on newly swapped content
|
|
10
|
+
htmx-settling # htmx swap lifecycle
|
|
11
|
+
htmx-swapping # htmx swap lifecycle
|
abilian_ds/cli.py
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
"""Abilian Design System command line."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
import re
|
|
7
|
+
from importlib.resources import files
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
import tomllib
|
|
11
|
+
|
|
12
|
+
from abilian_ds.lint import (
|
|
13
|
+
CLASS_ATTR,
|
|
14
|
+
ENTRY,
|
|
15
|
+
STYLESHEETS,
|
|
16
|
+
Finding,
|
|
17
|
+
check_duplicate_rules,
|
|
18
|
+
check_structure,
|
|
19
|
+
check_synced,
|
|
20
|
+
check_template,
|
|
21
|
+
check_unused,
|
|
22
|
+
class_tokens,
|
|
23
|
+
load_allowlist,
|
|
24
|
+
load_routes,
|
|
25
|
+
required_children,
|
|
26
|
+
stylesheet_classes,
|
|
27
|
+
)
|
|
28
|
+
from abilian_ds.tokens import doc_pages, generate
|
|
29
|
+
|
|
30
|
+
COMPONENTS = files("abilian_ds") / "templates" / "ads"
|
|
31
|
+
DEFAULT_TARGET = Path("static/css/ads")
|
|
32
|
+
DEFAULT_TEMPLATES = Path("templates")
|
|
33
|
+
DEFAULT_ALLOW = Path(".abilian-ds-allow")
|
|
34
|
+
DEFAULT_COMPONENTS = Path("templates/ads")
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def sync(theme_target: Path, components_target: Path) -> list[Path]:
|
|
38
|
+
"""Write the packaged stylesheets and component macros into the project tree.
|
|
39
|
+
|
|
40
|
+
Neither can be served from site-packages: a browser needs a URL. `ads.css` lands as one
|
|
41
|
+
file with its parts spliced in — see `bundle()` — so a page costs one request rather
|
|
42
|
+
than a `@import` waterfall of fifteen. `abilian-ds lint` hashes the vendored files back
|
|
43
|
+
against the package, which is what stops a vendored file becoming an escape hatch.
|
|
44
|
+
|
|
45
|
+
Anything else ending in `.css` under the target is a fossil of an earlier sync and is
|
|
46
|
+
removed: the target directory belongs to this command, and a stale `parts/button.css`
|
|
47
|
+
that no page links is exactly the file someone edits and wonders why nothing changes.
|
|
48
|
+
"""
|
|
49
|
+
written = []
|
|
50
|
+
for name, source in STYLESHEETS:
|
|
51
|
+
stylesheet = theme_target / name
|
|
52
|
+
stylesheet.parent.mkdir(parents=True, exist_ok=True)
|
|
53
|
+
stylesheet.write_bytes(source())
|
|
54
|
+
written.append(stylesheet)
|
|
55
|
+
for stale in sorted(theme_target.rglob("*.css")):
|
|
56
|
+
if stale not in written:
|
|
57
|
+
stale.unlink()
|
|
58
|
+
for empty in sorted(theme_target.rglob("*"), reverse=True):
|
|
59
|
+
if empty.is_dir() and not any(empty.iterdir()):
|
|
60
|
+
empty.rmdir()
|
|
61
|
+
components_target.mkdir(parents=True, exist_ok=True)
|
|
62
|
+
for source in sorted(COMPONENTS.iterdir()):
|
|
63
|
+
destination = components_target / source.name
|
|
64
|
+
destination.write_bytes(source.read_bytes())
|
|
65
|
+
written.append(destination)
|
|
66
|
+
return written
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def templates_in(paths: list[Path]) -> tuple[list[Path], list[Finding]]:
|
|
70
|
+
"""The templates to check, plus a finding for every configured path that is not there.
|
|
71
|
+
|
|
72
|
+
A missing path used to reach `read_text()` and come back as a traceback, which reads as a
|
|
73
|
+
crash in the linter rather than a typo in `pyproject.toml` — and the same shape happens when
|
|
74
|
+
a directory is renamed and the config is not.
|
|
75
|
+
"""
|
|
76
|
+
found: list[Path] = []
|
|
77
|
+
missing: list[Finding] = []
|
|
78
|
+
for path in paths:
|
|
79
|
+
if not path.exists():
|
|
80
|
+
missing.append(
|
|
81
|
+
Finding(
|
|
82
|
+
path,
|
|
83
|
+
0,
|
|
84
|
+
"path-missing",
|
|
85
|
+
"configured in [tool.abilian-ds] but not on disk",
|
|
86
|
+
)
|
|
87
|
+
)
|
|
88
|
+
elif path.is_dir():
|
|
89
|
+
found.extend(sorted(path.rglob("*.html")))
|
|
90
|
+
else:
|
|
91
|
+
found.append(path)
|
|
92
|
+
return found, missing
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def project_defaults() -> dict:
|
|
96
|
+
"""Read [tool.abilian-ds] from pyproject.toml.
|
|
97
|
+
|
|
98
|
+
The Makefile, CI and the editor hook all invoke lint with the same four paths.
|
|
99
|
+
Naming them once here is the difference between one source of truth and three
|
|
100
|
+
copies that drift.
|
|
101
|
+
"""
|
|
102
|
+
pyproject = Path("pyproject.toml")
|
|
103
|
+
if not pyproject.exists():
|
|
104
|
+
return {}
|
|
105
|
+
with pyproject.open("rb") as handle:
|
|
106
|
+
return tomllib.load(handle).get("tool", {}).get("abilian-ds", {})
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def sync_command(args: argparse.Namespace) -> int:
|
|
110
|
+
for path in sync(args.target, args.components):
|
|
111
|
+
print(path)
|
|
112
|
+
return 0
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def tokens(args: argparse.Namespace) -> int:
|
|
116
|
+
if args.docs:
|
|
117
|
+
for name, text in doc_pages().items():
|
|
118
|
+
target = args.docs / name
|
|
119
|
+
target.parent.mkdir(parents=True, exist_ok=True)
|
|
120
|
+
if args.check:
|
|
121
|
+
if not target.exists() or target.read_text() != text:
|
|
122
|
+
print(f"{target} is stale; run `abilian-ds tokens --docs {args.docs}`")
|
|
123
|
+
return 1
|
|
124
|
+
else:
|
|
125
|
+
target.write_text(text)
|
|
126
|
+
print(target)
|
|
127
|
+
if args.check:
|
|
128
|
+
return 0
|
|
129
|
+
reference = generate()
|
|
130
|
+
if args.check:
|
|
131
|
+
if not args.out.exists() or args.out.read_text() != reference:
|
|
132
|
+
print(f"{args.out} is stale; run `abilian-ds tokens`")
|
|
133
|
+
return 1
|
|
134
|
+
return 0
|
|
135
|
+
args.out.write_text(reference)
|
|
136
|
+
print(args.out)
|
|
137
|
+
return 0
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def lint(args: argparse.Namespace) -> int:
|
|
141
|
+
# The vocabulary is whatever the loaded stylesheets define — ours, vendored by `sync`,
|
|
142
|
+
# or a project's own prebuilt sheet (Tabler, Bootstrap) when the design layer is
|
|
143
|
+
# external. There used to be a second path that shelled out to Tailwind to find out;
|
|
144
|
+
# the utilities it asked about have not existed here for a long time.
|
|
145
|
+
sheets = args.stylesheet or [args.theme / ENTRY]
|
|
146
|
+
generated = stylesheet_classes(sheets)
|
|
147
|
+
findings = check_duplicate_rules(sheets, args.prefix)
|
|
148
|
+
# A vendored copy is an escape hatch unless it is provably ours, so it is hashed —
|
|
149
|
+
# but only when the project vendored one. Nothing to hash is not a finding.
|
|
150
|
+
#
|
|
151
|
+
# This used to be skipped whenever `stylesheet` was configured, on the reasoning that a
|
|
152
|
+
# project bringing its own sheet has nothing of ours to hash. Those are two questions,
|
|
153
|
+
# not one: `stylesheet` says what defines the vocabulary, and `exists()` already says
|
|
154
|
+
# whether we vendored anything. Conflating them turned the gate off for every project
|
|
155
|
+
# that loads a second stylesheet as well as ours — including this repo's own demo, the
|
|
156
|
+
# one project that actually vendors. Found by editing the vendored copy to prove the
|
|
157
|
+
# gate worked, and getting `0 finding(s)`.
|
|
158
|
+
if (args.theme / ENTRY).exists():
|
|
159
|
+
findings += check_synced(args.theme, args.components)
|
|
160
|
+
expects = required_children(sheets)
|
|
161
|
+
allowed = load_allowlist(args.allow)
|
|
162
|
+
routes = load_routes(args.app) if args.app else None
|
|
163
|
+
|
|
164
|
+
used: set[str] = set()
|
|
165
|
+
sources: list[str] = []
|
|
166
|
+
templates, missing = templates_in(args.paths)
|
|
167
|
+
findings += missing
|
|
168
|
+
for path in templates:
|
|
169
|
+
text = path.read_text()
|
|
170
|
+
findings += check_template(path, text, generated, allowed, routes)
|
|
171
|
+
findings += check_structure(path, text, expects)
|
|
172
|
+
used |= {
|
|
173
|
+
token for match in CLASS_ATTR.finditer(text) for token in class_tokens(match.group(2))
|
|
174
|
+
}
|
|
175
|
+
sources.append(text)
|
|
176
|
+
# A class name can ship from somewhere other than a `class=` attribute: a row's tone
|
|
177
|
+
# assembled in Python, a state class a script adds. For "is this dead?" the question is
|
|
178
|
+
# only whether the name is mentioned anywhere that ships, so the same templates plus the
|
|
179
|
+
# files named in `usage` are scanned as plain text. `unknown-class` stays strict about
|
|
180
|
+
# attributes — the two rules ask different questions and want different evidence.
|
|
181
|
+
sources += [path.read_text() for path in args.usage]
|
|
182
|
+
for text in sources:
|
|
183
|
+
used |= {name for name in generated if re.search(rf"\b{re.escape(name)}\b", text)}
|
|
184
|
+
# ...but only when the whole corpus was read, and only for the project that OWNS the
|
|
185
|
+
# stylesheet. "Nobody uses this class" is a question about every template there is; asked
|
|
186
|
+
# of one file it answers that 187 of them are dead, which is what the write-time hook did
|
|
187
|
+
# to the first template it was pointed at. Asked of a CONSUMER it is not a question at all
|
|
188
|
+
# — an application is supposed to use the part of the vocabulary it needs, and a first
|
|
189
|
+
# adopter with one page got 224 findings and a non-zero exit for a page with nothing wrong
|
|
190
|
+
# with it. A rule that cannot be evaluated from the evidence in front of it must not
|
|
191
|
+
# pretend to be, so this one is opt-in: `unused = true` in `[tool.abilian-ds]`.
|
|
192
|
+
if args.prefix and args.corpus and args.unused:
|
|
193
|
+
findings += check_unused(generated, used, args.prefix)
|
|
194
|
+
|
|
195
|
+
for finding in findings:
|
|
196
|
+
print(finding)
|
|
197
|
+
print(f"{len(findings)} finding(s)")
|
|
198
|
+
return 1 if findings else 0
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
def main() -> int:
|
|
202
|
+
config = project_defaults()
|
|
203
|
+
parser = argparse.ArgumentParser(prog="abilian-ds")
|
|
204
|
+
commands = parser.add_subparsers(dest="command", required=True)
|
|
205
|
+
|
|
206
|
+
sync_cmd = commands.add_parser("sync", help="copy the stylesheet and macros into this project")
|
|
207
|
+
sync_cmd.add_argument("--target", type=Path, default=Path(config.get("theme", DEFAULT_TARGET)))
|
|
208
|
+
sync_cmd.add_argument(
|
|
209
|
+
"--components",
|
|
210
|
+
type=Path,
|
|
211
|
+
default=Path(config.get("components", DEFAULT_COMPONENTS)),
|
|
212
|
+
)
|
|
213
|
+
sync_cmd.set_defaults(handler=sync_command)
|
|
214
|
+
|
|
215
|
+
tokens_cmd = commands.add_parser("tokens", help="generate the token reference")
|
|
216
|
+
tokens_cmd.add_argument("--out", type=Path, default=Path("TOKENS.md"))
|
|
217
|
+
tokens_cmd.add_argument("--check", action="store_true", help="fail if the file is stale")
|
|
218
|
+
tokens_cmd.add_argument(
|
|
219
|
+
"--docs",
|
|
220
|
+
type=Path,
|
|
221
|
+
default=None,
|
|
222
|
+
help="also write the documentation site's reference pages here",
|
|
223
|
+
)
|
|
224
|
+
tokens_cmd.set_defaults(handler=tokens)
|
|
225
|
+
|
|
226
|
+
lint_cmd = commands.add_parser("lint", help="check templates against the design system")
|
|
227
|
+
# `corpus` records whether the paths came from the config or from the command line,
|
|
228
|
+
# because some rules are only answerable over the whole set — see `check_unused`.
|
|
229
|
+
configured = [Path(p) for p in config.get("templates", [DEFAULT_TEMPLATES])]
|
|
230
|
+
lint_cmd.add_argument(
|
|
231
|
+
"paths",
|
|
232
|
+
nargs="*",
|
|
233
|
+
type=Path,
|
|
234
|
+
default=configured,
|
|
235
|
+
help="templates or directories to check",
|
|
236
|
+
)
|
|
237
|
+
lint_cmd.add_argument(
|
|
238
|
+
"--unused",
|
|
239
|
+
action="store_true",
|
|
240
|
+
default=bool(config.get("unused", False)),
|
|
241
|
+
help="also report classes the stylesheet defines that no template uses "
|
|
242
|
+
"(for the project that owns the stylesheet, not for a consumer)",
|
|
243
|
+
)
|
|
244
|
+
lint_cmd.add_argument(
|
|
245
|
+
"--usage",
|
|
246
|
+
type=Path,
|
|
247
|
+
nargs="*",
|
|
248
|
+
default=[Path(p) for p in config.get("usage", [])],
|
|
249
|
+
help="extra files that may name a class (Python, JS)",
|
|
250
|
+
)
|
|
251
|
+
lint_cmd.add_argument(
|
|
252
|
+
"--prefix",
|
|
253
|
+
default=config.get("prefix", ""),
|
|
254
|
+
help="flag classes with this prefix that no template uses",
|
|
255
|
+
)
|
|
256
|
+
lint_cmd.add_argument(
|
|
257
|
+
"--stylesheet",
|
|
258
|
+
type=Path,
|
|
259
|
+
nargs="*",
|
|
260
|
+
default=[Path(p) for p in config.get("stylesheet", [])],
|
|
261
|
+
help="stylesheets that define the vocabulary; defaults to the vendored one",
|
|
262
|
+
)
|
|
263
|
+
lint_cmd.add_argument(
|
|
264
|
+
"--theme",
|
|
265
|
+
type=Path,
|
|
266
|
+
default=Path(config.get("theme", DEFAULT_TARGET)),
|
|
267
|
+
help="directory `sync` vendored the stylesheet into",
|
|
268
|
+
)
|
|
269
|
+
lint_cmd.add_argument(
|
|
270
|
+
"--components",
|
|
271
|
+
type=Path,
|
|
272
|
+
default=Path(config.get("components", DEFAULT_COMPONENTS)),
|
|
273
|
+
help="directory holding the vendored component macros",
|
|
274
|
+
)
|
|
275
|
+
lint_cmd.add_argument(
|
|
276
|
+
"--allow",
|
|
277
|
+
type=Path,
|
|
278
|
+
default=Path(config.get("allow", DEFAULT_ALLOW)),
|
|
279
|
+
help="project allowlist of classes no stylesheet here defines",
|
|
280
|
+
)
|
|
281
|
+
lint_cmd.add_argument(
|
|
282
|
+
"--app",
|
|
283
|
+
default=config.get("app"),
|
|
284
|
+
help="Litestar app as module:attr, enabling the hx-* endpoint check",
|
|
285
|
+
)
|
|
286
|
+
lint_cmd.set_defaults(handler=lint)
|
|
287
|
+
|
|
288
|
+
args = parser.parse_args()
|
|
289
|
+
if args.command == "lint":
|
|
290
|
+
args.corpus = args.paths == configured
|
|
291
|
+
return args.handler(args)
|
abilian_ds/css/ads.css
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* The one stylesheet a consumer links.
|
|
2
|
+
*
|
|
3
|
+
* The parts were enumerated in every page template — four lists that had to be edited in
|
|
4
|
+
* step to add a file, and they had already drifted (the auth shell hand-picked a subset,
|
|
5
|
+
* so a component used there was styled on one page and not the next). The order IS the
|
|
6
|
+
* cascade, and an order that lives in five places is not an order.
|
|
7
|
+
*
|
|
8
|
+
* Knobs first (the overridable surface), then everything computed from them, then the
|
|
9
|
+
* reset, then the parts. A part never depends on another part — only on the tokens — so
|
|
10
|
+
* among the parts the order is alphabetical and means nothing.
|
|
11
|
+
*
|
|
12
|
+
* `layout.css` is the exception, and it goes LAST on purpose. Its classes are the
|
|
13
|
+
* composable set — `.ads-grid`, `.ads-stack`, `.ads-cluster`, `.ads-fill`, `.ads-muted` —
|
|
14
|
+
* and they are meant to be put ON a component: `class="ads-card__foot ads-grid"`. Both
|
|
15
|
+
* selectors are one class, so with layout first the component's own `display: flex` won
|
|
16
|
+
* on file order alone and the grid silently did nothing. A layout primitive that loses to
|
|
17
|
+
* the thing it is applied to is not a primitive.
|
|
18
|
+
*/
|
|
19
|
+
@import url("knobs.css");
|
|
20
|
+
@import url("derive.css");
|
|
21
|
+
@import url("base.css");
|
|
22
|
+
|
|
23
|
+
@import url("parts/shell.css");
|
|
24
|
+
@import url("parts/alert.css");
|
|
25
|
+
@import url("parts/button.css");
|
|
26
|
+
@import url("parts/card.css");
|
|
27
|
+
@import url("parts/content.css");
|
|
28
|
+
@import url("parts/form.css");
|
|
29
|
+
@import url("parts/indicator.css");
|
|
30
|
+
@import url("parts/nav.css");
|
|
31
|
+
@import url("parts/overlay.css");
|
|
32
|
+
@import url("parts/table.css");
|
|
33
|
+
|
|
34
|
+
@import url("parts/layout.css");
|
|
35
|
+
|
|
36
|
+
/* Last, and that is the point: it restores meaning that the parts expressed with colour,
|
|
37
|
+
* so every rule it overrides has to have been read already. Written at the end of the
|
|
38
|
+
* reset instead, it lost to `parts/button.css` and the primary button stayed unmarked. */
|
|
39
|
+
@import url("parts/forced-colors.css");
|
abilian_ds/css/base.css
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/* Reset and document defaults. Depends only on tokens. */
|
|
2
|
+
|
|
3
|
+
*, *::before, *::after { box-sizing: border-box; }
|
|
4
|
+
|
|
5
|
+
/* Anything with an intrinsic size of its own — an image, a video, a file input — will
|
|
6
|
+
* happily be wider than the box it is in, and the page scrolls sideways rather than the
|
|
7
|
+
* element shrinking. The browser gives `<input type="file">` a width from its default
|
|
8
|
+
* `size`, which is how one of these ended up 295px wide in a 192px grid cell. */
|
|
9
|
+
img, svg, video, canvas, iframe, input[type="file"] { max-width: 100%; }
|
|
10
|
+
|
|
11
|
+
/* `[hidden]` is only `display: none` by UA default, so ANY explicit display beats it —
|
|
12
|
+
* and nearly every component here sets one. Without this, the hidden attribute silently
|
|
13
|
+
* does nothing: situ's `:show` binder, a server-rendered `hidden`, a script toggling it.
|
|
14
|
+
* The `!important` is load-bearing; this is the one place it is correct. */
|
|
15
|
+
[hidden] { display: none !important; }
|
|
16
|
+
|
|
17
|
+
body {
|
|
18
|
+
margin: 0;
|
|
19
|
+
font-family: var(--ads-font);
|
|
20
|
+
font-size: var(--ads-text);
|
|
21
|
+
line-height: var(--ads-line-height);
|
|
22
|
+
color: var(--ads-ink);
|
|
23
|
+
background: var(--ads-page);
|
|
24
|
+
-webkit-font-smoothing: antialiased;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
h1, h2, h3, h4 { margin: 0 0 var(--ads-space-2); font-weight: var(--ads-weight-bold);
|
|
28
|
+
line-height: 1.25; color: var(--ads-ink-strong); }
|
|
29
|
+
h1 { font-size: var(--ads-text-xl); }
|
|
30
|
+
h2 { font-size: var(--ads-text-lg); }
|
|
31
|
+
h3 { font-size: var(--ads-text-md); }
|
|
32
|
+
h4 { font-size: var(--ads-text); }
|
|
33
|
+
p { margin: 0 0 var(--ads-space-3); }
|
|
34
|
+
small { font-size: var(--ads-text-sm); color: var(--ads-ink-muted); }
|
|
35
|
+
code, pre { font-family: var(--ads-font-mono); font-size: var(--ads-text-sm); }
|
|
36
|
+
/* the ink variant, not the knob: a brand chosen to read on white is below the
|
|
37
|
+
* contrast floor on a dark surface, and a link is the commonest text there is */
|
|
38
|
+
a { color: var(--ads-brand-ink); }
|
|
39
|
+
|
|
40
|
+
/* One focus treatment for everything, so it cannot be forgotten per component. */
|
|
41
|
+
:focus-visible {
|
|
42
|
+
outline: 2px solid var(--ads-brand);
|
|
43
|
+
outline-offset: 2px;
|
|
44
|
+
}
|
|
45
|
+
@media (forced-colors: active) {
|
|
46
|
+
:focus-visible { outline: 2px solid Highlight; }
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* Print.
|
|
50
|
+
*
|
|
51
|
+
* A business application prints: invoices, reports, a filtered list someone takes into a
|
|
52
|
+
* meeting. The application chrome is not part of that document, and a sidebar down the
|
|
53
|
+
* left of a PDF is the giveaway that nobody tried it. This is the document's own concern,
|
|
54
|
+
* not a component's, so it lives here rather than in `parts/`.
|
|
55
|
+
*
|
|
56
|
+
* `.ads-no-print` opts anything else out — a toolbar, a filter bar, an action column.
|
|
57
|
+
*/
|
|
58
|
+
@media print {
|
|
59
|
+
.ads-sidebar,
|
|
60
|
+
.ads-topbar,
|
|
61
|
+
.ads-skip,
|
|
62
|
+
.ads-toasts,
|
|
63
|
+
.ads-no-print { display: none !important; }
|
|
64
|
+
|
|
65
|
+
/* the shell is a two-column grid; on paper there is one column and no viewport */
|
|
66
|
+
.ads-app { display: block; }
|
|
67
|
+
.ads-main { overflow: visible; }
|
|
68
|
+
.ads-container { max-width: none; padding: 0; }
|
|
69
|
+
|
|
70
|
+
/* paper has no viewport, so a scroll container would print only what fits in it */
|
|
71
|
+
.ads-table-scroll, .ads-board, .ads-split > *, .ads-log { overflow: visible; max-height: none; }
|
|
72
|
+
|
|
73
|
+
/* ink is expensive and paper has no elevation */
|
|
74
|
+
body { background: #fff; }
|
|
75
|
+
.ads-card { border: 0; box-shadow: none; }
|
|
76
|
+
.ads-card,
|
|
77
|
+
.ads-table tr { break-inside: avoid; }
|
|
78
|
+
|
|
79
|
+
/* a link whose target the reader cannot click is worth spelling out, but only for
|
|
80
|
+
* real destinations — an in-page anchor or a javascript: handler prints as noise */
|
|
81
|
+
a[href^="http"]::after { content: " (" attr(href) ")"; font-size: var(--ads-text-xs); }
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* Every inline icon in the system. One declaration, and it is not decorative: an `<svg>`
|
|
85
|
+
* is a flex item like any other, `min-width: auto` resolves to zero for a replaced
|
|
86
|
+
* element with an intrinsic ratio, and a button in a narrow table cell therefore squashed
|
|
87
|
+
* its icon to nothing — an 18px-wide "Actions" control with nothing visible inside it.
|
|
88
|
+
* Size stays with the SVG's own attributes, which are the reference's. */
|
|
89
|
+
.ads-icon { flex: none; }
|