@nyxwire/css 0.0.0-stage → 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.
Files changed (134) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +133 -2
  3. package/dist/base.css +850 -0
  4. package/dist/components.css +10508 -0
  5. package/dist/docs/components/accordion.md +83 -0
  6. package/dist/docs/components/alert.md +52 -0
  7. package/dist/docs/components/avatar.md +55 -0
  8. package/dist/docs/components/badge.md +64 -0
  9. package/dist/docs/components/breadcrumbs.md +64 -0
  10. package/dist/docs/components/button.md +197 -0
  11. package/dist/docs/components/card.md +103 -0
  12. package/dist/docs/components/checkbox.md +45 -0
  13. package/dist/docs/components/chip.md +30 -0
  14. package/dist/docs/components/cluster.md +33 -0
  15. package/dist/docs/components/code.md +65 -0
  16. package/dist/docs/components/container.md +24 -0
  17. package/dist/docs/components/dialog.md +199 -0
  18. package/dist/docs/components/divider.md +31 -0
  19. package/dist/docs/components/dl.md +24 -0
  20. package/dist/docs/components/effect-utilities.md +82 -0
  21. package/dist/docs/components/empty.md +40 -0
  22. package/dist/docs/components/frame.md +27 -0
  23. package/dist/docs/components/grid.md +31 -0
  24. package/dist/docs/components/hud.md +75 -0
  25. package/dist/docs/components/input-group.md +28 -0
  26. package/dist/docs/components/input.md +52 -0
  27. package/dist/docs/components/kbd.md +42 -0
  28. package/dist/docs/components/label-and-field.md +31 -0
  29. package/dist/docs/components/link.md +41 -0
  30. package/dist/docs/components/list.md +67 -0
  31. package/dist/docs/components/menu.md +85 -0
  32. package/dist/docs/components/meter.md +77 -0
  33. package/dist/docs/components/navbar.md +66 -0
  34. package/dist/docs/components/pagination.md +64 -0
  35. package/dist/docs/components/popover.md +59 -0
  36. package/dist/docs/components/progress.md +32 -0
  37. package/dist/docs/components/prose.md +29 -0
  38. package/dist/docs/components/select.md +51 -0
  39. package/dist/docs/components/sidebar.md +35 -0
  40. package/dist/docs/components/sidenav.md +45 -0
  41. package/dist/docs/components/skeleton.md +36 -0
  42. package/dist/docs/components/slider.md +32 -0
  43. package/dist/docs/components/spinner.md +30 -0
  44. package/dist/docs/components/stack.md +26 -0
  45. package/dist/docs/components/steps.md +49 -0
  46. package/dist/docs/components/switch.md +19 -0
  47. package/dist/docs/components/table.md +83 -0
  48. package/dist/docs/components/tabs.md +207 -0
  49. package/dist/docs/components/textarea.md +13 -0
  50. package/dist/docs/components/toast.md +86 -0
  51. package/dist/docs/components/tooltip.md +39 -0
  52. package/dist/docs/components/typography-classes.md +38 -0
  53. package/dist/docs/families/data-display.md +15 -0
  54. package/dist/docs/families/feedback.md +13 -0
  55. package/dist/docs/families/forms.md +141 -0
  56. package/dist/docs/families/layout-typography.md +17 -0
  57. package/dist/docs/families/navigation.md +13 -0
  58. package/dist/docs/families/overlays.md +13 -0
  59. package/dist/docs/families/surfaces.md +11 -0
  60. package/dist/docs/foundations/accessibility.md +71 -0
  61. package/dist/docs/foundations/color-roles.md +114 -0
  62. package/dist/docs/foundations/effects-motion.md +150 -0
  63. package/dist/docs/foundations/flavors.md +156 -0
  64. package/dist/docs/foundations/icons.md +45 -0
  65. package/dist/docs/foundations/palette.md +180 -0
  66. package/dist/docs/foundations/spacing-elevation.md +168 -0
  67. package/dist/docs/foundations/typography.md +80 -0
  68. package/dist/docs/index.md +233 -0
  69. package/dist/docs/manifest.json +859 -0
  70. package/dist/fonts/inter-OFL.txt +93 -0
  71. package/dist/fonts/inter-latin-ext-wght-italic.woff2 +0 -0
  72. package/dist/fonts/inter-latin-ext-wght-normal.woff2 +0 -0
  73. package/dist/fonts/inter-latin-wght-italic.woff2 +0 -0
  74. package/dist/fonts/inter-latin-wght-normal.woff2 +0 -0
  75. package/dist/fonts/martian-mono-OFL.txt +93 -0
  76. package/dist/fonts/martian-mono-latin-ext-wdth-normal.woff2 +0 -0
  77. package/dist/fonts/martian-mono-latin-wdth-normal.woff2 +0 -0
  78. package/dist/fonts/space-grotesk-OFL.txt +93 -0
  79. package/dist/fonts/space-grotesk-latin-ext-wght-normal.woff2 +0 -0
  80. package/dist/fonts/space-grotesk-latin-wght-normal.woff2 +0 -0
  81. package/dist/fonts.css +73 -0
  82. package/dist/nyxwire.css +12183 -0
  83. package/dist/tokens.css +579 -0
  84. package/dist/utilities.css +176 -0
  85. package/nyxwire.d.ts +2 -0
  86. package/package.json +66 -3
  87. package/skills/nyxwire/SKILL.md +63 -0
  88. package/src/base.css +158 -0
  89. package/src/components/accordion.css +280 -0
  90. package/src/components/alert.css +176 -0
  91. package/src/components/avatar.css +262 -0
  92. package/src/components/badge.css +193 -0
  93. package/src/components/breadcrumbs.css +209 -0
  94. package/src/components/btn.css +517 -0
  95. package/src/components/card.css +327 -0
  96. package/src/components/checkbox.css +202 -0
  97. package/src/components/chip.css +345 -0
  98. package/src/components/code.css +340 -0
  99. package/src/components/dialog.css +411 -0
  100. package/src/components/divider.css +201 -0
  101. package/src/components/empty.css +216 -0
  102. package/src/components/field.css +161 -0
  103. package/src/components/hud.css +212 -0
  104. package/src/components/index.css +50 -0
  105. package/src/components/input.css +383 -0
  106. package/src/components/kbd.css +197 -0
  107. package/src/components/layout.css +344 -0
  108. package/src/components/link.css +178 -0
  109. package/src/components/list.css +353 -0
  110. package/src/components/menu.css +347 -0
  111. package/src/components/meter.css +238 -0
  112. package/src/components/navbar.css +309 -0
  113. package/src/components/pagination.css +302 -0
  114. package/src/components/popover.css +352 -0
  115. package/src/components/progress.css +241 -0
  116. package/src/components/select.css +121 -0
  117. package/src/components/sidenav.css +326 -0
  118. package/src/components/skeleton.css +193 -0
  119. package/src/components/slider.css +201 -0
  120. package/src/components/spinner.css +200 -0
  121. package/src/components/stat.css +263 -0
  122. package/src/components/steps.css +311 -0
  123. package/src/components/switch.css +183 -0
  124. package/src/components/table.css +290 -0
  125. package/src/components/tabs.css +271 -0
  126. package/src/components/toast.css +413 -0
  127. package/src/components/tooltip.css +288 -0
  128. package/src/fonts.css +92 -0
  129. package/src/index.css +6 -0
  130. package/src/motion.css +177 -0
  131. package/src/semantic.css +85 -0
  132. package/src/tokens.css +276 -0
  133. package/src/typography.css +430 -0
  134. package/src/utilities.css +198 -0
@@ -0,0 +1,103 @@
1
+ # .nw-card
2
+
3
+ Part of [Surfaces](../families/surfaces.md).
4
+
5
+ A card is one padded surface with a grid gap, so content can go straight in without a body wrapper. Its parts are optional.
6
+
7
+ ```html
8
+ <article class="nw-card">
9
+ <img class="nw-card-media" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 120'%3E%3Cdefs%3E%3ClinearGradient id='g' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%236d6bff'/%3E%3Cstop offset='1' stop-color='%23d36bff'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='320' height='120' fill='url(%23g)'/%3E%3C/svg%3E" alt="" width="320" height="120" />
10
+ <header class="nw-card-header">
11
+ <h3 class="nw-card-title">Relay hel-01</h3>
12
+ <p class="nw-card-description">Helsinki edge node, 12 ms from the core.</p>
13
+ </header>
14
+ <p class="nw-card-body">Media escapes the padding but keeps the card's radius. The parts are optional: content can go straight into the card.</p>
15
+ <footer class="nw-card-footer nw-card-footer-divided nw-card-footer-end">
16
+ <button type="button" class="nw-btn nw-btn-sm nw-btn-ghost nw-btn-neutral">Details</button>
17
+ <button type="button" class="nw-btn nw-btn-sm">Open console</button>
18
+ </footer>
19
+ </article>
20
+ <article class="nw-card nw-card-sm">
21
+ <h3 class="nw-card-title">Small card</h3>
22
+ <p class="nw-card-description">Tighter padding and gap, radius md.</p>
23
+ </article>
24
+ <article class="nw-card nw-card-lg">
25
+ <h3 class="nw-card-title">Large card</h3>
26
+ <p class="nw-card-description">Roomier padding and gap, radius xl.</p>
27
+ </article>
28
+ ```
29
+
30
+ | Class | Effect |
31
+ | -------------------------- | --------------------------------------------------------------------------------------------------------- |
32
+ | `nw-card` | The surface: panel fill, hairline, radius lg, a grid gap. Solid and medium by default. |
33
+ | `nw-card-header` | Groups the title and description. |
34
+ | `nw-card-title` | The title, in the display face; use a heading element. |
35
+ | `nw-card-description` | Supporting text in the muted ink. |
36
+ | `nw-card-body` | Optional content block. |
37
+ | `nw-card-footer` | An action row. |
38
+ | `nw-card-footer-end` | Aligns the footer's actions to the end. |
39
+ | `nw-card-footer-divided` | A hairline above the footer. |
40
+ | `nw-card-media` | Full-bleed media: it escapes the padding as the first or last child, but never the radius or the chamfer. |
41
+ | `nw-card-sm`, `-md`, `-lg` | Padding 1rem, 1.5rem (default) and 2rem, with matching gap, radius and cut size. |
42
+
43
+ ## Variants and states
44
+
45
+ An intent class on a plain card changes nothing visible: the card stays neutral and spends the accent on its soft wash, its selection, its edge and its glow.
46
+
47
+ ```html
48
+ <article class="nw-card nw-card-solid"><h3 class="nw-card-title">Solid</h3><p class="nw-card-description">The panel fill (default).</p></article>
49
+ <article class="nw-card nw-card-soft nw-card-secondary"><h3 class="nw-card-title">Soft secondary</h3><p class="nw-card-description">A wash of the intent.</p></article>
50
+ <article class="nw-card nw-card-outline"><h3 class="nw-card-title">Outline</h3><p class="nw-card-description">Transparent with a hairline.</p></article>
51
+ <article class="nw-card nw-card-ghost"><h3 class="nw-card-title">Ghost</h3><p class="nw-card-description">No fill and no border.</p></article>
52
+ ```
53
+
54
+ ```html
55
+ <a class="nw-card nw-card-interactive" href="#nw-card">
56
+ <h3 class="nw-card-title">Interactive</h3>
57
+ <p class="nw-card-description">A link card: hover raises the fill, focus draws the ring.</p>
58
+ </a>
59
+ <button type="button" class="nw-card nw-card-interactive nw-card-success" aria-pressed="true">
60
+ <span class="nw-card-title">Selected (aria-pressed)</span>
61
+ <span class="nw-card-description">A tonal wash and a 1px intent edge.</span>
62
+ </button>
63
+ <div class="nw-card nw-card-interactive" aria-disabled="true">
64
+ <h3 class="nw-card-title">Disabled</h3>
65
+ <p class="nw-card-description">aria-disabled="true" mutes it.</p>
66
+ </div>
67
+ ```
68
+
69
+ | Class / selector | Effect |
70
+ | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
71
+ | `nw-card-solid` (default), `-soft`, `-outline`, `-ghost` | The surface: panel fill, intent wash, hairline only, or nothing. |
72
+ | `nw-card-primary` ... `-danger` | The accent of the soft wash, the selection, the edge and the glow. |
73
+ | `nw-card-interactive` | A pointer surface: hover raises the fill, `:active` presses, `:focus-visible` draws the ring. Use it on an `<a>` or `<button>`. |
74
+ | `nw-card-selected`, `[aria-selected="true"]`, `[aria-pressed="true"]`, `[aria-checked="true"]`, `[data-state="on"]` | Selected: a tonal wash and a 1px intent edge. |
75
+ | `[aria-disabled="true"]` | Muted and not interactive. |
76
+
77
+ ## Cut, wire and glow
78
+
79
+ ```html
80
+ <article class="nw-card nw-card-cut">
81
+ <h3 class="nw-card-title">Cut</h3>
82
+ <p class="nw-card-description">Chamfered top-right and bottom-left corners.</p>
83
+ </article>
84
+ <article class="nw-card nw-card-wire">
85
+ <h3 class="nw-card-title">Wire</h3>
86
+ <p class="nw-card-description">The indigo-to-synth gradient edge.</p>
87
+ </article>
88
+ <article class="nw-card nw-card-cut nw-card-wire nw-card-glow">
89
+ <h3 class="nw-card-title">Cut, wire and glow</h3>
90
+ <p class="nw-card-description">The glow follows the chamfer through a drop-shadow.</p>
91
+ </article>
92
+ <a class="nw-card nw-card-cut nw-card-wire nw-card-interactive nw-card-tertiary" href="#nw-card">
93
+ <h3 class="nw-card-title">Interactive cut</h3>
94
+ <p class="nw-card-description">Hover or select it to light the tertiary edge.</p>
95
+ </a>
96
+ ```
97
+
98
+ | Class | Effect |
99
+ | ------------------- | ------------------------------------------------------------------------------------------------------- |
100
+ | `nw-card-cut` | Chamfers the top-right and bottom-left corners; the cut size follows the card size. Composes with wire. |
101
+ | `nw-card-wire` | The gradient edge from primary to secondary. |
102
+ | `nw-card-glow` | A resting bloom in the intent color; on a cut card it is a `drop-shadow` that follows the chamfer. |
103
+ | `nw-card-wire-glow` | On a cut card, a bloom in the wire's colors. |
@@ -0,0 +1,45 @@
1
+ # Checkbox and radio: .nw-checkbox, .nw-radio
2
+
3
+ Part of [Forms](../families/forms.md).
4
+
5
+ Both are drawn on the native `<input>` from tokens, so `:checked`, `:indeterminate`, `:disabled` and `:focus-visible` keep working and the mark survives forced colors. The visible box is small by design, but each control has a hit area of at least 24px, and a wrapping `nw-label` makes the whole row a target.
6
+
7
+ ```html
8
+ <fieldset class="nw-field-group">
9
+ <legend class="nw-field-legend">Alerts</legend>
10
+ <label class="nw-label"><input class="nw-checkbox" type="checkbox" checked /> Latency above 100 ms</label>
11
+ <label class="nw-label"><input class="nw-checkbox" type="checkbox" /> Packet loss</label>
12
+ <label class="nw-label"><input class="nw-checkbox" type="checkbox" data-indeterminate /> Some regions (indeterminate)</label>
13
+ <label class="nw-label"><input class="nw-checkbox" type="checkbox" disabled /> Hardware faults (disabled)</label>
14
+ <label class="nw-label"><input class="nw-checkbox" type="checkbox" aria-invalid="true" /> Accept the terms (invalid)</label>
15
+ </fieldset>
16
+ <fieldset class="nw-field-group">
17
+ <legend class="nw-field-legend">Routing</legend>
18
+ <label class="nw-label"><input class="nw-radio" type="radio" name="f-route" checked /> Lowest latency</label>
19
+ <label class="nw-label">
20
+ <input class="nw-radio" type="radio" name="f-route" />
21
+ <span class="nw-label-text">Lowest cost<span class="nw-field-hint">Routes through the cheapest uplink, even if slower.</span></span>
22
+ </label>
23
+ <label class="nw-label"><input class="nw-radio" type="radio" name="f-route" disabled /> Pinned (disabled)</label>
24
+ </fieldset>
25
+ <fieldset class="nw-field-group">
26
+ <legend class="nw-field-legend">Intents and sizes</legend>
27
+ <div class="nw-cluster">
28
+ <input class="nw-checkbox nw-checkbox-sm nw-checkbox-secondary" type="checkbox" checked aria-label="Small secondary" />
29
+ <input class="nw-checkbox nw-checkbox-success" type="checkbox" checked aria-label="Success" />
30
+ <input class="nw-checkbox nw-checkbox-lg nw-checkbox-danger" type="checkbox" checked aria-label="Large danger" />
31
+ <input class="nw-radio nw-radio-sm nw-radio-tertiary" type="radio" name="f-sizes" checked aria-label="Small tertiary" />
32
+ <input class="nw-radio nw-radio-warning" type="radio" name="f-sizes" aria-label="Warning" />
33
+ <input class="nw-radio nw-radio-lg nw-radio-info" type="radio" name="f-sizes" aria-label="Large info" />
34
+ </div>
35
+ </fieldset>
36
+ ```
37
+
38
+ | Class / selector | Effect |
39
+ | ---------------------------------------------------- | -------------------------------------------------------------------------------------------- |
40
+ | `nw-checkbox`, `nw-radio` | The control. Checked and indeterminate fills take the intent; the mark is the on-accent ink. |
41
+ | `nw-checkbox-primary` ... `-danger` (same for radio) | Intent of the checked control. |
42
+ | `nw-checkbox-sm`, `-md`, `-lg` (same for radio) | 14px, 16px (default) and 20px boxes. |
43
+ | `:indeterminate` | A dash. Set it from script (`input.indeterminate = true`); there is no attribute. |
44
+ | `[aria-invalid="true"]`, `:user-invalid` | Danger border. |
45
+ | `nw-label > .nw-checkbox` | Aligns the control to the first line of a wrapping label, through the `lh` unit. |
@@ -0,0 +1,30 @@
1
+ # Chips: .nw-chip
2
+
3
+ Part of [Forms](../families/forms.md).
4
+
5
+ A chip is a filter, a selected value or a removable token. At rest it is quiet, so a row of chips does not read as a row of primary buttons; the selected state carries the intent. Select it with `aria-pressed`, `aria-checked`, `aria-selected` or `data-state="on"`, or put a checkbox or radio inside a label chip.
6
+
7
+ ```html
8
+ <div class="nw-cluster" role="group" aria-label="Filter by region">
9
+ <button type="button" class="nw-chip" aria-pressed="true"><span class="nw-chip-check" aria-hidden="true"></span>Europe</button>
10
+ <button type="button" class="nw-chip" aria-pressed="false"><span class="nw-chip-check" aria-hidden="true"></span>Americas</button>
11
+ <button type="button" class="nw-chip nw-chip-soft nw-chip-secondary" aria-pressed="true">Soft secondary</button>
12
+ <button type="button" class="nw-chip nw-chip-outline nw-chip-success" aria-pressed="true">Outline success</button>
13
+ <button type="button" class="nw-chip" disabled>Disabled</button>
14
+ </div>
15
+ <div class="nw-cluster">
16
+ <label class="nw-chip"><input type="checkbox" checked /> Label chip with a checkbox</label>
17
+ <span class="nw-chip nw-chip-sm">hel-01 <button type="button" class="nw-chip-remove" aria-label="Remove hel-01"></button></span>
18
+ <span class="nw-chip nw-chip-sm">ams-03 <button type="button" class="nw-chip-remove" aria-label="Remove ams-03"></button></span>
19
+ </div>
20
+ ```
21
+
22
+ | Class / selector | Effect |
23
+ | --------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
24
+ | `nw-chip` | The chip. Interactive on `<a>`, `<button>`, `<label>`, `[role="button"]` or anything with a `tabindex`. |
25
+ | `nw-chip-solid` (default), `-soft`, `-outline` | How the selected state is painted. |
26
+ | `nw-chip-primary` ... `-danger` | Intent of the selected state. |
27
+ | `nw-chip-xs`, `-sm`, `-md`, `-lg` | Sizes. |
28
+ | `nw-chip-check` | An indicator slot: an empty ring at rest, a check when selected. The slot exists in both states, so the chip keeps its width. |
29
+ | `nw-chip-remove` | A remove button drawn as a cross. Give it an `aria-label`. |
30
+ | `nw-chip-disabled`, `:disabled`, `[aria-disabled="true"]` | Disabled chip, also when its inner input is disabled. |
@@ -0,0 +1,33 @@
1
+ # .nw-cluster
2
+
3
+ Part of [Layout and typography](../families/layout-typography.md).
4
+
5
+ `nw-cluster` is a wrapping row of boxes: controls, chips, metadata.
6
+
7
+ ```html
8
+ <div class="nw-cluster">
9
+ <span class="nw-badge nw-badge-soft">Wrapping</span>
10
+ <span class="nw-badge nw-badge-soft">Row</span>
11
+ <span class="nw-badge nw-badge-soft">Of</span>
12
+ <span class="nw-badge nw-badge-soft">Boxes</span>
13
+ <span class="nw-badge nw-badge-soft">That</span>
14
+ <span class="nw-badge nw-badge-soft">Wrap</span>
15
+ </div>
16
+ <div class="nw-cluster nw-cluster-between">
17
+ <span>Between spreads</span>
18
+ <span>its ends</span>
19
+ </div>
20
+ <div class="nw-cluster nw-cluster-top">
21
+ <span class="nw-card nw-card-sm">Top-aligned</span>
22
+ <span class="nw-card">Taller box</span>
23
+ </div>
24
+ ```
25
+
26
+ | Class / property | Effect |
27
+ | ------------------------------------------------- | -------------------------------------------- |
28
+ | `nw-cluster` | A wrapping, centered row with a 0.75rem gap. |
29
+ | `nw-cluster-start`, `-center`, `-end`, `-between` | Alignment of the row. |
30
+ | `nw-cluster-baseline` | Baseline-aligned (text rows of mixed sizes). |
31
+ | `nw-cluster-top` | Top-aligned. |
32
+ | `nw-cluster-nowrap` | One line, clipped at the end. |
33
+ | `nw-cluster-xs` ... `nw-cluster-xl` | Gaps 0.25rem to 2.5rem. |
@@ -0,0 +1,65 @@
1
+ # .nw-code and .nw-pre
2
+
3
+ Part of [Data display](../families/data-display.md).
4
+
5
+ `nw-code` marks inline code on a sunken well; it follows the size of its text unless pinned with a size class.
6
+
7
+ ```html
8
+ <p>
9
+ Inline code: set <code class="nw-code">--nw-cut</code> on any element. Wrapped:
10
+ <code class="nw-code nw-code-wrap">a-very-long-kebab-case-token-name-that-wraps</code>. Plain, no well:
11
+ <code class="nw-code nw-code-plain">data-flavor</code>. Pinned sizes:
12
+ <code class="nw-code nw-code-xs">xs</code>, <code class="nw-code nw-code-lg">lg</code>.
13
+ </p>
14
+ <p>
15
+ Intent inks: <code class="nw-code nw-code-success">200 OK</code>,
16
+ <code class="nw-code nw-code-danger">418</code>, <code class="nw-code nw-code-warning">deprecated</code>.
17
+ </p>
18
+ ```
19
+
20
+ `nw-pre` is the block: an optional header (filename, language, actions), line numbers, highlighted, added and removed lines, a terminal mode, and the cut-corner console.
21
+
22
+ ```html
23
+ <figure class="nw-pre">
24
+ <figcaption class="nw-pre-header">
25
+ <span class="nw-pre-filename">relay.ts</span>
26
+ <span class="nw-pre-lang">ts</span>
27
+ <span class="nw-pre-actions"><button type="button" class="nw-btn nw-btn-xs nw-btn-ghost">Copy</button></span>
28
+ </figcaption>
29
+ <code class="nw-pre-body">
30
+ <span class="nw-line nw-line-highlight">export const relay = {</span>
31
+ <span class="nw-line"> id: 'hel-01',</span>
32
+ <span class="nw-line nw-line-add"> region: 'eu-north',</span>
33
+ <span class="nw-line nw-line-del"> zone: 'eu',</span>
34
+ <span class="nw-line">}</span>
35
+ </code>
36
+ </figure>
37
+ <pre class="nw-pre nw-pre-lines"><code><span class="nw-line">export const up = () =&gt; 1</span>
38
+ <span class="nw-line">export const down = () =&gt; -1</span>
39
+ <span class="nw-line nw-line-focus">export const focus = () =&gt; 0</span></code></pre>
40
+ <div class="nw-pre nw-pre-terminal">
41
+ <code class="nw-pre-body"><span class="nw-prompt"></span>nyxwire deploy --relay hel-01
42
+ <span class="nw-output">Relay hel-01 is live in 1.4 s.</span></code>
43
+ </div>
44
+ <div class="nw-pre nw-pre-cut nw-pre-wire nw-pre-sm">
45
+ <code class="nw-pre-body">.nw-pre-cut { clip-path: var(--nw-cut-path) }</code>
46
+ </div>
47
+ ```
48
+
49
+ | Class | Effect |
50
+ | -------------------------------------------------- | -------------------------------------------------------------------------------------- |
51
+ | `nw-pre` | The block: sunken fill, hairline, radius lg. The scrolling box is the inner `<code>`. |
52
+ | `nw-pre-header` | The header row; it stays put while the body scrolls. |
53
+ | `nw-pre-filename`, `nw-pre-lang`, `nw-pre-actions` | The file name, the language tag and the action slot. |
54
+ | `nw-pre-body` | The scrolling body, for markup whose code element is not the direct child. |
55
+ | `nw-pre-caption` | A caption row under the block, ruled off. |
56
+ | `nw-pre-lines` | Line numbers, counted in CSS so the source stays clean. |
57
+ | `nw-line` | One source line, spanning the block's full width so a wash reaches the edges. |
58
+ | `nw-line-highlight` | A tonal wash on the line. |
59
+ | `nw-line-add`, `nw-line-del` | Added and removed lines, with their sign in the gutter. |
60
+ | `nw-line-focus` | A focused line; the others dim until the block is hovered. |
61
+ | `nw-pre-terminal` | Terminal mode: a prompt glyph before each command line; `.nw-output` lines carry none. |
62
+ | `nw-pre-cut` | The chamfered console, with the wire as its edge when combined with `nw-pre-wire`. |
63
+ | `nw-pre-wire` | The gradient edge around the block. |
64
+ | `nw-pre-xs` ... `-lg` | Block sizes. |
65
+ | `nw-pre-wrap` | Wraps lines instead of scrolling. |
@@ -0,0 +1,24 @@
1
+ # .nw-container
2
+
3
+ Part of [Layout and typography](../families/layout-typography.md).
4
+
5
+ A centered column with gutters. `--nw-container-max` overrides the width of one container, `--nw-container-pad` its gutter.
6
+
7
+ ```html
8
+ <div class="nw-stack nw-stack-sm">
9
+ <div class="nw-container nw-container-xs" style="block-size: 2.5rem; background: var(--nw-canvas-sunken)">xs 32rem</div>
10
+ <div class="nw-container nw-container-sm" style="block-size: 2.5rem; background: var(--nw-canvas-sunken)">sm 40rem</div>
11
+ <div class="nw-container" style="block-size: 2.5rem; background: var(--nw-canvas-sunken)">md 72rem (default)</div>
12
+ <div class="nw-container nw-container-xl" style="block-size: 2.5rem; background: var(--nw-canvas-sunken)">xl 90rem</div>
13
+ </div>
14
+ ```
15
+
16
+ | Class / property | Effect |
17
+ | ------------------------------------------ | ------------------------------------------------- |
18
+ | `nw-container` | A centered column, `min(72rem, 100% - 2 * 1rem)`. |
19
+ | `nw-container-xs` ... `nw-container-xl` | 32rem, 40rem, 56rem, 72rem (default) and 90rem. |
20
+ | `nw-container-prose` | A 68ch measure for reading pages. |
21
+ | `nw-container-fluid` | Full width, still centered (for a bounded strip). |
22
+ | `nw-container-start` | Left-aligned instead of centered. |
23
+ | `nw-container-flush` | No gutters, for a strip inside its own padding. |
24
+ | `--nw-container-max`, `--nw-container-pad` | One container's width and gutter. |
@@ -0,0 +1,199 @@
1
+ # .nw-dialog
2
+
3
+ Part of [Overlays](../families/overlays.md).
4
+
5
+ `nw-dialog` styles a native `<dialog>`. Open it modally with `dialog.showModal()`: the browser puts it in the top layer, draws the `::backdrop`, traps focus, closes on Escape and returns focus to the opener. `dialog.show()` opens it non-modally, inline.
6
+
7
+ The demos use one delegated script: `data-open="#id"` on a button calls `showModal()`, and `data-close` on a button inside calls `close()`.
8
+
9
+ ```html
10
+ <div class="nw-cluster">
11
+ <button type="button" class="nw-btn" data-open="#dlg-md">Open dialog</button>
12
+ <button type="button" class="nw-btn nw-btn-soft nw-btn-danger" data-open="#dlg-danger">Danger dialog</button>
13
+ <button type="button" class="nw-btn nw-btn-outline nw-btn-secondary" data-open="#dlg-cut">Cut and wired</button>
14
+ <button type="button" class="nw-btn nw-btn-outline nw-btn-secondary" data-open="#drw-right">Drawer right</button>
15
+ <button type="button" class="nw-btn nw-btn-outline nw-btn-secondary" data-open="#drw-bottom">Drawer bottom</button>
16
+ </div>
17
+ <dialog class="nw-dialog" id="dlg-md" aria-labelledby="dlg-md-title">
18
+ <header class="nw-dialog-header">
19
+ <h2 class="nw-dialog-title" id="dlg-md-title">Reroute sector 7?</h2>
20
+ <p class="nw-dialog-description">Traffic moves to the nearest healthy relay. Active sessions drop.</p>
21
+ <button type="button" class="nw-dialog-close" data-close aria-label="Close"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18"/></svg></button>
22
+ </header>
23
+ <div class="nw-dialog-body">
24
+ <p>The body scrolls on its own when it overflows. The header, the body and the footer are optional parts.</p>
25
+ </div>
26
+ <footer class="nw-dialog-footer">
27
+ <span class="nw-dialog-footer-start nw-text-subtle">Sessions: 312</span>
28
+ <button type="button" class="nw-btn nw-btn-ghost nw-btn-neutral" data-close>Cancel</button>
29
+ <button type="button" class="nw-btn" data-close>Reroute</button>
30
+ </footer>
31
+ </dialog>
32
+ <dialog class="nw-dialog nw-dialog-sm nw-dialog-danger" id="dlg-danger" aria-labelledby="dlg-danger-title">
33
+ <header class="nw-dialog-header">
34
+ <h2 class="nw-dialog-title" id="dlg-danger-title">Drop node fra-02?</h2>
35
+ <p class="nw-dialog-description">A destructive flow: the edge and the glow turn danger.</p>
36
+ </header>
37
+ <footer class="nw-dialog-footer">
38
+ <button type="button" class="nw-btn nw-btn-ghost nw-btn-neutral" data-close autofocus>Keep</button>
39
+ <button type="button" class="nw-btn nw-btn-danger" data-close>Drop</button>
40
+ </footer>
41
+ </dialog>
42
+ <dialog class="nw-dialog nw-dialog-lg nw-dialog-cut nw-dialog-secondary" id="dlg-cut" aria-labelledby="dlg-cut-title">
43
+ <header class="nw-dialog-header">
44
+ <h2 class="nw-dialog-title" id="dlg-cut-title">Cut dialog</h2>
45
+ <button type="button" class="nw-dialog-close" data-close aria-label="Close"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18"/></svg></button>
46
+ </header>
47
+ <div class="nw-dialog-body"><p>Cut corners and the secondary intent edge. The glow follows the chamfer through a drop-shadow.</p></div>
48
+ <footer class="nw-dialog-footer"><button type="button" class="nw-btn" data-close>Done</button></footer>
49
+ </dialog>
50
+ <dialog class="nw-dialog nw-dialog-drawer" id="drw-right" aria-labelledby="drw-right-title">
51
+ <header class="nw-dialog-header">
52
+ <h2 class="nw-dialog-title" id="drw-right-title">Node list</h2>
53
+ <button type="button" class="nw-dialog-close" data-close aria-label="Close"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18"/></svg></button>
54
+ </header>
55
+ <div class="nw-dialog-body"><p>A drawer is the same dialog docked to a viewport edge; this one slides in from the inline-end.</p></div>
56
+ <footer class="nw-dialog-footer"><button type="button" class="nw-btn" data-close>Done</button></footer>
57
+ </dialog>
58
+ <dialog class="nw-dialog nw-dialog-drawer nw-dialog-drawer-bottom" id="drw-bottom" aria-labelledby="drw-bottom-title">
59
+ <header class="nw-dialog-header">
60
+ <h2 class="nw-dialog-title" id="drw-bottom-title">Bottom sheet</h2>
61
+ <button type="button" class="nw-dialog-close" data-close aria-label="Close"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18"/></svg></button>
62
+ </header>
63
+ <div class="nw-dialog-body">Docked to the bottom edge.</div>
64
+ </dialog>
65
+ ```
66
+
67
+ ```js title="native-behaviors.js"
68
+ // Native behaviors for the plain-HTML component demos. The nw-* classes need none of this; it only
69
+ // wires the platform features and the documented state attributes the markup relies on.
70
+ export function bindNativeBehaviors() {
71
+ document.addEventListener('click', (event) => {
72
+ const target = event.target
73
+ if (!(target instanceof Element)) return
74
+
75
+ // [data-open="#id"] opens a modal <dialog>; [data-close] closes the dialog it sits in.
76
+ const opener = target.closest('[data-open]')
77
+ if (opener) {
78
+ const dialog = document.querySelector(opener.getAttribute('data-open'))
79
+ if (dialog instanceof HTMLDialogElement && !dialog.open) dialog.showModal()
80
+ return
81
+ }
82
+ const closer = target.closest('[data-close]')
83
+ if (closer) {
84
+ closer.closest('dialog')?.close()
85
+ return
86
+ }
87
+
88
+ // [data-toggle="#id"] flips aria-expanded on the trigger and data-state on the target, the
89
+ // contract of the navbar collapse region and of collapsible sidenav groups.
90
+ const toggle = target.closest('[data-toggle]')
91
+ if (toggle) {
92
+ const region = document.querySelector(toggle.getAttribute('data-toggle'))
93
+ const open = toggle.getAttribute('aria-expanded') !== 'true'
94
+ toggle.setAttribute('aria-expanded', String(open))
95
+ region?.setAttribute('data-state', open ? 'open' : 'closed')
96
+ return
97
+ }
98
+
99
+ // [data-toast="#template"] stamps the template's toast into the region that holds the template;
100
+ // [data-dismiss] plays the toast's exit (data-state="closed") and removes it once it ends.
101
+ const notifier = target.closest('[data-toast]')
102
+ if (notifier) {
103
+ const template = document.querySelector(notifier.getAttribute('data-toast'))
104
+ if (template instanceof HTMLTemplateElement) {
105
+ template.parentElement?.append(template.content.cloneNode(true))
106
+ }
107
+ return
108
+ }
109
+ const toast = target.closest('[data-dismiss]')?.closest('.nw-toast')
110
+ if (toast) {
111
+ toast.setAttribute('data-state', 'closed')
112
+ Promise.all(toast.getAnimations().map((animation) => animation.finished)).then(() =>
113
+ toast.remove(),
114
+ )
115
+ }
116
+ })
117
+
118
+ // Range inputs: WebKit and Blink have no progress pseudo-element, so the fill reads
119
+ // --_slider-value. An <output for="id"> mirrors the value.
120
+ const paintSlider = (slider) => {
121
+ const min = Number(slider.min || 0)
122
+ const max = Number(slider.max || 100)
123
+ const percent = ((Number(slider.value) - min) / (max - min)) * 100
124
+ slider.style.setProperty('--_slider-value', `${percent}%`)
125
+ for (const output of document.querySelectorAll('output')) {
126
+ if (output.htmlFor.contains(slider.id)) output.value = slider.value
127
+ }
128
+ }
129
+ for (const slider of document.querySelectorAll('input.nw-slider')) paintSlider(slider)
130
+ document.addEventListener('input', (event) => {
131
+ if (event.target instanceof HTMLInputElement && event.target.matches('.nw-slider'))
132
+ paintSlider(event.target)
133
+ })
134
+
135
+ // Tab lists: click and arrow keys move selection (roving tabindex), Home and End jump.
136
+ for (const tabs of document.querySelectorAll('[data-tabs]')) {
137
+ const list = tabs.querySelector('[role="tablist"]')
138
+ if (!list) continue
139
+ const vertical = list.getAttribute('aria-orientation') === 'vertical'
140
+ const enabledTabs = () => [...list.querySelectorAll('[role="tab"]:not(:disabled)')]
141
+
142
+ const select = (tab, focus) => {
143
+ for (const item of list.querySelectorAll('[role="tab"]')) {
144
+ const selected = item === tab
145
+ item.setAttribute('aria-selected', String(selected))
146
+ item.tabIndex = selected ? 0 : -1
147
+ const panel = document.getElementById(item.getAttribute('aria-controls'))
148
+ if (panel) panel.hidden = !selected
149
+ }
150
+ if (focus) tab.focus()
151
+ }
152
+
153
+ list.addEventListener('click', (event) => {
154
+ const tab = event.target instanceof Element ? event.target.closest('[role="tab"]') : null
155
+ if (tab && !tab.disabled) select(tab, false)
156
+ })
157
+
158
+ list.addEventListener('keydown', (event) => {
159
+ const all = enabledTabs()
160
+ const index = all.indexOf(document.activeElement)
161
+ if (index < 0) return
162
+ const previousKey = vertical ? 'ArrowUp' : 'ArrowLeft'
163
+ const nextKey = vertical ? 'ArrowDown' : 'ArrowRight'
164
+ let next
165
+ if (event.key === nextKey) next = all[(index + 1) % all.length]
166
+ else if (event.key === previousKey) next = all[(index - 1 + all.length) % all.length]
167
+ else if (event.key === 'Home') next = all[0]
168
+ else if (event.key === 'End') next = all[all.length - 1]
169
+ if (!next) return
170
+ event.preventDefault()
171
+ select(next, true)
172
+ })
173
+ }
174
+
175
+ // The indeterminate state of a checkbox has no attribute; it is a DOM property.
176
+ for (const box of document.querySelectorAll('[data-indeterminate]')) box.indeterminate = true
177
+ }
178
+ ```
179
+
180
+ Always name the dialog with `aria-labelledby` (pointing at the title) or `aria-label`. Put `autofocus` on the safest control of a destructive dialog, as the danger example does.
181
+
182
+ | Class | Effect |
183
+ | --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
184
+ | `nw-dialog` | The panel, medium by default: sunken fill, hairline, radius lg, an enter animation, a dimmed blurred `::backdrop`. |
185
+ | `nw-dialog-xs`, `-sm`, `-md`, `-lg`, `-xl`, `-full` | Widths 20rem, 24rem, 32rem (default), 44rem, 60rem and full viewport. Under 40rem every dialog becomes full-width. |
186
+ | `nw-dialog-header` | The header part. |
187
+ | `nw-dialog-title` | The title; use a heading element. |
188
+ | `nw-dialog-description` | Supporting text under the title. |
189
+ | `nw-dialog-close` | Close button in the header corner; needs an `aria-label`. |
190
+ | `nw-dialog-body` | The scrolling content area; it carries the outer padding when there is no header or footer. |
191
+ | `nw-dialog-footer` | The action row, pinned to the bottom. |
192
+ | `nw-dialog-footer-start` | Pushes a footer item to the start, for a note beside the actions. |
193
+ | `nw-dialog-primary` ... `-danger` | Intents color the edge and the glow; the text stays the foreground. |
194
+ | `nw-dialog-glow` | A resting bloom in the intent color. |
195
+ | `nw-dialog-cut` | Cut corners, painted so focus rings and child popovers are not clipped; the glow follows the chamfer. |
196
+ | `nw-dialog-drawer` | Docks to a viewport edge, inline-end by default. |
197
+ | `nw-dialog-drawer-left`, `-top`, `-bottom` | The edge for a drawer. |
198
+ | `[open]`, `[data-state="open"]` | The visible state; the enter animation plays on open, the leave animation on `data-state="closed"`. |
199
+ | `.nw-dialog-backdrop` | A scrim element for a library-driven dialog that is not a native `<dialog>`. |
@@ -0,0 +1,31 @@
1
+ # .nw-divider
2
+
3
+ Part of [Data display](../families/data-display.md).
4
+
5
+ A hairline between regions, on `<hr>` or `div role="separator"`. Text inside it sits in the line, set in the mono eyebrow face; a divider with no content runs one line the whole way.
6
+
7
+ ```html
8
+ <div class="nw-stack nw-stack-sm">
9
+ <hr class="nw-divider" />
10
+ <hr class="nw-divider nw-divider-strong" />
11
+ <hr class="nw-divider nw-divider-dashed" />
12
+ <div class="nw-divider nw-divider-fade">fade</div>
13
+ <div class="nw-divider nw-divider-wire">wire</div>
14
+ <div class="nw-divider nw-divider-wire nw-divider-glow">wire + glow</div>
15
+ <div class="nw-divider nw-divider-success">success</div>
16
+ <p>A vertical one between inline items: <span class="nw-cluster nw-cluster-sm"><span>Latency</span><span class="nw-divider nw-divider-vertical"></span><span>12 ms</span></span></p>
17
+ </div>
18
+ ```
19
+
20
+ | Class | Effect |
21
+ | ------------------------------------ | ------------------------------------------------------------------- |
22
+ | `nw-divider` | The hairline. |
23
+ | `nw-divider-start`, `-end` | The line runs only from the text's far side. |
24
+ | `nw-divider-dashed` | A dashed line. |
25
+ | `nw-divider-strong`, `-bright` | A heavier line; the `--nw-line-bright` line. |
26
+ | `nw-divider-fade` | The line fades out toward both ends. |
27
+ | `nw-divider-wire` | The signature gradient, primary to secondary across the whole rule. |
28
+ | `nw-divider-glow` | The line blooms. |
29
+ | `nw-divider-primary` ... `-danger` | The line's and the text's intent. |
30
+ | `nw-divider-vertical` | A vertical rule that stretches to its row's height. |
31
+ | `nw-divider-xs`, `-sm`, `-md`, `-lg` | The space the divider takes around itself. |
@@ -0,0 +1,24 @@
1
+ # .nw-dl
2
+
3
+ Part of [Data display](../families/data-display.md).
4
+
5
+ A description list pairs terms with details: terms in the mono eyebrow face beside their details.
6
+
7
+ ```html
8
+ <dl class="nw-dl">
9
+ <div><dt>Node</dt><dd>hel-01</dd></div>
10
+ <div><dt>Region</dt><dd>Helsinki, eu-north</dd></div>
11
+ <div><dt>Latency</dt><dd>12 ms</dd></div>
12
+ <div><dt>Status</dt><dd>Online since 04:12</dd></div>
13
+ </dl>
14
+ <dl class="nw-dl nw-dl-stacked">
15
+ <dt>Node</dt><dd>hel-01</dd>
16
+ <dt>Region</dt><dd>Helsinki, eu-north</dd>
17
+ </dl>
18
+ ```
19
+
20
+ | Class | Effect |
21
+ | --------------- | ------------------------------------------------------------------- |
22
+ | `nw-dl` | Terms in a fixed inline column, details flowing; wraps under 40rem. |
23
+ | `nw-dl-stacked` | Each pair on its own lines. |
24
+ | `nw-dl-divided` | A hairline between pairs. |