ply-css 1.7.1 → 1.8.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/CLAUDE.md CHANGED
@@ -71,6 +71,13 @@ Setting a custom `data-theme` value prevents auto dark mode from interfering wit
71
71
 
72
72
  See `customProperties` in `ply-classes.json` for the full list of overridable variables. Use the `themeTemplate` key in `ply-classes.json` for a complete copy-paste CSS block with every overridable variable grouped by category.
73
73
 
74
+ ### Token Scales
75
+
76
+ - **Radius** — `--ply-radius-none/xs/sm/md/lg/xl/full` scale, consumed by semantic aliases `--ply-border-radius`, `--ply-btn-border-radius`, `--ply-label-radius`, `--ply-badge-radius`, `--ply-input-radius`. Override the scale once or retarget a single alias.
77
+ - **Control sizing** — `--ply-control-{font,py,px,lh}` (+ `-lg`/`-sm`/`-xs`) are shared by inputs, buttons, selects, and textareas, so the same size renders the same height everywhere. Heights are emergent (padding + line-height), never fixed.
78
+ - **Spacing** — `--ply-space` is the default 16px unit, between `--ply-space-md` (12px) and `--ply-space-lg` (24px).
79
+ - **Inverse & black** — `--ply-bg-inverse` / `--ply-layer-inverse-0/1` reference the text-color vars (flip opposite the body automatically); `--ply-color-black` is `#000` in every mode.
80
+
74
81
  ## Common Patterns
75
82
 
76
83
  - **Equal-height cards** — Add `equal-height` to `units-row` so all children stretch to the tallest
package/PLY.md CHANGED
@@ -54,6 +54,38 @@ Setting a custom `data-theme` value prevents auto dark mode from interfering wit
54
54
 
55
55
  See `customProperties` in `ply-classes.json` for the full list of overridable variables.
56
56
 
57
+ ### Scales: Radius, Control Sizing, Spacing
58
+
59
+ ply exposes three token scales so you can theme size/shape from a few places:
60
+
61
+ **Border radius** — a scale plus semantic aliases. Change the scale once, or retarget one component.
62
+
63
+ ```css
64
+ --ply-radius-none: 0; --ply-radius-lg: 0.75rem; /* 12px */
65
+ --ply-radius-xs: 0.125rem; --ply-radius-xl: 1rem; /* 16px */
66
+ --ply-radius-sm: 0.25rem; --ply-radius-full: 9999px; /* pill */
67
+ --ply-radius-md: 0.5rem;
68
+ /* aliases consumed by components */
69
+ --ply-border-radius: var(--ply-radius-sm);
70
+ --ply-btn-border-radius: var(--ply-radius-full);
71
+ --ply-label-radius: var(--ply-radius-sm);
72
+ --ply-badge-radius: var(--ply-radius-full);
73
+ --ply-input-radius: var(--ply-radius-sm);
74
+ ```
75
+
76
+ **Control sizing** — shared by inputs, buttons, selects, and textareas, so a given size is the **same height** across every control. Height is emergent (`padding-y × 2 + line-height`), never a fixed dimension. Suffixes: `-lg`, none (default), `-sm`, `-xs`.
77
+
78
+ ```css
79
+ --ply-control-font / -lg / -sm / -xs /* 1rem · 1.125 · 0.875 · 0.75 */
80
+ --ply-control-py / -lg / -sm / -xs /* 0.625rem · 0.875 · 0.375 · 0.25 */
81
+ --ply-control-px / -lg / -sm / -xs /* 1.5rem · 2 · 1 · 0.75 */
82
+ --ply-control-lh / -lg / -sm / -xs /* 1.5rem · 1.75 · 1.25 · 1 */
83
+ ```
84
+
85
+ **Spacing** — `--ply-space-xs/sm/md`, `--ply-space` (the 16px default unit), `--ply-space-lg/xl/xxl`.
86
+
87
+ **Inverse & black** — `--ply-bg-inverse` / `--ply-layer-inverse-0/1` reference the text-color variables, so they flip opposite the body automatically. `--ply-color-black` stays `#000` in every mode.
88
+
57
89
  ### Custom Theme Browser Compatibility
58
90
 
59
91
  ply uses `color-mix()` to auto-compute hover/active button states from your base color. This works in all modern browsers (Chrome 111+, Firefox 113+, Safari 16.4+, Edge 111+). On older browsers (pre-2023), `color-mix()` is ignored and the fallback hex values from ply's default theme are used instead. For custom themes targeting legacy browsers, also set `--ply-btn-default-bg-hover`, `--ply-btn-default-bg-active`, `--ply-btn-secondary-bg-hover`, and `--ply-btn-secondary-bg-active` explicitly. In modern browsers, `color-mix()` overrides these fallbacks automatically.
@@ -13,6 +13,10 @@
13
13
  --ply-bg-surface: #ffffff;
14
14
  --ply-bg-surface-alt: #f4f4f4;
15
15
  --ply-bg-muted: #e0e0e0;
16
+ --ply-bg-inverse: var(--ply-color-body);
17
+ --ply-layer-inverse-0: var(--ply-color-body);
18
+ --ply-layer-inverse-1: var(--ply-color-secondary);
19
+ --ply-color-black: #000000;
16
20
  --ply-color-body: #161616;
17
21
  --ply-color-headings: #161616;
18
22
  --ply-color-secondary: #525252;
@@ -47,8 +51,34 @@
47
51
  --ply-btn-secondary-bg-hover: color-mix(in oklch, var(--ply-btn-secondary-bg), black 15%);
48
52
  --ply-btn-secondary-bg-active: #2b2b2b;
49
53
  --ply-btn-secondary-bg-active: color-mix(in oklch, var(--ply-btn-secondary-bg), black 25%);
50
- --ply-border-radius: 0.25rem;
51
- --ply-btn-border-radius: 2rem;
54
+ --ply-radius-none: 0;
55
+ --ply-radius-xs: 0.125rem;
56
+ --ply-radius-sm: 0.25rem;
57
+ --ply-radius-md: 0.5rem;
58
+ --ply-radius-lg: 0.75rem;
59
+ --ply-radius-xl: 1rem;
60
+ --ply-radius-full: 9999px;
61
+ --ply-border-radius: var(--ply-radius-sm);
62
+ --ply-btn-border-radius: var(--ply-radius-full);
63
+ --ply-label-radius: var(--ply-radius-sm);
64
+ --ply-badge-radius: var(--ply-radius-full);
65
+ --ply-control-font-lg: 1.125rem;
66
+ --ply-control-font: 1rem;
67
+ --ply-control-font-sm: 0.875rem;
68
+ --ply-control-font-xs: 0.75rem;
69
+ --ply-control-py-lg: 0.875rem;
70
+ --ply-control-py: 0.625rem;
71
+ --ply-control-py-sm: 0.375rem;
72
+ --ply-control-py-xs: 0.25rem;
73
+ --ply-control-px-lg: 2rem;
74
+ --ply-control-px: 1.5rem;
75
+ --ply-control-px-sm: 1rem;
76
+ --ply-control-px-xs: 0.75rem;
77
+ --ply-control-lh-lg: 1.75rem;
78
+ --ply-control-lh: 1.5rem;
79
+ --ply-control-lh-sm: 1.25rem;
80
+ --ply-control-lh-xs: 1rem;
81
+ --ply-input-radius: var(--ply-radius-sm);
52
82
  --ply-nav-bg: var(--ply-bg-body);
53
83
  --ply-nav-color: var(--ply-color-body);
54
84
  --ply-nav-border: var(--ply-color-body);
@@ -130,6 +160,7 @@
130
160
  --ply-space-xs: 0.25rem;
131
161
  --ply-space-sm: 0.5rem;
132
162
  --ply-space-md: 0.75rem;
163
+ --ply-space: 1rem;
133
164
  --ply-space-lg: 1.5rem;
134
165
  --ply-space-xl: 2rem;
135
166
  --ply-space-xxl: 3rem;
@@ -706,20 +737,26 @@ summary {
706
737
  font-weight: 600;
707
738
  padding: 0.25rem 0;
708
739
  list-style: none;
740
+ display: flex;
741
+ align-items: center;
709
742
  }
710
743
  summary::marker, summary::-webkit-details-marker {
711
744
  display: none;
712
745
  }
713
- summary::before {
714
- content: "";
715
- display: inline-block;
716
- margin-right: 0.5rem;
717
- font-size: 0.75em;
746
+ summary::after {
747
+ content: "";
748
+ flex: none;
749
+ margin-left: auto;
750
+ width: 0;
751
+ height: 0;
752
+ border-left: 0.3em solid transparent;
753
+ border-right: 0.3em solid transparent;
754
+ border-top: 0.35em solid var(--ply-color-secondary);
718
755
  transition: transform 0.15s ease;
719
756
  }
720
757
 
721
- details[open] > summary::before {
722
- transform: rotate(90deg);
758
+ details[open] > summary::after {
759
+ transform: rotate(180deg);
723
760
  }
724
761
 
725
762
  details[open] > summary {
@@ -3577,7 +3614,9 @@ table.table-hovered tbody tr:hover td {
3577
3614
  border-radius: var(--ply-border-radius);
3578
3615
  display: block;
3579
3616
  width: 100%;
3580
- padding: 0.5em 0.75em;
3617
+ font-size: var(--ply-control-font);
3618
+ line-height: var(--ply-control-lh);
3619
+ padding: var(--ply-control-py) var(--ply-control-px);
3581
3620
  }
3582
3621
 
3583
3622
  .form-inline input[type=text],
@@ -3771,26 +3810,33 @@ input.input-on-black:focus::-moz-placeholder, input.input-on-black.active::-moz-
3771
3810
  color: #aaa;
3772
3811
  }
3773
3812
 
3774
- /* Sizes */
3813
+ /* Sizes — share the control sizing scale with buttons so a given size is the
3814
+ same height across inputs, buttons, selects and textareas */
3775
3815
  .form .input-lg,
3776
3816
  input.input-lg[type],
3777
3817
  textarea.input-lg,
3778
3818
  select.input-lg {
3779
- font-size: 1.5rem;
3819
+ font-size: var(--ply-control-font-lg);
3820
+ line-height: var(--ply-control-lh-lg);
3821
+ padding: var(--ply-control-py-lg) var(--ply-control-px-lg);
3780
3822
  }
3781
3823
 
3782
3824
  .form .input-sm,
3783
3825
  input.input-sm[type],
3784
3826
  textarea.input-sm,
3785
3827
  select.input-sm {
3786
- font-size: 0.875rem;
3828
+ font-size: var(--ply-control-font-sm);
3829
+ line-height: var(--ply-control-lh-sm);
3830
+ padding: var(--ply-control-py-sm) var(--ply-control-px-sm);
3787
3831
  }
3788
3832
 
3789
3833
  .form .input-xs,
3790
3834
  input.input-xs[type],
3791
3835
  textarea.input-xs,
3792
3836
  select.input-xs {
3793
- font-size: 0.75rem;
3837
+ font-size: var(--ply-control-font-xs);
3838
+ line-height: var(--ply-control-lh-xs);
3839
+ padding: var(--ply-control-py-xs) var(--ply-control-px-xs);
3794
3840
  }
3795
3841
 
3796
3842
  /* Append & Prepend */
@@ -3882,7 +3928,6 @@ select.input-xs {
3882
3928
  border-left: none;
3883
3929
  }
3884
3930
 
3885
- /* Select */
3886
3931
  .form select {
3887
3932
  -webkit-appearance: none;
3888
3933
  -moz-appearance: none;
@@ -4438,9 +4483,9 @@ button.btn {
4438
4483
  justify-content: center;
4439
4484
  gap: var(--ply-btn-gap, 0.5em);
4440
4485
  font-family: var(--ply-font-body, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji);
4441
- font-size: var(--ply-btn-font-size, 1em);
4486
+ font-size: var(--ply-btn-font-size, var(--ply-control-font));
4442
4487
  font-weight: 400;
4443
- line-height: 1.5rem;
4488
+ line-height: var(--ply-control-lh);
4444
4489
  text-decoration: none;
4445
4490
  color: var(--ply-btn-secondary-color, var(--ply-color-text-inverse, #fff));
4446
4491
  -webkit-appearance: none;
@@ -4453,7 +4498,7 @@ button.btn {
4453
4498
  box-shadow: none;
4454
4499
  cursor: pointer;
4455
4500
  background: var(--ply-btn-secondary-bg, #393939);
4456
- padding: 0.625rem 1.5rem;
4501
+ padding: var(--ply-control-py) var(--ply-control-px);
4457
4502
  }
4458
4503
  .btn:hover, .btn:active, .btn:focus-visible,
4459
4504
  input[type=submit].btn:hover,
@@ -4518,8 +4563,9 @@ input[type=submit].btn-lg,
4518
4563
  input[type=button].btn-lg,
4519
4564
  input[type=reset].btn-lg,
4520
4565
  button.btn-lg {
4521
- font-size: 1.125rem;
4522
- padding: 0.875rem 2rem;
4566
+ font-size: var(--ply-control-font-lg);
4567
+ line-height: var(--ply-control-lh-lg);
4568
+ padding: var(--ply-control-py-lg) var(--ply-control-px-lg);
4523
4569
  }
4524
4570
 
4525
4571
  .btn-sm,
@@ -4527,8 +4573,9 @@ input[type=submit].btn-sm,
4527
4573
  input[type=button].btn-sm,
4528
4574
  input[type=reset].btn-sm,
4529
4575
  button.btn-sm {
4530
- font-size: 0.875rem;
4531
- padding: 0.375rem 1rem;
4576
+ font-size: var(--ply-control-font-sm);
4577
+ line-height: var(--ply-control-lh-sm);
4578
+ padding: var(--ply-control-py-sm) var(--ply-control-px-sm);
4532
4579
  }
4533
4580
 
4534
4581
  .btn-xs,
@@ -4536,8 +4583,9 @@ input[type=submit].btn-xs,
4536
4583
  input[type=button].btn-xs,
4537
4584
  input[type=reset].btn-xs,
4538
4585
  button.btn-xs {
4539
- font-size: 0.75rem;
4540
- padding: 0.25rem 0.75rem;
4586
+ font-size: var(--ply-control-font-xs);
4587
+ line-height: var(--ply-control-lh-xs);
4588
+ padding: var(--ply-control-py-xs) var(--ply-control-px-xs);
4541
4589
  vertical-align: baseline;
4542
4590
  }
4543
4591