cakeinpanic-shared 1.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.
- package/dist/cjs/_virtual/_commonjsHelpers.js +10 -0
- package/dist/cjs/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/cjs/_virtual/index.js +10 -0
- package/dist/cjs/_virtual/index.js.map +1 -0
- package/dist/cjs/_virtual/index2.js +8 -0
- package/dist/cjs/_virtual/index2.js.map +1 -0
- package/dist/cjs/_virtual/ua-parser.js +10 -0
- package/dist/cjs/_virtual/ua-parser.js.map +1 -0
- package/dist/cjs/_virtual/ua-parser2.js +8 -0
- package/dist/cjs/_virtual/ua-parser2.js.map +1 -0
- package/dist/cjs/index.css +1 -0
- package/dist/cjs/index.js +39 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/node_modules/classnames/index.js +74 -0
- package/dist/cjs/node_modules/classnames/index.js.map +1 -0
- package/dist/cjs/node_modules/ua-parser-js/src/ua-parser.js +811 -0
- package/dist/cjs/node_modules/ua-parser-js/src/ua-parser.js.map +1 -0
- package/dist/cjs/theme-css/constants.js +21 -0
- package/dist/cjs/theme-css/constants.js.map +1 -0
- package/dist/cjs/theme-css/content-theme/content-theme.js +30 -0
- package/dist/cjs/theme-css/content-theme/content-theme.js.map +1 -0
- package/dist/cjs/theme-css/content-theme/content-theme.module.css.js +6 -0
- package/dist/cjs/theme-css/content-theme/content-theme.module.css.js.map +1 -0
- package/dist/cjs/theme-css/cookie-theme-provider.js +129 -0
- package/dist/cjs/theme-css/cookie-theme-provider.js.map +1 -0
- package/dist/cjs/theme-css/document-head-contents/element-theme-script.js +73 -0
- package/dist/cjs/theme-css/document-head-contents/element-theme-script.js.map +1 -0
- package/dist/cjs/theme-css/theme-provider/theme-provider.js +48 -0
- package/dist/cjs/theme-css/theme-provider/theme-provider.js.map +1 -0
- package/dist/cjs/theme-css/theme-toggler/theme-toggler.js +72 -0
- package/dist/cjs/theme-css/theme-toggler/theme-toggler.js.map +1 -0
- package/dist/cjs/theme-css/theme-toggler/theme-toggler.module.css.js +6 -0
- package/dist/cjs/theme-css/theme-toggler/theme-toggler.module.css.js.map +1 -0
- package/dist/cjs/theme-css/use-theme-toggle.js +13 -0
- package/dist/cjs/theme-css/use-theme-toggle.js.map +1 -0
- package/dist/cjs/theme-css/utils/cookies.js +21 -0
- package/dist/cjs/theme-css/utils/cookies.js.map +1 -0
- package/dist/cjs/theme-css/utils/set-theme-cookie.js +37 -0
- package/dist/cjs/theme-css/utils/set-theme-cookie.js.map +1 -0
- package/dist/cjs/utils/cookies-client-side.js +63 -0
- package/dist/cjs/utils/cookies-client-side.js.map +1 -0
- package/dist/cjs/utils/get-top-level-domain.js +18 -0
- package/dist/cjs/utils/get-top-level-domain.js.map +1 -0
- package/dist/cjs/utils/index.js +18 -0
- package/dist/cjs/utils/index.js.map +1 -0
- package/dist/cjs/utils/modalRoot.js +19 -0
- package/dist/cjs/utils/modalRoot.js.map +1 -0
- package/dist/esm/_virtual/_commonjsHelpers.mjs +6 -0
- package/dist/esm/_virtual/_commonjsHelpers.mjs.map +1 -0
- package/dist/esm/_virtual/index.mjs +8 -0
- package/dist/esm/_virtual/index.mjs.map +1 -0
- package/dist/esm/_virtual/index2.mjs +4 -0
- package/dist/esm/_virtual/index2.mjs.map +1 -0
- package/dist/esm/_virtual/ua-parser.mjs +6 -0
- package/dist/esm/_virtual/ua-parser.mjs.map +1 -0
- package/dist/esm/_virtual/ua-parser2.mjs +4 -0
- package/dist/esm/_virtual/ua-parser2.mjs.map +1 -0
- package/dist/esm/index.css +1 -0
- package/dist/esm/index.mjs +11 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/node_modules/classnames/index.mjs +70 -0
- package/dist/esm/node_modules/classnames/index.mjs.map +1 -0
- package/dist/esm/node_modules/ua-parser-js/src/ua-parser.mjs +807 -0
- package/dist/esm/node_modules/ua-parser-js/src/ua-parser.mjs.map +1 -0
- package/dist/esm/theme-css/constants.mjs +13 -0
- package/dist/esm/theme-css/constants.mjs.map +1 -0
- package/dist/esm/theme-css/content-theme/content-theme.mjs +26 -0
- package/dist/esm/theme-css/content-theme/content-theme.mjs.map +1 -0
- package/dist/esm/theme-css/content-theme/content-theme.module.css.mjs +4 -0
- package/dist/esm/theme-css/content-theme/content-theme.module.css.mjs.map +1 -0
- package/dist/esm/theme-css/cookie-theme-provider.mjs +124 -0
- package/dist/esm/theme-css/cookie-theme-provider.mjs.map +1 -0
- package/dist/esm/theme-css/document-head-contents/element-theme-script.mjs +69 -0
- package/dist/esm/theme-css/document-head-contents/element-theme-script.mjs.map +1 -0
- package/dist/esm/theme-css/theme-provider/theme-provider.mjs +42 -0
- package/dist/esm/theme-css/theme-provider/theme-provider.mjs.map +1 -0
- package/dist/esm/theme-css/theme-toggler/theme-toggler.mjs +68 -0
- package/dist/esm/theme-css/theme-toggler/theme-toggler.mjs.map +1 -0
- package/dist/esm/theme-css/theme-toggler/theme-toggler.module.css.mjs +4 -0
- package/dist/esm/theme-css/theme-toggler/theme-toggler.module.css.mjs.map +1 -0
- package/dist/esm/theme-css/use-theme-toggle.mjs +9 -0
- package/dist/esm/theme-css/use-theme-toggle.mjs.map +1 -0
- package/dist/esm/theme-css/utils/cookies.mjs +17 -0
- package/dist/esm/theme-css/utils/cookies.mjs.map +1 -0
- package/dist/esm/theme-css/utils/set-theme-cookie.mjs +33 -0
- package/dist/esm/theme-css/utils/set-theme-cookie.mjs.map +1 -0
- package/dist/esm/utils/cookies-client-side.mjs +55 -0
- package/dist/esm/utils/cookies-client-side.mjs.map +1 -0
- package/dist/esm/utils/get-top-level-domain.mjs +14 -0
- package/dist/esm/utils/get-top-level-domain.mjs.map +1 -0
- package/dist/esm/utils/index.mjs +8 -0
- package/dist/esm/utils/index.mjs.map +1 -0
- package/dist/esm/utils/modalRoot.mjs +17 -0
- package/dist/esm/utils/modalRoot.mjs.map +1 -0
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/theme-css/block/Block.d.ts +2 -0
- package/dist/types/theme-css/block/Block.d.ts.map +1 -0
- package/dist/types/theme-css/block/index.d.ts +2 -0
- package/dist/types/theme-css/block/index.d.ts.map +1 -0
- package/dist/types/theme-css/constants.d.ts +9 -0
- package/dist/types/theme-css/constants.d.ts.map +1 -0
- package/dist/types/theme-css/content-theme/content-theme.d.ts +7 -0
- package/dist/types/theme-css/content-theme/content-theme.d.ts.map +1 -0
- package/dist/types/theme-css/content-theme/index.d.ts +2 -0
- package/dist/types/theme-css/content-theme/index.d.ts.map +1 -0
- package/dist/types/theme-css/cookie-theme-provider.d.ts +20 -0
- package/dist/types/theme-css/cookie-theme-provider.d.ts.map +1 -0
- package/dist/types/theme-css/document-head-contents/element-theme-script.d.ts +6 -0
- package/dist/types/theme-css/document-head-contents/element-theme-script.d.ts.map +1 -0
- package/dist/types/theme-css/document-head-contents/index.d.ts +2 -0
- package/dist/types/theme-css/document-head-contents/index.d.ts.map +1 -0
- package/dist/types/theme-css/index.d.ts +7 -0
- package/dist/types/theme-css/index.d.ts.map +1 -0
- package/dist/types/theme-css/theme-provider/index.d.ts +2 -0
- package/dist/types/theme-css/theme-provider/index.d.ts.map +1 -0
- package/dist/types/theme-css/theme-provider/theme-provider.d.ts +10 -0
- package/dist/types/theme-css/theme-provider/theme-provider.d.ts.map +1 -0
- package/dist/types/theme-css/theme-toggler/index.d.ts +2 -0
- package/dist/types/theme-css/theme-toggler/index.d.ts.map +1 -0
- package/dist/types/theme-css/theme-toggler/theme-toggler.d.ts +5 -0
- package/dist/types/theme-css/theme-toggler/theme-toggler.d.ts.map +1 -0
- package/dist/types/theme-css/use-theme-toggle.d.ts +3 -0
- package/dist/types/theme-css/use-theme-toggle.d.ts.map +1 -0
- package/dist/types/theme-css/utils/cookies.d.ts +3 -0
- package/dist/types/theme-css/utils/cookies.d.ts.map +1 -0
- package/dist/types/theme-css/utils/set-theme-cookie.d.ts +3 -0
- package/dist/types/theme-css/utils/set-theme-cookie.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/dist/types/utils/__tests__/get-top-level-domain.test.d.ts +2 -0
- package/dist/types/utils/__tests__/get-top-level-domain.test.d.ts.map +1 -0
- package/dist/types/utils/cookies-client-side.d.ts +6 -0
- package/dist/types/utils/cookies-client-side.d.ts.map +1 -0
- package/dist/types/utils/get-top-level-domain.d.ts +2 -0
- package/dist/types/utils/get-top-level-domain.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +6 -0
- package/dist/types/utils/index.d.ts.map +1 -0
- package/dist/types/utils/modalRoot.d.ts +3 -0
- package/dist/types/utils/modalRoot.d.ts.map +1 -0
- package/dist/types/utils/types.d.ts +11 -0
- package/dist/types/utils/types.d.ts.map +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import { useThemeToggle } from '../use-theme-toggle.mjs';
|
|
3
|
+
import cn from '../../_virtual/index.mjs';
|
|
4
|
+
import styles from './theme-toggler.module.css.mjs';
|
|
5
|
+
import { DEFAULT_THEME_NAME } from '../constants.mjs';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
const Light = /*#__PURE__*/React.forwardRef(function Light(props, ref) {
|
|
9
|
+
return /*#__PURE__*/jsx("svg", {
|
|
10
|
+
width: 24,
|
|
11
|
+
height: 24,
|
|
12
|
+
viewBox: "0 0 24 24",
|
|
13
|
+
fill: "none",
|
|
14
|
+
ref: ref,
|
|
15
|
+
...props,
|
|
16
|
+
children: /*#__PURE__*/jsx("path", {
|
|
17
|
+
fill: "currentColor",
|
|
18
|
+
d: "M12 3a1 1 0 011 1v1.455a1 1 0 11-2 0V4a1 1 0 011-1zm0 12.636a3.636 3.636 0 100-7.272 3.636 3.636 0 000 7.272zm1 2.91a1 1 0 10-2 0V20a1 1 0 102 0v-1.454zM5.635 5.634a1 1 0 011.414 0l1.033 1.033A1 1 0 116.668 8.08L5.635 7.048a1 1 0 010-1.414zm11.697 10.284a1 1 0 00-1.414 1.414l1.033 1.033a1 1 0 101.414-1.414l-1.033-1.033zM3 12a1 1 0 011-1h1.455a1 1 0 110 2H4a1 1 0 01-1-1zm15.546-1a1 1 0 100 2H20a1 1 0 100-2h-1.454zM8.082 15.918a1 1 0 010 1.414L7.05 18.365a1 1 0 11-1.414-1.414l1.033-1.033a1 1 0 011.414 0zm10.283-8.87a1 1 0 10-1.414-1.414l-1.033 1.033a1 1 0 001.414 1.414l1.033-1.033z"
|
|
19
|
+
})
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
const Dark = /*#__PURE__*/React.forwardRef(function Dark(props, ref) {
|
|
23
|
+
return /*#__PURE__*/jsx("svg", {
|
|
24
|
+
width: 24,
|
|
25
|
+
height: 24,
|
|
26
|
+
viewBox: "0 0 24 24",
|
|
27
|
+
fill: "none",
|
|
28
|
+
ref: ref,
|
|
29
|
+
...props,
|
|
30
|
+
children: /*#__PURE__*/jsx("path", {
|
|
31
|
+
fillRule: "evenodd",
|
|
32
|
+
clipRule: "evenodd",
|
|
33
|
+
fill: "currentColor",
|
|
34
|
+
d: "M19 12.63A7.015 7.015 0 1111.37 5 5.456 5.456 0 0019 12.63z"
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
const ThemeToggler = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
39
|
+
let {
|
|
40
|
+
className,
|
|
41
|
+
onClick,
|
|
42
|
+
...rest
|
|
43
|
+
} = _ref;
|
|
44
|
+
const {
|
|
45
|
+
toggleTheme,
|
|
46
|
+
themeName
|
|
47
|
+
} = useThemeToggle();
|
|
48
|
+
const isLightTheme = themeName === DEFAULT_THEME_NAME;
|
|
49
|
+
return /*#__PURE__*/jsx("button", {
|
|
50
|
+
type: "button",
|
|
51
|
+
className: cn(styles.themeToggler, className, isLightTheme && styles.lightTheme),
|
|
52
|
+
ref: ref,
|
|
53
|
+
onClick: e => {
|
|
54
|
+
toggleTheme();
|
|
55
|
+
onClick?.(e);
|
|
56
|
+
},
|
|
57
|
+
...rest,
|
|
58
|
+
children: isLightTheme ? /*#__PURE__*/jsx(Light, {
|
|
59
|
+
className: styles.icon
|
|
60
|
+
}) : /*#__PURE__*/jsx(Dark, {
|
|
61
|
+
className: styles.icon
|
|
62
|
+
})
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
ThemeToggler.displayName = 'ThemeToggler';
|
|
66
|
+
|
|
67
|
+
export { ThemeToggler };
|
|
68
|
+
//# sourceMappingURL=theme-toggler.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-toggler.mjs","sources":["../../../../src/theme-css/theme-toggler/theme-toggler.tsx"],"sourcesContent":["import { ButtonHTMLAttributes, ForwardedRef, forwardRef } from 'react'\nimport { useThemeToggle } from '../use-theme-toggle'\nimport cn from 'classnames'\nimport styles from './theme-toggler.module.css'\nimport { DEFAULT_THEME_NAME } from '../constants'\nimport React, { SVGProps, Ref } from 'react'\n\nexport type ThemeTogglerProps = ButtonHTMLAttributes<HTMLButtonElement>\n\nconst Light = React.forwardRef(function Light(\n props: SVGProps<SVGSVGElement>,\n ref: Ref<SVGSVGElement>,\n) {\n return (\n <svg\n width={24}\n height={24}\n viewBox='0 0 24 24'\n fill='none'\n ref={ref}\n {...props}\n >\n <path\n fill='currentColor'\n d='M12 3a1 1 0 011 1v1.455a1 1 0 11-2 0V4a1 1 0 011-1zm0 12.636a3.636 3.636 0 100-7.272 3.636 3.636 0 000 7.272zm1 2.91a1 1 0 10-2 0V20a1 1 0 102 0v-1.454zM5.635 5.634a1 1 0 011.414 0l1.033 1.033A1 1 0 116.668 8.08L5.635 7.048a1 1 0 010-1.414zm11.697 10.284a1 1 0 00-1.414 1.414l1.033 1.033a1 1 0 101.414-1.414l-1.033-1.033zM3 12a1 1 0 011-1h1.455a1 1 0 110 2H4a1 1 0 01-1-1zm15.546-1a1 1 0 100 2H20a1 1 0 100-2h-1.454zM8.082 15.918a1 1 0 010 1.414L7.05 18.365a1 1 0 11-1.414-1.414l1.033-1.033a1 1 0 011.414 0zm10.283-8.87a1 1 0 10-1.414-1.414l-1.033 1.033a1 1 0 001.414 1.414l1.033-1.033z'\n />\n </svg>\n )\n})\n\nconst Dark = React.forwardRef(function Dark(\n props: SVGProps<SVGSVGElement>,\n ref: Ref<SVGSVGElement>,\n) {\n return (\n <svg\n width={24}\n height={24}\n viewBox='0 0 24 24'\n fill='none'\n ref={ref}\n {...props}\n >\n <path\n fillRule='evenodd'\n clipRule='evenodd'\n fill='currentColor'\n d='M19 12.63A7.015 7.015 0 1111.37 5 5.456 5.456 0 0019 12.63z'\n />\n </svg>\n )\n})\n\nexport const ThemeToggler = forwardRef(\n (\n { className, onClick, ...rest }: ThemeTogglerProps,\n ref: ForwardedRef<HTMLButtonElement>,\n ) => {\n const { toggleTheme, themeName } = useThemeToggle()\n\n const isLightTheme = themeName === DEFAULT_THEME_NAME\n\n return (\n <button\n type='button'\n className={cn(\n styles.themeToggler,\n className,\n isLightTheme && styles.lightTheme,\n )}\n ref={ref}\n onClick={(e) => {\n toggleTheme()\n onClick?.(e)\n }}\n {...rest}\n >\n {isLightTheme ? (\n <Light className={styles.icon} />\n ) : (\n <Dark className={styles.icon} />\n )}\n </button>\n )\n },\n)\nThemeToggler.displayName = 'ThemeToggler'\n"],"names":["Light","React","forwardRef","props","ref","_jsx","width","height","viewBox","fill","children","d","Dark","fillRule","clipRule","ThemeToggler","_ref","className","onClick","rest","toggleTheme","themeName","useThemeToggle","isLightTheme","DEFAULT_THEME_NAME","type","cn","styles","themeToggler","lightTheme","e","icon","displayName"],"mappings":";;;;;;;AASA,MAAMA,KAAK,gBAAGC,KAAK,CAACC,UAAU,CAAC,SAASF,KAAKA,CAC3CG,KAA8B,EAC9BC,GAAuB,EACvB;AACA,EAAA,oBACEC,GAAA,CAAA,KAAA,EAAA;AACEC,IAAAA,KAAK,EAAE,EAAG;AACVC,IAAAA,MAAM,EAAE,EAAG;AACXC,IAAAA,OAAO,EAAC,WAAW;AACnBC,IAAAA,IAAI,EAAC,MAAM;AACXL,IAAAA,GAAG,EAAEA,GAAI;AAAA,IAAA,GACLD,KAAK;AAAAO,IAAAA,QAAA,eAETL,GAAA,CAAA,MAAA,EAAA;AACEI,MAAAA,IAAI,EAAC,cAAc;AACnBE,MAAAA,CAAC,EAAC,4kBAAA;KACH,CAAA;AAAC,GACC,CAAC,CAAA;AAEV,CAAC,CAAC,CAAA;AAEF,MAAMC,IAAI,gBAAGX,KAAK,CAACC,UAAU,CAAC,SAASU,IAAIA,CACzCT,KAA8B,EAC9BC,GAAuB,EACvB;AACA,EAAA,oBACEC,GAAA,CAAA,KAAA,EAAA;AACEC,IAAAA,KAAK,EAAE,EAAG;AACVC,IAAAA,MAAM,EAAE,EAAG;AACXC,IAAAA,OAAO,EAAC,WAAW;AACnBC,IAAAA,IAAI,EAAC,MAAM;AACXL,IAAAA,GAAG,EAAEA,GAAI;AAAA,IAAA,GACLD,KAAK;AAAAO,IAAAA,QAAA,eAETL,GAAA,CAAA,MAAA,EAAA;AACEQ,MAAAA,QAAQ,EAAC,SAAS;AAClBC,MAAAA,QAAQ,EAAC,SAAS;AAClBL,MAAAA,IAAI,EAAC,cAAc;AACnBE,MAAAA,CAAC,EAAC,6DAAA;KACH,CAAA;AAAC,GACC,CAAC,CAAA;AAEV,CAAC,CAAC,CAAA;AAEK,MAAMI,YAAY,gBAAGb,UAAU,CACpC,CAAAc,IAAA,EAEEZ,GAAoC,KACjC;EAAA,IAFH;IAAEa,SAAS;IAAEC,OAAO;IAAE,GAAGC,IAAAA;AAAwB,GAAC,GAAAH,IAAA,CAAA;EAGlD,MAAM;IAAEI,WAAW;AAAEC,IAAAA,SAAAA;GAAW,GAAGC,cAAc,EAAE,CAAA;AAEnD,EAAA,MAAMC,YAAY,GAAGF,SAAS,KAAKG,kBAAkB,CAAA;AAErD,EAAA,oBACEnB,GAAA,CAAA,QAAA,EAAA;AACEoB,IAAAA,IAAI,EAAC,QAAQ;AACbR,IAAAA,SAAS,EAAES,EAAE,CACXC,MAAM,CAACC,YAAY,EACnBX,SAAS,EACTM,YAAY,IAAII,MAAM,CAACE,UACzB,CAAE;AACFzB,IAAAA,GAAG,EAAEA,GAAI;IACTc,OAAO,EAAGY,CAAC,IAAK;AACdV,MAAAA,WAAW,EAAE,CAAA;MACbF,OAAO,GAAGY,CAAC,CAAC,CAAA;KACZ;AAAA,IAAA,GACEX,IAAI;AAAAT,IAAAA,QAAA,EAEPa,YAAY,gBACXlB,GAAA,CAACL,KAAK,EAAA;MAACiB,SAAS,EAAEU,MAAM,CAACI,IAAAA;AAAK,KAAE,CAAC,gBAEjC1B,GAAA,CAACO,IAAI,EAAA;MAACK,SAAS,EAAEU,MAAM,CAACI,IAAAA;KAAO,CAAA;AAChC,GACK,CAAC,CAAA;AAEb,CACF,EAAC;AACDhB,YAAY,CAACiB,WAAW,GAAG,cAAc;;;;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const styles = {"icon":"theme-toggler-module_icon__ZRs7R","light":"theme-toggler-module_light__Q-trB theme-toggler-module_icon__ZRs7R","dark":"theme-toggler-module_dark__-0RKw theme-toggler-module_icon__ZRs7R","lightTheme":"theme-toggler-module_lightTheme__3NHWC","themeToggler":"theme-toggler-module_themeToggler__8IBGg"};
|
|
2
|
+
|
|
3
|
+
export { styles as default };
|
|
4
|
+
//# sourceMappingURL=theme-toggler.module.css.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-toggler.module.css.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-theme-toggle.mjs","sources":["../../../src/theme-css/use-theme-toggle.ts"],"sourcesContent":["import { useContext } from 'react'\nimport { ThemeToggleContext, ThemeContext } from './cookie-theme-provider'\n\nexport const useThemeToggle = (): ThemeContext => {\n return useContext(ThemeToggleContext)\n}\n"],"names":["useThemeToggle","useContext","ThemeToggleContext"],"mappings":";;;AAGaA,MAAAA,cAAc,GAAGA,MAAoB;EAChD,OAAOC,UAAU,CAACC,kBAAkB,CAAC,CAAA;AACvC;;;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { themeCookieKey } from '../constants.mjs';
|
|
2
|
+
|
|
3
|
+
// TODO: use /packages/utils/cookies-client-side.ts
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
// we're using all-same regex in element-theme-script.tsx.
|
|
7
|
+
// Sadly, we cannot re-use it as this script is supposed to be inlined in document head
|
|
8
|
+
const cookieThemeMatcher = new RegExp(`(^| )${themeCookieKey}=([^;]+)`);
|
|
9
|
+
const getThemeNameFromCookies = () => {
|
|
10
|
+
if (typeof window === 'undefined') {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
return document.cookie.match(cookieThemeMatcher)?.[2] ?? null;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { getThemeNameFromCookies };
|
|
17
|
+
//# sourceMappingURL=cookies.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookies.mjs","sources":["../../../../src/theme-css/utils/cookies.ts"],"sourcesContent":["// TODO: use /packages/utils/cookies-client-side.ts\n\nimport { themeCookieKey, ThemeName } from '../constants'\n\n// we're using all-same regex in element-theme-script.tsx.\n// Sadly, we cannot re-use it as this script is supposed to be inlined in document head\nconst cookieThemeMatcher = new RegExp(`(^| )${themeCookieKey}=([^;]+)`)\n\nexport const getThemeNameFromCookies = (): ThemeName | null => {\n if (typeof window === 'undefined') {\n return null\n }\n\n return (document.cookie.match(cookieThemeMatcher)?.[2] as ThemeName) ?? null\n}\n"],"names":["cookieThemeMatcher","RegExp","themeCookieKey","getThemeNameFromCookies","window","document","cookie","match"],"mappings":";;AAAA;;;AAIA;AACA;AACA,MAAMA,kBAAkB,GAAG,IAAIC,MAAM,CAAC,CAAQC,KAAAA,EAAAA,cAAc,UAAU,CAAC,CAAA;AAE1DC,MAAAA,uBAAuB,GAAGA,MAAwB;AAC7D,EAAA,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE;AACjC,IAAA,OAAO,IAAI,CAAA;AACb,GAAA;AAEA,EAAA,OAAQC,QAAQ,CAACC,MAAM,CAACC,KAAK,CAACP,kBAAkB,CAAC,GAAG,CAAC,CAAC,IAAkB,IAAI,CAAA;AAC9E;;;;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { u as uaParserExports } from '../../_virtual/ua-parser.mjs';
|
|
2
|
+
import '../../utils/modalRoot.mjs';
|
|
3
|
+
import { getTopLevelDomain } from '../../utils/get-top-level-domain.mjs';
|
|
4
|
+
import '../../utils/cookies-client-side.mjs';
|
|
5
|
+
import { themeCookieKey, themeCookieMaxAge } from '../constants.mjs';
|
|
6
|
+
|
|
7
|
+
const parser = new uaParserExports.UAParser();
|
|
8
|
+
const setSecureCookie = cookie => {
|
|
9
|
+
// 1. we want this cookie to be available on HTTP websites too.
|
|
10
|
+
// 2. there is a bug on localhost which causes Chrome to ignore cookies set without Secure,
|
|
11
|
+
// and Safari when cookies are set with Secure, so we're forcing cookie into both
|
|
12
|
+
if (parser.getBrowser()?.name?.toLowerCase() === 'safari') {
|
|
13
|
+
if (window.location.protocol !== 'https:') {
|
|
14
|
+
document.cookie = cookie;
|
|
15
|
+
} else {
|
|
16
|
+
document.cookie = `${cookie}Secure;`;
|
|
17
|
+
}
|
|
18
|
+
} else {
|
|
19
|
+
document.cookie = `${cookie}Secure;`;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const setThemeCookie = theme => {
|
|
23
|
+
const cookie = `${themeCookieKey}=${theme};max-age=${themeCookieMaxAge};path=/;samesite=None;`;
|
|
24
|
+
// For top level domain - *.some-domain.fi
|
|
25
|
+
setSecureCookie(`${cookie}domain=${getTopLevelDomain()};`);
|
|
26
|
+
if (!document.cookie.includes(`${themeCookieKey}=${theme}`)) {
|
|
27
|
+
// For specific.domain.fi, if cookie can't be set to top level domain
|
|
28
|
+
setSecureCookie(cookie);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { setThemeCookie };
|
|
33
|
+
//# sourceMappingURL=set-theme-cookie.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-theme-cookie.mjs","sources":["../../../../src/theme-css/utils/set-theme-cookie.ts"],"sourcesContent":["import { UAParser } from 'ua-parser-js'\nimport { getTopLevelDomain } from '../../utils/index'\nimport { themeCookieMaxAge, themeCookieKey, ThemeName } from '../constants'\n\nconst parser = new UAParser()\n\nconst setSecureCookie = (cookie: string) => {\n // 1. we want this cookie to be available on HTTP websites too.\n // 2. there is a bug on localhost which causes Chrome to ignore cookies set without Secure,\n // and Safari when cookies are set with Secure, so we're forcing cookie into both\n if (parser.getBrowser()?.name?.toLowerCase() === 'safari') {\n if (window.location.protocol !== 'https:') {\n document.cookie = cookie\n } else {\n document.cookie = `${cookie}Secure;`\n }\n } else {\n document.cookie = `${cookie}Secure;`\n }\n}\n\nexport const setThemeCookie = (theme: ThemeName) => {\n const cookie = `${themeCookieKey}=${theme};max-age=${themeCookieMaxAge};path=/;samesite=None;`\n // For top level domain - *.some-domain.fi\n setSecureCookie(`${cookie}domain=${getTopLevelDomain()};`)\n\n if (!document.cookie.includes(`${themeCookieKey}=${theme}`)) {\n // For specific.domain.fi, if cookie can't be set to top level domain\n setSecureCookie(cookie)\n }\n}\n"],"names":["parser","UAParser","setSecureCookie","cookie","getBrowser","name","toLowerCase","window","location","protocol","document","setThemeCookie","theme","themeCookieKey","themeCookieMaxAge","getTopLevelDomain","includes"],"mappings":";;;;;;AAIA,MAAMA,MAAM,GAAG,IAAIC,wBAAQ,EAAE,CAAA;AAE7B,MAAMC,eAAe,GAAIC,MAAc,IAAK;AAC1C;AACA;AACA;AACA,EAAA,IAAIH,MAAM,CAACI,UAAU,EAAE,EAAEC,IAAI,EAAEC,WAAW,EAAE,KAAK,QAAQ,EAAE;AACzD,IAAA,IAAIC,MAAM,CAACC,QAAQ,CAACC,QAAQ,KAAK,QAAQ,EAAE;MACzCC,QAAQ,CAACP,MAAM,GAAGA,MAAM,CAAA;AAC1B,KAAC,MAAM;AACLO,MAAAA,QAAQ,CAACP,MAAM,GAAG,CAAA,EAAGA,MAAM,CAAS,OAAA,CAAA,CAAA;AACtC,KAAA;AACF,GAAC,MAAM;AACLO,IAAAA,QAAQ,CAACP,MAAM,GAAG,CAAA,EAAGA,MAAM,CAAS,OAAA,CAAA,CAAA;AACtC,GAAA;AACF,CAAC,CAAA;AAEYQ,MAAAA,cAAc,GAAIC,KAAgB,IAAK;EAClD,MAAMT,MAAM,GAAG,CAAGU,EAAAA,cAAc,IAAID,KAAK,CAAA,SAAA,EAAYE,iBAAiB,CAAwB,sBAAA,CAAA,CAAA;AAC9F;EACAZ,eAAe,CAAC,GAAGC,MAAM,CAAA,OAAA,EAAUY,iBAAiB,EAAE,GAAG,CAAC,CAAA;AAE1D,EAAA,IAAI,CAACL,QAAQ,CAACP,MAAM,CAACa,QAAQ,CAAC,CAAA,EAAGH,cAAc,CAAA,CAAA,EAAID,KAAK,CAAA,CAAE,CAAC,EAAE;AAC3D;IACAV,eAAe,CAACC,MAAM,CAAC,CAAA;AACzB,GAAA;AACF;;;;"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { u as uaParserExports } from '../_virtual/ua-parser.mjs';
|
|
2
|
+
import { getTopLevelDomain } from './get-top-level-domain.mjs';
|
|
3
|
+
|
|
4
|
+
const parser = new uaParserExports.UAParser();
|
|
5
|
+
const setSecureCookie = cookie => {
|
|
6
|
+
// 1. we want this cookie to be available on HTTP websites too.
|
|
7
|
+
// 2. there is a bug on localhost which causes Chrome to ignore cookies set without Secure,
|
|
8
|
+
// and Safari when cookies are set with Secure, so we're forcing cookie into both
|
|
9
|
+
if (parser.getBrowser()?.name?.toLowerCase() === 'safari') {
|
|
10
|
+
if (window.location.protocol !== 'https:') {
|
|
11
|
+
document.cookie = cookie;
|
|
12
|
+
} else {
|
|
13
|
+
document.cookie = `${cookie}Secure;`;
|
|
14
|
+
}
|
|
15
|
+
} else {
|
|
16
|
+
document.cookie = `${cookie}Secure;`;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// :)
|
|
21
|
+
const prepareForCookingCookie = function (key, value) {
|
|
22
|
+
let expire = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 365;
|
|
23
|
+
return `${key}=${value};expires=${expire};path=/;samesite=None;`;
|
|
24
|
+
};
|
|
25
|
+
const setCrossDomainCookieClientSide = function (key, value) {
|
|
26
|
+
let expire = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 365;
|
|
27
|
+
if (typeof window === 'undefined') {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
setSecureCookie(`${prepareForCookingCookie(key, value, expire)}domain=${getTopLevelDomain()};`);
|
|
31
|
+
};
|
|
32
|
+
const setDomainCookieClientSide = function (key, value) {
|
|
33
|
+
let expire = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 365;
|
|
34
|
+
if (typeof window === 'undefined') {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
setSecureCookie(prepareForCookingCookie(key, value, expire));
|
|
38
|
+
};
|
|
39
|
+
const getCrossDomainCookieClientSide = key => {
|
|
40
|
+
const defaultValue = null;
|
|
41
|
+
if (typeof window === 'undefined') {
|
|
42
|
+
return defaultValue;
|
|
43
|
+
}
|
|
44
|
+
const cookieMatcher = new RegExp(`(^| )${key}=([^;]+)`);
|
|
45
|
+
return document.cookie.match(cookieMatcher)?.[2] ?? defaultValue;
|
|
46
|
+
};
|
|
47
|
+
const getDomainCookieClientSide = key => {
|
|
48
|
+
return getCrossDomainCookieClientSide(key);
|
|
49
|
+
};
|
|
50
|
+
const removeCookiesClientSide = key => {
|
|
51
|
+
document.cookie = `${key}= ; expires = Thu, 01 Jan 1970 00:00:00 GMT`;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export { getCrossDomainCookieClientSide, getDomainCookieClientSide, removeCookiesClientSide, setCrossDomainCookieClientSide, setDomainCookieClientSide };
|
|
55
|
+
//# sourceMappingURL=cookies-client-side.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookies-client-side.mjs","sources":["../../../src/utils/cookies-client-side.ts"],"sourcesContent":["import { UAParser } from 'ua-parser-js'\nimport { getTopLevelDomain } from './get-top-level-domain'\n\nconst parser = new UAParser()\n\nconst setSecureCookie = (cookie: string) => {\n // 1. we want this cookie to be available on HTTP websites too.\n // 2. there is a bug on localhost which causes Chrome to ignore cookies set without Secure,\n // and Safari when cookies are set with Secure, so we're forcing cookie into both\n if (parser.getBrowser()?.name?.toLowerCase() === 'safari') {\n if (window.location.protocol !== 'https:') {\n document.cookie = cookie\n } else {\n document.cookie = `${cookie}Secure;`\n }\n } else {\n document.cookie = `${cookie}Secure;`\n }\n}\n\n// :)\nconst prepareForCookingCookie = (\n key: string,\n value: string,\n expire = 365,\n): string => {\n return `${key}=${value};expires=${expire};path=/;samesite=None;`\n}\n\nexport const setCrossDomainCookieClientSide = (\n key: string,\n value: string,\n expire = 365,\n): void => {\n if (typeof window === 'undefined') {\n return\n }\n\n setSecureCookie(\n `${prepareForCookingCookie(\n key,\n value,\n expire,\n )}domain=${getTopLevelDomain()};`,\n )\n}\n\nexport const setDomainCookieClientSide = (\n key: string,\n value: string,\n expire = 365,\n): void => {\n if (typeof window === 'undefined') {\n return\n }\n\n setSecureCookie(prepareForCookingCookie(key, value, expire))\n}\n\nexport const getCrossDomainCookieClientSide = (key: string): string | null => {\n const defaultValue = null\n\n if (typeof window === 'undefined') {\n return defaultValue\n }\n\n const cookieMatcher = new RegExp(`(^| )${key}=([^;]+)`)\n return (document.cookie.match(cookieMatcher)?.[2] as string) ?? defaultValue\n}\n\nexport const getDomainCookieClientSide = (key: string): string | null => {\n return getCrossDomainCookieClientSide(key)\n}\n\nexport const removeCookiesClientSide = (key: string): void => {\n document.cookie = `${key}= ; expires = Thu, 01 Jan 1970 00:00:00 GMT`\n}\n"],"names":["parser","UAParser","setSecureCookie","cookie","getBrowser","name","toLowerCase","window","location","protocol","document","prepareForCookingCookie","key","value","expire","arguments","length","undefined","setCrossDomainCookieClientSide","getTopLevelDomain","setDomainCookieClientSide","getCrossDomainCookieClientSide","defaultValue","cookieMatcher","RegExp","match","getDomainCookieClientSide","removeCookiesClientSide"],"mappings":"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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const getTopLevelDomain = () => {
|
|
2
|
+
if (typeof window === 'undefined') {
|
|
3
|
+
return 'localhost';
|
|
4
|
+
}
|
|
5
|
+
const pathParts = window.location.hostname.split('.');
|
|
6
|
+
if (pathParts[pathParts.length - 1] === 'localhost') {
|
|
7
|
+
return 'localhost';
|
|
8
|
+
}
|
|
9
|
+
// Get host with dot in first position
|
|
10
|
+
return `.${pathParts.slice(-2).join('.')}`;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { getTopLevelDomain };
|
|
14
|
+
//# sourceMappingURL=get-top-level-domain.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-top-level-domain.mjs","sources":["../../../src/utils/get-top-level-domain.ts"],"sourcesContent":["export const getTopLevelDomain = () => {\n if (typeof window === 'undefined') {\n return 'localhost'\n }\n const pathParts = window.location.hostname.split('.')\n\n if (pathParts[pathParts.length - 1] === 'localhost') {\n return 'localhost'\n }\n // Get host with dot in first position\n return `.${pathParts.slice(-2).join('.')}`\n}\n"],"names":["getTopLevelDomain","window","pathParts","location","hostname","split","length","slice","join"],"mappings":"AAAaA,MAAAA,iBAAiB,GAAGA,MAAM;AACrC,EAAA,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE;AACjC,IAAA,OAAO,WAAW,CAAA;AACpB,GAAA;EACA,MAAMC,SAAS,GAAGD,MAAM,CAACE,QAAQ,CAACC,QAAQ,CAACC,KAAK,CAAC,GAAG,CAAC,CAAA;EAErD,IAAIH,SAAS,CAACA,SAAS,CAACI,MAAM,GAAG,CAAC,CAAC,KAAK,WAAW,EAAE;AACnD,IAAA,OAAO,WAAW,CAAA;AACpB,GAAA;AACA;AACA,EAAA,OAAO,CAAIJ,CAAAA,EAAAA,SAAS,CAACK,KAAK,CAAC,CAAC,CAAC,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC,CAAE,CAAA,CAAA;AAC5C;;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as modalRoot } from './modalRoot.mjs';
|
|
2
|
+
export { getCrossDomainCookieClientSide, getDomainCookieClientSide, removeCookiesClientSide, setCrossDomainCookieClientSide, setDomainCookieClientSide } from './cookies-client-side.mjs';
|
|
3
|
+
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
5
|
+
const VOID_FN = () => {};
|
|
6
|
+
|
|
7
|
+
export { VOID_FN };
|
|
8
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/utils/index.ts"],"sourcesContent":["export * from './types'\nexport { default as modalRoot } from './modalRoot'\nexport * from './get-top-level-domain'\nexport * from './cookies-client-side'\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nexport const VOID_FN = () => {}\n"],"names":["VOID_FN"],"mappings":";;;AAKA;MACaA,OAAO,GAAGA,MAAM;;;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const ROOT_ID = 'lido-ui-modal-root';
|
|
2
|
+
const ModalRoot = (() => {
|
|
3
|
+
try {
|
|
4
|
+
let modalRoot = document.getElementById(ROOT_ID);
|
|
5
|
+
if (!modalRoot) {
|
|
6
|
+
modalRoot = document.createElement('div');
|
|
7
|
+
modalRoot.id = ROOT_ID;
|
|
8
|
+
document.body.append(modalRoot);
|
|
9
|
+
}
|
|
10
|
+
return modalRoot;
|
|
11
|
+
} catch {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
})();
|
|
15
|
+
|
|
16
|
+
export { ModalRoot as default };
|
|
17
|
+
//# sourceMappingURL=modalRoot.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modalRoot.mjs","sources":["../../../src/utils/modalRoot.ts"],"sourcesContent":["const ROOT_ID = 'lido-ui-modal-root'\n\nconst ModalRoot = ((): HTMLElement | null => {\n try {\n let modalRoot = document.getElementById(ROOT_ID)\n\n if (!modalRoot) {\n modalRoot = document.createElement('div')\n modalRoot.id = ROOT_ID\n document.body.append(modalRoot)\n }\n\n return modalRoot\n } catch {\n return null\n }\n})()\n\nexport default ModalRoot\n"],"names":["ROOT_ID","ModalRoot","modalRoot","document","getElementById","createElement","id","body","append"],"mappings":"AAAA,MAAMA,OAAO,GAAG,oBAAoB,CAAA;AAE9BC,MAAAA,SAAS,GAAG,CAAC,MAA0B;EAC3C,IAAI;AACF,IAAA,IAAIC,SAAS,GAAGC,QAAQ,CAACC,cAAc,CAACJ,OAAO,CAAC,CAAA;IAEhD,IAAI,CAACE,SAAS,EAAE;AACdA,MAAAA,SAAS,GAAGC,QAAQ,CAACE,aAAa,CAAC,KAAK,CAAC,CAAA;MACzCH,SAAS,CAACI,EAAE,GAAGN,OAAO,CAAA;AACtBG,MAAAA,QAAQ,CAACI,IAAI,CAACC,MAAM,CAACN,SAAS,CAAC,CAAA;AACjC,KAAA;AAEA,IAAA,OAAOA,SAAS,CAAA;AAClB,GAAC,CAAC,MAAM;AACN,IAAA,OAAO,IAAI,CAAA;AACb,GAAA;AACF,CAAC;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Block.d.ts","sourceRoot":"","sources":["../../../../src/theme-css/block/Block.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,KAAK,2MAOjB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/theme-css/block/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare enum ThemeName {
|
|
2
|
+
light = "light",
|
|
3
|
+
dark = "dark"
|
|
4
|
+
}
|
|
5
|
+
export declare const DEFAULT_THEME_NAME = ThemeName.light;
|
|
6
|
+
export declare const themeCookieKey = "lido-theme-manual1";
|
|
7
|
+
export declare const themeCookieMaxAge: number;
|
|
8
|
+
export declare const prefersDarkThemeMediaQuery: MediaQueryList | undefined;
|
|
9
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/theme-css/constants.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS;IACnB,KAAK,UAAU;IACf,IAAI,SAAS;CACd;AAED,eAAO,MAAM,kBAAkB,kBAAkB,CAAA;AAEjD,eAAO,MAAM,cAAc,uBAAuB,CAAA;AAElD,eAAO,MAAM,iBAAiB,QAAkB,CAAA;AAEhD,eAAO,MAAM,0BAA0B,4BAGxB,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, FC, ReactElement } from 'react';
|
|
2
|
+
export type ContentThemeProps = ComponentPropsWithoutRef<'div'> & {
|
|
3
|
+
darkContent: ReactElement;
|
|
4
|
+
lightContent: ReactElement;
|
|
5
|
+
};
|
|
6
|
+
export declare const ContentTheme: FC<ContentThemeProps>;
|
|
7
|
+
//# sourceMappingURL=content-theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-theme.d.ts","sourceRoot":"","sources":["../../../../src/theme-css/content-theme/content-theme.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAGlE,MAAM,MAAM,iBAAiB,GAAG,wBAAwB,CAAC,KAAK,CAAC,GAAG;IAChE,WAAW,EAAE,YAAY,CAAA;IACzB,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAgB9C,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/theme-css/content-theme/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FC, PropsWithChildren } from 'react';
|
|
2
|
+
import { ThemeName } from './constants';
|
|
3
|
+
export type ThemeContext = {
|
|
4
|
+
toggleTheme: () => void;
|
|
5
|
+
themeName: ThemeName;
|
|
6
|
+
};
|
|
7
|
+
export declare const ThemeToggleContext: import("react").Context<ThemeContext>;
|
|
8
|
+
/**
|
|
9
|
+
* This is really complicated logic here. Comments will be added on specific lines
|
|
10
|
+
*
|
|
11
|
+
* Cookie theme provider acts differently from common theme provider.
|
|
12
|
+
* 1. it can be nested, BUT it should re-use value provided by itself for optimisation purposes
|
|
13
|
+
* 2. if it is top-level, it is not altering itself, but instead altering theme behavior on HTMLElement level
|
|
14
|
+
* 3. it does not support custom themes, preferring pre-defined themes instead
|
|
15
|
+
* */
|
|
16
|
+
export declare const CookieThemeProvider: FC<PropsWithChildren<{
|
|
17
|
+
initialThemeName?: ThemeName;
|
|
18
|
+
overrideThemeName?: ThemeName;
|
|
19
|
+
}>>;
|
|
20
|
+
//# sourceMappingURL=cookie-theme-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookie-theme-provider.d.ts","sourceRoot":"","sources":["../../../src/theme-css/cookie-theme-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,EAAE,EAEF,iBAAiB,EAKlB,MAAM,OAAO,CAAA;AACd,OAAO,EAGL,SAAS,EACV,MAAM,aAAa,CAAA;AAQpB,MAAM,MAAM,YAAY,GAAG;IACzB,WAAW,EAAE,MAAM,IAAI,CAAA;IACvB,SAAS,EAAE,SAAS,CAAA;CACrB,CAAA;AAGD,eAAO,MAAM,kBAAkB,uCACmB,CAAA;AAIlD;;;;;;;KAOK;AAEL,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAClC,iBAAiB,CAAC;IAEhB,gBAAgB,CAAC,EAAE,SAAS,CAAA;IAC5B,iBAAiB,CAAC,EAAE,SAAS,CAAA;CAC9B,CAAC,CAmHH,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ThemeName } from '../constants';
|
|
2
|
+
export declare const getThemeNameFromUrl: () => ThemeName | undefined;
|
|
3
|
+
export declare let updateGlobalTheme: (theme: string) => void;
|
|
4
|
+
export declare let initGlobalCookieTheme: () => void;
|
|
5
|
+
export declare const ScriptThemeValue: () => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
//# sourceMappingURL=element-theme-script.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element-theme-script.d.ts","sourceRoot":"","sources":["../../../../src/theme-css/document-head-contents/element-theme-script.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkB,SAAS,EAAE,MAAM,cAAc,CAAA;AAGxD,eAAO,MAAM,mBAAmB,QAAO,SAAS,GAAG,SAOlD,CAAA;AA8CD,eAAO,IAAI,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAc,CAAA;AAE/D,eAAO,IAAI,qBAAqB,YAUzB,CAAA;AAEP,eAAO,MAAM,gBAAgB,+CAM5B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/theme-css/document-head-contents/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/theme-css/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA;AAC3B,cAAc,yBAAyB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/theme-css/theme-provider/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC, PropsWithChildren } from 'react';
|
|
2
|
+
import { ThemeName } from '../constants';
|
|
3
|
+
type ThemeProviderProps = PropsWithChildren & {
|
|
4
|
+
themeName: ThemeName;
|
|
5
|
+
};
|
|
6
|
+
export declare const ThemeProvider: FC<ThemeProviderProps>;
|
|
7
|
+
export declare const LightThemeProvider: FC<PropsWithChildren>;
|
|
8
|
+
export declare const DarkThemeProvider: FC<PropsWithChildren>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=theme-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-provider.d.ts","sourceRoot":"","sources":["../../../../src/theme-css/theme-provider/theme-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,KAAK,kBAAkB,GAAG,iBAAiB,GAAG;IAC5C,SAAS,EAAE,SAAS,CAAA;CACrB,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAOhD,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,iBAAiB,CAIpD,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,iBAAiB,CAInD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/theme-css/theme-toggler/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ButtonHTMLAttributes } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export type ThemeTogglerProps = ButtonHTMLAttributes<HTMLButtonElement>;
|
|
4
|
+
export declare const ThemeToggler: React.ForwardRefExoticComponent<ThemeTogglerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
//# sourceMappingURL=theme-toggler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-toggler.d.ts","sourceRoot":"","sources":["../../../../src/theme-css/theme-toggler/theme-toggler.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAA4B,MAAM,OAAO,CAAA;AAKtE,OAAO,KAAwB,MAAM,OAAO,CAAA;AAE5C,MAAM,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,CAAA;AA8CvE,eAAO,MAAM,YAAY,6FAgCxB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-theme-toggle.d.ts","sourceRoot":"","sources":["../../../src/theme-css/use-theme-toggle.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAE1E,eAAO,MAAM,cAAc,QAAO,YAEjC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookies.d.ts","sourceRoot":"","sources":["../../../../src/theme-css/utils/cookies.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,SAAS,EAAE,MAAM,cAAc,CAAA;AAMxD,eAAO,MAAM,uBAAuB,QAAO,SAAS,GAAG,IAMtD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-theme-cookie.d.ts","sourceRoot":"","sources":["../../../../src/theme-css/utils/set-theme-cookie.ts"],"names":[],"mappings":"AAEA,OAAO,EAAqC,SAAS,EAAE,MAAM,cAAc,CAAA;AAmB3E,eAAO,MAAM,cAAc,GAAI,OAAO,SAAS,SAS9C,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-top-level-domain.test.d.ts","sourceRoot":"","sources":["../../../../src/utils/__tests__/get-top-level-domain.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const setCrossDomainCookieClientSide: (key: string, value: string, expire?: number) => void;
|
|
2
|
+
export declare const setDomainCookieClientSide: (key: string, value: string, expire?: number) => void;
|
|
3
|
+
export declare const getCrossDomainCookieClientSide: (key: string) => string | null;
|
|
4
|
+
export declare const getDomainCookieClientSide: (key: string) => string | null;
|
|
5
|
+
export declare const removeCookiesClientSide: (key: string) => void;
|
|
6
|
+
//# sourceMappingURL=cookies-client-side.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookies-client-side.d.ts","sourceRoot":"","sources":["../../../src/utils/cookies-client-side.ts"],"names":[],"mappings":"AA6BA,eAAO,MAAM,8BAA8B,GACzC,KAAK,MAAM,EACX,OAAO,MAAM,EACb,eAAY,KACX,IAYF,CAAA;AAED,eAAO,MAAM,yBAAyB,GACpC,KAAK,MAAM,EACX,OAAO,MAAM,EACb,eAAY,KACX,IAMF,CAAA;AAED,eAAO,MAAM,8BAA8B,GAAI,KAAK,MAAM,KAAG,MAAM,GAAG,IASrE,CAAA;AAED,eAAO,MAAM,yBAAyB,GAAI,KAAK,MAAM,KAAG,MAAM,GAAG,IAEhE,CAAA;AAED,eAAO,MAAM,uBAAuB,GAAI,KAAK,MAAM,KAAG,IAErD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-top-level-domain.d.ts","sourceRoot":"","sources":["../../../src/utils/get-top-level-domain.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,cAW7B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAA;AAClD,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AAGrC,eAAO,MAAM,OAAO,YAAW,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modalRoot.d.ts","sourceRoot":"","sources":["../../../src/utils/modalRoot.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,SAAS,oBAcX,CAAA;AAEJ,eAAe,SAAS,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
export type LidoComponentProps<T extends keyof JSX.IntrinsicElements, Props extends object = object> = Props & Omit<JSX.IntrinsicElements[T] & {
|
|
3
|
+
as?: keyof JSX.IntrinsicElements;
|
|
4
|
+
forwardedAs?: keyof JSX.IntrinsicElements;
|
|
5
|
+
}, 'ref' | keyof Props>;
|
|
6
|
+
export type IconConfig = {
|
|
7
|
+
icon: ReactElement;
|
|
8
|
+
isColored?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type IconConfigProp = IconConfig | ReactElement;
|
|
11
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAEpC,MAAM,MAAM,kBAAkB,CAC5B,CAAC,SAAS,MAAM,GAAG,CAAC,iBAAiB,EACrC,KAAK,SAAS,MAAM,GAAG,MAAM,IAC3B,KAAK,GACP,IAAI,CACF,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,GAAG;IACzB,EAAE,CAAC,EAAE,MAAM,GAAG,CAAC,iBAAiB,CAAA;IAChC,WAAW,CAAC,EAAE,MAAM,GAAG,CAAC,iBAAiB,CAAA;CAC1C,EACD,KAAK,GAAG,MAAM,KAAK,CACpB,CAAA;AAEH,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,YAAY,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,YAAY,CAAA"}
|