@govnepal/css 0.1.0

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Nepal Design System Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # @govnepal/css
2
+
3
+ The framework-agnostic visual layer. Semantic HTML plus `.gov-*` classes, no JavaScript. A
4
+ plain-HTML ministry site or a CMS gets the full Civic Calm interface without adopting a
5
+ component library — the four-step quick start in §10.2, minus the framework.
6
+
7
+ ```
8
+ pnpm --filter @govnepal/css build # regenerate dist/ from tokens + .guidelines + .assets
9
+ pnpm --filter @govnepal/css test
10
+ ```
11
+
12
+ ## Usage
13
+
14
+ ```html
15
+ <link rel="stylesheet" href="@govnepal/tokens/tokens.css" />
16
+ <link rel="stylesheet" href="@govnepal/css/fonts.css" />
17
+ <link rel="stylesheet" href="@govnepal/css/civic-calm.css" />
18
+ ```
19
+
20
+ `civic-calm.css` is meaningless without `tokens.css` loaded alongside it — every rule resolves a
21
+ `var(--gov-*)` the token package declares. A test enforces that contract, so if `@govnepal/tokens`
22
+ ever renames or drops a token this package still consumes, the build fails here rather than
23
+ rendering an element unstyled in production.
24
+
25
+ Semantic HTML already looks like Civic Calm before a single class is applied — that is the point
26
+ of `base.css`. Classes are for components (`.gov-button--primary`, `.gov-alert--emergency`), not
27
+ for making a heading look like a heading.
28
+
29
+ ## This package holds ALL the visual decisions
30
+
31
+ That is the deliberate split with `@govnepal/ui`:
32
+
33
+ - **`css` owns every visual decision** — colour, spacing, the type scale, all six display modes,
34
+ the print stylesheet, density. The whole visual truth of Civic Calm is here.
35
+ - **`ui` owns only behavior** — ARIA, keyboard, focus management, state. It renders these classes
36
+ and adds no styling of its own.
37
+
38
+ So a plain-HTML site, a Drupal theme, or a future Vue / Web Component port re-implements *behavior
39
+ only* — never a design decision. The design decision was made once, here.
40
+
41
+ ## Generated vs. hand-written
42
+
43
+ Anything carrying a policy **number** is generated, so no stylesheet hardcodes it:
44
+
45
+ | Generated from | Produces |
46
+ |---|---|
47
+ | `data/grid.yaml`, `data/breakpoints.yaml` | the grid variables and their per-breakpoint `@media` blocks (media queries can't read custom properties, so they're emitted) |
48
+ | the light-mode token set | the `@media print` colour block — see below |
49
+ | `design-assets/fonts/` | `fonts.css` + the woff2 files, copied and url-rewritten; never a CDN link (§9.2) |
50
+
51
+ Everything in `src/*.css` is hand-written: the visual implementation of the component specs,
52
+ consuming nothing but tokens and the generated layout variables. A test asserts that no
53
+ hand-written file contains a single hex or `rgb()` value.
54
+
55
+ ## Two rules worth knowing
56
+
57
+ **The focus ring is `box-shadow`, never `outline-offset`.** `outline-offset` leaves the element's
58
+ own background showing in the gap, so on a primary button the double ring would be blue-on-blue and
59
+ collapse into one thick edge. `box-shadow` lets the gap be an actual colour — which is what §5.2
60
+ means by "visible on any background including primary buttons and dark surfaces." A test guards it.
61
+
62
+ **Dark mode never prints dark (§5.1.5).** Print isn't a seventh display mode — it's a rendering
63
+ target that forces every semantic colour token back to its light-mode value inside `@media print`,
64
+ because a `[data-mode="dark"]` override on `:root` would otherwise still be in force on paper. That
65
+ block is generated from the token set, so even this override hardcodes no hex.
66
+
67
+ ## A known gap: the emblem
68
+
69
+ The government header renders the emblem from a verified master in `design-assets`. That directory
70
+ (`emblems/files/`) is **currently empty** — no official master exists yet, and the guidelines
71
+ prohibit redrawing, recolouring, or approximating the coat of arms (an outdated or invented emblem
72
+ is a legal error, not a style choice). So `header.css` styles a deliberately ugly
73
+ `.gov-header__emblem-missing` placeholder for development and **never draws emblem artwork** — a
74
+ test asserts the stylesheet contains no `background-image`, `mask-image`, or `content: url`. The
75
+ real emblem drops in the moment the master lands, with no CSS change.