@rickycourtes/designrail 0.2.1 → 0.3.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.
@@ -11,6 +11,22 @@
11
11
  Knobs (set them on a variant of your own, never restyle .btn where it is used):
12
12
  --btn-h --btn-line --btn-radius --btn-bg --btn-bg-hover --btn-bg-press
13
13
  --btn-fg --btn-fg-hover --btn-rim --btn-rim-w --btn-font-size --btn-gap
14
+ --btn-pad-x (side pad; default derived from the height) --btn-pad-y (0)
15
+ --btn-font (the font shorthand; default composed from --weight-strong,
16
+ --btn-font-size, --btn-line, --font-ui) --btn-lift (a filter on hover,
17
+ none) --btn-press (the press transform, scale(0.98)) --btn-blur (a
18
+ backdrop-filter, none) --btn-text-wrap (nowrap) --btn-align (center:
19
+ justify-content) --btn-text-align (center: text-align, for a label that
20
+ wraps) --btn-disabled (opacity, 0.45)
21
+ --btn-busy-size (18px) --btn-busy-w (2px): aria-busy='true' spins a ring;
22
+ --btn-busy-ring ('' draws it, none draws none: a page with its own)
23
+ --btn-shadow (a box-shadow, none; keyboard focus shows --focus-glow
24
+ instead).
25
+ .btn.small: --btn-hit (the hit area's height, --control-h) --btn-hit-area
26
+ ('' draws it, none draws none).
27
+ The height is a min-height, so a two-line option grows. Disabled and
28
+ aria-disabled stay clickable to script (no pointer-events: none), so an
29
+ aria-disabled button can still explain itself on click.
14
30
  The side pad is twice the top pad, derived from the height, so a label
15
31
  never sits closer to a side than to the top. */
16
32
 
@@ -28,36 +44,72 @@
28
44
  --btn-rim-w: 1px;
29
45
  --btn-font-size: var(--font-size-body);
30
46
  --btn-gap: var(--space-6);
47
+ --btn-pad-x: calc(var(--btn-h) - var(--btn-line) - var(--btn-rim-w));
48
+ --btn-pad-y: 0px;
49
+ --btn-font: var(--weight-strong) var(--btn-font-size) / var(--btn-line) var(--font-ui);
50
+ --btn-lift: none;
51
+ --btn-press: scale(0.98);
52
+ --btn-blur: none;
53
+ --btn-text-wrap: nowrap;
54
+ --btn-align: center;
55
+ --btn-text-align: center;
56
+ --btn-disabled: 0.45;
57
+ --btn-busy-size: 18px;
58
+ --btn-busy-w: 2px;
59
+ --btn-busy-ring: '';
60
+ --btn-shadow: none;
31
61
  position: relative;
32
62
  display: inline-flex;
33
63
  align-items: center;
34
- justify-content: center;
64
+ justify-content: var(--btn-align);
35
65
  gap: var(--btn-gap);
36
66
  box-sizing: border-box;
37
- height: var(--btn-h);
38
- padding: 0 calc(var(--btn-h) - var(--btn-line) - var(--btn-rim-w));
67
+ appearance: none;
68
+ min-height: var(--btn-h);
69
+ padding: var(--btn-pad-y) var(--btn-pad-x);
39
70
  border: var(--btn-rim-w) solid var(--btn-rim);
40
71
  border-radius: var(--btn-radius);
41
72
  background: var(--btn-bg);
73
+ box-shadow: var(--btn-shadow);
42
74
  color: var(--btn-fg);
43
- font: var(--weight-strong) var(--btn-font-size) / var(--btn-line) var(--font-ui);
75
+ font: var(--btn-font);
76
+ text-align: var(--btn-text-align);
44
77
  text-decoration: none;
45
- white-space: nowrap;
78
+ white-space: var(--btn-text-wrap);
79
+ -webkit-backdrop-filter: var(--btn-blur);
80
+ backdrop-filter: var(--btn-blur);
46
81
  cursor: pointer;
47
82
  user-select: none;
48
- transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out);
83
+ transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out), filter var(--duration-fast) var(--ease-out);
49
84
  }
50
- .btn:hover { background: var(--btn-bg-hover); color: var(--btn-fg-hover); }
51
- .btn:active { background: var(--btn-bg-press); transform: scale(0.98); }
52
- .btn:disabled, .btn[aria-disabled='true'] { opacity: 0.45; pointer-events: none; }
85
+ .btn:hover, .btn.is-hover { background: var(--btn-bg-hover); color: var(--btn-fg-hover); filter: var(--btn-lift); }
86
+ .btn:active, .btn.is-active { background: var(--btn-bg-press); transform: var(--btn-press); }
87
+ .btn:focus-visible, .btn.is-focus { box-shadow: var(--focus-glow); }
88
+ .btn:disabled, .btn[aria-disabled='true'] { opacity: var(--btn-disabled); cursor: default; }
89
+ .btn:disabled:is(:hover, :active, .is-hover, .is-active), .btn[aria-disabled='true']:is(:hover, :active, .is-hover, .is-active) { background: var(--btn-bg); color: var(--btn-fg); filter: none; transform: none; }
90
+ /* Busy: the label stays for its width, a ring turns over it. */
91
+ .btn[aria-busy='true'] { color: transparent; cursor: progress; }
92
+ .btn[aria-busy='true']::before {
93
+ content: var(--btn-busy-ring);
94
+ position: absolute;
95
+ inset: 0;
96
+ margin: auto;
97
+ width: var(--btn-busy-size);
98
+ height: var(--btn-busy-size);
99
+ border: var(--btn-busy-w) solid var(--btn-fg);
100
+ border-right-color: transparent;
101
+ border-radius: var(--radius-full);
102
+ animation: designrail-spin 0.8s linear infinite;
103
+ }
104
+ @keyframes designrail-spin { to { transform: rotate(1turn); } }
53
105
 
54
106
  .btn.primary { --btn-bg: var(--accent); --btn-bg-hover: var(--accent-hover); --btn-bg-press: var(--accent-hover); --btn-fg: var(--text-on-accent); }
55
107
  .btn.danger { --btn-bg: var(--danger); --btn-bg-hover: color-mix(in oklab, var(--danger), var(--text) 12%); --btn-bg-press: var(--btn-bg-hover); --btn-fg: var(--text-on-accent); }
56
108
  .btn.outline { --btn-bg: transparent; --btn-rim: var(--border-strong); }
57
109
  .btn.quiet { --btn-bg: transparent; --btn-bg-hover: var(--fill); --btn-bg-press: var(--fill-hover); --btn-fg: var(--text-muted); --btn-fg-hover: var(--text); }
58
- .btn.small { --btn-h: 32px; --btn-line: 16px; --btn-font-size: var(--font-size-small); }
110
+ .btn.small { --btn-h: 32px; --btn-line: 16px; --btn-font-size: var(--font-size-small); --btn-hit: var(--control-h); --btn-hit-area: ''; }
59
111
  /* A small button keeps a 44px hit area. */
60
- .btn.small::after { content: ''; position: absolute; inset: calc((var(--btn-h) - var(--control-h)) / 2) 0; }
112
+ .btn.small::after { content: var(--btn-hit-area); position: absolute; inset: calc((var(--btn-h) - var(--btn-hit)) / 2) 0; }
61
113
 
62
114
  .btn > svg, .icon-btn > svg { width: var(--icon-size, 18px); height: var(--icon-size, 18px); flex: none; }
63
115
 
@@ -80,6 +132,6 @@
80
132
  cursor: pointer;
81
133
  transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
82
134
  }
83
- .icon-btn:hover { background: var(--icon-btn-bg-hover); color: var(--text); }
84
- .icon-btn:active, .icon-btn[aria-pressed='true'] { background: var(--icon-btn-bg-press); color: var(--text); }
135
+ .icon-btn:hover, .icon-btn.is-hover { background: var(--icon-btn-bg-hover); color: var(--text); }
136
+ .icon-btn:active, .icon-btn.is-active, .icon-btn[aria-pressed='true'] { background: var(--icon-btn-bg-press); color: var(--text); }
85
137
  }
@@ -3,7 +3,11 @@
3
3
  .card > .inset a box inside: its corner is concentric (outer radius − padding)
4
4
  .card-head a title and its line, tighter than the gap to the body
5
5
  A box is only as big as what it holds: it never stretches to a column.
6
- Knobs: --card-pad --card-gap --card-radius --card-bg --card-shadow --card-rim */
6
+ Knobs: --card-pad --card-gap --card-radius --card-bg --card-shadow --card-rim
7
+ --card-blur (a backdrop-filter, none) --card-fg (inherit)
8
+ --card-align (align-items, normal) --card-align-content (normal: a card
9
+ set to display: grid packs its rows at the top with start)
10
+ --card-type (the whole font shorthand; initial, so the font inherits) */
7
11
 
8
12
  @layer designrail.parts {
9
13
  .card {
@@ -13,14 +17,25 @@
13
17
  --card-bg: var(--surface-raised);
14
18
  --card-shadow: var(--shadow-raised);
15
19
  --card-rim: transparent;
20
+ --card-blur: none;
21
+ --card-fg: inherit;
22
+ --card-align: normal;
23
+ --card-align-content: normal;
24
+ --card-type: initial;
16
25
  display: flex;
17
26
  flex-direction: column;
18
27
  gap: var(--card-gap);
28
+ align-items: var(--card-align);
29
+ align-content: var(--card-align-content);
19
30
  padding: var(--card-pad);
20
31
  border: 1px solid var(--card-rim);
21
32
  border-radius: var(--card-radius);
22
33
  background: var(--card-bg);
23
34
  box-shadow: var(--card-shadow);
35
+ color: var(--card-fg);
36
+ font: var(--card-type);
37
+ -webkit-backdrop-filter: var(--card-blur);
38
+ backdrop-filter: var(--card-blur);
24
39
  align-self: start;
25
40
  }
26
41
  .card.flat { --card-shadow: none; --card-rim: var(--border); }
@@ -7,7 +7,11 @@
7
7
  </div>
8
8
  dropdown.js wires opening, arrow keys, Escape and outside clicks.
9
9
  The menu's corner is concentric with its rows: radius − padding.
10
- Knobs: --menu-pad --menu-radius --menu-bg --menu-shadow --menu-min-w --menu-item-h */
10
+ Knobs: --menu-pad --menu-radius --menu-bg --menu-shadow --menu-min-w --menu-item-h
11
+ --menu-gap (between rows, 0) --menu-rim (an inside rim that takes no
12
+ room, transparent) --menu-fg (the text colour, inherit) --menu-origin
13
+ (where it grows from, top left; .end: top right).
14
+ A .menu that is a [popover] draws no browser rim: its rim is --menu-rim. */
11
15
 
12
16
  @layer designrail.parts {
13
17
  .dropdown { position: relative; display: inline-block; }
@@ -18,21 +22,28 @@
18
22
  --menu-shadow: var(--shadow-overlay);
19
23
  --menu-min-w: 220px;
20
24
  --menu-item-h: 40px;
25
+ --menu-gap: 0px;
26
+ --menu-rim: transparent;
27
+ --menu-fg: inherit;
28
+ --menu-origin: top left;
21
29
  position: absolute;
22
30
  z-index: 50;
23
31
  top: calc(100% + var(--space-6));
24
32
  left: 0;
25
33
  display: grid;
34
+ gap: var(--menu-gap);
26
35
  min-width: var(--menu-min-w);
27
36
  padding: var(--menu-pad);
28
37
  border-radius: var(--menu-radius);
38
+ border: 0;
29
39
  background: var(--menu-bg);
30
- box-shadow: var(--menu-shadow);
31
- transform-origin: top left;
40
+ color: var(--menu-fg);
41
+ box-shadow: inset 0 0 0 1px var(--menu-rim), var(--menu-shadow);
42
+ transform-origin: var(--menu-origin);
32
43
  animation: dr-menu-in var(--duration-fast) var(--ease-out);
33
44
  }
34
45
  .menu[hidden] { display: none; }
35
- .menu.end { left: auto; right: 0; transform-origin: top right; }
46
+ .menu.end { --menu-origin: top right; left: auto; right: 0; }
36
47
  .menu-item {
37
48
  display: flex;
38
49
  align-items: center;
@@ -47,7 +58,7 @@
47
58
  text-align: start;
48
59
  cursor: pointer;
49
60
  }
50
- .menu-item:hover, .menu-item:focus-visible { background: var(--fill); outline: none; }
61
+ .menu-item:hover, .menu-item.is-hover, .menu-item:focus-visible, .menu-item.is-focus { background: var(--fill); outline: none; }
51
62
  .menu-item[aria-checked='true'] { color: var(--accent); }
52
63
  .menu-sep { height: 1px; margin: var(--space-4) 0; background: var(--border); }
53
64
 
@@ -8,10 +8,22 @@
8
8
  every side (unlike a button). Focus turns the rim to the accent; the ring
9
9
  is for the keyboard only. .check is a checkbox or radio with its label.
10
10
  Knobs: --input-h --input-line --input-rim-w --input-radius --input-bg
11
- --input-fg --input-rim --input-rim-hover --input-rim-focus --field-gap */
11
+ --input-fg --input-rim --input-rim-hover --input-rim-focus --field-gap
12
+ --input-pad-y (default derived from the height) --input-pad-x (--space-12)
13
+ --input-pad-end (--input-pad-x) --input-bg-hover (--input-bg)
14
+ --input-bg-focus (--input-bg, on :focus-within, so a wrapper .input
15
+ around its <input> lights too) --input-shadow (none) --input-font
16
+ (the font shorthand: --font-size-body / --input-line --font-ui)
17
+ --input-rim-style (solid: none for a wrapper .input with no rim at all)
18
+ --input-align (align-items, normal) --input-gap (gap, normal): for a
19
+ wrapper .input a page lays out as a flex row.
20
+ A .field may be a <fieldset>: its margin, padding and border reset.
21
+ .check knobs: --check-gap (--space-8) --check-pad-y (0) --check-fg
22
+ (inherit) --check-font (inherit) --check-line (1.5, after the font: set it
23
+ to the font's own line when --check-font names one). */
12
24
 
13
25
  @layer designrail.parts {
14
- .field { --field-gap: var(--space-6); display: grid; gap: var(--field-gap); align-content: start; }
26
+ .field { --field-gap: var(--space-6); display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--field-gap); align-content: start; min-width: 0; margin: 0; padding: 0; border: 0; }
15
27
  .field > .label { font-size: var(--font-size-small); font-weight: var(--weight-strong); color: var(--text); }
16
28
  .field > .hint { font-size: var(--font-size-small); color: var(--text-muted); }
17
29
  .field.invalid > .hint { color: var(--danger); }
@@ -20,27 +32,40 @@
20
32
  --input-h: var(--control-h);
21
33
  --input-line: 20px;
22
34
  --input-rim-w: 1px;
35
+ --input-rim-style: solid;
36
+ --input-align: normal;
37
+ --input-gap: normal;
23
38
  --input-radius: var(--radius-control);
24
39
  --input-bg: var(--surface);
25
40
  --input-fg: var(--text);
26
41
  --input-rim: var(--border-strong);
27
42
  --input-rim-hover: var(--text-faint);
28
43
  --input-rim-focus: var(--accent);
44
+ --input-pad-y: calc((var(--input-h) - var(--input-line)) / 2 - var(--input-rim-w));
45
+ --input-pad-x: var(--space-12);
46
+ --input-pad-end: var(--input-pad-x);
47
+ --input-bg-hover: var(--input-bg);
48
+ --input-bg-focus: var(--input-bg);
49
+ --input-shadow: none;
50
+ --input-font: var(--font-size-body) / var(--input-line) var(--font-ui);
29
51
  box-sizing: border-box;
30
52
  width: 100%;
31
53
  min-height: var(--input-h);
32
- padding: calc((var(--input-h) - var(--input-line)) / 2 - var(--input-rim-w)) var(--space-12);
33
- border: var(--input-rim-w) solid var(--input-rim);
54
+ padding: var(--input-pad-y) var(--input-pad-end) var(--input-pad-y) var(--input-pad-x);
55
+ border: var(--input-rim-w) var(--input-rim-style) var(--input-rim);
34
56
  border-radius: var(--input-radius);
35
57
  background: var(--input-bg);
58
+ box-shadow: var(--input-shadow);
59
+ align-items: var(--input-align);
60
+ gap: var(--input-gap);
36
61
  color: var(--input-fg);
37
- font: var(--font-size-body) / var(--input-line) var(--font-ui);
62
+ font: var(--input-font);
38
63
  transition: border-color var(--duration-fast) var(--ease-out), background-color var(--duration-fast) var(--ease-out);
39
64
  }
40
65
  .input::placeholder { color: var(--text-faint); }
41
- .input:hover { border-color: var(--input-rim-hover); }
42
- .input:focus { border-color: var(--input-rim-focus); outline: none; }
43
- .input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
66
+ .input:hover, .input.is-hover { border-color: var(--input-rim-hover); background: var(--input-bg-hover); }
67
+ .input:focus, .input:focus-within, .input.is-focus { border-color: var(--input-rim-focus); background: var(--input-bg-focus); outline: none; }
68
+ .input:focus-visible { outline: var(--focus-ring); outline-offset: 1px; }
44
69
  .field.invalid .input { --input-rim: var(--danger); --input-rim-hover: var(--danger); }
45
70
  .input:disabled { --input-bg: var(--surface-sunken); --input-fg: var(--text-faint); }
46
71
  textarea.input { min-height: calc(var(--input-h) * 2); resize: vertical; }
@@ -55,7 +80,21 @@
55
80
  .input[type='search']::-webkit-search-cancel-button { display: none; }
56
81
 
57
82
  /* A tick leads its label's first line: top-aligned, centred on that line. */
58
- .check { display: flex; align-items: flex-start; gap: var(--space-8); cursor: pointer; line-height: 1.5; }
83
+ .check {
84
+ --check-gap: var(--space-8);
85
+ --check-pad-y: 0px;
86
+ --check-fg: inherit;
87
+ --check-font: inherit;
88
+ --check-line: 1.5;
89
+ display: flex;
90
+ align-items: flex-start;
91
+ gap: var(--check-gap);
92
+ padding: var(--check-pad-y) 0;
93
+ color: var(--check-fg);
94
+ font: var(--check-font);
95
+ line-height: var(--check-line);
96
+ cursor: pointer;
97
+ }
59
98
  .check > input {
60
99
  --tick: 18px;
61
100
  flex: none;
@@ -1,21 +1,39 @@
1
1
  /* pill: a short status or tag. .pill.accent / .danger / .success / .warning
2
2
  tint it by what it says. .pill .dot leads with a mark --space-6 from the words.
3
3
  .count is a number beside its label, never run into the text.
4
- Knobs: --pill-tone (the colour it says) --pill-bg --pill-fg */
4
+ Knobs: --pill-tone (the colour it says) --pill-bg --pill-fg
5
+ --pill-pad-y (--space-4) --pill-pad-x (--space-8) --pill-radius
6
+ (--radius-full) --pill-font (--weight-strong --font-size-small / 16px
7
+ --font-ui) --pill-blur (a backdrop-filter, none) --pill-text-shadow
8
+ (none). A pill may be a <button>: it draws no browser border.
9
+ .count knobs: --count-bg (--fill-hover) --count-fg (--text)
10
+ --count-font (--weight-strong --font-size-small / 1 --font-ui)
11
+ --count-pad-x (--space-6) --count-h (20px) --count-radius (--radius-full) */
5
12
 
6
13
  @layer designrail.parts {
7
14
  .pill {
8
15
  --pill-tone: var(--text-muted);
9
16
  --pill-bg: var(--fill);
10
17
  --pill-fg: var(--pill-tone);
18
+ --pill-pad-y: var(--space-4);
19
+ --pill-pad-x: var(--space-8);
20
+ --pill-radius: var(--radius-full);
21
+ --pill-font: var(--weight-strong) var(--font-size-small) / 16px var(--font-ui);
22
+ --pill-blur: none;
23
+ --pill-text-shadow: none;
11
24
  display: inline-flex;
12
25
  align-items: center;
26
+ justify-content: center;
13
27
  gap: var(--space-6);
14
- padding: var(--space-4) var(--space-8);
15
- border-radius: var(--radius-full);
28
+ padding: var(--pill-pad-y) var(--pill-pad-x);
29
+ border: 0;
30
+ border-radius: var(--pill-radius);
16
31
  background: var(--pill-bg);
17
32
  color: var(--pill-fg);
18
- font: var(--weight-strong) var(--font-size-small) / 16px var(--font-ui);
33
+ font: var(--pill-font);
34
+ text-shadow: var(--pill-text-shadow);
35
+ -webkit-backdrop-filter: var(--pill-blur);
36
+ backdrop-filter: var(--pill-blur);
19
37
  white-space: nowrap;
20
38
  }
21
39
  .pill > .dot { width: 6px; height: 6px; border-radius: var(--radius-full); background: currentColor; }
@@ -26,15 +44,21 @@
26
44
  .pill.warning { --pill-tone: var(--warning); }
27
45
 
28
46
  .count {
47
+ --count-bg: var(--fill-hover);
48
+ --count-fg: var(--text);
49
+ --count-font: var(--weight-strong) var(--font-size-small) / 1 var(--font-ui);
50
+ --count-pad-x: var(--space-6);
51
+ --count-h: 20px;
52
+ --count-radius: var(--radius-full);
29
53
  display: inline-grid;
30
54
  place-items: center;
31
- min-width: 20px;
32
- height: 20px;
33
- padding: 0 var(--space-6);
34
- border-radius: var(--radius-full);
35
- background: var(--fill-hover);
36
- color: var(--text);
37
- font: var(--weight-strong) var(--font-size-small) / 1 var(--font-ui);
55
+ min-width: var(--count-h);
56
+ height: var(--count-h);
57
+ padding: 0 var(--count-pad-x);
58
+ border-radius: var(--count-radius);
59
+ background: var(--count-bg);
60
+ color: var(--count-fg);
61
+ font: var(--count-font);
38
62
  font-variant-numeric: tabular-nums;
39
63
  }
40
64
  }
@@ -7,7 +7,18 @@
7
7
  </dialog>
8
8
  el.showModal() opens it. Nothing sits under the close button: the title
9
9
  row stops a gap short of it.
10
- Knobs: --sheet-pad --sheet-width --sheet-radius --sheet-bg --sheet-gap */
10
+ Knobs: --sheet-pad --sheet-width --sheet-radius --sheet-bg --sheet-gap
11
+ --sheet-rim (an inside rim, transparent) --sheet-rim-w (1px)
12
+ --sheet-shadow (--shadow-overlay) --sheet-blur (a backdrop-filter, none)
13
+ --sheet-fg (--text) --sheet-border-w (0) --sheet-border-style (none): a
14
+ real border in --sheet-rim that can leave sides out (1px 0 0 is a
15
+ top-only rim, for a sheet standing on the page's foot); set --sheet-rim-w
16
+ to 0 with it so the ring doesn't draw too. --sheet-align-content (normal:
17
+ a sheet set to display: grid packs its rows at the top with start). The
18
+ gap applies on any sheet laid out as flex or grid, open or not.
19
+ Only dialog.sheet is sized and placed as a modal (width, max-height,
20
+ margin, the phone's bottom edge). A .sheet that is not a <dialog> is
21
+ placed by its page: a bottom dock, a side panel. */
11
22
 
12
23
  @layer designrail.parts {
13
24
  .sheet {
@@ -16,25 +27,41 @@
16
27
  --sheet-width: 420px;
17
28
  --sheet-radius: var(--radius-card);
18
29
  --sheet-bg: var(--surface-raised);
30
+ --sheet-rim: transparent;
31
+ --sheet-rim-w: 1px;
32
+ --sheet-shadow: var(--shadow-overlay);
33
+ --sheet-blur: none;
34
+ --sheet-fg: var(--text);
35
+ --sheet-border-w: 0;
36
+ --sheet-border-style: none;
37
+ --sheet-align-content: normal;
19
38
  box-sizing: border-box;
20
- width: min(var(--sheet-width), calc(100vw - 2 * var(--space-16)));
21
- max-height: calc(100dvh - 2 * var(--space-16));
22
39
  padding: var(--sheet-pad);
23
- border: 0;
40
+ border-width: var(--sheet-border-w);
41
+ border-style: var(--sheet-border-style);
42
+ border-color: var(--sheet-rim);
24
43
  border-radius: var(--sheet-radius);
25
44
  background: var(--sheet-bg);
26
- color: var(--text);
27
- box-shadow: var(--shadow-overlay);
45
+ color: var(--sheet-fg);
46
+ box-shadow: inset 0 0 0 var(--sheet-rim-w) var(--sheet-rim), var(--sheet-shadow);
47
+ -webkit-backdrop-filter: var(--sheet-blur);
48
+ backdrop-filter: var(--sheet-blur);
49
+ gap: var(--sheet-gap);
50
+ align-content: var(--sheet-align-content);
28
51
  overflow: auto;
29
52
  }
30
- .sheet[open] { display: flex; flex-direction: column; gap: var(--sheet-gap); animation: dr-sheet-in var(--duration-base) var(--ease-out); }
53
+ dialog.sheet {
54
+ width: min(var(--sheet-width), calc(100vw - 2 * var(--space-16)));
55
+ max-height: calc(100dvh - 2 * var(--space-16));
56
+ }
57
+ .sheet[open] { display: flex; flex-direction: column; animation: dr-sheet-in var(--duration-base) var(--ease-out); }
31
58
  .sheet::backdrop { background: var(--surface-scrim); animation: dr-scrim-in var(--duration-base) var(--ease-out); }
32
59
  .sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-12); margin: calc(var(--space-8) * -1) calc(var(--space-12) * -1) 0 0; }
33
60
  .sheet-head > h2 { margin: 0; font: var(--weight-strong) var(--font-size-title) / 1.25 var(--font-display); }
34
61
 
35
62
  @media (max-width: 520px) {
36
- .sheet { width: 100vw; max-width: none; margin: auto 0 0; border-end-start-radius: 0; border-end-end-radius: 0; padding-bottom: max(var(--sheet-pad), env(safe-area-inset-bottom)); }
37
- .sheet[open] { animation-name: dr-sheet-up; }
63
+ dialog.sheet { width: 100vw; max-width: none; margin: auto 0 0; border-end-start-radius: 0; border-end-end-radius: 0; padding-bottom: max(var(--sheet-pad), env(safe-area-inset-bottom)); }
64
+ dialog.sheet[open] { animation-name: dr-sheet-up; }
38
65
  }
39
66
 
40
67
  @keyframes dr-sheet-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
@@ -2,7 +2,13 @@
2
2
  toast.js builds them in one polite live region at the bottom of the page.
3
3
  A filled box pads every side equally; an end that holds a button drops to
4
4
  the top pad, so the button sits as far from the edge as from the top.
5
- Knobs: --toast-bg --toast-fg --toast-radius --toast-max-w */
5
+ Knobs: --toast-bg --toast-fg --toast-radius --toast-max-w
6
+ --toast-pad-y (--space-12) --toast-pad-start (--space-16) --toast-pad-end
7
+ (--space-16; --space-8 when the toast ends in a button) --toast-rim (an
8
+ inside rim, transparent) --toast-shadow (--shadow-overlay) --toast-gap
9
+ (--space-12) --toast-font (--font-size-body; inherits the rest)
10
+ --toast-type (the whole font shorthand; initial, so the font inherits):
11
+ its size still comes from --toast-font, so set that to the same size. */
6
12
 
7
13
  @layer designrail.parts {
8
14
  .toasts {
@@ -19,20 +25,30 @@
19
25
  --toast-fg: var(--surface);
20
26
  --toast-radius: var(--radius-card);
21
27
  --toast-max-w: 420px;
28
+ --toast-pad-y: var(--space-12);
29
+ --toast-pad-start: var(--space-16);
30
+ --toast-pad-end: var(--space-16);
31
+ --toast-rim: transparent;
32
+ --toast-shadow: var(--shadow-overlay);
33
+ --toast-gap: var(--space-12);
34
+ --toast-font: var(--font-size-body);
35
+ --toast-type: initial;
22
36
  display: flex;
23
37
  align-items: center;
24
- gap: var(--space-12);
38
+ gap: var(--toast-gap);
25
39
  max-width: var(--toast-max-w);
26
- padding: var(--space-12) var(--space-16);
40
+ padding-block: var(--toast-pad-y);
41
+ padding-inline: var(--toast-pad-start) var(--toast-pad-end);
27
42
  border-radius: var(--toast-radius);
28
43
  background: var(--toast-bg);
29
44
  color: var(--toast-fg);
30
- box-shadow: var(--shadow-overlay);
31
- font-size: var(--font-size-body);
45
+ box-shadow: inset 0 0 0 1px var(--toast-rim), var(--toast-shadow);
46
+ font: var(--toast-type);
47
+ font-size: var(--toast-font);
32
48
  pointer-events: auto;
33
49
  animation: dr-toast-in var(--duration-base) var(--ease-out);
34
50
  }
35
- .toast:has(> .btn:last-child) { padding-right: var(--space-8); }
51
+ .toast:has(> .btn:last-child) { --toast-pad-end: var(--space-8); }
36
52
  .toast > .btn { --btn-h: 32px; --btn-line: 16px; --btn-bg: color-mix(in srgb, var(--toast-fg) 14%, transparent); --btn-bg-hover: color-mix(in srgb, var(--toast-fg) 22%, transparent); --btn-fg: var(--toast-fg); }
37
53
  .toast.leaving { opacity: 0; transform: translateY(8px); transition: opacity var(--duration-base) var(--ease-out), transform var(--duration-base) var(--ease-out); }
38
54
 
package/kit/tokens.css CHANGED
@@ -67,6 +67,9 @@
67
67
  --success: var(--green-500);
68
68
  --warning: var(--amber-500);
69
69
  --focus: var(--accent);
70
+ /* The keyboard focus mark: an outline, and a glow beside or instead of it. */
71
+ --focus-ring: 2px solid var(--focus);
72
+ --focus-glow: none;
70
73
 
71
74
  /* --- semantic: type ---------------------------------------------------- */
72
75
  --font-ui: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rickycourtes/designrail",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "The design foundation for any web project: a token contract, layered parts every project builds on, and tooling to audit duplication, extract tokens, fix hardcoded values, gate drift and upgrade.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -13,6 +13,7 @@
13
13
  "./tokens.css": "./kit/tokens.css",
14
14
  "./parts/*": "./kit/parts/*",
15
15
  "./kit/*": "./kit/*",
16
+ "./rules/*": "./rules/*",
16
17
  "./package.json": "./package.json"
17
18
  },
18
19
  "files": [
package/rules/DESIGN.md CHANGED
@@ -1,9 +1,14 @@
1
1
  # Design rules
2
2
 
3
- How this project builds its UI. Every bullet ends with a tag
3
+ The base rules: how every project on designrail builds its UI. A project's
4
+ own `DESIGN.md` extends this file (`@rickycourtes/designrail/rules/DESIGN.md`)
5
+ with rules of its own, and never reuses an `{id}` from here
6
+ (`designrail check`: rules-override). Every bullet ends with a tag
4
7
  `{id · checks}`: `check` means `designrail check` fails a change that breaks
5
8
  it, `audit` means `designrail audit` reports it, `eye` means a person or an
6
- agent has to look. Turn a rule off in `designrail.config.json` → `rules`.
9
+ agent has to look. A project can turn a rule up, never down: in
10
+ `designrail.config.json` → `rules` a level may rise from `warn` to `error`,
11
+ and `check` and `audit` refuse a config that lowers one.
7
12
 
8
13
  ## Tokens
9
14
 
package/schema.json CHANGED
@@ -29,7 +29,14 @@
29
29
  },
30
30
  "parts": {
31
31
  "type": "string",
32
- "description": "Where `designrail add` copies kit parts."
32
+ "description": "Where the project's own parts live (each file is one part), and where `designrail eject` copies one."
33
+ },
34
+ "specimens": {
35
+ "type": "array",
36
+ "items": {
37
+ "type": "string"
38
+ },
39
+ "description": "Globs for specimen pages (parts side by side on purpose), left out of the repeated-markup and part-family checks."
33
40
  },
34
41
  "grid": {
35
42
  "type": "number",
@@ -78,9 +85,21 @@
78
85
  "unused": {},
79
86
  "tracked-caps": {},
80
87
  "contract": {},
81
- "part-restyle": {}
88
+ "part-restyle": {},
89
+ "rules-override": {}
82
90
  }
83
91
  },
92
+ "duplicates": {
93
+ "type": "object",
94
+ "properties": {
95
+ "minDeclarations": {
96
+ "type": "integer",
97
+ "minimum": 2,
98
+ "description": "Identical rule blocks count as duplicates at this many declarations or more, near-duplicates when they share this many (default 3)."
99
+ }
100
+ },
101
+ "additionalProperties": false
102
+ },
84
103
  "maxFileBytes": {
85
104
  "type": "number"
86
105
  },