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,72 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const React = require('react');
|
|
6
|
+
const useThemeToggle = require('../use-theme-toggle.js');
|
|
7
|
+
const index = require('../../_virtual/index.js');
|
|
8
|
+
const themeToggler_module = require('./theme-toggler.module.css.js');
|
|
9
|
+
const constants = require('../constants.js');
|
|
10
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
11
|
+
|
|
12
|
+
const Light = /*#__PURE__*/React.forwardRef(function Light(props, ref) {
|
|
13
|
+
return /*#__PURE__*/jsxRuntime.jsx("svg", {
|
|
14
|
+
width: 24,
|
|
15
|
+
height: 24,
|
|
16
|
+
viewBox: "0 0 24 24",
|
|
17
|
+
fill: "none",
|
|
18
|
+
ref: ref,
|
|
19
|
+
...props,
|
|
20
|
+
children: /*#__PURE__*/jsxRuntime.jsx("path", {
|
|
21
|
+
fill: "currentColor",
|
|
22
|
+
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"
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
const Dark = /*#__PURE__*/React.forwardRef(function Dark(props, ref) {
|
|
27
|
+
return /*#__PURE__*/jsxRuntime.jsx("svg", {
|
|
28
|
+
width: 24,
|
|
29
|
+
height: 24,
|
|
30
|
+
viewBox: "0 0 24 24",
|
|
31
|
+
fill: "none",
|
|
32
|
+
ref: ref,
|
|
33
|
+
...props,
|
|
34
|
+
children: /*#__PURE__*/jsxRuntime.jsx("path", {
|
|
35
|
+
fillRule: "evenodd",
|
|
36
|
+
clipRule: "evenodd",
|
|
37
|
+
fill: "currentColor",
|
|
38
|
+
d: "M19 12.63A7.015 7.015 0 1111.37 5 5.456 5.456 0 0019 12.63z"
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
const ThemeToggler = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
43
|
+
let {
|
|
44
|
+
className,
|
|
45
|
+
onClick,
|
|
46
|
+
...rest
|
|
47
|
+
} = _ref;
|
|
48
|
+
const {
|
|
49
|
+
toggleTheme,
|
|
50
|
+
themeName
|
|
51
|
+
} = useThemeToggle.useThemeToggle();
|
|
52
|
+
const isLightTheme = themeName === constants.DEFAULT_THEME_NAME;
|
|
53
|
+
return /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
54
|
+
type: "button",
|
|
55
|
+
className: index(themeToggler_module.themeToggler, className, isLightTheme && themeToggler_module.lightTheme),
|
|
56
|
+
ref: ref,
|
|
57
|
+
onClick: e => {
|
|
58
|
+
toggleTheme();
|
|
59
|
+
onClick?.(e);
|
|
60
|
+
},
|
|
61
|
+
...rest,
|
|
62
|
+
children: isLightTheme ? /*#__PURE__*/jsxRuntime.jsx(Light, {
|
|
63
|
+
className: themeToggler_module.icon
|
|
64
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(Dark, {
|
|
65
|
+
className: themeToggler_module.icon
|
|
66
|
+
})
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
ThemeToggler.displayName = 'ThemeToggler';
|
|
70
|
+
|
|
71
|
+
exports.ThemeToggler = ThemeToggler;
|
|
72
|
+
//# sourceMappingURL=theme-toggler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-toggler.js","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,cAAA,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,cAAA,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,cAAA,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,cAAA,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,gBAAU,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,6BAAc,EAAE,CAAA;AAEnD,EAAA,MAAMC,YAAY,GAAGF,SAAS,KAAKG,4BAAkB,CAAA;AAErD,EAAA,oBACEnB,cAAA,CAAA,QAAA,EAAA;AACEoB,IAAAA,IAAI,EAAC,QAAQ;AACbR,IAAAA,SAAS,EAAES,KAAE,CACXC,mBAAM,CAACC,YAAY,EACnBX,SAAS,EACTM,YAAY,IAAII,mBAAM,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,cAAA,CAACL,KAAK,EAAA;MAACiB,SAAS,EAAEU,mBAAM,CAACI,IAAAA;AAAK,KAAE,CAAC,gBAEjC1B,cAAA,CAACO,IAAI,EAAA;MAACK,SAAS,EAAEU,mBAAM,CAACI,IAAAA;KAAO,CAAA;AAChC,GACK,CAAC,CAAA;AAEb,CACF,EAAC;AACDhB,YAAY,CAACiB,WAAW,GAAG,cAAc;;;;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
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"};
|
|
4
|
+
|
|
5
|
+
module.exports = styles;
|
|
6
|
+
//# sourceMappingURL=theme-toggler.module.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-toggler.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const React = require('react');
|
|
6
|
+
const cookieThemeProvider = require('./cookie-theme-provider.js');
|
|
7
|
+
|
|
8
|
+
const useThemeToggle = () => {
|
|
9
|
+
return React.useContext(cookieThemeProvider.ThemeToggleContext);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
exports.useThemeToggle = useThemeToggle;
|
|
13
|
+
//# sourceMappingURL=use-theme-toggle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-theme-toggle.js","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,gBAAU,CAACC,sCAAkB,CAAC,CAAA;AACvC;;;;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const constants = require('../constants.js');
|
|
6
|
+
|
|
7
|
+
// TODO: use /packages/utils/cookies-client-side.ts
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
// we're using all-same regex in element-theme-script.tsx.
|
|
11
|
+
// Sadly, we cannot re-use it as this script is supposed to be inlined in document head
|
|
12
|
+
const cookieThemeMatcher = new RegExp(`(^| )${constants.themeCookieKey}=([^;]+)`);
|
|
13
|
+
const getThemeNameFromCookies = () => {
|
|
14
|
+
if (typeof window === 'undefined') {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return document.cookie.match(cookieThemeMatcher)?.[2] ?? null;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
exports.getThemeNameFromCookies = getThemeNameFromCookies;
|
|
21
|
+
//# sourceMappingURL=cookies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookies.js","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,wBAAc,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,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const uaParser = require('../../_virtual/ua-parser.js');
|
|
6
|
+
require('../../utils/modalRoot.js');
|
|
7
|
+
const getTopLevelDomain = require('../../utils/get-top-level-domain.js');
|
|
8
|
+
require('../../utils/cookies-client-side.js');
|
|
9
|
+
const constants = require('../constants.js');
|
|
10
|
+
|
|
11
|
+
const parser = new uaParser.uaParserExports.UAParser();
|
|
12
|
+
const setSecureCookie = cookie => {
|
|
13
|
+
// 1. we want this cookie to be available on HTTP websites too.
|
|
14
|
+
// 2. there is a bug on localhost which causes Chrome to ignore cookies set without Secure,
|
|
15
|
+
// and Safari when cookies are set with Secure, so we're forcing cookie into both
|
|
16
|
+
if (parser.getBrowser()?.name?.toLowerCase() === 'safari') {
|
|
17
|
+
if (window.location.protocol !== 'https:') {
|
|
18
|
+
document.cookie = cookie;
|
|
19
|
+
} else {
|
|
20
|
+
document.cookie = `${cookie}Secure;`;
|
|
21
|
+
}
|
|
22
|
+
} else {
|
|
23
|
+
document.cookie = `${cookie}Secure;`;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const setThemeCookie = theme => {
|
|
27
|
+
const cookie = `${constants.themeCookieKey}=${theme};max-age=${constants.themeCookieMaxAge};path=/;samesite=None;`;
|
|
28
|
+
// For top level domain - *.some-domain.fi
|
|
29
|
+
setSecureCookie(`${cookie}domain=${getTopLevelDomain.getTopLevelDomain()};`);
|
|
30
|
+
if (!document.cookie.includes(`${constants.themeCookieKey}=${theme}`)) {
|
|
31
|
+
// For specific.domain.fi, if cookie can't be set to top level domain
|
|
32
|
+
setSecureCookie(cookie);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
exports.setThemeCookie = setThemeCookie;
|
|
37
|
+
//# sourceMappingURL=set-theme-cookie.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-theme-cookie.js","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,iCAAQ,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,wBAAc,IAAID,KAAK,CAAA,SAAA,EAAYE,2BAAiB,CAAwB,sBAAA,CAAA,CAAA;AAC9F;EACAZ,eAAe,CAAC,GAAGC,MAAM,CAAA,OAAA,EAAUY,mCAAiB,EAAE,GAAG,CAAC,CAAA;AAE1D,EAAA,IAAI,CAACL,QAAQ,CAACP,MAAM,CAACa,QAAQ,CAAC,CAAA,EAAGH,wBAAc,CAAA,CAAA,EAAID,KAAK,CAAA,CAAE,CAAC,EAAE;AAC3D;IACAV,eAAe,CAACC,MAAM,CAAC,CAAA;AACzB,GAAA;AACF;;;;"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const uaParser = require('../_virtual/ua-parser.js');
|
|
6
|
+
const getTopLevelDomain = require('./get-top-level-domain.js');
|
|
7
|
+
|
|
8
|
+
const parser = new uaParser.uaParserExports.UAParser();
|
|
9
|
+
const setSecureCookie = cookie => {
|
|
10
|
+
// 1. we want this cookie to be available on HTTP websites too.
|
|
11
|
+
// 2. there is a bug on localhost which causes Chrome to ignore cookies set without Secure,
|
|
12
|
+
// and Safari when cookies are set with Secure, so we're forcing cookie into both
|
|
13
|
+
if (parser.getBrowser()?.name?.toLowerCase() === 'safari') {
|
|
14
|
+
if (window.location.protocol !== 'https:') {
|
|
15
|
+
document.cookie = cookie;
|
|
16
|
+
} else {
|
|
17
|
+
document.cookie = `${cookie}Secure;`;
|
|
18
|
+
}
|
|
19
|
+
} else {
|
|
20
|
+
document.cookie = `${cookie}Secure;`;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// :)
|
|
25
|
+
const prepareForCookingCookie = function (key, value) {
|
|
26
|
+
let expire = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 365;
|
|
27
|
+
return `${key}=${value};expires=${expire};path=/;samesite=None;`;
|
|
28
|
+
};
|
|
29
|
+
const setCrossDomainCookieClientSide = function (key, value) {
|
|
30
|
+
let expire = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 365;
|
|
31
|
+
if (typeof window === 'undefined') {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
setSecureCookie(`${prepareForCookingCookie(key, value, expire)}domain=${getTopLevelDomain.getTopLevelDomain()};`);
|
|
35
|
+
};
|
|
36
|
+
const setDomainCookieClientSide = function (key, value) {
|
|
37
|
+
let expire = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 365;
|
|
38
|
+
if (typeof window === 'undefined') {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
setSecureCookie(prepareForCookingCookie(key, value, expire));
|
|
42
|
+
};
|
|
43
|
+
const getCrossDomainCookieClientSide = key => {
|
|
44
|
+
const defaultValue = null;
|
|
45
|
+
if (typeof window === 'undefined') {
|
|
46
|
+
return defaultValue;
|
|
47
|
+
}
|
|
48
|
+
const cookieMatcher = new RegExp(`(^| )${key}=([^;]+)`);
|
|
49
|
+
return document.cookie.match(cookieMatcher)?.[2] ?? defaultValue;
|
|
50
|
+
};
|
|
51
|
+
const getDomainCookieClientSide = key => {
|
|
52
|
+
return getCrossDomainCookieClientSide(key);
|
|
53
|
+
};
|
|
54
|
+
const removeCookiesClientSide = key => {
|
|
55
|
+
document.cookie = `${key}= ; expires = Thu, 01 Jan 1970 00:00:00 GMT`;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
exports.getCrossDomainCookieClientSide = getCrossDomainCookieClientSide;
|
|
59
|
+
exports.getDomainCookieClientSide = getDomainCookieClientSide;
|
|
60
|
+
exports.removeCookiesClientSide = removeCookiesClientSide;
|
|
61
|
+
exports.setCrossDomainCookieClientSide = setCrossDomainCookieClientSide;
|
|
62
|
+
exports.setDomainCookieClientSide = setDomainCookieClientSide;
|
|
63
|
+
//# sourceMappingURL=cookies-client-side.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookies-client-side.js","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,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const getTopLevelDomain = () => {
|
|
6
|
+
if (typeof window === 'undefined') {
|
|
7
|
+
return 'localhost';
|
|
8
|
+
}
|
|
9
|
+
const pathParts = window.location.hostname.split('.');
|
|
10
|
+
if (pathParts[pathParts.length - 1] === 'localhost') {
|
|
11
|
+
return 'localhost';
|
|
12
|
+
}
|
|
13
|
+
// Get host with dot in first position
|
|
14
|
+
return `.${pathParts.slice(-2).join('.')}`;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.getTopLevelDomain = getTopLevelDomain;
|
|
18
|
+
//# sourceMappingURL=get-top-level-domain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-top-level-domain.js","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,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const modalRoot = require('./modalRoot.js');
|
|
6
|
+
const cookiesClientSide = require('./cookies-client-side.js');
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
9
|
+
const VOID_FN = () => {};
|
|
10
|
+
|
|
11
|
+
exports.modalRoot = modalRoot;
|
|
12
|
+
exports.getCrossDomainCookieClientSide = cookiesClientSide.getCrossDomainCookieClientSide;
|
|
13
|
+
exports.getDomainCookieClientSide = cookiesClientSide.getDomainCookieClientSide;
|
|
14
|
+
exports.removeCookiesClientSide = cookiesClientSide.removeCookiesClientSide;
|
|
15
|
+
exports.setCrossDomainCookieClientSide = cookiesClientSide.setCrossDomainCookieClientSide;
|
|
16
|
+
exports.setDomainCookieClientSide = cookiesClientSide.setDomainCookieClientSide;
|
|
17
|
+
exports.VOID_FN = VOID_FN;
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","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,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const ROOT_ID = 'lido-ui-modal-root';
|
|
4
|
+
const ModalRoot = (() => {
|
|
5
|
+
try {
|
|
6
|
+
let modalRoot = document.getElementById(ROOT_ID);
|
|
7
|
+
if (!modalRoot) {
|
|
8
|
+
modalRoot = document.createElement('div');
|
|
9
|
+
modalRoot.id = ROOT_ID;
|
|
10
|
+
document.body.append(modalRoot);
|
|
11
|
+
}
|
|
12
|
+
return modalRoot;
|
|
13
|
+
} catch {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
})();
|
|
17
|
+
|
|
18
|
+
module.exports = ModalRoot;
|
|
19
|
+
//# sourceMappingURL=modalRoot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modalRoot.js","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
|
+
{"version":3,"file":"_commonjsHelpers.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { getDefaultExportFromCjs } from './_commonjsHelpers.mjs';
|
|
2
|
+
import { __require as requireClassnames } from '../node_modules/classnames/index.mjs';
|
|
3
|
+
|
|
4
|
+
var classnamesExports = requireClassnames();
|
|
5
|
+
const cn = /*@__PURE__*/getDefaultExportFromCjs(classnamesExports);
|
|
6
|
+
|
|
7
|
+
export { cn as default };
|
|
8
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index2.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ua-parser.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ua-parser2.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer contentTheme{.content-theme-module_dark__oFY1C{display:var(--lido-ui-dark-display,contents)}.content-theme-module_light__w1TiD{display:var(--lido-ui-light-display,contents)}}.theme-toggler-module_icon__ZRs7R{--local-icon-size:24px;font-family:var(--lido-ui-font-family);grid-area:a;place-self:center center}.theme-toggler-module_light__Q-trB{visibility:var(--lido-ui-dark-mode-visibility)}.theme-toggler-module_dark__-0RKw{visibility:var(--lido-ui-light-mode-visibility)}.theme-toggler-module_lightTheme__3NHWC{color:var(--lido-ui-color-icons-primary)}.theme-toggler-module_themeToggler__8IBGg{display:inline-grid;grid-template-areas:"a";&>span:first-child{display:contents}}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { VOID_FN } from './utils/index.mjs';
|
|
2
|
+
export { ContentTheme } from './theme-css/content-theme/content-theme.mjs';
|
|
3
|
+
export { DarkThemeProvider, LightThemeProvider, ThemeProvider } from './theme-css/theme-provider/theme-provider.mjs';
|
|
4
|
+
export { ThemeToggler } from './theme-css/theme-toggler/theme-toggler.mjs';
|
|
5
|
+
export { useThemeToggle } from './theme-css/use-theme-toggle.mjs';
|
|
6
|
+
export { DEFAULT_THEME_NAME, ThemeName, prefersDarkThemeMediaQuery, themeCookieKey, themeCookieMaxAge } from './theme-css/constants.mjs';
|
|
7
|
+
export { CookieThemeProvider, ThemeToggleContext } from './theme-css/cookie-theme-provider.mjs';
|
|
8
|
+
export { default as modalRoot } from './utils/modalRoot.mjs';
|
|
9
|
+
export { getTopLevelDomain } from './utils/get-top-level-domain.mjs';
|
|
10
|
+
export { getCrossDomainCookieClientSide, getDomainCookieClientSide, removeCookiesClientSide, setCrossDomainCookieClientSide, setDomainCookieClientSide } from './utils/cookies-client-side.mjs';
|
|
11
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { __module as classnames } from '../../_virtual/index2.mjs';
|
|
2
|
+
|
|
3
|
+
/*!
|
|
4
|
+
Copyright (c) 2018 Jed Watson.
|
|
5
|
+
Licensed under the MIT License (MIT), see
|
|
6
|
+
http://jedwatson.github.io/classnames
|
|
7
|
+
*/
|
|
8
|
+
var hasRequiredClassnames;
|
|
9
|
+
function requireClassnames() {
|
|
10
|
+
if (hasRequiredClassnames) return classnames.exports;
|
|
11
|
+
hasRequiredClassnames = 1;
|
|
12
|
+
(function (module) {
|
|
13
|
+
/* global define */
|
|
14
|
+
|
|
15
|
+
(function () {
|
|
16
|
+
|
|
17
|
+
var hasOwn = {}.hasOwnProperty;
|
|
18
|
+
function classNames() {
|
|
19
|
+
var classes = '';
|
|
20
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
21
|
+
var arg = arguments[i];
|
|
22
|
+
if (arg) {
|
|
23
|
+
classes = appendClass(classes, parseValue(arg));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return classes;
|
|
27
|
+
}
|
|
28
|
+
function parseValue(arg) {
|
|
29
|
+
if (typeof arg === 'string' || typeof arg === 'number') {
|
|
30
|
+
return arg;
|
|
31
|
+
}
|
|
32
|
+
if (typeof arg !== 'object') {
|
|
33
|
+
return '';
|
|
34
|
+
}
|
|
35
|
+
if (Array.isArray(arg)) {
|
|
36
|
+
return classNames.apply(null, arg);
|
|
37
|
+
}
|
|
38
|
+
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
|
|
39
|
+
return arg.toString();
|
|
40
|
+
}
|
|
41
|
+
var classes = '';
|
|
42
|
+
for (var key in arg) {
|
|
43
|
+
if (hasOwn.call(arg, key) && arg[key]) {
|
|
44
|
+
classes = appendClass(classes, key);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return classes;
|
|
48
|
+
}
|
|
49
|
+
function appendClass(value, newClass) {
|
|
50
|
+
if (!newClass) {
|
|
51
|
+
return value;
|
|
52
|
+
}
|
|
53
|
+
if (value) {
|
|
54
|
+
return value + ' ' + newClass;
|
|
55
|
+
}
|
|
56
|
+
return value + newClass;
|
|
57
|
+
}
|
|
58
|
+
if (module.exports) {
|
|
59
|
+
classNames.default = classNames;
|
|
60
|
+
module.exports = classNames;
|
|
61
|
+
} else {
|
|
62
|
+
window.classNames = classNames;
|
|
63
|
+
}
|
|
64
|
+
})();
|
|
65
|
+
})(classnames);
|
|
66
|
+
return classnames.exports;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export { requireClassnames as __require };
|
|
70
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../../../node_modules/classnames/index.js"],"sourcesContent":["/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = '';\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (arg) {\n\t\t\t\tclasses = appendClass(classes, parseValue(arg));\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction parseValue (arg) {\n\t\tif (typeof arg === 'string' || typeof arg === 'number') {\n\t\t\treturn arg;\n\t\t}\n\n\t\tif (typeof arg !== 'object') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (Array.isArray(arg)) {\n\t\t\treturn classNames.apply(null, arg);\n\t\t}\n\n\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\treturn arg.toString();\n\t\t}\n\n\t\tvar classes = '';\n\n\t\tfor (var key in arg) {\n\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\tclasses = appendClass(classes, key);\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction appendClass (value, newClass) {\n\t\tif (!newClass) {\n\t\t\treturn value;\n\t\t}\n\t\n\t\tif (value) {\n\t\t\treturn value + ' ' + newClass;\n\t\t}\n\t\n\t\treturn value + newClass;\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n"],"names":["hasOwn","hasOwnProperty","classNames","classes","i","arguments","length","arg","appendClass","parseValue","Array","isArray","apply","toString","Object","prototype","includes","key","call","value","newClass","module","exports","default","window"],"mappings":";;;;;;;;;;;;AAKA;;IAEC,CAAY,YAAA;;AAGZ,MAAA,IAAIA,MAAM,GAAG,EAAE,CAACC,cAAc,CAAA;MAE9B,SAASC,UAAUA,GAAI;QACtB,IAAIC,OAAO,GAAG,EAAE,CAAA;AAEhB,QAAA,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGC,SAAS,CAACC,MAAM,EAAEF,CAAC,EAAE,EAAE;AAC1C,UAAA,IAAIG,GAAG,GAAGF,SAAS,CAACD,CAAC,CAAC,CAAA;AACtB,UAAA,IAAIG,GAAG,EAAE;YACRJ,OAAO,GAAGK,WAAW,CAACL,OAAO,EAAEM,UAAU,CAACF,GAAG,CAAC,CAAC,CAAA;AACnD,WAAA;AACA,SAAA;AAEE,QAAA,OAAOJ,OAAO,CAAA;AAChB,OAAA;MAEC,SAASM,UAAUA,CAAEF,GAAG,EAAE;QACzB,IAAI,OAAOA,GAAG,KAAK,QAAQ,IAAI,OAAOA,GAAG,KAAK,QAAQ,EAAE;AACvD,UAAA,OAAOA,GAAG,CAAA;AACb,SAAA;AAEE,QAAA,IAAI,OAAOA,GAAG,KAAK,QAAQ,EAAE;AAC5B,UAAA,OAAO,EAAE,CAAA;AACZ,SAAA;AAEE,QAAA,IAAIG,KAAK,CAACC,OAAO,CAACJ,GAAG,CAAC,EAAE;AACvB,UAAA,OAAOL,UAAU,CAACU,KAAK,CAAC,IAAI,EAAEL,GAAG,CAAC,CAAA;AACrC,SAAA;QAEE,IAAIA,GAAG,CAACM,QAAQ,KAAKC,MAAM,CAACC,SAAS,CAACF,QAAQ,IAAI,CAACN,GAAG,CAACM,QAAQ,CAACA,QAAQ,EAAE,CAACG,QAAQ,CAAC,eAAe,CAAC,EAAE;AACrG,UAAA,OAAOT,GAAG,CAACM,QAAQ,EAAE,CAAA;AACxB,SAAA;QAEE,IAAIV,OAAO,GAAG,EAAE,CAAA;AAEhB,QAAA,KAAK,IAAIc,GAAG,IAAIV,GAAG,EAAE;AACpB,UAAA,IAAIP,MAAM,CAACkB,IAAI,CAACX,GAAG,EAAEU,GAAG,CAAC,IAAIV,GAAG,CAACU,GAAG,CAAC,EAAE;AACtCd,YAAAA,OAAO,GAAGK,WAAW,CAACL,OAAO,EAAEc,GAAG,CAAC,CAAA;AACvC,WAAA;AACA,SAAA;AAEE,QAAA,OAAOd,OAAO,CAAA;AAChB,OAAA;AAEC,MAAA,SAASK,WAAWA,CAAEW,KAAK,EAAEC,QAAQ,EAAE;QACtC,IAAI,CAACA,QAAQ,EAAE;AACd,UAAA,OAAOD,KAAK,CAAA;AACf,SAAA;AAEE,QAAA,IAAIA,KAAK,EAAE;AACV,UAAA,OAAOA,KAAK,GAAG,GAAG,GAAGC,QAAQ,CAAA;AAChC,SAAA;QAEE,OAAOD,KAAK,GAAGC,QAAQ,CAAA;AACzB,OAAA;AAEC,MAAA,IAAqCC,MAAM,CAACC,OAAO,EAAE;QACpDpB,UAAU,CAACqB,OAAO,GAAGrB,UAAU,CAAA;QAC/BmB,iBAAiBnB,UAAU,CAAA;AAC7B,OAAE,MAKM;QACNsB,MAAM,CAACtB,UAAU,GAAGA,UAAU,CAAA;AAChC,OAAA;AACA,KAAC,GAAE,CAAA;;;;;;;","x_google_ignoreList":[0]}
|