@helpdice/theme 1.0.4 → 1.0.5

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.
@@ -1,9 +1,10 @@
1
1
  import React, { ReactElement } from 'react';
2
+ import flush from 'styled-jsx';
2
3
  export type FlushToReact = <T>(opts?: {
3
4
  nonce?: string;
4
5
  }) => Array<ReactElement<T>>;
5
6
  type MemoCssBaselineComponent<P = {}> = React.NamedExoticComponent<P> & {
6
- flush: FlushToReact;
7
+ flush: typeof flush.StyleRegistry;
7
8
  };
8
9
  declare const MemoCssBaseline: MemoCssBaselineComponent<React.PropsWithChildren<unknown>>;
9
10
  export default MemoCssBaseline;
@@ -842,14 +842,31 @@ var Themes = {
842
842
  };
843
843
 
844
844
  /* "use client" */
845
-
846
845
  var defaultTheme = Themes.getPresetStaticTheme();
847
846
  var ThemeContext = /*#__PURE__*/React.createContext(defaultTheme);
847
+
848
+ // export const useTheme = (): HUIThemes => React.useContext<HUIThemes>(ThemeContext)
849
+
848
850
  var useTheme = function useTheme() {
849
- return React.useContext(ThemeContext);
851
+ var context = React.useContext(ThemeContext);
852
+ if (!context) {
853
+ throw new Error('useTheme must be used within a ThemeProvider');
854
+ }
855
+ return context;
850
856
  };
851
857
 
852
- // import flush from 'styled-jsx'
858
+ var styledJsx;
859
+ var hasRequiredStyledJsx;
860
+
861
+ function requireStyledJsx () {
862
+ if (hasRequiredStyledJsx) return styledJsx;
863
+ hasRequiredStyledJsx = 1;
864
+ styledJsx = requireIndex();
865
+ return styledJsx;
866
+ }
867
+
868
+ var styledJsxExports = requireStyledJsx();
869
+ var flush = /*@__PURE__*/getDefaultExportFromCjs(styledJsxExports);
853
870
 
854
871
  // export type FlushToReact = <T>(opts?: { nonce?: string }) => Array<ReactElement<T>>
855
872
 
@@ -864,5 +881,6 @@ var CssBaseline = function CssBaseline(_ref) {
864
881
  }, "html,body{background-color:".concat(theme.palette.background, ";color:").concat(theme.palette.foreground, ";}html{font-size:16px;--helpdice-icons-background:").concat(theme.palette.background, ";}body{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility;font-size:1rem;line-height:1.5;margin:0;padding:0;min-height:100%;position:relative;overflow-x:hidden;font-family:").concat(theme.font.sans, ";}#__next{overflow-x:hidden;}*,*:before,*:after{box-sizing:inherit;text-rendering:geometricPrecision;-webkit-tap-highlight-color:transparent;}p,small{font-weight:400;color:inherit;-webkit-letter-spacing:-0.005625em;-moz-letter-spacing:-0.005625em;-ms-letter-spacing:-0.005625em;letter-spacing:-0.005625em;font-family:").concat(theme.font.sans, ";}p{margin:1em 0;font-size:1em;line-height:1.625em;}small{margin:0;line-height:1.5;font-size:0.875em;}b{font-weight:600;}span{font-size:inherit;color:inherit;font-weight:inherit;}img{max-width:100%;}a{cursor:pointer;font-size:inherit;-webkit-touch-callout:none;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-box-align:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:").concat(theme.palette.link, ";-webkit-text-decoration:").concat(theme.expressiveness.linkStyle, ";text-decoration:").concat(theme.expressiveness.linkStyle, ";}a:hover{-webkit-text-decoration:").concat(theme.expressiveness.linkHoverStyle, ";text-decoration:").concat(theme.expressiveness.linkHoverStyle, ";}ul,ol{padding:0;list-style-type:none;margin:").concat(theme.layout.gapHalf, " ").concat(theme.layout.gapHalf, " ").concat(theme.layout.gapHalf, " ").concat(theme.layout.gap, ";color:").concat(theme.palette.foreground, ";}ol{list-style-type:decimal;}li{margin-bottom:0.625em;font-size:1em;line-height:1.625em;}h1,h2,h3,h4,h5,h6{color:inherit;margin:0 0 0.7rem 0;}h1{font-size:3rem;-webkit-letter-spacing:-0.02em;-moz-letter-spacing:-0.02em;-ms-letter-spacing:-0.02em;letter-spacing:-0.02em;line-height:1.5;font-weight:700;}h2{font-size:2.25rem;-webkit-letter-spacing:-0.02em;-moz-letter-spacing:-0.02em;-ms-letter-spacing:-0.02em;letter-spacing:-0.02em;font-weight:600;}h3{font-size:1.5rem;-webkit-letter-spacing:-0.02em;-moz-letter-spacing:-0.02em;-ms-letter-spacing:-0.02em;letter-spacing:-0.02em;font-weight:600;}h4{font-size:1.25rem;-webkit-letter-spacing:-0.02em;-moz-letter-spacing:-0.02em;-ms-letter-spacing:-0.02em;letter-spacing:-0.02em;font-weight:600;}h5{font-size:1rem;-webkit-letter-spacing:-0.01em;-moz-letter-spacing:-0.01em;-ms-letter-spacing:-0.01em;letter-spacing:-0.01em;font-weight:600;}h6{font-size:0.875rem;-webkit-letter-spacing:-0.005em;-moz-letter-spacing:-0.005em;-ms-letter-spacing:-0.005em;letter-spacing:-0.005em;font-weight:600;}button,input,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit;color:inherit;margin:0;}button:focus,input:focus,select:focus,textarea:focus{outline:none;}code{color:").concat(theme.palette.code, ";font-family:").concat(theme.font.mono, ";font-size:0.9em;white-space:pre-wrap;}code:before,code:after{content:'\\`';}pre{padding:calc(").concat(theme.layout.gap, " * 0.9) ").concat(theme.layout.gap, ";margin:").concat(theme.layout.gap, " 0;border:1px solid ").concat(theme.palette.accents_2, ";border-radius:").concat(theme.layout.radius, ";font-family:").concat(theme.font.mono, ";white-space:pre;overflow:auto;line-height:1.5;text-align:left;font-size:14px;-webkit-overflow-scrolling:touch;}pre code{color:").concat(theme.palette.foreground, ";font-size:1em;line-height:1.25em;white-space:pre;}pre code:before,pre code:after{display:none;}pre p{margin:0;}pre::-webkit-scrollbar{display:none;width:0;height:0;background:transparent;}hr{border-color:").concat(theme.palette.accents_2, ";}details{background-color:").concat(theme.palette.accents_1, ";border:none;}details:focus,details:hover,details:active{outline:none;}summary{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;list-style:none;outline:none;}summary::marker,summary::before,summary::-webkit-details-marker{display:none;}summary::-moz-list-bullet{font-size:0;}summary:focus,summary:hover,summary:active{outline:none;list-style:none;}blockquote{padding:calc(0.667 * ").concat(theme.layout.gap, ") ").concat(theme.layout.gap, ";color:").concat(theme.palette.accents_5, ";background-color:").concat(theme.palette.accents_1, ";border-radius:").concat(theme.layout.radius, ";margin:1.5em 0;border:1px solid ").concat(theme.palette.border, ";}blockquote *:first-child{margin-top:0;}blockquote *:last-child{margin-bottom:0;}::selection{background-color:").concat(theme.palette.selection, ";color:").concat(theme.palette.foreground, ";}")));
865
882
  };
866
883
  var MemoCssBaseline = /*#__PURE__*/React.memo(CssBaseline);
884
+ MemoCssBaseline.flush = flush.StyleRegistry;
867
885
 
868
886
  exports.default = MemoCssBaseline;
package/dist/index.d.ts CHANGED
@@ -21,3 +21,4 @@ export { default as Expand } from './shared/expand';
21
21
  export { default as Dropdown } from './shared/dropdown';
22
22
  export { default as CssTransition } from './shared/css-transition';
23
23
  export { default as Backdrop } from './shared/backdrop';
24
+ export { addColorAlpha, colorToRgbValues } from './utils/color';
package/dist/index.js CHANGED
@@ -414,11 +414,17 @@ var Themes = {
414
414
  };
415
415
 
416
416
  /* "use client" */
417
-
418
417
  var defaultTheme = Themes.getPresetStaticTheme();
419
418
  var ThemeContext = /*#__PURE__*/React.createContext(defaultTheme);
419
+
420
+ // export const useTheme = (): HUIThemes => React.useContext<HUIThemes>(ThemeContext)
421
+
420
422
  var useTheme = function useTheme() {
421
- return React.useContext(ThemeContext);
423
+ var context = React.useContext(ThemeContext);
424
+ if (!context) {
425
+ throw new Error('useTheme must be used within a ThemeProvider');
426
+ }
427
+ return context;
422
428
  };
423
429
 
424
430
  /* "use client" */
@@ -1442,7 +1448,18 @@ var HuiProvider = function HuiProvider(_ref) {
1442
1448
  }, children, /*#__PURE__*/React.createElement(ToastContainer, null)));
1443
1449
  };
1444
1450
 
1445
- // import flush from 'styled-jsx'
1451
+ var styledJsx;
1452
+ var hasRequiredStyledJsx;
1453
+
1454
+ function requireStyledJsx () {
1455
+ if (hasRequiredStyledJsx) return styledJsx;
1456
+ hasRequiredStyledJsx = 1;
1457
+ styledJsx = requireIndex();
1458
+ return styledJsx;
1459
+ }
1460
+
1461
+ var styledJsxExports = requireStyledJsx();
1462
+ var flush = /*@__PURE__*/getDefaultExportFromCjs(styledJsxExports);
1446
1463
 
1447
1464
  // export type FlushToReact = <T>(opts?: { nonce?: string }) => Array<ReactElement<T>>
1448
1465
 
@@ -1457,6 +1474,7 @@ var CssBaseline = function CssBaseline(_ref) {
1457
1474
  }, "html,body{background-color:".concat(theme.palette.background, ";color:").concat(theme.palette.foreground, ";}html{font-size:16px;--helpdice-icons-background:").concat(theme.palette.background, ";}body{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility;font-size:1rem;line-height:1.5;margin:0;padding:0;min-height:100%;position:relative;overflow-x:hidden;font-family:").concat(theme.font.sans, ";}#__next{overflow-x:hidden;}*,*:before,*:after{box-sizing:inherit;text-rendering:geometricPrecision;-webkit-tap-highlight-color:transparent;}p,small{font-weight:400;color:inherit;-webkit-letter-spacing:-0.005625em;-moz-letter-spacing:-0.005625em;-ms-letter-spacing:-0.005625em;letter-spacing:-0.005625em;font-family:").concat(theme.font.sans, ";}p{margin:1em 0;font-size:1em;line-height:1.625em;}small{margin:0;line-height:1.5;font-size:0.875em;}b{font-weight:600;}span{font-size:inherit;color:inherit;font-weight:inherit;}img{max-width:100%;}a{cursor:pointer;font-size:inherit;-webkit-touch-callout:none;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-box-align:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:").concat(theme.palette.link, ";-webkit-text-decoration:").concat(theme.expressiveness.linkStyle, ";text-decoration:").concat(theme.expressiveness.linkStyle, ";}a:hover{-webkit-text-decoration:").concat(theme.expressiveness.linkHoverStyle, ";text-decoration:").concat(theme.expressiveness.linkHoverStyle, ";}ul,ol{padding:0;list-style-type:none;margin:").concat(theme.layout.gapHalf, " ").concat(theme.layout.gapHalf, " ").concat(theme.layout.gapHalf, " ").concat(theme.layout.gap, ";color:").concat(theme.palette.foreground, ";}ol{list-style-type:decimal;}li{margin-bottom:0.625em;font-size:1em;line-height:1.625em;}h1,h2,h3,h4,h5,h6{color:inherit;margin:0 0 0.7rem 0;}h1{font-size:3rem;-webkit-letter-spacing:-0.02em;-moz-letter-spacing:-0.02em;-ms-letter-spacing:-0.02em;letter-spacing:-0.02em;line-height:1.5;font-weight:700;}h2{font-size:2.25rem;-webkit-letter-spacing:-0.02em;-moz-letter-spacing:-0.02em;-ms-letter-spacing:-0.02em;letter-spacing:-0.02em;font-weight:600;}h3{font-size:1.5rem;-webkit-letter-spacing:-0.02em;-moz-letter-spacing:-0.02em;-ms-letter-spacing:-0.02em;letter-spacing:-0.02em;font-weight:600;}h4{font-size:1.25rem;-webkit-letter-spacing:-0.02em;-moz-letter-spacing:-0.02em;-ms-letter-spacing:-0.02em;letter-spacing:-0.02em;font-weight:600;}h5{font-size:1rem;-webkit-letter-spacing:-0.01em;-moz-letter-spacing:-0.01em;-ms-letter-spacing:-0.01em;letter-spacing:-0.01em;font-weight:600;}h6{font-size:0.875rem;-webkit-letter-spacing:-0.005em;-moz-letter-spacing:-0.005em;-ms-letter-spacing:-0.005em;letter-spacing:-0.005em;font-weight:600;}button,input,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit;color:inherit;margin:0;}button:focus,input:focus,select:focus,textarea:focus{outline:none;}code{color:").concat(theme.palette.code, ";font-family:").concat(theme.font.mono, ";font-size:0.9em;white-space:pre-wrap;}code:before,code:after{content:'\\`';}pre{padding:calc(").concat(theme.layout.gap, " * 0.9) ").concat(theme.layout.gap, ";margin:").concat(theme.layout.gap, " 0;border:1px solid ").concat(theme.palette.accents_2, ";border-radius:").concat(theme.layout.radius, ";font-family:").concat(theme.font.mono, ";white-space:pre;overflow:auto;line-height:1.5;text-align:left;font-size:14px;-webkit-overflow-scrolling:touch;}pre code{color:").concat(theme.palette.foreground, ";font-size:1em;line-height:1.25em;white-space:pre;}pre code:before,pre code:after{display:none;}pre p{margin:0;}pre::-webkit-scrollbar{display:none;width:0;height:0;background:transparent;}hr{border-color:").concat(theme.palette.accents_2, ";}details{background-color:").concat(theme.palette.accents_1, ";border:none;}details:focus,details:hover,details:active{outline:none;}summary{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;list-style:none;outline:none;}summary::marker,summary::before,summary::-webkit-details-marker{display:none;}summary::-moz-list-bullet{font-size:0;}summary:focus,summary:hover,summary:active{outline:none;list-style:none;}blockquote{padding:calc(0.667 * ").concat(theme.layout.gap, ") ").concat(theme.layout.gap, ";color:").concat(theme.palette.accents_5, ";background-color:").concat(theme.palette.accents_1, ";border-radius:").concat(theme.layout.radius, ";margin:1.5em 0;border:1px solid ").concat(theme.palette.border, ";}blockquote *:first-child{margin-top:0;}blockquote *:last-child{margin-bottom:0;}::selection{background-color:").concat(theme.palette.selection, ";color:").concat(theme.palette.foreground, ";}")));
1458
1475
  };
1459
1476
  var MemoCssBaseline = /*#__PURE__*/React.memo(CssBaseline);
1477
+ MemoCssBaseline.flush = flush.StyleRegistry;
1460
1478
 
1461
1479
  var getElementOffset = function getElementOffset(el) {
1462
1480
  if (!el) return {
@@ -2090,6 +2108,41 @@ var Backdrop = /*#__PURE__*/React.memo(function (_ref) {
2090
2108
  });
2091
2109
  Backdrop.displayName = 'Backdrop';
2092
2110
 
2111
+ var hexToRgb = function hexToRgb(color) {
2112
+ var fullReg = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
2113
+ var full = color.replace(fullReg, function (_, r, g, b) {
2114
+ return "".concat(r).concat(r).concat(g).concat(g).concat(b).concat(b);
2115
+ });
2116
+ var values = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(full);
2117
+ if (!values) {
2118
+ throw new Error("Helpdice UI: Unsupported ".concat(color, " color."));
2119
+ }
2120
+ return [Number.parseInt(values[1], 16), Number.parseInt(values[2], 16), Number.parseInt(values[3], 16)];
2121
+ };
2122
+ var colorToRgbValues = function colorToRgbValues(color) {
2123
+ if (color.charAt(0) === '#') return hexToRgb(color);
2124
+ var safeColor = color.replace(/ /g, '');
2125
+ var colorType = color.substr(0, 4);
2126
+ var regArray = safeColor.match(/\((.+)\)/);
2127
+ if (!colorType.startsWith('rgb') || !regArray) {
2128
+ console.log(color);
2129
+ throw new Error("Helpdice UI: Only support [\"RGB\", \"RGBA\", \"HEX\"] color.");
2130
+ }
2131
+ return regArray[1].split(',').map(function (str) {
2132
+ return Number.parseFloat(str);
2133
+ });
2134
+ };
2135
+ var addColorAlpha = function addColorAlpha(color, alpha) {
2136
+ if (!/^#|rgb|RGB/.test(color)) return color;
2137
+ var _colorToRgbValues = colorToRgbValues(color),
2138
+ _colorToRgbValues2 = _slicedToArray(_colorToRgbValues, 3),
2139
+ r = _colorToRgbValues2[0],
2140
+ g = _colorToRgbValues2[1],
2141
+ b = _colorToRgbValues2[2];
2142
+ var safeAlpha = alpha > 1 ? 1 : alpha < 0 ? 0 : alpha;
2143
+ return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(safeAlpha, ")");
2144
+ };
2145
+
2093
2146
  exports.Backdrop = Backdrop;
2094
2147
  exports.CssBaseline = MemoCssBaseline;
2095
2148
  exports.CssTransition = CssTransition;
@@ -2099,6 +2152,8 @@ exports.Expand = Expand;
2099
2152
  exports.Highlight = Highlight;
2100
2153
  exports.Themes = Themes;
2101
2154
  exports.UiProvider = HuiProvider;
2155
+ exports.addColorAlpha = addColorAlpha;
2156
+ exports.colorToRgbValues = colorToRgbValues;
2102
2157
  exports.useAllThemes = useAllThemes;
2103
2158
  exports.useClasses = useClasses;
2104
2159
  exports.useCurrentState = useCurrentState;
@@ -395,11 +395,17 @@ var Themes = {
395
395
  };
396
396
 
397
397
  /* "use client" */
398
-
399
398
  var defaultTheme = Themes.getPresetStaticTheme();
400
399
  var ThemeContext = /*#__PURE__*/React.createContext(defaultTheme);
400
+
401
+ // export const useTheme = (): HUIThemes => React.useContext<HUIThemes>(ThemeContext)
402
+
401
403
  var useTheme = function useTheme() {
402
- return React.useContext(ThemeContext);
404
+ var context = React.useContext(ThemeContext);
405
+ if (!context) {
406
+ throw new Error('useTheme must be used within a ThemeProvider');
407
+ }
408
+ return context;
403
409
  };
404
410
 
405
411
  /* "use client" */
@@ -344,11 +344,17 @@ var Themes = {
344
344
  };
345
345
 
346
346
  /* "use client" */
347
-
348
347
  var defaultTheme = Themes.getPresetStaticTheme();
349
348
  var ThemeContext = /*#__PURE__*/React.createContext(defaultTheme);
349
+
350
+ // export const useTheme = (): HUIThemes => React.useContext<HUIThemes>(ThemeContext)
351
+
350
352
  var useTheme = function useTheme() {
351
- return React.useContext(ThemeContext);
353
+ var context = React.useContext(ThemeContext);
354
+ if (!context) {
355
+ throw new Error('useTheme must be used within a ThemeProvider');
356
+ }
357
+ return context;
352
358
  };
353
359
 
354
360
  var tuple = function tuple() {
@@ -299,11 +299,17 @@ var Themes = {
299
299
  };
300
300
 
301
301
  /* "use client" */
302
-
303
302
  var defaultTheme = Themes.getPresetStaticTheme();
304
303
  var ThemeContext = /*#__PURE__*/React.createContext(defaultTheme);
304
+
305
+ // export const useTheme = (): HUIThemes => React.useContext<HUIThemes>(ThemeContext)
306
+
305
307
  var useTheme = function useTheme() {
306
- return React.useContext(ThemeContext);
308
+ var context = React.useContext(ThemeContext);
309
+ if (!context) {
310
+ throw new Error('useTheme must be used within a ThemeProvider');
311
+ }
312
+ return context;
307
313
  };
308
314
 
309
315
  exports.default = useTheme;
@@ -0,0 +1,2 @@
1
+ export declare const colorToRgbValues: (color: string) => number[];
2
+ export declare const addColorAlpha: (color: string, alpha: number) => string;
@@ -1,9 +1,10 @@
1
1
  import React, { ReactElement } from 'react';
2
+ import flush from 'styled-jsx';
2
3
  export type FlushToReact = <T>(opts?: {
3
4
  nonce?: string;
4
5
  }) => Array<ReactElement<T>>;
5
6
  type MemoCssBaselineComponent<P = {}> = React.NamedExoticComponent<P> & {
6
- flush: FlushToReact;
7
+ flush: typeof flush.StyleRegistry;
7
8
  };
8
9
  declare const MemoCssBaseline: MemoCssBaselineComponent<React.PropsWithChildren<unknown>>;
9
10
  export default MemoCssBaseline;
@@ -2,8 +2,7 @@ import _JSXStyle from "../styled-jsx.es.js";
2
2
  /* "use client" */
3
3
  import React from 'react';
4
4
  import useTheme from '../use-theme';
5
- // import flush from 'styled-jsx'
6
-
5
+ import flush from 'styled-jsx';
7
6
  // export type FlushToReact = <T>(opts?: { nonce?: string }) => Array<ReactElement<T>>
8
7
 
9
8
  // export type FlushToHTML = (opts?: { nonce?: string }) => string
@@ -17,7 +16,7 @@ var CssBaseline = function CssBaseline(_ref) {
17
16
  }, "html,body{background-color:".concat(theme.palette.background, ";color:").concat(theme.palette.foreground, ";}html{font-size:16px;--helpdice-icons-background:").concat(theme.palette.background, ";}body{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility;font-size:1rem;line-height:1.5;margin:0;padding:0;min-height:100%;position:relative;overflow-x:hidden;font-family:").concat(theme.font.sans, ";}#__next{overflow-x:hidden;}*,*:before,*:after{box-sizing:inherit;text-rendering:geometricPrecision;-webkit-tap-highlight-color:transparent;}p,small{font-weight:400;color:inherit;-webkit-letter-spacing:-0.005625em;-moz-letter-spacing:-0.005625em;-ms-letter-spacing:-0.005625em;letter-spacing:-0.005625em;font-family:").concat(theme.font.sans, ";}p{margin:1em 0;font-size:1em;line-height:1.625em;}small{margin:0;line-height:1.5;font-size:0.875em;}b{font-weight:600;}span{font-size:inherit;color:inherit;font-weight:inherit;}img{max-width:100%;}a{cursor:pointer;font-size:inherit;-webkit-touch-callout:none;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-box-align:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:").concat(theme.palette.link, ";-webkit-text-decoration:").concat(theme.expressiveness.linkStyle, ";text-decoration:").concat(theme.expressiveness.linkStyle, ";}a:hover{-webkit-text-decoration:").concat(theme.expressiveness.linkHoverStyle, ";text-decoration:").concat(theme.expressiveness.linkHoverStyle, ";}ul,ol{padding:0;list-style-type:none;margin:").concat(theme.layout.gapHalf, " ").concat(theme.layout.gapHalf, " ").concat(theme.layout.gapHalf, " ").concat(theme.layout.gap, ";color:").concat(theme.palette.foreground, ";}ol{list-style-type:decimal;}li{margin-bottom:0.625em;font-size:1em;line-height:1.625em;}h1,h2,h3,h4,h5,h6{color:inherit;margin:0 0 0.7rem 0;}h1{font-size:3rem;-webkit-letter-spacing:-0.02em;-moz-letter-spacing:-0.02em;-ms-letter-spacing:-0.02em;letter-spacing:-0.02em;line-height:1.5;font-weight:700;}h2{font-size:2.25rem;-webkit-letter-spacing:-0.02em;-moz-letter-spacing:-0.02em;-ms-letter-spacing:-0.02em;letter-spacing:-0.02em;font-weight:600;}h3{font-size:1.5rem;-webkit-letter-spacing:-0.02em;-moz-letter-spacing:-0.02em;-ms-letter-spacing:-0.02em;letter-spacing:-0.02em;font-weight:600;}h4{font-size:1.25rem;-webkit-letter-spacing:-0.02em;-moz-letter-spacing:-0.02em;-ms-letter-spacing:-0.02em;letter-spacing:-0.02em;font-weight:600;}h5{font-size:1rem;-webkit-letter-spacing:-0.01em;-moz-letter-spacing:-0.01em;-ms-letter-spacing:-0.01em;letter-spacing:-0.01em;font-weight:600;}h6{font-size:0.875rem;-webkit-letter-spacing:-0.005em;-moz-letter-spacing:-0.005em;-ms-letter-spacing:-0.005em;letter-spacing:-0.005em;font-weight:600;}button,input,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit;color:inherit;margin:0;}button:focus,input:focus,select:focus,textarea:focus{outline:none;}code{color:").concat(theme.palette.code, ";font-family:").concat(theme.font.mono, ";font-size:0.9em;white-space:pre-wrap;}code:before,code:after{content:'\\`';}pre{padding:calc(").concat(theme.layout.gap, " * 0.9) ").concat(theme.layout.gap, ";margin:").concat(theme.layout.gap, " 0;border:1px solid ").concat(theme.palette.accents_2, ";border-radius:").concat(theme.layout.radius, ";font-family:").concat(theme.font.mono, ";white-space:pre;overflow:auto;line-height:1.5;text-align:left;font-size:14px;-webkit-overflow-scrolling:touch;}pre code{color:").concat(theme.palette.foreground, ";font-size:1em;line-height:1.25em;white-space:pre;}pre code:before,pre code:after{display:none;}pre p{margin:0;}pre::-webkit-scrollbar{display:none;width:0;height:0;background:transparent;}hr{border-color:").concat(theme.palette.accents_2, ";}details{background-color:").concat(theme.palette.accents_1, ";border:none;}details:focus,details:hover,details:active{outline:none;}summary{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;list-style:none;outline:none;}summary::marker,summary::before,summary::-webkit-details-marker{display:none;}summary::-moz-list-bullet{font-size:0;}summary:focus,summary:hover,summary:active{outline:none;list-style:none;}blockquote{padding:calc(0.667 * ").concat(theme.layout.gap, ") ").concat(theme.layout.gap, ";color:").concat(theme.palette.accents_5, ";background-color:").concat(theme.palette.accents_1, ";border-radius:").concat(theme.layout.radius, ";margin:1.5em 0;border:1px solid ").concat(theme.palette.border, ";}blockquote *:first-child{margin-top:0;}blockquote *:last-child{margin-bottom:0;}::selection{background-color:").concat(theme.palette.selection, ";color:").concat(theme.palette.foreground, ";}")));
18
17
  };
19
18
  var MemoCssBaseline = /*#__PURE__*/React.memo(CssBaseline);
20
- // MemoCssBaseline.flush = flush.StyleRegistry
19
+ MemoCssBaseline.flush = flush.StyleRegistry;
21
20
  // MemoCssBaseline.flushToHTML = flushToReact
22
21
 
23
22
  export default MemoCssBaseline;
package/esm/index.d.ts CHANGED
@@ -21,3 +21,4 @@ export { default as Expand } from './shared/expand';
21
21
  export { default as Dropdown } from './shared/dropdown';
22
22
  export { default as CssTransition } from './shared/css-transition';
23
23
  export { default as Backdrop } from './shared/backdrop';
24
+ export { addColorAlpha, colorToRgbValues } from './utils/color';
package/esm/index.js CHANGED
@@ -16,4 +16,5 @@ export { default as Ellipsis } from './shared/ellipsis';
16
16
  export { default as Expand } from './shared/expand';
17
17
  export { default as Dropdown } from './shared/dropdown';
18
18
  export { default as CssTransition } from './shared/css-transition';
19
- export { default as Backdrop } from './shared/backdrop';
19
+ export { default as Backdrop } from './shared/backdrop';
20
+ export { addColorAlpha, colorToRgbValues } from './utils/color';
@@ -1,9 +1,15 @@
1
1
  /* "use client" */
2
-
3
2
  import React from 'react';
4
3
  import Themes from '../themes';
5
4
  var defaultTheme = Themes.getPresetStaticTheme();
6
5
  export var ThemeContext = /*#__PURE__*/React.createContext(defaultTheme);
6
+
7
+ // export const useTheme = (): HUIThemes => React.useContext<HUIThemes>(ThemeContext)
8
+
7
9
  export var useTheme = function useTheme() {
8
- return React.useContext(ThemeContext);
10
+ var context = React.useContext(ThemeContext);
11
+ if (!context) {
12
+ throw new Error('useTheme must be used within a ThemeProvider');
13
+ }
14
+ return context;
9
15
  };
@@ -0,0 +1,2 @@
1
+ export declare const colorToRgbValues: (color: string) => number[];
2
+ export declare const addColorAlpha: (color: string, alpha: number) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helpdice/theme",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "main": "dist/index.js",
5
5
  "types": "esm/index.d.ts",
6
6
  "unpkg": "dist/index.min.js",