eidos-ui 3.0.0 → 3.1.1

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/dist/index.css CHANGED
@@ -113,6 +113,8 @@
113
113
  --navigation-collapsed-width: 64px;
114
114
  --footer-height: 60px;
115
115
  --badge-offset: 0.3em;
116
+ --scrollbar-size: 10px;
117
+ --scrollbar-thumb: var(--primary-color);
116
118
  --z-index-drawer: 1200;
117
119
  --z-index-modal: 1300;
118
120
  --z-index-dropdown: 1400;
@@ -134,6 +136,11 @@
134
136
 
135
137
  html,
136
138
  body {
139
+ /* `100%`, not `100vh`: on mobile `100vh` resolves against the *large*
140
+ viewport, so a full-height app shell ends up taller than what is actually
141
+ visible and its bottom chrome hides behind the browser UI. `height: 100%`
142
+ on `html` already resolves against the viewport, and on `body` against
143
+ `html`, so this is the same thing on desktop without that bug. */
137
144
  height: 100%;
138
145
  font-family: var(--font-family-primary);
139
146
  -webkit-font-smoothing: antialiased;
@@ -141,7 +148,6 @@ body {
141
148
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
142
149
  font-size: 14px;
143
150
  line-height: 1.4;
144
- margin-bottom: var(--spacing-sm);
145
151
  color: var(--dark-color);
146
152
  }
147
153
 
@@ -224,6 +230,44 @@ svg.lucide {
224
230
  height: 1em;
225
231
  }
226
232
 
233
+ /* Scrollbars, WebKit/Blink (Chrome, Brave, Edge, Safari).
234
+ Both dimensions are needed: `width` is the thickness of a *vertical* bar
235
+ only, so setting it alone left every horizontal scroller (`pre`, the
236
+ Table/DataGrid wrappers, Tabs' strip) at the OS default thickness.
237
+ Overridable through the `--scrollbar-*` tokens - see `variables.scss`. */
238
+ *::-webkit-scrollbar {
239
+ width: var(--scrollbar-size);
240
+ height: var(--scrollbar-size);
241
+ }
242
+
243
+ *::-webkit-scrollbar-track {
244
+ background: transparent;
245
+ }
246
+
247
+ *::-webkit-scrollbar-thumb {
248
+ background-color: var(--scrollbar-thumb);
249
+ /* A scrollbar thumb takes no `padding`, so a transparent border plus
250
+ `background-clip: padding-box` is what insets the visible bar from the
251
+ track - the clip does nothing on its own. The thumb still hit-tests over
252
+ its whole border box, so this keeps a slim look without shrinking the
253
+ target to something un-grabbable. */
254
+ border: 3px solid transparent;
255
+ background-clip: padding-box;
256
+ border-radius: var(--scrollbar-size);
257
+ }
258
+
259
+ /* Firefox, which supports neither the pseudo-elements above nor an inset
260
+ thumb - `scrollbar-width`/`scrollbar-color` is its ceiling. Gated behind a
261
+ Firefox-only `@supports` test on purpose: the standard properties take
262
+ precedence over the pseudo-elements wherever both are supported, so
263
+ applying them unconditionally would replace the styling above in Chromium
264
+ with this coarser version. */
265
+ @supports (scrollbar-width: auto) and (-moz-appearance: none) {
266
+ * {
267
+ scrollbar-width: thin;
268
+ scrollbar-color: var(--scrollbar-thumb) transparent;
269
+ }
270
+ }
227
271
  .eidos-accordion {
228
272
  display: flex;
229
273
  flex-direction: column;
@@ -1307,6 +1351,7 @@ svg.lucide {
1307
1351
  align-items: center;
1308
1352
  cursor: pointer;
1309
1353
  width: fit-content;
1354
+ position: relative;
1310
1355
  }
1311
1356
  .eidos-checkbox-wrapper--disabled {
1312
1357
  cursor: not-allowed;
@@ -5073,6 +5118,7 @@ kbd.eidos-cmd-kbd {
5073
5118
  display: inline-flex;
5074
5119
  flex-direction: column;
5075
5120
  gap: var(--spacing-xs);
5121
+ position: relative;
5076
5122
  }
5077
5123
  .eidos-number-input--fullWidth {
5078
5124
  width: 100%;
@@ -5698,6 +5744,7 @@ kbd.eidos-cmd-kbd {
5698
5744
  align-items: center;
5699
5745
  cursor: pointer;
5700
5746
  width: fit-content;
5747
+ position: relative;
5701
5748
  }
5702
5749
  .eidos-radio-wrapper--disabled {
5703
5750
  cursor: not-allowed;
@@ -6903,6 +6950,7 @@ kbd.eidos-cmd-kbd {
6903
6950
  align-items: center;
6904
6951
  gap: var(--spacing-sm);
6905
6952
  cursor: pointer;
6953
+ position: relative;
6906
6954
  }
6907
6955
  .eidos-switch-wrapper--disabled {
6908
6956
  cursor: not-allowed;
@@ -7804,13 +7852,21 @@ kbd.eidos-cmd-kbd {
7804
7852
  flex-direction: column;
7805
7853
  }
7806
7854
  .eidos-tabs--line .eidos-tabs-list {
7807
- border-bottom: 2px solid var(--gray-200);
7855
+ padding-bottom: 2px;
7856
+ box-shadow: inset 0 -2px 0 var(--gray-200);
7808
7857
  position: relative;
7809
7858
  gap: 0;
7810
7859
  }
7811
7860
  .eidos-tabs--line .eidos-tab {
7812
7861
  border-radius: 0;
7813
7862
  }
7863
+ .eidos-tabs--enclosed .eidos-tabs-bar {
7864
+ background: var(--gray-100);
7865
+ border-radius: var(--border-radius-md);
7866
+ }
7867
+ .eidos-tabs--enclosed .eidos-tabs-scroll-button:hover {
7868
+ background: var(--gray-200);
7869
+ }
7814
7870
  .eidos-tabs--enclosed .eidos-tabs-list {
7815
7871
  background: var(--gray-100);
7816
7872
  border-radius: var(--border-radius-md);
@@ -7828,6 +7884,9 @@ kbd.eidos-cmd-kbd {
7828
7884
  gap: var(--spacing-xs);
7829
7885
  }
7830
7886
  .eidos-tabs--pills .eidos-tab {
7887
+ height: auto;
7888
+ padding-block: var(--spacing-sm);
7889
+ min-height: 24px;
7831
7890
  border-radius: 9999px;
7832
7891
  }
7833
7892
  .eidos-tabs--pills .eidos-tab--active {
@@ -7835,15 +7894,89 @@ kbd.eidos-cmd-kbd {
7835
7894
  color: var(--primary-contrast);
7836
7895
  }
7837
7896
 
7897
+ .eidos-tabs-bar {
7898
+ display: flex;
7899
+ align-items: stretch;
7900
+ min-width: 0;
7901
+ position: relative;
7902
+ }
7903
+
7904
+ .eidos-tabs-scroll-button {
7905
+ background: none;
7906
+ border: none;
7907
+ padding: 0;
7908
+ margin: 0;
7909
+ font: inherit;
7910
+ cursor: pointer;
7911
+ }
7912
+ .eidos-tabs-scroll-button:focus {
7913
+ outline: none;
7914
+ }
7915
+ .eidos-tabs-scroll-button {
7916
+ display: flex;
7917
+ align-items: center;
7918
+ justify-content: center;
7919
+ position: absolute;
7920
+ top: 50%;
7921
+ transform: translateY(-50%);
7922
+ z-index: 1;
7923
+ padding: var(--spacing-sm);
7924
+ background: rgb(var(--white-rgb), 0.9);
7925
+ border: 1px solid var(--gray-200);
7926
+ border-radius: var(--border-radius-sm);
7927
+ box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
7928
+ color: var(--gray-500);
7929
+ transition: color 0.2s ease, background-color 0.2s ease;
7930
+ }
7931
+ .eidos-tabs-scroll-button--prev {
7932
+ left: 0;
7933
+ }
7934
+ .eidos-tabs-scroll-button--next {
7935
+ right: 0;
7936
+ }
7937
+ .eidos-tabs-scroll-button:hover {
7938
+ color: var(--gray-700);
7939
+ background: var(--gray-100);
7940
+ }
7941
+ .eidos-tabs-scroll-button--sm {
7942
+ font-size: var(--font-size-xs);
7943
+ }
7944
+ .eidos-tabs-scroll-button--md {
7945
+ font-size: var(--font-size-sm);
7946
+ }
7947
+ .eidos-tabs-scroll-button--lg {
7948
+ font-size: var(--font-size-base);
7949
+ }
7950
+
7951
+ .eidos-tabs-scroll-button-icon {
7952
+ width: 1.25em;
7953
+ height: 1.25em;
7954
+ }
7955
+
7838
7956
  .eidos-tabs-list {
7839
7957
  display: flex;
7840
7958
  align-items: center;
7841
7959
  overflow-x: auto;
7842
7960
  min-width: 0;
7843
7961
  }
7962
+ .eidos-tabs-list--sm {
7963
+ height: var(--component-size-sm);
7964
+ }
7965
+ .eidos-tabs-list--md {
7966
+ height: var(--component-size-md);
7967
+ }
7968
+ .eidos-tabs-list--lg {
7969
+ height: var(--component-size-lg);
7970
+ }
7844
7971
  .eidos-tabs-list--fullWidth .eidos-tab {
7845
7972
  flex: 1;
7846
7973
  }
7974
+ .eidos-tabs-list--hideScrollbar {
7975
+ scrollbar-width: none;
7976
+ }
7977
+ .eidos-tabs-list--hideScrollbar::-webkit-scrollbar {
7978
+ display: none;
7979
+ }
7847
7980
 
7848
7981
  .eidos-tab {
7849
7982
  background: none;
@@ -7864,24 +7997,22 @@ kbd.eidos-cmd-kbd {
7864
7997
  white-space: nowrap;
7865
7998
  color: var(--gray-500);
7866
7999
  font-weight: var(--font-weight-medium);
8000
+ line-height: 1;
7867
8001
  transition: all 0.2s ease;
7868
8002
  border-radius: 0;
7869
- will-change: transform;
8003
+ height: 100%;
7870
8004
  }
7871
8005
  .eidos-tab--sm {
7872
8006
  font-size: var(--font-size-xs);
7873
- padding: var(--spacing-xs) var(--spacing-sm);
7874
- height: var(--component-size-sm);
8007
+ padding-inline: var(--spacing-sm);
7875
8008
  }
7876
8009
  .eidos-tab--md {
7877
8010
  font-size: var(--font-size-sm);
7878
- padding: var(--spacing-xs) var(--spacing-md);
7879
- height: var(--component-size-md);
8011
+ padding-inline: var(--spacing-md);
7880
8012
  }
7881
8013
  .eidos-tab--lg {
7882
8014
  font-size: var(--font-size-base);
7883
- padding: var(--spacing-sm) var(--spacing-md);
7884
- height: var(--component-size-lg);
8015
+ padding-inline: var(--spacing-md);
7885
8016
  }
7886
8017
  .eidos-tab:hover:not(.eidos-tab--disabled):not(.eidos-tab--active) {
7887
8018
  color: var(--gray-700);
@@ -7912,7 +8043,7 @@ kbd.eidos-cmd-kbd {
7912
8043
  color: var(--primary-contrast);
7913
8044
  }
7914
8045
  .eidos-tabs--primary .eidos-tab:focus-visible {
7915
- box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.3);
8046
+ box-shadow: inset 0 0 0 2px rgba(var(--primary-rgb), 0.5);
7916
8047
  }
7917
8048
 
7918
8049
  .eidos-tabs--secondary .eidos-tab--active {
@@ -7926,7 +8057,7 @@ kbd.eidos-cmd-kbd {
7926
8057
  color: var(--secondary-contrast);
7927
8058
  }
7928
8059
  .eidos-tabs--secondary .eidos-tab:focus-visible {
7929
- box-shadow: 0 0 0 3px rgba(var(--secondary-rgb), 0.3);
8060
+ box-shadow: inset 0 0 0 2px rgba(var(--secondary-rgb), 0.5);
7930
8061
  }
7931
8062
 
7932
8063
  .eidos-tabs--success .eidos-tab--active {
@@ -7940,7 +8071,7 @@ kbd.eidos-cmd-kbd {
7940
8071
  color: var(--success-contrast);
7941
8072
  }
7942
8073
  .eidos-tabs--success .eidos-tab:focus-visible {
7943
- box-shadow: 0 0 0 3px rgba(var(--success-rgb), 0.3);
8074
+ box-shadow: inset 0 0 0 2px rgba(var(--success-rgb), 0.5);
7944
8075
  }
7945
8076
 
7946
8077
  .eidos-tabs--danger .eidos-tab--active {
@@ -7954,7 +8085,7 @@ kbd.eidos-cmd-kbd {
7954
8085
  color: var(--danger-contrast);
7955
8086
  }
7956
8087
  .eidos-tabs--danger .eidos-tab:focus-visible {
7957
- box-shadow: 0 0 0 3px rgba(var(--danger-rgb), 0.3);
8088
+ box-shadow: inset 0 0 0 2px rgba(var(--danger-rgb), 0.5);
7958
8089
  }
7959
8090
 
7960
8091
  .eidos-tabs--warning .eidos-tab--active {
@@ -7968,7 +8099,7 @@ kbd.eidos-cmd-kbd {
7968
8099
  color: var(--warning-contrast);
7969
8100
  }
7970
8101
  .eidos-tabs--warning .eidos-tab:focus-visible {
7971
- box-shadow: 0 0 0 3px rgba(var(--warning-rgb), 0.3);
8102
+ box-shadow: inset 0 0 0 2px rgba(var(--warning-rgb), 0.5);
7972
8103
  }
7973
8104
 
7974
8105
  .eidos-tabs--info .eidos-tab--active {
@@ -7982,12 +8113,16 @@ kbd.eidos-cmd-kbd {
7982
8113
  color: var(--info-contrast);
7983
8114
  }
7984
8115
  .eidos-tabs--info .eidos-tab:focus-visible {
7985
- box-shadow: 0 0 0 3px rgba(var(--info-rgb), 0.3);
8116
+ box-shadow: inset 0 0 0 2px rgba(var(--info-rgb), 0.5);
8117
+ }
8118
+
8119
+ .eidos-tabs--pills .eidos-tab--active:focus-visible {
8120
+ box-shadow: inset 0 0 0 2px currentColor;
7986
8121
  }
7987
8122
 
7988
8123
  .eidos-tabs-indicator {
7989
8124
  position: absolute;
7990
- bottom: -2px;
8125
+ bottom: 0;
7991
8126
  left: 0;
7992
8127
  width: 0;
7993
8128
  height: 2px;
@@ -8611,6 +8746,7 @@ kbd.eidos-cmd-kbd {
8611
8746
  align-items: center;
8612
8747
  gap: var(--spacing-xs);
8613
8748
  flex: 0 0 auto;
8749
+ position: relative;
8614
8750
  margin-left: auto;
8615
8751
  }
8616
8752
  .eidos-theme-editor-row--wide > .eidos-theme-editor-row__control {
@@ -9048,16 +9184,18 @@ kbd.eidos-cmd-kbd {
9048
9184
  }
9049
9185
  .eidos-pagelayout__content {
9050
9186
  grid-area: content;
9051
- display: grid;
9052
- grid-template-rows: minmax(50px, auto) 1fr auto;
9187
+ display: flex;
9188
+ flex-direction: column;
9053
9189
  background-color: var(--gray-50);
9054
9190
  min-height: 0;
9055
9191
  min-width: 0;
9192
+ overflow: auto;
9193
+ }
9194
+ .eidos-pagelayout__header, .eidos-pagelayout__footer {
9195
+ flex: 0 0 auto;
9056
9196
  }
9057
9197
  .eidos-pagelayout__body {
9058
- overflow: auto;
9059
- min-height: 0;
9060
- min-width: 0;
9198
+ flex: 1 0 auto;
9061
9199
  }
9062
9200
  .eidos-pagelayout__footer.eidos-footer--copyright {
9063
9201
  padding: var(--spacing-md) var(--spacing-xl);
@@ -9314,7 +9452,7 @@ kbd.eidos-cmd-kbd {
9314
9452
  transition: background 0.12s ease, color 0.12s ease, gap var(--navigation-collapse-duration) var(--navigation-collapse-easing), padding var(--navigation-collapse-duration) var(--navigation-collapse-easing);
9315
9453
  }
9316
9454
  .eidos-navigation__item:hover:not(:disabled) {
9317
- background: var(--gray-100);
9455
+ background: var(--primary-50);
9318
9456
  color: var(--dark-color);
9319
9457
  }
9320
9458
  .eidos-navigation__item:disabled {
@@ -9322,10 +9460,14 @@ kbd.eidos-cmd-kbd {
9322
9460
  cursor: not-allowed;
9323
9461
  }
9324
9462
  .eidos-navigation__item--active {
9325
- background: var(--primary-50);
9326
- color: var(--primary-color);
9463
+ background: var(--primary-color);
9464
+ color: var(--primary-contrast);
9327
9465
  font-weight: var(--font-weight-semibold);
9328
9466
  }
9467
+ .eidos-navigation__item--active:hover:not(:disabled) {
9468
+ background: var(--primary-dark);
9469
+ color: var(--primary-contrast);
9470
+ }
9329
9471
  .eidos-navigation--collapsed .eidos-navigation__item {
9330
9472
  gap: 0;
9331
9473
  padding: var(--spacing-sm) calc((var(--navigation-collapsed-width) - 2 * var(--spacing-sm) - 16px) / 2);
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  Tab,
9
9
  TabPanel,
10
10
  Tabs
11
- } from "./chunk-RAZRQ57B.js";
11
+ } from "./chunk-74MBKLYI.js";
12
12
  import {
13
13
  TagInput
14
14
  } from "./chunk-R4PU2TBM.js";
@@ -17,7 +17,7 @@ import {
17
17
  } from "./chunk-REVK7IGN.js";
18
18
  import {
19
19
  ThemeEditor
20
- } from "./chunk-H5HWFOWZ.js";
20
+ } from "./chunk-SYWSXSHY.js";
21
21
  import {
22
22
  FONT_ACCEPT,
23
23
  ThemeProvider,
@@ -29,7 +29,7 @@ import {
29
29
  registerFontFile,
30
30
  toFontStack,
31
31
  useTheme
32
- } from "./chunk-2ZY7M72Q.js";
32
+ } from "./chunk-GWQEADRJ.js";
33
33
  import {
34
34
  Timeline
35
35
  } from "./chunk-NEQXEVHM.js";
@@ -2,12 +2,12 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkVHQTDITVcjs = require('../chunk-VHQTDITV.cjs');
5
+ var _chunkKQD7CQ4Zcjs = require('../chunk-KQD7CQ4Z.cjs');
6
6
  require('../chunk-GEHL4LKK.cjs');
7
7
  require('../chunk-DZUJEN5N.cjs');
8
8
 
9
9
 
10
10
 
11
11
 
12
- exports.Tab = _chunkVHQTDITVcjs.Tab; exports.TabPanel = _chunkVHQTDITVcjs.TabPanel; exports.Tabs = _chunkVHQTDITVcjs.Tabs;
12
+ exports.Tab = _chunkKQD7CQ4Zcjs.Tab; exports.TabPanel = _chunkKQD7CQ4Zcjs.TabPanel; exports.Tabs = _chunkKQD7CQ4Zcjs.Tabs;
13
13
  //# sourceMappingURL=index.cjs.map
@@ -3,6 +3,16 @@ import { I as IconType } from '../renderIcon-C2lEMMzb.cjs';
3
3
  import { C as ComponentSizeProps } from '../sizes-DM6Rrrgq.cjs';
4
4
 
5
5
  type TabsColorProps = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info';
6
+ /**
7
+ * How an overflowing tab strip is scrolled.
8
+ *
9
+ * - `auto` - previous/next buttons appear only while the strip overflows, and
10
+ * the native scrollbar is hidden because the buttons are the affordance.
11
+ * - `none` - no buttons; the strip keeps its native scrollbar.
12
+ *
13
+ * Native scrolling (touch swipe, trackpad, shift+wheel) works either way.
14
+ */
15
+ type TabsScrollButtonsProps = 'auto' | 'none';
6
16
  interface TabsProps {
7
17
  value?: string;
8
18
  defaultValue?: string;
@@ -11,6 +21,7 @@ interface TabsProps {
11
21
  size?: ComponentSizeProps;
12
22
  color?: TabsColorProps;
13
23
  fullWidth?: boolean;
24
+ scrollButtons?: TabsScrollButtonsProps;
14
25
  className?: string;
15
26
  children: React__default.ReactNode;
16
27
  }
@@ -3,6 +3,16 @@ import { I as IconType } from '../renderIcon-C2lEMMzb.js';
3
3
  import { C as ComponentSizeProps } from '../sizes-DM6Rrrgq.js';
4
4
 
5
5
  type TabsColorProps = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info';
6
+ /**
7
+ * How an overflowing tab strip is scrolled.
8
+ *
9
+ * - `auto` - previous/next buttons appear only while the strip overflows, and
10
+ * the native scrollbar is hidden because the buttons are the affordance.
11
+ * - `none` - no buttons; the strip keeps its native scrollbar.
12
+ *
13
+ * Native scrolling (touch swipe, trackpad, shift+wheel) works either way.
14
+ */
15
+ type TabsScrollButtonsProps = 'auto' | 'none';
6
16
  interface TabsProps {
7
17
  value?: string;
8
18
  defaultValue?: string;
@@ -11,6 +21,7 @@ interface TabsProps {
11
21
  size?: ComponentSizeProps;
12
22
  color?: TabsColorProps;
13
23
  fullWidth?: boolean;
24
+ scrollButtons?: TabsScrollButtonsProps;
14
25
  className?: string;
15
26
  children: React__default.ReactNode;
16
27
  }
@@ -2,7 +2,7 @@ import {
2
2
  Tab,
3
3
  TabPanel,
4
4
  Tabs
5
- } from "../chunk-RAZRQ57B.js";
5
+ } from "../chunk-74MBKLYI.js";
6
6
  import "../chunk-KBG77JHC.js";
7
7
  import "../chunk-5WRI5ZAA.js";
8
8
  export {
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkSE7MWOC7cjs = require('../chunk-SE7MWOC7.cjs');
4
- require('../chunk-U5FHQ73U.cjs');
3
+ var _chunkJRYTZ5B2cjs = require('../chunk-JRYTZ5B2.cjs');
4
+ require('../chunk-SEDKUITE.cjs');
5
5
  require('../chunk-OZZHOEN5.cjs');
6
6
  require('../chunk-V5RS3JZN.cjs');
7
7
  require('../chunk-5BX4Q76D.cjs');
@@ -18,5 +18,5 @@ require('../chunk-Z5U4NJTW.cjs');
18
18
  require('../chunk-DZUJEN5N.cjs');
19
19
 
20
20
 
21
- exports.ThemeEditor = _chunkSE7MWOC7cjs.ThemeEditor;
21
+ exports.ThemeEditor = _chunkJRYTZ5B2cjs.ThemeEditor;
22
22
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ThemeEditor
3
- } from "../chunk-H5HWFOWZ.js";
4
- import "../chunk-2ZY7M72Q.js";
3
+ } from "../chunk-SYWSXSHY.js";
4
+ import "../chunk-GWQEADRJ.js";
5
5
  import "../chunk-2BC4M4QZ.js";
6
6
  import "../chunk-EF4Y6Q35.js";
7
7
  import "../chunk-LEMCJW57.js";
@@ -9,7 +9,7 @@
9
9
 
10
10
 
11
11
 
12
- var _chunkU5FHQ73Ucjs = require('../chunk-U5FHQ73U.cjs');
12
+ var _chunkSEDKUITEcjs = require('../chunk-SEDKUITE.cjs');
13
13
  require('../chunk-GEHL4LKK.cjs');
14
14
  require('../chunk-DZUJEN5N.cjs');
15
15
 
@@ -23,5 +23,5 @@ require('../chunk-DZUJEN5N.cjs');
23
23
 
24
24
 
25
25
 
26
- exports.FONT_ACCEPT = _chunkU5FHQ73Ucjs.FONT_ACCEPT; exports.ThemeProvider = _chunkU5FHQ73Ucjs.ThemeProvider; exports.defaultTheme = _chunkU5FHQ73Ucjs.defaultTheme; exports.familyNameFromFile = _chunkU5FHQ73Ucjs.familyNameFromFile; exports.isFontAvailable = _chunkU5FHQ73Ucjs.isFontAvailable; exports.isFontStackAvailable = _chunkU5FHQ73Ucjs.isFontStackAvailable; exports.registerFontFace = _chunkU5FHQ73Ucjs.registerFontFace; exports.registerFontFile = _chunkU5FHQ73Ucjs.registerFontFile; exports.toFontStack = _chunkU5FHQ73Ucjs.toFontStack; exports.useTheme = _chunkU5FHQ73Ucjs.useTheme;
26
+ exports.FONT_ACCEPT = _chunkSEDKUITEcjs.FONT_ACCEPT; exports.ThemeProvider = _chunkSEDKUITEcjs.ThemeProvider; exports.defaultTheme = _chunkSEDKUITEcjs.defaultTheme; exports.familyNameFromFile = _chunkSEDKUITEcjs.familyNameFromFile; exports.isFontAvailable = _chunkSEDKUITEcjs.isFontAvailable; exports.isFontStackAvailable = _chunkSEDKUITEcjs.isFontStackAvailable; exports.registerFontFace = _chunkSEDKUITEcjs.registerFontFace; exports.registerFontFile = _chunkSEDKUITEcjs.registerFontFile; exports.toFontStack = _chunkSEDKUITEcjs.toFontStack; exports.useTheme = _chunkSEDKUITEcjs.useTheme;
27
27
  //# sourceMappingURL=index.cjs.map
@@ -9,7 +9,7 @@ import {
9
9
  registerFontFile,
10
10
  toFontStack,
11
11
  useTheme
12
- } from "../chunk-2ZY7M72Q.js";
12
+ } from "../chunk-GWQEADRJ.js";
13
13
  import "../chunk-KBG77JHC.js";
14
14
  import "../chunk-5WRI5ZAA.js";
15
15
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eidos-ui",
3
- "version": "3.0.0",
3
+ "version": "3.1.1",
4
4
  "description": "A modern React component library with TypeScript and SCSS",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/ThemeProvider/ThemeProvider.component.tsx","../src/components/ThemeProvider/ThemeProvider.context.tsx","../src/components/ThemeProvider/ThemeProvider.color.ts","../src/components/ThemeProvider/ThemeProvider.tokens.ts","../src/components/ThemeProvider/ThemeProvider.fonts.ts"],"sourcesContent":["import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport { devWarn } from '../../utils';\nimport { ThemeContext } from './ThemeProvider.context';\nimport { buildTokens, diffFromDefault, resolveTheme, themeToCss } from './ThemeProvider.tokens';\nimport type { ThemeConfig, ThemeContextValue, ThemeProviderProps } from './ThemeProvider.types';\n\nconst EMPTY_THEME: ThemeConfig = {};\n\n/**\n * Number of providers currently mounted.\n *\n * Because tokens are written to `document.documentElement` (see the component\n * comment for why), providers do not compose: two of them target the same\n * element, so whichever applied a given token last wins for the entire page -\n * including for the subtree of the other one. That looks like a broken theme\n * rather than a misuse, so it is worth saying out loud.\n */\nlet mountedProviders = 0;\n\n/** Merges `patch` over `base` one level into `colors`/`typography`. */\nconst mergeTheme = (base: ThemeConfig, patch: ThemeConfig): ThemeConfig => ({\n colors: { ...base.colors, ...patch.colors },\n typography: { ...base.typography, ...patch.typography },\n});\n\n/**\n * Applies a theme by writing CSS custom properties to `document.documentElement`.\n *\n * Two deliberate choices worth knowing:\n *\n * **The target is `documentElement`, not a wrapper element.** Every overlay in\n * this library (`Dropdown`, `Modal`, `Drawer`, `Snackbar`, `Tooltip`, …) portals\n * to `document.body`, so tokens scoped to a wrapper `<div>` would leave every\n * popup rendering the preset instead.\n *\n * **Properties are set through the CSSOM** (`style.setProperty`), which no CSP\n * directive gates - `style-src` and `style-src-attr` only cover the `style`\n * HTML attribute and stylesheet loads. Nothing here needs a nonce, and no\n * `<style>` element is ever created. See `ContentSecurityPolicy.mdx`.\n *\n * Under SSR the server sends the preset from `dist/index.css` and the theme is\n * applied on hydration; use `toCss()` if you need a themed first paint.\n */\nexport const ThemeProvider: React.FC<ThemeProviderProps> = ({\n children,\n theme: controlledTheme,\n defaultTheme: initialTheme,\n onThemeChange,\n}) => {\n const isControlled = controlledTheme !== undefined;\n const [uncontrolledTheme, setUncontrolledTheme] = useState<ThemeConfig>(\n initialTheme ?? EMPTY_THEME,\n );\n const theme = isControlled ? controlledTheme : uncontrolledTheme;\n\n useEffect(() => {\n mountedProviders += 1;\n if (mountedProviders > 1) {\n devWarn(\n 'theme-multiple-providers',\n `ThemeProvider: ${mountedProviders} providers are mounted at once. They all write to document.documentElement, so the last one to apply each token wins for the whole page - nested or sibling providers cannot theme separate subtrees. Use a single provider at your app root.`,\n );\n }\n return () => {\n mountedProviders -= 1;\n };\n }, []);\n\n const resolvedTheme = useMemo(() => resolveTheme(theme), [theme]);\n const tokens = useMemo(() => diffFromDefault(buildTokens(resolvedTheme)), [resolvedTheme]);\n\n // Names written on the previous pass, so properties dropped from the theme\n // are removed rather than left behind at their last value.\n const appliedRef = useRef<string[]>([]);\n\n useLayoutEffect(() => {\n if (typeof document === 'undefined') return;\n const root = document.documentElement;\n\n for (const name of appliedRef.current) {\n if (!(name in tokens)) root.style.removeProperty(name);\n }\n for (const [name, value] of Object.entries(tokens)) {\n root.style.setProperty(name, value);\n }\n appliedRef.current = Object.keys(tokens);\n\n return () => {\n for (const name of appliedRef.current) {\n root.style.removeProperty(name);\n }\n appliedRef.current = [];\n };\n }, [tokens]);\n\n const commit = useCallback(\n (next: ThemeConfig) => {\n if (!isControlled) setUncontrolledTheme(next);\n onThemeChange?.(next);\n },\n [isControlled, onThemeChange],\n );\n\n const setTheme = useCallback((next: ThemeConfig) => commit(next), [commit]);\n\n const updateTheme = useCallback(\n (patch: ThemeConfig) => commit(mergeTheme(theme, patch)),\n [commit, theme],\n );\n\n const resetTheme = useCallback(() => commit(EMPTY_THEME), [commit]);\n\n const toCss = useCallback(() => themeToCss(resolvedTheme), [resolvedTheme]);\n\n const value = useMemo<ThemeContextValue>(\n () => ({\n theme,\n resolvedTheme,\n setTheme,\n updateTheme,\n resetTheme,\n isDefault: Object.keys(tokens).length === 0,\n toCss,\n }),\n [theme, resolvedTheme, setTheme, updateTheme, resetTheme, tokens, toCss],\n );\n\n return <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>;\n};\n\nThemeProvider.displayName = 'ThemeProvider';\n","import { createContext, useContext } from 'react';\nimport type { ThemeContextValue } from './ThemeProvider.types';\n\nexport const ThemeContext = createContext<ThemeContextValue | undefined>(undefined);\n\n/**\n * Reads the active theme. Throws outside a `ThemeProvider`, matching\n * `useSnackbarContext` - a silent fallback would make a missing provider look\n * like a theme that simply is not applying.\n */\nexport const useTheme = (): ThemeContextValue => {\n const context = useContext(ThemeContext);\n if (!context) {\n throw new Error('useTheme must be used within a ThemeProvider');\n }\n return context;\n};\n","/**\n * Colour maths for the theme system.\n *\n * All conversions are done in JS and emitted as `#rrggbb`, so browser support\n * for `oklch()` is irrelevant here - nothing in the generated CSS uses a modern\n * colour function.\n *\n * OKLab is used rather than HSL for every interpolation. HSL lightness\n * interpolation is ~40 lines shorter but produces muddy, desaturated ramps for\n * exactly the saturated brand hues this feature exists to support, because its\n * \"lightness\" is not perceptual.\n */\n\n// ============================================================================\n// sRGB <-> OKLab\n// ============================================================================\n\nexport interface Oklch {\n /** Perceptual lightness, 0-1. */\n l: number;\n /** Chroma (colourfulness), 0 to ~0.4 in sRGB. */\n c: number;\n /** Hue angle in radians. */\n h: number;\n}\n\nconst srgbToLinear = (v: number): number =>\n v <= 0.04045 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);\n\nconst linearToSrgb = (v: number): number =>\n v <= 0.0031308 ? 12.92 * v : 1.055 * Math.pow(v, 1 / 2.4) - 0.055;\n\nconst clamp01 = (v: number): number => (v < 0 ? 0 : v > 1 ? 1 : v);\n\n/** Parses `#rgb` / `#rrggbb` into 0-1 sRGB channels. Returns null if unparseable. */\nexport const parseHex = (hex: string): [number, number, number] | null => {\n if (typeof hex !== 'string') return null;\n const raw = hex.trim().replace(/^#/, '');\n const full =\n raw.length === 3\n ? raw\n .split('')\n .map((c) => c + c)\n .join('')\n : raw;\n if (!/^[0-9a-fA-F]{6}$/.test(full)) return null;\n const n = parseInt(full, 16);\n return [((n >> 16) & 255) / 255, ((n >> 8) & 255) / 255, (n & 255) / 255];\n};\n\nexport const isValidHex = (hex: string): boolean => parseHex(hex) !== null;\n\nconst toHex = ([r, g, b]: [number, number, number]): string =>\n '#' +\n [r, g, b]\n .map((v) =>\n Math.round(clamp01(v) * 255)\n .toString(16)\n .padStart(2, '0'),\n )\n .join('');\n\n/** `#rrggbb` -> the comma-separated triple the `--x-rgb` tokens use. */\nexport const hexToRgbTriple = (hex: string): string => {\n const rgb = parseHex(hex);\n if (!rgb) return '0, 0, 0';\n return rgb.map((v) => Math.round(v * 255)).join(', ');\n};\n\nconst linearToOklab = ([r, g, b]: [number, number, number]): [number, number, number] => {\n const l = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b);\n const m = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b);\n const s = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b);\n return [\n 0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s,\n 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s,\n 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s,\n ];\n};\n\nconst oklabToLinear = ([L, A, B]: [number, number, number]): [number, number, number] => {\n const l = (L + 0.3963377774 * A + 0.2158037573 * B) ** 3;\n const m = (L - 0.1055613458 * A - 0.0638541728 * B) ** 3;\n const s = (L - 0.0894841775 * A - 1.291485548 * B) ** 3;\n return [\n 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,\n -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s,\n -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s,\n ];\n};\n\nexport const hexToOklch = (hex: string): Oklch => {\n const rgb = parseHex(hex) ?? [0, 0, 0];\n const [l, a, b] = linearToOklab(rgb.map(srgbToLinear) as [number, number, number]);\n return { l, c: Math.hypot(a, b), h: Math.atan2(b, a) };\n};\n\nconst inGamut = ([r, g, b]: [number, number, number]): boolean =>\n [r, g, b].every((v) => v >= -1e-4 && v <= 1 + 1e-4);\n\n/**\n * Largest chroma that still fits in sRGB at this lightness and hue.\n *\n * Needed because OKLab is a much larger space than sRGB: naively keeping a\n * colour's chroma while changing its lightness frequently lands outside the\n * gamut, where channels clip and the hue visibly shifts.\n */\nconst maxChroma = (l: number, h: number): number => {\n let lo = 0;\n let hi = 0.45;\n for (let i = 0; i < 24; i++) {\n const mid = (lo + hi) / 2;\n if (inGamut(oklabToLinear([l, mid * Math.cos(h), mid * Math.sin(h)]))) lo = mid;\n else hi = mid;\n }\n return lo;\n};\n\nexport const oklchToHex = ({ l, c, h }: Oklch): string => {\n const lc = clamp01(l);\n const cc = Math.min(Math.max(c, 0), maxChroma(lc, h));\n return toHex(\n oklabToLinear([lc, cc * Math.cos(h), cc * Math.sin(h)]).map(linearToSrgb) as [\n number,\n number,\n number,\n ],\n );\n};\n\n// ============================================================================\n// WCAG 2.1 contrast\n// ============================================================================\n\n/**\n * WCAG 2.1 is used rather than APCA. APCA models perception better but is\n * still a draft (targeted at WCAG 3), while WCAG 2 is what consumers are\n * actually audited against. Its known weakness - mis-ranking some mid-tone\n * blues and greens - is accepted for that reason.\n */\nexport const relativeLuminance = (hex: string): number => {\n const [r, g, b] = (parseHex(hex) ?? [0, 0, 0]).map(srgbToLinear);\n return 0.2126 * r + 0.7152 * g + 0.0722 * b;\n};\n\n/** Contrast ratio between two colours, 1 (identical) to 21 (black on white). */\nexport const contrastRatio = (a: string, b: string): number => {\n const [x, y] = [relativeLuminance(a), relativeLuminance(b)];\n return (Math.max(x, y) + 0.05) / (Math.min(x, y) + 0.05);\n};\n\n/** The two foreground candidates, matching `--white` and `--gray-900`. */\nexport const CONTRAST_LIGHT = '#ffffff';\nexport const CONTRAST_DARK = '#0f172a';\n\n/**\n * Foreground to place on `fill`.\n *\n * White wins unless it drops below 3:1, at which point the better of the two\n * candidates is used. The threshold is deliberately 3:1 rather than \"whichever\n * scores higher\": on mid-tone reds the dark candidate often scores marginally\n * better while looking plainly wrong, and every preset base clears 4.5:1\n * against white anyway.\n */\nexport const pickContrast = (fill: string): string => {\n const onLight = contrastRatio(fill, CONTRAST_LIGHT);\n if (onLight >= 3) return CONTRAST_LIGHT;\n return onLight >= contrastRatio(fill, CONTRAST_DARK) ? CONTRAST_LIGHT : CONTRAST_DARK;\n};\n\n// ============================================================================\n// Ramp generation\n// ============================================================================\n\n/** The ramp steps, in the order `--x-50` … `--x-900` are declared. */\nexport const RAMP_STEPS = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900] as const;\n\nexport type RampStep = (typeof RAMP_STEPS)[number];\n\n/** The step the supplied base colour occupies; the ramp is built around it. */\nconst BASE_STEP = 500;\n\n/**\n * Target lightness per step, and how much of the base's chroma to keep.\n *\n * Measured from the preset indigo ramp, so feeding the preset primary through\n * `buildRamp` lands close to the shipped `--primary-*` values rather than\n * something arbitrary. It is deliberately not an exact reproduction - see the\n * note on `buildRamp`.\n */\nconst RAMP_CURVE: Record<RampStep, { l: number; chroma: number }> = {\n 50: { l: 0.962, chroma: 0.09 },\n 100: { l: 0.93, chroma: 0.16 },\n 200: { l: 0.87, chroma: 0.3 },\n 300: { l: 0.785, chroma: 0.51 },\n 400: { l: 0.68, chroma: 0.77 },\n 500: { l: 0.558, chroma: 1.0 },\n 600: { l: 0.511, chroma: 1.12 },\n 700: { l: 0.457, chroma: 1.05 },\n 800: { l: 0.398, chroma: 0.87 },\n 900: { l: 0.359, chroma: 0.66 },\n};\n\n/** Ceiling/floor the generated ends aim for, leaving the base itself untouched. */\nconst LIGHT_CEILING = 0.985;\nconst DARK_FLOOR = 0.22;\n\n/** Minimum lightness gap between adjacent steps, so none can collapse together. */\nconst MIN_STEP_DELTA = 0.012;\n\n/**\n * Generates a 50-900 ramp around `base`, which is placed at the 500 step.\n *\n * The base's own hue is always preserved, and `--x-500` is returned as the base\n * hex verbatim, so the colour a consumer picked is never silently replaced.\n *\n * The curve above is *rescaled* to whatever lightness headroom the base leaves,\n * rather than being applied absolutely or simply shifted:\n *\n * - Applying it absolutely would reassign the base - pick a pale yellow and\n * `--x-500` would come back a mid-olive, contradicting `--x-color`.\n * - Shifting it so 500 sits at the base's lightness pushes the light end past\n * `l = 1`, where it clips and 50/100/200/300 all come out pure white.\n *\n * Rescaling keeps the ends anchored (50 stays near-white, 900 stays dark) and\n * compresses only the side with less room - the scale is capped at 1 so a base\n * sitting where the curve expects it reproduces the curve exactly rather than\n * being stretched past it.\n *\n * Two inputs are genuinely degenerate and are handled rather than solved: a\n * base at or above `LIGHT_CEILING` has no room for tints, and one with zero\n * chroma (pure white, black, any gray) has no saturation to separate them with\n * either. For those the light end converges, and `isRampViable` reports it so\n * the caller can warn. Realistic light picks are fine - `#fde047` still yields\n * five distinct tints.\n */\nexport const buildRamp = (base: string): Record<RampStep, string> => {\n const { l: baseL, c: baseC, h } = hexToOklch(base);\n const anchor = RAMP_CURVE[BASE_STEP].l;\n\n // Headroom available above and below the base, versus what the curve wants.\n // Capped at 1: this may only compress the curve, never stretch it.\n const lightSpan = RAMP_CURVE[50].l - anchor;\n const darkSpan = anchor - RAMP_CURVE[900].l;\n const lightScale =\n lightSpan > 0 ? Math.min(1, Math.max(0, LIGHT_CEILING - baseL) / lightSpan) : 0;\n const darkScale = darkSpan > 0 ? Math.min(1, Math.max(0, baseL - DARK_FLOOR) / darkSpan) : 0;\n\n const out = {} as Record<RampStep, string>;\n for (const step of RAMP_STEPS) {\n if (step === BASE_STEP) {\n out[step] = base;\n continue;\n }\n const { l: curveL, chroma } = RAMP_CURVE[step];\n const offset = curveL - anchor;\n const l = baseL + offset * (offset > 0 ? lightScale : darkScale);\n out[step] = oklchToHex({ l, c: baseC * chroma, h });\n }\n\n return enforceSeparation(out, h, baseC);\n};\n\n/**\n * Walks outward from the base step, pushing any step that ended up too close to\n * its neighbour further away. Only bites for extreme inputs (near-white,\n * near-black, zero-chroma), where the rescale above has almost no room left.\n */\nconst enforceSeparation = (\n ramp: Record<RampStep, string>,\n h: number,\n baseC: number,\n): Record<RampStep, string> => {\n const baseIndex = RAMP_STEPS.indexOf(BASE_STEP);\n const lightness = RAMP_STEPS.map((s) => hexToOklch(ramp[s]).l);\n\n // Lighter steps: walk from the base toward 50, each must be lighter.\n for (let i = baseIndex - 1; i >= 0; i--) {\n const limit = lightness[i + 1] + MIN_STEP_DELTA;\n if (lightness[i] < limit) lightness[i] = Math.min(1, limit);\n }\n // Darker steps: walk from the base toward 900, each must be darker.\n for (let i = baseIndex + 1; i < RAMP_STEPS.length; i++) {\n const limit = lightness[i - 1] - MIN_STEP_DELTA;\n if (lightness[i] > limit) lightness[i] = Math.max(0, limit);\n }\n\n const out = {} as Record<RampStep, string>;\n RAMP_STEPS.forEach((step, i) => {\n if (step === BASE_STEP) {\n out[step] = ramp[step];\n return;\n }\n out[step] = oklchToHex({\n l: lightness[i],\n c: baseC * RAMP_CURVE[step].chroma,\n h,\n });\n });\n return out;\n};\n\n/** How far `--x-dark` / `--x-light` sit from the base, in OKLab lightness. */\nconst DARK_DELTA = 0.086;\nconst LIGHT_DELTA = 0.169;\n\n/** Below this lightness there is no room left to darken, so the hover lightens. */\nconst HOVER_INVERT_BELOW = DARK_DELTA * 1.5;\n\n/**\n * The hover/active colour. Must differ *visibly* from the base and stay legible\n * as text on white, since `--x-dark` is used both as a fill (Button, Chip\n * hovers) and as text (Snackbar, link hover in `global.scss`).\n *\n * A fixed ramp step is not good enough: for a near-white base the 600 step\n * lands barely darker than the base and the hover reads as no change at all.\n * Hence a guaranteed delta.\n *\n * For a base that is already near-black the delta is applied *upwards* instead.\n * Clamping to a floor would return a colour lighter than the base while still\n * being named \"dark\", and returning the base unchanged would leave the control\n * with no hover affordance at all; lightening is what dark-surface design\n * systems do anyway.\n */\nexport const deriveDark = (base: string): string => {\n const { l, c, h } = hexToOklch(base);\n const target = l < HOVER_INVERT_BELOW ? l + DARK_DELTA : l - DARK_DELTA;\n return oklchToHex({ l: target, c, h });\n};\n\n/**\n * The light companion. Lightening has a hard ceiling, so for an already-pale\n * base this lands very close to it - acceptable, as `--x-light` is a public\n * token that nothing inside the library currently consumes.\n */\nexport const deriveLight = (base: string): string => {\n const { l, c, h } = hexToOklch(base);\n return oklchToHex({ l: Math.min(LIGHT_CEILING, l + LIGHT_DELTA), c, h });\n};\n\n/**\n * Whether `base` leaves enough lightness headroom to generate a usable 50-900\n * ramp. False only for near-white and near-black, where the tint or shade end\n * necessarily converges - the caller surfaces that as a developer warning\n * rather than silently shipping identical tokens.\n *\n * Deliberately does not test chroma: an unsaturated gray separates perfectly\n * well by lightness alone, and a saturated light colour like `#fde047` still\n * produces five distinct tints. Only the extremes genuinely fail.\n */\nexport const isRampViable = (base: string): boolean => {\n const { l } = hexToOklch(base);\n return l < 0.95 && l > 0.12;\n};\n","import { devWarn } from '../../utils';\nimport {\n RAMP_STEPS,\n buildRamp,\n deriveDark,\n deriveLight,\n hexToRgbTriple,\n isValidHex,\n isRampViable,\n pickContrast,\n} from './ThemeProvider.color';\nimport type {\n ResolvedTheme,\n ThemeColorKey,\n ThemeColorValue,\n ThemeConfig,\n} from './ThemeProvider.types';\n\nexport const THEME_COLOR_KEYS: readonly ThemeColorKey[] = [\n 'primary',\n 'secondary',\n 'success',\n 'danger',\n 'warning',\n 'info',\n 'hyperlink',\n] as const;\n\n/**\n * `hyperlink` is link text on a surface, never a fill, so it has no\n * `--hyperlink-contrast` token - nothing in the library would read it.\n */\nconst FILL_COLOR_KEYS: readonly ThemeColorKey[] = [\n 'primary',\n 'secondary',\n 'success',\n 'danger',\n 'warning',\n 'info',\n] as const;\n\n/** Only `primary` has a 50-900 ramp in `variables.scss`. */\nconst RAMP_COLOR_KEY: ThemeColorKey = 'primary';\n\n/** The eight preset `--font-size-*` values, in declaration order. */\nconst FONT_SIZE_STEPS: readonly [string, number][] = [\n ['xs', 0.75],\n ['sm', 0.875],\n ['base', 1],\n ['md', 1.1],\n ['lg', 1.125],\n ['xl', 1.25],\n ['2xl', 1.5],\n ['3xl', 1.875],\n] as const;\n\n/**\n * The shipped values from `src/styles/variables.scss`.\n *\n * This is a literal copy, not something derived: the ramp is hand-tuned and no\n * generator reproduces it byte for byte. Keeping it literal means a theme equal\n * to the preset writes no CSS properties at all, so default rendering is\n * identical to `dist/index.css`.\n *\n * Must be kept in sync with `variables.scss` by hand. The bases are all chosen\n * to clear WCAG AA against white text; see the comment at the top of that file.\n */\nexport const defaultTheme: Required<ThemeConfig> = {\n colors: {\n primary: '#5c5de8',\n secondary: '#617087',\n success: '#007f57',\n danger: '#d6272f',\n warning: '#9c6300',\n info: '#007a90',\n hyperlink: '#007b84',\n },\n typography: {\n fontFamily:\n \"'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif\",\n monoFamily:\n \"'JetBrains Mono', 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Source Code Pro', monospace\",\n fontScale: 1,\n },\n};\n\n/** The preset `--primary-*` ramp, needed so an unthemed primary emits nothing. */\nconst DEFAULT_PRIMARY_RAMP: Record<number, string> = {\n 50: '#eef2ff',\n 100: '#e0e7ff',\n 200: '#c7d2fe',\n 300: '#a5b4fc',\n 400: '#818cf8',\n 500: '#5c5de8',\n 600: '#4f46e5',\n 700: '#4338ca',\n 800: '#3730a3',\n 900: '#312e81',\n};\n\nexport const FONT_SCALE_MIN = 0.875;\nexport const FONT_SCALE_MAX = 1.25;\n\nconst normalizeColor = (value: ThemeColorValue): { base: string; contrast?: string } =>\n typeof value === 'string' ? { base: value } : value;\n\n/** Fills every absent field from the preset. */\nexport const resolveTheme = (theme: ThemeConfig): ResolvedTheme => {\n const colors = {} as ResolvedTheme['colors'];\n\n for (const key of THEME_COLOR_KEYS) {\n const supplied = theme.colors?.[key];\n const fallback = normalizeColor(defaultTheme.colors[key]!);\n if (supplied === undefined) {\n colors[key] = fallback;\n continue;\n }\n const { base, contrast } = normalizeColor(supplied);\n if (!isValidHex(base)) {\n devWarn(\n `theme-color-${key}`,\n `ThemeProvider: colors.${key} is not a valid hex colour (received ${JSON.stringify(base)}). Falling back to the preset.`,\n );\n colors[key] = fallback;\n continue;\n }\n if (contrast !== undefined && !isValidHex(contrast)) {\n devWarn(\n `theme-contrast-${key}`,\n `ThemeProvider: colors.${key}.contrast is not a valid hex colour (received ${JSON.stringify(contrast)}). It will be computed instead.`,\n );\n colors[key] = { base };\n continue;\n }\n colors[key] = contrast === undefined ? { base } : { base, contrast };\n }\n\n const scale = theme.typography?.fontScale;\n let fontScale = defaultTheme.typography.fontScale!;\n if (scale !== undefined) {\n if (!Number.isFinite(scale) || scale < FONT_SCALE_MIN || scale > FONT_SCALE_MAX) {\n devWarn(\n 'theme-font-scale',\n `ThemeProvider: typography.fontScale must be between ${FONT_SCALE_MIN} and ${FONT_SCALE_MAX} (received ${String(scale)}). Falling back to ${fontScale}.`,\n );\n } else {\n fontScale = scale;\n }\n }\n\n return {\n colors,\n typography: {\n fontFamily: theme.typography?.fontFamily || defaultTheme.typography.fontFamily!,\n monoFamily: theme.typography?.monoFamily || defaultTheme.typography.monoFamily!,\n fontScale,\n },\n };\n};\n\n/**\n * Expands a resolved theme into the flat `--token: value` map to apply.\n *\n * Every family contributes `--x-color`, `--x-rgb`, `--x-dark` and `--x-light`;\n * the six fill families also get `--x-contrast`, and `primary` additionally\n * gets the full `--primary-50…900` ramp.\n */\nexport const buildTokens = (resolved: ResolvedTheme): Record<string, string> => {\n const tokens: Record<string, string> = {};\n\n for (const key of THEME_COLOR_KEYS) {\n const { base, contrast } = resolved.colors[key];\n tokens[`--${key}-color`] = base;\n tokens[`--${key}-rgb`] = hexToRgbTriple(base);\n tokens[`--${key}-dark`] = deriveDark(base);\n tokens[`--${key}-light`] = deriveLight(base);\n\n if (FILL_COLOR_KEYS.includes(key)) {\n tokens[`--${key}-contrast`] = contrast ?? pickContrast(base);\n }\n\n if (key === RAMP_COLOR_KEY) {\n const isPreset = base === normalizeColor(defaultTheme.colors[key]!).base;\n // The preset ramp is hand-tuned, so reuse it verbatim rather than\n // regenerating a near-identical one.\n const ramp = isPreset ? DEFAULT_PRIMARY_RAMP : buildRamp(base);\n if (!isPreset && !isRampViable(base)) {\n devWarn(\n `theme-ramp-${key}`,\n `ThemeProvider: colors.${key} (${base}) is too light or too dark to generate a usable --${key}-50…900 scale; several steps will be identical. Pick a colour with more headroom.`,\n );\n }\n for (const step of RAMP_STEPS) {\n tokens[`--${key}-${step}`] = ramp[step];\n }\n }\n }\n\n const { fontFamily, monoFamily, fontScale } = resolved.typography;\n tokens['--font-family-primary'] = fontFamily;\n tokens['--font-family-mono'] = monoFamily;\n for (const [name, rem] of FONT_SIZE_STEPS) {\n // Trailing zeros trimmed so 1 * 0.75 reads as `0.75rem`, not `0.750rem`.\n tokens[`--font-size-${name}`] = `${parseFloat((rem * fontScale).toFixed(4))}rem`;\n }\n\n return tokens;\n};\n\n/** Tokens for the preset, used to tell which of them are actually overrides. */\nconst DEFAULT_TOKENS = buildTokens(resolveTheme(defaultTheme));\n\n/**\n * Only the tokens that differ from the preset.\n *\n * This is what makes an unthemed `ThemeProvider` a no-op: it writes nothing, so\n * `dist/index.css` stays authoritative and there is no inline-style churn on\n * `documentElement` for values that already match.\n */\nexport const diffFromDefault = (tokens: Record<string, string>): Record<string, string> => {\n const diff: Record<string, string> = {};\n for (const [name, value] of Object.entries(tokens)) {\n if (DEFAULT_TOKENS[name] !== value) diff[name] = value;\n }\n return diff;\n};\n\n/**\n * The resolved theme as a `:root { … }` block.\n *\n * Paste the output into your own stylesheet to bake a theme in at build time -\n * that avoids the brief flash of the preset that any runtime theme has when the\n * value arrives after first paint, and needs no JavaScript at all.\n */\nexport const themeToCss = (resolved: ResolvedTheme): string => {\n const tokens = buildTokens(resolved);\n const body = Object.entries(tokens)\n .map(([name, value]) => ` ${name}: ${value};`)\n .join('\\n');\n return `:root {\\n${body}\\n}`;\n};\n","/**\n * Runtime font registration for the theme system.\n *\n * `--font-family-primary` only *names* families - it cannot make a font\n * available. Selecting \"Plus Jakarta Sans\" on a machine that doesn't have it\n * installed silently falls through to the next stack entry, which is why a\n * theme needs a way to supply the font data itself.\n *\n * ## Why this is CSP-safe\n *\n * Fonts are registered with the CSS Font Loading API from an `ArrayBuffer`:\n *\n * ```ts\n * document.fonts.add(new FontFace(family, buffer));\n * ```\n *\n * CSP's `font-src` directive governs *fetching* a font resource by URL - it is\n * what gates `@font-face { src: url(...) }` and the string form of the\n * `FontFace` constructor. The binary form performs no fetch at all, so there is\n * no request for `font-src` to check and no allowance to configure. Notably\n * this also avoids `blob:` URLs, which *would* require `font-src blob:`.\n *\n * No `<style>` element is created either, so nothing here needs a nonce - the\n * same position as the rest of the theme system.\n */\n\n/** A font registered at runtime, as listed by the editor. */\nexport interface RegisteredFont {\n /** The family name to reference in a font stack. */\n family: string;\n /** Where it came from, so the UI can distinguish uploads from built-ins. */\n source: 'upload';\n}\n\n/**\n * Turns a filename into a usable CSS family name.\n *\n * Deliberately conservative: the real family name lives in the font's internal\n * `name` table, and parsing SFNT tables to read it would be a disproportionate\n * amount of binary handling for a label. The filename is what the user\n * recognises anyway.\n */\nexport const familyNameFromFile = (filename: string): string => {\n const base = filename.replace(/\\.[^.]+$/, '');\n const cleaned = base\n // Strip the weight/style suffixes font vendors append.\n .replace(/[-_](regular|normal|book|roman)$/i, '')\n .replace(/[-_]+/g, ' ')\n // A quoted family name may contain spaces but not quotes or control chars.\n .replace(/[\"'\\\\]/g, '')\n .replace(/\\s+/g, ' ')\n .trim();\n return cleaned || 'Custom Font';\n};\n\n/** Wraps a family name for use in a CSS font stack if it needs quoting. */\nexport const quoteFamily = (family: string): string =>\n /^[a-zA-Z][a-zA-Z0-9-]*$/.test(family) ? family : `'${family}'`;\n\n/**\n * Builds a full stack from a custom family, keeping sensible fallbacks so the\n * page stays readable if the font is ever unavailable.\n */\nexport const toFontStack = (family: string, mono = false): string =>\n mono\n ? `${quoteFamily(family)}, 'SF Mono', Monaco, monospace`\n : `${quoteFamily(family)}, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif`;\n\n/** Font formats accepted for upload, as an `accept` attribute value. */\nexport const FONT_ACCEPT = '.woff2,.woff,.ttf,.otf';\n\nconst SUPPORTED_EXTENSIONS = /\\.(woff2|woff|ttf|otf)$/i;\n\nexport const isSupportedFontFile = (filename: string): boolean =>\n SUPPORTED_EXTENSIONS.test(filename);\n\n/**\n * Registers font data with the document so a theme can reference its family.\n *\n * Resolves with the family name actually registered. Rejects if the data is not\n * a font the browser can parse, or if the Font Loading API is unavailable\n * (notably during SSR, where there is no `document` to register against).\n */\nexport const registerFontFace = async (family: string, data: ArrayBuffer): Promise<string> => {\n if (typeof document === 'undefined' || !document.fonts) {\n throw new Error('registerFontFace requires a document with the CSS Font Loading API.');\n }\n\n // ArrayBuffer source - no URL is fetched, so CSP's font-src never applies.\n const face = new FontFace(family, data);\n await face.load();\n document.fonts.add(face);\n // No cache invalidation needed: only positive results are cached, and this\n // family could not have been cached positive while it was still unavailable.\n // `document.fonts.add` also fires `loadingdone`, which wakes subscribers.\n return family;\n};\n\n/** Reads a File and registers it, returning the family name it was given. */\nexport const registerFontFile = async (file: File, family?: string): Promise<string> => {\n if (!isSupportedFontFile(file.name)) {\n throw new Error(`Unsupported font format: ${file.name}. Use ${FONT_ACCEPT}.`);\n }\n const buffer = await file.arrayBuffer();\n return registerFontFace(family ?? familyNameFromFile(file.name), buffer);\n};\n\n/**\n * CSS generic families, which always resolve and must never be reported\n * missing. They also cannot be probed by the method below, since asking for\n * `monospace, monospace` measures identically to `monospace` alone.\n */\nconst GENERIC_FAMILIES = new Set([\n 'serif',\n 'sans-serif',\n 'monospace',\n 'cursive',\n 'fantasy',\n 'system-ui',\n 'ui-serif',\n 'ui-sans-serif',\n 'ui-monospace',\n 'ui-rounded',\n 'math',\n 'emoji',\n 'fangsong',\n 'inherit',\n 'initial',\n 'unset',\n]);\n\n/**\n * Mixed-width glyphs, so a real font is very unlikely to measure identically\n * to a fallback by coincidence.\n */\nconst PROBE_TEXT = 'mmmmmmmmmmlliI0OWw@';\n\n/** Two structurally different fallbacks - a font need only differ from one. */\nconst PROBE_FALLBACKS = ['monospace', 'serif'] as const;\n\n/**\n * Cached per family - **positive results only**.\n *\n * A negative answer is not stable: web fonts load asynchronously (always, with\n * `font-display: swap`), so a family probed during the first render is\n * legitimately unavailable and becomes available moments later. Caching that\n * `false` pinned the answer forever, which showed a permanent \"not installed\"\n * warning for fonts that had in fact loaded.\n *\n * A positive answer cannot go stale the same way - a loaded font is not\n * unloaded - so those are worth keeping. Re-probing the misses costs one canvas\n * measurement each.\n */\nconst availabilityCache = new Map<string, true>();\n\n/**\n * Notifies when the set of usable fonts changes, so a caller rendering an\n * availability state can re-check.\n *\n * Both signals are needed: `loadingdone` covers fonts that begin loading after\n * subscription, while `ready` covers those already in flight when the listener\n * was attached - which is the common case for a stylesheet's `@font-face`\n * rules, since they start loading before any component mounts.\n */\nexport const subscribeToFontLoads = (onChange: () => void): (() => void) => {\n if (typeof document === 'undefined' || !document.fonts) return () => {};\n\n let active = true;\n const handler = () => {\n if (active) onChange();\n };\n\n document.fonts.addEventListener('loadingdone', handler);\n void document.fonts.ready.then(handler);\n\n return () => {\n active = false;\n document.fonts.removeEventListener('loadingdone', handler);\n };\n};\n\n/**\n * Whether a font family will actually render, rather than silently falling\n * through to the next entry in the stack.\n *\n * **`document.fonts.check` cannot answer this.** Per spec it reports whether\n * the faces *in the FontFaceSet* matching the query are loaded, so with no\n * matching face it returns `true` vacuously. Verified in a real browser: it\n * answers `true` for `'Totally Not A Real Font 12345'`, and therefore for every\n * uninstalled system font too. Using it here produced a check that could never\n * fail.\n *\n * Instead the family is measured on a canvas against two fallbacks. If it\n * resolves to anything real, the text measures differently from at least one\n * fallback alone; if it does not resolve, the browser renders that fallback and\n * the widths match exactly.\n */\nexport const isFontAvailable = (family: string): boolean => {\n const name = family.trim().replace(/^['\"]|['\"]$/g, '');\n if (!name) return true;\n if (GENERIC_FAMILIES.has(name.toLowerCase())) return true;\n if (typeof document === 'undefined') return true;\n\n if (availabilityCache.get(name)) return true;\n\n try {\n const context = document.createElement('canvas').getContext('2d');\n if (!context) return true;\n\n const available = PROBE_FALLBACKS.some((fallback) => {\n context.font = `100px ${fallback}`;\n const baseline = context.measureText(PROBE_TEXT).width;\n context.font = `100px ${quoteFamily(name)}, ${fallback}`;\n // An invalid font shorthand leaves `font` untouched, which measures as\n // the baseline and correctly reports the family as unavailable.\n return Math.abs(context.measureText(PROBE_TEXT).width - baseline) > 0.5;\n });\n\n if (available) availabilityCache.set(name, true);\n return available;\n } catch {\n // Never report a font missing because probing itself failed - and don't\n // cache a failure, so a later call can still get a real answer.\n return true;\n }\n};\n\n/** Whether the first family in a stack will render. */\nexport const isFontStackAvailable = (stack: string): boolean =>\n isFontAvailable(stack.split(',')[0] ?? '');\n"],"mappings":";;;;;AAAA,SAAgB,aAAa,WAAW,iBAAiB,SAAS,QAAQ,gBAAgB;;;ACA1F,SAAS,eAAe,kBAAkB;AAGnC,IAAM,eAAe,cAA6C,MAAS;AAO3E,IAAM,WAAW,MAAyB;AAC/C,QAAM,UAAU,WAAW,YAAY;AACvC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,8CAA8C;AAAA,EAChE;AACA,SAAO;AACT;;;ACUA,IAAM,eAAe,CAAC,MACpB,KAAK,UAAU,IAAI,QAAQ,KAAK,KAAK,IAAI,SAAS,OAAO,GAAG;AAE9D,IAAM,eAAe,CAAC,MACpB,KAAK,WAAY,QAAQ,IAAI,QAAQ,KAAK,IAAI,GAAG,IAAI,GAAG,IAAI;AAE9D,IAAM,UAAU,CA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