eidos-ui 2.1.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +66 -16
  2. package/dist/ThemeProvider.types-DgXN0gEH.d.cts +88 -0
  3. package/dist/ThemeProvider.types-DgXN0gEH.d.ts +88 -0
  4. package/dist/chunk-2ZY7M72Q.js +521 -0
  5. package/dist/chunk-2ZY7M72Q.js.map +1 -0
  6. package/dist/{chunk-W6IKHJ76.cjs → chunk-5BX4Q76D.cjs} +134 -126
  7. package/dist/chunk-5BX4Q76D.cjs.map +1 -0
  8. package/dist/{chunk-RAZRQ57B.js → chunk-74MBKLYI.js} +97 -16
  9. package/dist/chunk-74MBKLYI.js.map +1 -0
  10. package/dist/chunk-H5HWFOWZ.js +390 -0
  11. package/dist/chunk-H5HWFOWZ.js.map +1 -0
  12. package/dist/{chunk-VHQTDITV.cjs → chunk-KQD7CQ4Z.cjs} +96 -15
  13. package/dist/chunk-KQD7CQ4Z.cjs.map +1 -0
  14. package/dist/{chunk-JV7Z3D3U.js → chunk-LEMCJW57.js} +134 -126
  15. package/dist/chunk-LEMCJW57.js.map +1 -0
  16. package/dist/chunk-SE7MWOC7.cjs +390 -0
  17. package/dist/chunk-SE7MWOC7.cjs.map +1 -0
  18. package/dist/chunk-U5FHQ73U.cjs +521 -0
  19. package/dist/chunk-U5FHQ73U.cjs.map +1 -0
  20. package/dist/color-picker/index.cjs +2 -2
  21. package/dist/color-picker/index.js +1 -1
  22. package/dist/fonts/JetBrains-Mono-OFL.txt +93 -0
  23. package/dist/fonts/Plus-Jakarta-Sans-OFL.txt +93 -0
  24. package/dist/fonts/jetbrains-mono-latin-ext-wght-normal.woff2 +0 -0
  25. package/dist/fonts/jetbrains-mono-latin-wght-normal.woff2 +0 -0
  26. package/dist/fonts/plus-jakarta-sans-latin-ext-wght-normal.woff2 +0 -0
  27. package/dist/fonts/plus-jakarta-sans-latin-wght-normal.woff2 +0 -0
  28. package/dist/fonts.css +32 -0
  29. package/dist/fonts.css.d.ts +2 -0
  30. package/dist/index.cjs +32 -6
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.css +467 -123
  33. package/dist/index.d.cts +3 -0
  34. package/dist/index.d.ts +3 -0
  35. package/dist/index.js +35 -9
  36. package/dist/tabs/index.cjs +2 -2
  37. package/dist/tabs/index.d.cts +11 -0
  38. package/dist/tabs/index.d.ts +11 -0
  39. package/dist/tabs/index.js +1 -1
  40. package/dist/theme-editor/index.cjs +22 -0
  41. package/dist/theme-editor/index.cjs.map +1 -0
  42. package/dist/theme-editor/index.d.cts +65 -0
  43. package/dist/theme-editor/index.d.ts +65 -0
  44. package/dist/theme-editor/index.js +22 -0
  45. package/dist/theme-editor/index.js.map +1 -0
  46. package/dist/theme-provider/index.cjs +27 -0
  47. package/dist/theme-provider/index.cjs.map +1 -0
  48. package/dist/theme-provider/index.d.cts +123 -0
  49. package/dist/theme-provider/index.d.ts +123 -0
  50. package/dist/theme-provider/index.js +27 -0
  51. package/dist/theme-provider/index.js.map +1 -0
  52. package/package.json +13 -3
  53. package/dist/chunk-JV7Z3D3U.js.map +0 -1
  54. package/dist/chunk-RAZRQ57B.js.map +0 -1
  55. package/dist/chunk-VHQTDITV.cjs.map +0 -1
  56. package/dist/chunk-W6IKHJ76.cjs.map +0 -1
package/dist/index.d.cts CHANGED
@@ -67,6 +67,9 @@ export { CommandPalette } from './command-palette/index.cjs';
67
67
  export { C as CommandItem, a as CommandPaletteProps } from './CommandPalette.types-DRMMS_ev.cjs';
68
68
  export { VirtualList, VirtualListProps } from './virtual-list/index.cjs';
69
69
  export { DataGrid, DataGridActionsColumn, DataGridCellType, DataGridColumn, DataGridCustomColumn, DataGridFilterField, DataGridProps, DataGridQuickFilter, DataGridQuickFilterCombobox, DataGridQuickFilterComboboxOption, DataGridQuickFilterSegmented, DataGridQuickFilterSegmentedOption, DataGridQuickFilterSelect, DataGridQuickFilterSelectOption, DataGridRowAction, DataGridSelectOption, DataGridValueCellType, DataGridValueColumn, EditingCell } from './data-grid/index.cjs';
70
+ export { FONT_ACCEPT, RegisteredFont, ThemeProvider, defaultTheme, familyNameFromFile, isFontAvailable, isFontStackAvailable, registerFontFace, registerFontFile, toFontStack, useTheme } from './theme-provider/index.cjs';
71
+ export { R as ResolvedTheme, T as ThemeColorKey, a as ThemeColorValue, b as ThemeColors, c as ThemeConfig, d as ThemeContextValue, e as ThemeFontOption, f as ThemeProviderProps, g as ThemeTypography } from './ThemeProvider.types-DgXN0gEH.cjs';
72
+ export { ThemeEditor, ThemeEditorProps } from './theme-editor/index.cjs';
70
73
  export { I as IconType, r as renderIcon } from './renderIcon-C2lEMMzb.cjs';
71
74
  export { C as ComponentSizeProps } from './sizes-DM6Rrrgq.cjs';
72
75
  import 'react';
package/dist/index.d.ts CHANGED
@@ -67,6 +67,9 @@ export { CommandPalette } from './command-palette/index.js';
67
67
  export { C as CommandItem, a as CommandPaletteProps } from './CommandPalette.types-DRMMS_ev.js';
68
68
  export { VirtualList, VirtualListProps } from './virtual-list/index.js';
69
69
  export { DataGrid, DataGridActionsColumn, DataGridCellType, DataGridColumn, DataGridCustomColumn, DataGridFilterField, DataGridProps, DataGridQuickFilter, DataGridQuickFilterCombobox, DataGridQuickFilterComboboxOption, DataGridQuickFilterSegmented, DataGridQuickFilterSegmentedOption, DataGridQuickFilterSelect, DataGridQuickFilterSelectOption, DataGridRowAction, DataGridSelectOption, DataGridValueCellType, DataGridValueColumn, EditingCell } from './data-grid/index.js';
70
+ export { FONT_ACCEPT, RegisteredFont, ThemeProvider, defaultTheme, familyNameFromFile, isFontAvailable, isFontStackAvailable, registerFontFace, registerFontFile, toFontStack, useTheme } from './theme-provider/index.js';
71
+ export { R as ResolvedTheme, T as ThemeColorKey, a as ThemeColorValue, b as ThemeColors, c as ThemeConfig, d as ThemeContextValue, e as ThemeFontOption, f as ThemeProviderProps, g as ThemeTypography } from './ThemeProvider.types-DgXN0gEH.js';
72
+ export { ThemeEditor, ThemeEditorProps } from './theme-editor/index.js';
70
73
  export { I as IconType, r as renderIcon } from './renderIcon-C2lEMMzb.js';
71
74
  export { C as ComponentSizeProps } from './sizes-DM6Rrrgq.js';
72
75
  import 'react';
package/dist/index.js CHANGED
@@ -1,23 +1,38 @@
1
+ import {
2
+ TreeView
3
+ } from "./chunk-LUSLBNSG.js";
4
+ import {
5
+ VirtualList
6
+ } from "./chunk-CJVC3A4O.js";
1
7
  import {
2
8
  Tab,
3
9
  TabPanel,
4
10
  Tabs
5
- } from "./chunk-RAZRQ57B.js";
11
+ } from "./chunk-74MBKLYI.js";
6
12
  import {
7
13
  TagInput
8
14
  } from "./chunk-R4PU2TBM.js";
9
15
  import {
10
16
  Textarea
11
17
  } from "./chunk-REVK7IGN.js";
18
+ import {
19
+ ThemeEditor
20
+ } from "./chunk-H5HWFOWZ.js";
21
+ import {
22
+ FONT_ACCEPT,
23
+ ThemeProvider,
24
+ defaultTheme,
25
+ familyNameFromFile,
26
+ isFontAvailable,
27
+ isFontStackAvailable,
28
+ registerFontFace,
29
+ registerFontFile,
30
+ toFontStack,
31
+ useTheme
32
+ } from "./chunk-2ZY7M72Q.js";
12
33
  import {
13
34
  Timeline
14
35
  } from "./chunk-NEQXEVHM.js";
15
- import {
16
- TreeView
17
- } from "./chunk-LUSLBNSG.js";
18
- import {
19
- VirtualList
20
- } from "./chunk-CJVC3A4O.js";
21
36
  import {
22
37
  Skeleton
23
38
  } from "./chunk-O3I3RBZJ.js";
@@ -99,7 +114,7 @@ import {
99
114
  } from "./chunk-SHYSLWQG.js";
100
115
  import {
101
116
  ColorPicker
102
- } from "./chunk-JV7Z3D3U.js";
117
+ } from "./chunk-LEMCJW57.js";
103
118
  import {
104
119
  CommandPalette
105
120
  } from "./chunk-PY2376XI.js";
@@ -218,6 +233,7 @@ export {
218
233
  Dropdown,
219
234
  DropdownProvider,
220
235
  EmptyState,
236
+ FONT_ACCEPT,
221
237
  FileUpload,
222
238
  Footer,
223
239
  Header,
@@ -255,15 +271,25 @@ export {
255
271
  Tabs,
256
272
  TagInput,
257
273
  Textarea,
274
+ ThemeEditor,
275
+ ThemeProvider,
258
276
  TimeInput,
259
277
  Timeline,
260
278
  Toolbar,
261
279
  Tooltip,
262
280
  TreeView,
263
281
  VirtualList,
282
+ defaultTheme,
283
+ familyNameFromFile,
284
+ isFontAvailable,
285
+ isFontStackAvailable,
286
+ registerFontFace,
287
+ registerFontFile,
264
288
  renderIcon,
289
+ toFontStack,
265
290
  useDropdownContext,
266
291
  useSnackbar,
267
- useSnackbarContext
292
+ useSnackbarContext,
293
+ useTheme
268
294
  };
269
295
  //# sourceMappingURL=index.js.map
@@ -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 {
@@ -0,0 +1,22 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkSE7MWOC7cjs = require('../chunk-SE7MWOC7.cjs');
4
+ require('../chunk-U5FHQ73U.cjs');
5
+ require('../chunk-OZZHOEN5.cjs');
6
+ require('../chunk-V5RS3JZN.cjs');
7
+ require('../chunk-5BX4Q76D.cjs');
8
+ require('../chunk-SJDTFR3I.cjs');
9
+ require('../chunk-KJZUYC4X.cjs');
10
+ require('../chunk-5VM2256W.cjs');
11
+ require('../chunk-FRUOA2QU.cjs');
12
+ require('../chunk-B5G5XVFJ.cjs');
13
+ require('../chunk-EACNRR3C.cjs');
14
+ require('../chunk-APK5OQRV.cjs');
15
+ require('../chunk-I6UOIS4J.cjs');
16
+ require('../chunk-GEHL4LKK.cjs');
17
+ require('../chunk-Z5U4NJTW.cjs');
18
+ require('../chunk-DZUJEN5N.cjs');
19
+
20
+
21
+ exports.ThemeEditor = _chunkSE7MWOC7cjs.ThemeEditor;
22
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/eidos-ui/eidos-ui/dist/theme-editor/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACF,oDAAC","file":"/home/runner/work/eidos-ui/eidos-ui/dist/theme-editor/index.cjs"}
@@ -0,0 +1,65 @@
1
+ import React__default from 'react';
2
+ import { T as ThemeColorKey, e as ThemeFontOption } from '../ThemeProvider.types-DgXN0gEH.cjs';
3
+
4
+ interface ThemeEditorProps {
5
+ /**
6
+ * Which colour rows to show, in this order. Defaults to all seven - pass a
7
+ * subset when only part of the palette should be user-editable.
8
+ */
9
+ colors?: ThemeColorKey[];
10
+ /**
11
+ * Body font stacks to offer. Defaults to a small built-in list.
12
+ *
13
+ * Supply your own to list the fonts your app actually ships - a stack is only
14
+ * a *name*, so offering one the browser cannot resolve silently falls through
15
+ * to the next entry.
16
+ */
17
+ fontOptions?: ThemeFontOption[];
18
+ /** Monospace font stacks to offer. Defaults to a small built-in list. */
19
+ monoFontOptions?: ThemeFontOption[];
20
+ /**
21
+ * Allow loading a font file from disk. Default `true`.
22
+ *
23
+ * The font is registered with the CSS Font Loading API from an `ArrayBuffer`,
24
+ * which needs no CSP allowance, and renders immediately. It is **not**
25
+ * persisted on its own - see `onFontUpload`.
26
+ */
27
+ allowFontUpload?: boolean;
28
+ /**
29
+ * Called with the file the user picked, after it has been registered and
30
+ * applied.
31
+ *
32
+ * This is the hook for making an uploaded font permanent. A `ThemeConfig` is
33
+ * JSON and cannot carry binary data, so the theme records only the family
34
+ * *name* - without persisting the file yourself, the name resolves to nothing
35
+ * on the next load and the stack quietly falls back. Upload the file to your
36
+ * server (or store it in IndexedDB), then `registerFontFace` it on startup
37
+ * and include it in `fontOptions`.
38
+ *
39
+ * @param file The font file as chosen by the user.
40
+ * @param family The family name it was registered under.
41
+ * @param mono `true` when it was picked for the monospace slot.
42
+ */
43
+ onFontUpload?: (file: File, family: string, mono: boolean) => void;
44
+ /** Hide the typography section. */
45
+ hideTypography?: boolean;
46
+ /** Hide the "Reset all" action. */
47
+ hideReset?: boolean;
48
+ /** Hide the "Copy as CSS" action. */
49
+ hideCssExport?: boolean;
50
+ className?: string;
51
+ }
52
+
53
+ /**
54
+ * Live editor for the active `ThemeProvider` theme.
55
+ *
56
+ * Renders no preview of its own: the provider writes tokens to
57
+ * `document.documentElement`, so the surrounding page is the preview.
58
+ *
59
+ * Contrast readouts are diagnostics only - a colour that fails is still
60
+ * applied. Automatically "correcting" a chosen colour would mean silently
61
+ * rendering something other than what was picked.
62
+ */
63
+ declare const ThemeEditor: React__default.FC<ThemeEditorProps>;
64
+
65
+ export { ThemeEditor, type ThemeEditorProps };
@@ -0,0 +1,65 @@
1
+ import React__default from 'react';
2
+ import { T as ThemeColorKey, e as ThemeFontOption } from '../ThemeProvider.types-DgXN0gEH.js';
3
+
4
+ interface ThemeEditorProps {
5
+ /**
6
+ * Which colour rows to show, in this order. Defaults to all seven - pass a
7
+ * subset when only part of the palette should be user-editable.
8
+ */
9
+ colors?: ThemeColorKey[];
10
+ /**
11
+ * Body font stacks to offer. Defaults to a small built-in list.
12
+ *
13
+ * Supply your own to list the fonts your app actually ships - a stack is only
14
+ * a *name*, so offering one the browser cannot resolve silently falls through
15
+ * to the next entry.
16
+ */
17
+ fontOptions?: ThemeFontOption[];
18
+ /** Monospace font stacks to offer. Defaults to a small built-in list. */
19
+ monoFontOptions?: ThemeFontOption[];
20
+ /**
21
+ * Allow loading a font file from disk. Default `true`.
22
+ *
23
+ * The font is registered with the CSS Font Loading API from an `ArrayBuffer`,
24
+ * which needs no CSP allowance, and renders immediately. It is **not**
25
+ * persisted on its own - see `onFontUpload`.
26
+ */
27
+ allowFontUpload?: boolean;
28
+ /**
29
+ * Called with the file the user picked, after it has been registered and
30
+ * applied.
31
+ *
32
+ * This is the hook for making an uploaded font permanent. A `ThemeConfig` is
33
+ * JSON and cannot carry binary data, so the theme records only the family
34
+ * *name* - without persisting the file yourself, the name resolves to nothing
35
+ * on the next load and the stack quietly falls back. Upload the file to your
36
+ * server (or store it in IndexedDB), then `registerFontFace` it on startup
37
+ * and include it in `fontOptions`.
38
+ *
39
+ * @param file The font file as chosen by the user.
40
+ * @param family The family name it was registered under.
41
+ * @param mono `true` when it was picked for the monospace slot.
42
+ */
43
+ onFontUpload?: (file: File, family: string, mono: boolean) => void;
44
+ /** Hide the typography section. */
45
+ hideTypography?: boolean;
46
+ /** Hide the "Reset all" action. */
47
+ hideReset?: boolean;
48
+ /** Hide the "Copy as CSS" action. */
49
+ hideCssExport?: boolean;
50
+ className?: string;
51
+ }
52
+
53
+ /**
54
+ * Live editor for the active `ThemeProvider` theme.
55
+ *
56
+ * Renders no preview of its own: the provider writes tokens to
57
+ * `document.documentElement`, so the surrounding page is the preview.
58
+ *
59
+ * Contrast readouts are diagnostics only - a colour that fails is still
60
+ * applied. Automatically "correcting" a chosen colour would mean silently
61
+ * rendering something other than what was picked.
62
+ */
63
+ declare const ThemeEditor: React__default.FC<ThemeEditorProps>;
64
+
65
+ export { ThemeEditor, type ThemeEditorProps };
@@ -0,0 +1,22 @@
1
+ import {
2
+ ThemeEditor
3
+ } from "../chunk-H5HWFOWZ.js";
4
+ import "../chunk-2ZY7M72Q.js";
5
+ import "../chunk-2BC4M4QZ.js";
6
+ import "../chunk-EF4Y6Q35.js";
7
+ import "../chunk-LEMCJW57.js";
8
+ import "../chunk-KGXGTWUL.js";
9
+ import "../chunk-A7WQINIG.js";
10
+ import "../chunk-VHMOKXUT.js";
11
+ import "../chunk-4BKTBV2I.js";
12
+ import "../chunk-5ZL6PYU3.js";
13
+ import "../chunk-N5JDL4VE.js";
14
+ import "../chunk-YJXZR7RL.js";
15
+ import "../chunk-66R54X6R.js";
16
+ import "../chunk-KBG77JHC.js";
17
+ import "../chunk-YV57RSPD.js";
18
+ import "../chunk-5WRI5ZAA.js";
19
+ export {
20
+ ThemeEditor
21
+ };
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,27 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+ var _chunkU5FHQ73Ucjs = require('../chunk-U5FHQ73U.cjs');
13
+ require('../chunk-GEHL4LKK.cjs');
14
+ require('../chunk-DZUJEN5N.cjs');
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
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;
27
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/eidos-ui/eidos-ui/dist/theme-provider/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,6kBAAC","file":"/home/runner/work/eidos-ui/eidos-ui/dist/theme-provider/index.cjs"}
@@ -0,0 +1,123 @@
1
+ import React__default from 'react';
2
+ import { f as ThemeProviderProps, d as ThemeContextValue, c as ThemeConfig } from '../ThemeProvider.types-DgXN0gEH.cjs';
3
+ export { R as ResolvedTheme, T as ThemeColorKey, a as ThemeColorValue, b as ThemeColors, e as ThemeFontOption, g as ThemeTypography } from '../ThemeProvider.types-DgXN0gEH.cjs';
4
+
5
+ /**
6
+ * Applies a theme by writing CSS custom properties to `document.documentElement`.
7
+ *
8
+ * Two deliberate choices worth knowing:
9
+ *
10
+ * **The target is `documentElement`, not a wrapper element.** Every overlay in
11
+ * this library (`Dropdown`, `Modal`, `Drawer`, `Snackbar`, `Tooltip`, …) portals
12
+ * to `document.body`, so tokens scoped to a wrapper `<div>` would leave every
13
+ * popup rendering the preset instead.
14
+ *
15
+ * **Properties are set through the CSSOM** (`style.setProperty`), which no CSP
16
+ * directive gates - `style-src` and `style-src-attr` only cover the `style`
17
+ * HTML attribute and stylesheet loads. Nothing here needs a nonce, and no
18
+ * `<style>` element is ever created. See `ContentSecurityPolicy.mdx`.
19
+ *
20
+ * Under SSR the server sends the preset from `dist/index.css` and the theme is
21
+ * applied on hydration; use `toCss()` if you need a themed first paint.
22
+ */
23
+ declare const ThemeProvider: React__default.FC<ThemeProviderProps>;
24
+
25
+ /**
26
+ * Reads the active theme. Throws outside a `ThemeProvider`, matching
27
+ * `useSnackbarContext` - a silent fallback would make a missing provider look
28
+ * like a theme that simply is not applying.
29
+ */
30
+ declare const useTheme: () => ThemeContextValue;
31
+
32
+ /**
33
+ * The shipped values from `src/styles/variables.scss`.
34
+ *
35
+ * This is a literal copy, not something derived: the ramp is hand-tuned and no
36
+ * generator reproduces it byte for byte. Keeping it literal means a theme equal
37
+ * to the preset writes no CSS properties at all, so default rendering is
38
+ * identical to `dist/index.css`.
39
+ *
40
+ * Must be kept in sync with `variables.scss` by hand. The bases are all chosen
41
+ * to clear WCAG AA against white text; see the comment at the top of that file.
42
+ */
43
+ declare const defaultTheme: Required<ThemeConfig>;
44
+
45
+ /**
46
+ * Runtime font registration for the theme system.
47
+ *
48
+ * `--font-family-primary` only *names* families - it cannot make a font
49
+ * available. Selecting "Plus Jakarta Sans" on a machine that doesn't have it
50
+ * installed silently falls through to the next stack entry, which is why a
51
+ * theme needs a way to supply the font data itself.
52
+ *
53
+ * ## Why this is CSP-safe
54
+ *
55
+ * Fonts are registered with the CSS Font Loading API from an `ArrayBuffer`:
56
+ *
57
+ * ```ts
58
+ * document.fonts.add(new FontFace(family, buffer));
59
+ * ```
60
+ *
61
+ * CSP's `font-src` directive governs *fetching* a font resource by URL - it is
62
+ * what gates `@font-face { src: url(...) }` and the string form of the
63
+ * `FontFace` constructor. The binary form performs no fetch at all, so there is
64
+ * no request for `font-src` to check and no allowance to configure. Notably
65
+ * this also avoids `blob:` URLs, which *would* require `font-src blob:`.
66
+ *
67
+ * No `<style>` element is created either, so nothing here needs a nonce - the
68
+ * same position as the rest of the theme system.
69
+ */
70
+ /** A font registered at runtime, as listed by the editor. */
71
+ interface RegisteredFont {
72
+ /** The family name to reference in a font stack. */
73
+ family: string;
74
+ /** Where it came from, so the UI can distinguish uploads from built-ins. */
75
+ source: 'upload';
76
+ }
77
+ /**
78
+ * Turns a filename into a usable CSS family name.
79
+ *
80
+ * Deliberately conservative: the real family name lives in the font's internal
81
+ * `name` table, and parsing SFNT tables to read it would be a disproportionate
82
+ * amount of binary handling for a label. The filename is what the user
83
+ * recognises anyway.
84
+ */
85
+ declare const familyNameFromFile: (filename: string) => string;
86
+ /**
87
+ * Builds a full stack from a custom family, keeping sensible fallbacks so the
88
+ * page stays readable if the font is ever unavailable.
89
+ */
90
+ declare const toFontStack: (family: string, mono?: boolean) => string;
91
+ /** Font formats accepted for upload, as an `accept` attribute value. */
92
+ declare const FONT_ACCEPT = ".woff2,.woff,.ttf,.otf";
93
+ /**
94
+ * Registers font data with the document so a theme can reference its family.
95
+ *
96
+ * Resolves with the family name actually registered. Rejects if the data is not
97
+ * a font the browser can parse, or if the Font Loading API is unavailable
98
+ * (notably during SSR, where there is no `document` to register against).
99
+ */
100
+ declare const registerFontFace: (family: string, data: ArrayBuffer) => Promise<string>;
101
+ /** Reads a File and registers it, returning the family name it was given. */
102
+ declare const registerFontFile: (file: File, family?: string) => Promise<string>;
103
+ /**
104
+ * Whether a font family will actually render, rather than silently falling
105
+ * through to the next entry in the stack.
106
+ *
107
+ * **`document.fonts.check` cannot answer this.** Per spec it reports whether
108
+ * the faces *in the FontFaceSet* matching the query are loaded, so with no
109
+ * matching face it returns `true` vacuously. Verified in a real browser: it
110
+ * answers `true` for `'Totally Not A Real Font 12345'`, and therefore for every
111
+ * uninstalled system font too. Using it here produced a check that could never
112
+ * fail.
113
+ *
114
+ * Instead the family is measured on a canvas against two fallbacks. If it
115
+ * resolves to anything real, the text measures differently from at least one
116
+ * fallback alone; if it does not resolve, the browser renders that fallback and
117
+ * the widths match exactly.
118
+ */
119
+ declare const isFontAvailable: (family: string) => boolean;
120
+ /** Whether the first family in a stack will render. */
121
+ declare const isFontStackAvailable: (stack: string) => boolean;
122
+
123
+ export { FONT_ACCEPT, type RegisteredFont, ThemeConfig, ThemeContextValue, ThemeProvider, ThemeProviderProps, defaultTheme, familyNameFromFile, isFontAvailable, isFontStackAvailable, registerFontFace, registerFontFile, toFontStack, useTheme };
@@ -0,0 +1,123 @@
1
+ import React__default from 'react';
2
+ import { f as ThemeProviderProps, d as ThemeContextValue, c as ThemeConfig } from '../ThemeProvider.types-DgXN0gEH.js';
3
+ export { R as ResolvedTheme, T as ThemeColorKey, a as ThemeColorValue, b as ThemeColors, e as ThemeFontOption, g as ThemeTypography } from '../ThemeProvider.types-DgXN0gEH.js';
4
+
5
+ /**
6
+ * Applies a theme by writing CSS custom properties to `document.documentElement`.
7
+ *
8
+ * Two deliberate choices worth knowing:
9
+ *
10
+ * **The target is `documentElement`, not a wrapper element.** Every overlay in
11
+ * this library (`Dropdown`, `Modal`, `Drawer`, `Snackbar`, `Tooltip`, …) portals
12
+ * to `document.body`, so tokens scoped to a wrapper `<div>` would leave every
13
+ * popup rendering the preset instead.
14
+ *
15
+ * **Properties are set through the CSSOM** (`style.setProperty`), which no CSP
16
+ * directive gates - `style-src` and `style-src-attr` only cover the `style`
17
+ * HTML attribute and stylesheet loads. Nothing here needs a nonce, and no
18
+ * `<style>` element is ever created. See `ContentSecurityPolicy.mdx`.
19
+ *
20
+ * Under SSR the server sends the preset from `dist/index.css` and the theme is
21
+ * applied on hydration; use `toCss()` if you need a themed first paint.
22
+ */
23
+ declare const ThemeProvider: React__default.FC<ThemeProviderProps>;
24
+
25
+ /**
26
+ * Reads the active theme. Throws outside a `ThemeProvider`, matching
27
+ * `useSnackbarContext` - a silent fallback would make a missing provider look
28
+ * like a theme that simply is not applying.
29
+ */
30
+ declare const useTheme: () => ThemeContextValue;
31
+
32
+ /**
33
+ * The shipped values from `src/styles/variables.scss`.
34
+ *
35
+ * This is a literal copy, not something derived: the ramp is hand-tuned and no
36
+ * generator reproduces it byte for byte. Keeping it literal means a theme equal
37
+ * to the preset writes no CSS properties at all, so default rendering is
38
+ * identical to `dist/index.css`.
39
+ *
40
+ * Must be kept in sync with `variables.scss` by hand. The bases are all chosen
41
+ * to clear WCAG AA against white text; see the comment at the top of that file.
42
+ */
43
+ declare const defaultTheme: Required<ThemeConfig>;
44
+
45
+ /**
46
+ * Runtime font registration for the theme system.
47
+ *
48
+ * `--font-family-primary` only *names* families - it cannot make a font
49
+ * available. Selecting "Plus Jakarta Sans" on a machine that doesn't have it
50
+ * installed silently falls through to the next stack entry, which is why a
51
+ * theme needs a way to supply the font data itself.
52
+ *
53
+ * ## Why this is CSP-safe
54
+ *
55
+ * Fonts are registered with the CSS Font Loading API from an `ArrayBuffer`:
56
+ *
57
+ * ```ts
58
+ * document.fonts.add(new FontFace(family, buffer));
59
+ * ```
60
+ *
61
+ * CSP's `font-src` directive governs *fetching* a font resource by URL - it is
62
+ * what gates `@font-face { src: url(...) }` and the string form of the
63
+ * `FontFace` constructor. The binary form performs no fetch at all, so there is
64
+ * no request for `font-src` to check and no allowance to configure. Notably
65
+ * this also avoids `blob:` URLs, which *would* require `font-src blob:`.
66
+ *
67
+ * No `<style>` element is created either, so nothing here needs a nonce - the
68
+ * same position as the rest of the theme system.
69
+ */
70
+ /** A font registered at runtime, as listed by the editor. */
71
+ interface RegisteredFont {
72
+ /** The family name to reference in a font stack. */
73
+ family: string;
74
+ /** Where it came from, so the UI can distinguish uploads from built-ins. */
75
+ source: 'upload';
76
+ }
77
+ /**
78
+ * Turns a filename into a usable CSS family name.
79
+ *
80
+ * Deliberately conservative: the real family name lives in the font's internal
81
+ * `name` table, and parsing SFNT tables to read it would be a disproportionate
82
+ * amount of binary handling for a label. The filename is what the user
83
+ * recognises anyway.
84
+ */
85
+ declare const familyNameFromFile: (filename: string) => string;
86
+ /**
87
+ * Builds a full stack from a custom family, keeping sensible fallbacks so the
88
+ * page stays readable if the font is ever unavailable.
89
+ */
90
+ declare const toFontStack: (family: string, mono?: boolean) => string;
91
+ /** Font formats accepted for upload, as an `accept` attribute value. */
92
+ declare const FONT_ACCEPT = ".woff2,.woff,.ttf,.otf";
93
+ /**
94
+ * Registers font data with the document so a theme can reference its family.
95
+ *
96
+ * Resolves with the family name actually registered. Rejects if the data is not
97
+ * a font the browser can parse, or if the Font Loading API is unavailable
98
+ * (notably during SSR, where there is no `document` to register against).
99
+ */
100
+ declare const registerFontFace: (family: string, data: ArrayBuffer) => Promise<string>;
101
+ /** Reads a File and registers it, returning the family name it was given. */
102
+ declare const registerFontFile: (file: File, family?: string) => Promise<string>;
103
+ /**
104
+ * Whether a font family will actually render, rather than silently falling
105
+ * through to the next entry in the stack.
106
+ *
107
+ * **`document.fonts.check` cannot answer this.** Per spec it reports whether
108
+ * the faces *in the FontFaceSet* matching the query are loaded, so with no
109
+ * matching face it returns `true` vacuously. Verified in a real browser: it
110
+ * answers `true` for `'Totally Not A Real Font 12345'`, and therefore for every
111
+ * uninstalled system font too. Using it here produced a check that could never
112
+ * fail.
113
+ *
114
+ * Instead the family is measured on a canvas against two fallbacks. If it
115
+ * resolves to anything real, the text measures differently from at least one
116
+ * fallback alone; if it does not resolve, the browser renders that fallback and
117
+ * the widths match exactly.
118
+ */
119
+ declare const isFontAvailable: (family: string) => boolean;
120
+ /** Whether the first family in a stack will render. */
121
+ declare const isFontStackAvailable: (stack: string) => boolean;
122
+
123
+ export { FONT_ACCEPT, type RegisteredFont, ThemeConfig, ThemeContextValue, ThemeProvider, ThemeProviderProps, defaultTheme, familyNameFromFile, isFontAvailable, isFontStackAvailable, registerFontFace, registerFontFile, toFontStack, useTheme };