@chayns-components/core 5.0.0-beta.613 → 5.0.0-beta.617
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/lib/cjs/api/theme/get.js +14 -1
- package/lib/cjs/api/theme/get.js.map +1 -1
- package/lib/cjs/components/button/Button.js +10 -2
- package/lib/cjs/components/button/Button.js.map +1 -1
- package/lib/cjs/components/button/Button.styles.js +32 -8
- package/lib/cjs/components/button/Button.styles.js.map +1 -1
- package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.js +29 -1
- package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.js.map +1 -1
- package/lib/cjs/components/small-wait-cursor/SmallWaitCursor.js +1 -2
- package/lib/cjs/components/small-wait-cursor/SmallWaitCursor.js.map +1 -1
- package/lib/cjs/components/small-wait-cursor/SmallWaitCursor.styles.js +3 -3
- package/lib/cjs/components/small-wait-cursor/SmallWaitCursor.styles.js.map +1 -1
- package/lib/cjs/types/colorSchemeProvider.js.map +1 -1
- package/lib/cjs/utils/font.js +83 -1
- package/lib/cjs/utils/font.js.map +1 -1
- package/lib/esm/api/theme/get.js +12 -0
- package/lib/esm/api/theme/get.js.map +1 -1
- package/lib/esm/components/button/Button.js +8 -2
- package/lib/esm/components/button/Button.js.map +1 -1
- package/lib/esm/components/button/Button.styles.js +31 -11
- package/lib/esm/components/button/Button.styles.js.map +1 -1
- package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.js +31 -3
- package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.js.map +1 -1
- package/lib/esm/components/small-wait-cursor/SmallWaitCursor.js +1 -2
- package/lib/esm/components/small-wait-cursor/SmallWaitCursor.js.map +1 -1
- package/lib/esm/components/small-wait-cursor/SmallWaitCursor.styles.js +3 -3
- package/lib/esm/components/small-wait-cursor/SmallWaitCursor.styles.js.map +1 -1
- package/lib/esm/types/colorSchemeProvider.js.map +1 -1
- package/lib/esm/utils/font.js +81 -0
- package/lib/esm/utils/font.js.map +1 -1
- package/lib/types/api/theme/get.d.ts +2 -1
- package/lib/types/components/small-wait-cursor/SmallWaitCursor.d.ts +1 -2
- package/lib/types/components/small-wait-cursor/SmallWaitCursor.styles.d.ts +2 -2
- package/lib/types/types/colorSchemeProvider.d.ts +17 -0
- package/lib/types/utils/font.d.ts +9 -1
- package/package.json +2 -2
package/lib/cjs/api/theme/get.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getDesignSettings = void 0;
|
|
6
|
+
exports.getParagraphFormat = exports.getDesignSettings = void 0;
|
|
7
7
|
var _chaynsApi = require("chayns-api");
|
|
8
8
|
const getDesignSettings = async () => {
|
|
9
9
|
const {
|
|
@@ -18,4 +18,17 @@ const getDesignSettings = async () => {
|
|
|
18
18
|
return undefined;
|
|
19
19
|
};
|
|
20
20
|
exports.getDesignSettings = getDesignSettings;
|
|
21
|
+
const getParagraphFormat = async () => {
|
|
22
|
+
const {
|
|
23
|
+
id
|
|
24
|
+
} = (0, _chaynsApi.getSite)();
|
|
25
|
+
const response = await fetch(`https://api.chayns.net/css/${id}/paragraphFormat`, {
|
|
26
|
+
method: 'GET'
|
|
27
|
+
});
|
|
28
|
+
if (response.status === 200) {
|
|
29
|
+
return await response.json();
|
|
30
|
+
}
|
|
31
|
+
return undefined;
|
|
32
|
+
};
|
|
33
|
+
exports.getParagraphFormat = getParagraphFormat;
|
|
21
34
|
//# sourceMappingURL=get.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.js","names":["_chaynsApi","require","getDesignSettings","id","getSite","response","fetch","method","status","json","undefined","exports"],"sources":["../../../../src/api/theme/get.ts"],"sourcesContent":["import { getSite } from 'chayns-api';\nimport type { DesignSettings } from '../../types/colorSchemeProvider';\n\nexport const getDesignSettings = async (): Promise<DesignSettings | undefined> => {\n const { id } = getSite();\n\n const response = await fetch(`https://api.chayns.net/css/${id}/style/v2`, {\n method: 'GET',\n });\n\n if (response.status === 200) {\n return (await response.json()) as DesignSettings;\n }\n\n return undefined;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAGO,MAAMC,iBAAiB,GAAG,MAAAA,CAAA,KAAiD;EAC9E,MAAM;IAAEC;EAAG,CAAC,GAAG,IAAAC,kBAAO,EAAC,CAAC;EAExB,MAAMC,QAAQ,GAAG,MAAMC,KAAK,CAAE,8BAA6BH,EAAG,WAAU,EAAE;IACtEI,MAAM,EAAE;EACZ,CAAC,CAAC;EAEF,IAAIF,QAAQ,CAACG,MAAM,KAAK,GAAG,EAAE;IACzB,OAAQ,MAAMH,QAAQ,CAACI,IAAI,CAAC,CAAC;EACjC;EAEA,OAAOC,SAAS;AACpB,CAAC;AAACC,OAAA,CAAAT,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"get.js","names":["_chaynsApi","require","getDesignSettings","id","getSite","response","fetch","method","status","json","undefined","exports","getParagraphFormat"],"sources":["../../../../src/api/theme/get.ts"],"sourcesContent":["import { getSite } from 'chayns-api';\nimport type { DesignSettings, ParagraphFormat } from '../../types/colorSchemeProvider';\n\nexport const getDesignSettings = async (): Promise<DesignSettings | undefined> => {\n const { id } = getSite();\n\n const response = await fetch(`https://api.chayns.net/css/${id}/style/v2`, {\n method: 'GET',\n });\n\n if (response.status === 200) {\n return (await response.json()) as DesignSettings;\n }\n\n return undefined;\n};\n\nexport const getParagraphFormat = async (): Promise<ParagraphFormat[] | undefined> => {\n const { id } = getSite();\n\n const response = await fetch(`https://api.chayns.net/css/${id}/paragraphFormat`, {\n method: 'GET',\n });\n\n if (response.status === 200) {\n return (await response.json()) as ParagraphFormat[];\n }\n\n return undefined;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAGO,MAAMC,iBAAiB,GAAG,MAAAA,CAAA,KAAiD;EAC9E,MAAM;IAAEC;EAAG,CAAC,GAAG,IAAAC,kBAAO,EAAC,CAAC;EAExB,MAAMC,QAAQ,GAAG,MAAMC,KAAK,CAAE,8BAA6BH,EAAG,WAAU,EAAE;IACtEI,MAAM,EAAE;EACZ,CAAC,CAAC;EAEF,IAAIF,QAAQ,CAACG,MAAM,KAAK,GAAG,EAAE;IACzB,OAAQ,MAAMH,QAAQ,CAACI,IAAI,CAAC,CAAC;EACjC;EAEA,OAAOC,SAAS;AACpB,CAAC;AAACC,OAAA,CAAAT,iBAAA,GAAAA,iBAAA;AAEK,MAAMU,kBAAkB,GAAG,MAAAA,CAAA,KAAoD;EAClF,MAAM;IAAET;EAAG,CAAC,GAAG,IAAAC,kBAAO,EAAC,CAAC;EAExB,MAAMC,QAAQ,GAAG,MAAMC,KAAK,CAAE,8BAA6BH,EAAG,kBAAiB,EAAE;IAC7EI,MAAM,EAAE;EACZ,CAAC,CAAC;EAEF,IAAIF,QAAQ,CAACG,MAAM,KAAK,GAAG,EAAE;IACzB,OAAQ,MAAMH,QAAQ,CAACI,IAAI,CAAC,CAAC;EACjC;EAEA,OAAOC,SAAS;AACpB,CAAC;AAACC,OAAA,CAAAC,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -6,11 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
8
8
|
var _framerMotion = require("framer-motion");
|
|
9
|
-
var _react =
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _styledComponents = require("styled-components");
|
|
11
11
|
var _Icon = _interopRequireDefault(require("../icon/Icon"));
|
|
12
12
|
var _Button = require("./Button.styles");
|
|
13
13
|
var _WaitCursor = _interopRequireDefault(require("./wait-cursor/WaitCursor"));
|
|
14
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
17
|
const Button = ({
|
|
16
18
|
children,
|
|
@@ -31,6 +33,12 @@ const Button = ({
|
|
|
31
33
|
};
|
|
32
34
|
const buttonClasses = (0, _clsx.default)('beta-chayns-button ellipsis', className);
|
|
33
35
|
const theme = (0, _styledComponents.useTheme)();
|
|
36
|
+
const iconColor = (0, _react.useMemo)(() => {
|
|
37
|
+
if (isSecondary) {
|
|
38
|
+
return theme.text;
|
|
39
|
+
}
|
|
40
|
+
return theme.buttonColor ?? 'white';
|
|
41
|
+
}, [isSecondary, theme.buttonColor, theme.text]);
|
|
34
42
|
return /*#__PURE__*/_react.default.createElement(_Button.StyledMotionButton, {
|
|
35
43
|
$ShouldShowTextAsRobotoMedium: ShouldShowTextAsRobotoMedium,
|
|
36
44
|
className: buttonClasses,
|
|
@@ -49,7 +57,7 @@ const Button = ({
|
|
|
49
57
|
}, /*#__PURE__*/_react.default.createElement(_framerMotion.AnimatePresence, {
|
|
50
58
|
initial: false
|
|
51
59
|
}, icon && /*#__PURE__*/_react.default.createElement(_Button.StyledIconWrapper, null, /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
52
|
-
color:
|
|
60
|
+
color: iconColor,
|
|
53
61
|
icons: [icon]
|
|
54
62
|
})), shouldShowWaitCursor && /*#__PURE__*/_react.default.createElement(_Button.StyledMotionWaitCursorWrapper, {
|
|
55
63
|
animate: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","names":["_clsx","_interopRequireDefault","require","_framerMotion","_react","_styledComponents","_Icon","_Button","_WaitCursor","
|
|
1
|
+
{"version":3,"file":"Button.js","names":["_clsx","_interopRequireDefault","require","_framerMotion","_react","_interopRequireWildcard","_styledComponents","_Icon","_Button","_WaitCursor","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","obj","Button","children","className","icon","isDisabled","isSecondary","onClick","shouldShowWaitCursor","shouldStopPropagation","ShouldShowTextAsRobotoMedium","handleClick","event","stopPropagation","buttonClasses","clsx","theme","useTheme","iconColor","useMemo","text","buttonColor","createElement","StyledMotionButton","$ShouldShowTextAsRobotoMedium","disabled","$isDisabled","$hasChildren","$hasIcon","$isSecondary","whileTap","backgroundColor","whileHover","AnimatePresence","initial","StyledIconWrapper","color","icons","StyledMotionWaitCursorWrapper","animate","opacity","width","exit","key","style","overflow","transition","duration","shouldHideBackground","StyledMotionChildrenWrapper","displayName","_default","exports"],"sources":["../../../../src/components/button/Button.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport { AnimatePresence } from 'framer-motion';\nimport React, { FC, MouseEventHandler, ReactNode, useMemo } from 'react';\nimport { useTheme } from 'styled-components';\nimport type { Theme } from '../color-scheme-provider/ColorSchemeProvider';\nimport Icon from '../icon/Icon';\nimport {\n StyledIconWrapper,\n StyledMotionButton,\n StyledMotionChildrenWrapper,\n StyledMotionWaitCursorWrapper,\n} from './Button.styles';\nimport WaitCursor from './wait-cursor/WaitCursor';\n\nexport type ButtonProps = {\n /**\n * The label of the button\n */\n children?: ReactNode;\n /**\n * Additional class names for the button element\n */\n className?: string;\n /**\n * An icon that is displayed on the left-hand side of the button text\n */\n icon?: string;\n /**\n * Disables the button so that it cannot be clicked anymore\n */\n isDisabled?: boolean;\n /**\n * Displays the button in the secondary style\n */\n isSecondary?: boolean;\n /**\n * Function to be executed when the button is clicked\n */\n onClick: MouseEventHandler<HTMLButtonElement>;\n /**\n * Whether the text should be 'Roboto Medium'\n */\n ShouldShowTextAsRobotoMedium?: boolean;\n /**\n * Shows a wait cursor instead of button text\n */\n shouldShowWaitCursor?: boolean;\n /**\n * Stops event propagation on click\n */\n shouldStopPropagation?: boolean;\n};\n\nconst Button: FC<ButtonProps> = ({\n children,\n className,\n icon,\n isDisabled,\n isSecondary,\n onClick,\n shouldShowWaitCursor,\n shouldStopPropagation,\n ShouldShowTextAsRobotoMedium = true,\n}) => {\n const handleClick: MouseEventHandler<HTMLButtonElement> = (event) => {\n if (shouldStopPropagation) {\n event.stopPropagation();\n }\n\n onClick(event);\n };\n\n const buttonClasses = clsx('beta-chayns-button ellipsis', className);\n\n const theme: Theme = useTheme();\n\n const iconColor = useMemo(() => {\n if (isSecondary) {\n return theme.text;\n }\n\n return theme.buttonColor ?? 'white';\n }, [isSecondary, theme.buttonColor, theme.text]);\n\n return (\n <StyledMotionButton\n $ShouldShowTextAsRobotoMedium={ShouldShowTextAsRobotoMedium}\n className={buttonClasses}\n disabled={isDisabled}\n $isDisabled={isDisabled}\n $hasChildren={!!children}\n $hasIcon={typeof icon === 'string' && icon !== ''}\n $isSecondary={isSecondary}\n onClick={handleClick}\n whileTap={\n isDisabled ? {} : { backgroundColor: isSecondary ? theme['201'] : theme['407'] }\n }\n whileHover={\n isDisabled ? {} : { backgroundColor: isSecondary ? theme['203'] : theme['409'] }\n }\n >\n <AnimatePresence initial={false}>\n {icon && (\n <StyledIconWrapper>\n <Icon color={iconColor} icons={[icon]} />\n </StyledIconWrapper>\n )}\n {shouldShowWaitCursor && (\n <StyledMotionWaitCursorWrapper\n animate={{ opacity: 1, width: 40 }}\n exit={{ opacity: 0, width: 0 }}\n initial={{ opacity: 0, width: 0 }}\n key=\"wait-cursor\"\n style={{ overflow: 'hidden' }}\n transition={{ duration: 0.2 }}\n >\n <WaitCursor shouldHideBackground />\n </StyledMotionWaitCursorWrapper>\n )}\n {!shouldShowWaitCursor && children && (\n <StyledMotionChildrenWrapper\n animate={{ opacity: 1, width: 'auto' }}\n exit={{ opacity: 0, width: 0 }}\n initial={{ opacity: 0, width: 0 }}\n key=\"children\"\n // style={{ overflow: 'hidden' }}\n transition={{ duration: 0.2 }}\n >\n {children}\n </StyledMotionChildrenWrapper>\n )}\n </AnimatePresence>\n </StyledMotionButton>\n );\n};\n\nButton.displayName = 'Button';\n\nexport default Button;\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AAEA,IAAAK,KAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAMA,IAAAO,WAAA,GAAAR,sBAAA,CAAAC,OAAA;AAAkD,SAAAQ,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAN,wBAAAM,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oB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EF,OAAO,EAAE,CAAC;MAAEC,KAAK,EAAE;IAAE,CAAE;IAC/BP,OAAO,EAAE;MAAEM,OAAO,EAAE,CAAC;MAAEC,KAAK,EAAE;IAAE,CAAE;IAClCE,GAAG,EAAC,aAAa;IACjBC,KAAK,EAAE;MAAEC,QAAQ,EAAE;IAAS,CAAE;IAC9BC,UAAU,EAAE;MAAEC,QAAQ,EAAE;IAAI;EAAE,gBAE9BzE,MAAA,CAAAY,OAAA,CAAAoC,aAAA,CAAC3C,WAAA,CAAAO,OAAU;IAAC8D,oBAAoB;EAAA,CAAE,CACP,CAClC,EACA,CAACxC,oBAAoB,IAAIN,QAAQ,iBAC9B5B,MAAA,CAAAY,OAAA,CAAAoC,aAAA,CAAC5C,OAAA,CAAAuE,2BAA2B;IACxBV,OAAO,EAAE;MAAEC,OAAO,EAAE,CAAC;MAAEC,KAAK,EAAE;IAAO,CAAE;IACvCC,IAAI,EAAE;MAAEF,OAAO,EAAE,CAAC;MAAEC,KAAK,EAAE;IAAE,CAAE;IAC/BP,OAAO,EAAE;MAAEM,OAAO,EAAE,CAAC;MAAEC,KAAK,EAAE;IAAE,CAAE;IAClCE,GAAG,EAAC;IACJ;IAAA;IACAG,UAAU,EAAE;MAAEC,QAAQ,EAAE;IAAI;EAAE,GAE7B7C,QACwB,CAEpB,CACD,CAAC;AAE7B,CAAC;AAEDD,MAAM,CAACiD,WAAW,GAAG,QAAQ;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAlE,OAAA,GAEfe,MAAM","ignoreList":[]}
|
|
@@ -17,17 +17,41 @@ const StyledMotionButton = exports.StyledMotionButton = (0, _styledComponents.de
|
|
|
17
17
|
`}
|
|
18
18
|
|
|
19
19
|
align-items: center;
|
|
20
|
-
|
|
20
|
+
|
|
21
|
+
${({
|
|
21
22
|
$isSecondary,
|
|
22
23
|
theme
|
|
23
|
-
}) =>
|
|
24
|
+
}) => {
|
|
25
|
+
if ($isSecondary) {
|
|
26
|
+
return (0, _styledComponents.css)`
|
|
27
|
+
background-color: ${theme['202']};
|
|
28
|
+
color: ${theme.text};
|
|
29
|
+
`;
|
|
30
|
+
}
|
|
31
|
+
return (0, _styledComponents.css)`
|
|
32
|
+
background-color: ${theme.buttonBackgroundColor ?? theme['408']};
|
|
33
|
+
color: ${theme.buttonColor ?? 'white'};
|
|
34
|
+
`;
|
|
35
|
+
}}
|
|
36
|
+
|
|
37
|
+
${({
|
|
38
|
+
theme,
|
|
39
|
+
$isSecondary
|
|
40
|
+
}) => {
|
|
41
|
+
if (theme.buttonDesign === '2') {
|
|
42
|
+
return (0, _styledComponents.css)`
|
|
43
|
+
background-color: transparent;
|
|
44
|
+
border: 1px solid ${$isSecondary ? theme['202'] : theme.buttonBackgroundColor};
|
|
45
|
+
box-shadow: none;
|
|
46
|
+
`;
|
|
47
|
+
}
|
|
48
|
+
return (0, _styledComponents.css)`
|
|
49
|
+
border: none;
|
|
50
|
+
box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.2);
|
|
51
|
+
`;
|
|
52
|
+
}}
|
|
53
|
+
|
|
24
54
|
border-radius: 3px;
|
|
25
|
-
box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.2);
|
|
26
|
-
border: none;
|
|
27
|
-
color: ${({
|
|
28
|
-
$isSecondary,
|
|
29
|
-
theme
|
|
30
|
-
}) => $isSecondary ? theme.text : 'white'};
|
|
31
55
|
cursor: ${({
|
|
32
56
|
$isDisabled
|
|
33
57
|
}) => $isDisabled ? 'default' : 'pointer'};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.styles.js","names":["_framerMotion","require","_styledComponents","_interopRequireWildcard","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","StyledMotionButton","exports","styled","motion","button","$ShouldShowTextAsRobotoMedium","css","$isSecondary","theme","text","$isDisabled","$hasIcon","$hasChildren","StyledIconWrapper","span","StyledMotionChildrenWrapper","div","StyledMotionWaitCursorWrapper"],"sources":["../../../../src/components/button/Button.styles.ts"],"sourcesContent":["import { motion } from 'framer-motion';\nimport styled, { css } from 'styled-components';\nimport type { FramerMotionBugFix, WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledButtonProps = WithTheme<{\n $hasIcon: boolean;\n $hasChildren: boolean;\n $isDisabled?: boolean;\n $isSecondary?: boolean;\n $ShouldShowTextAsRobotoMedium: boolean;\n}>;\n\nexport const StyledMotionButton = styled(motion.button)<StyledButtonProps>`\n ${({ $ShouldShowTextAsRobotoMedium }) =>\n $ShouldShowTextAsRobotoMedium &&\n css`\n font-size: 110%;\n font-family: 'Roboto Medium', serif;\n `}\n\n align-items: center;\n
|
|
1
|
+
{"version":3,"file":"Button.styles.js","names":["_framerMotion","require","_styledComponents","_interopRequireWildcard","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","StyledMotionButton","exports","styled","motion","button","$ShouldShowTextAsRobotoMedium","css","$isSecondary","theme","text","buttonBackgroundColor","buttonColor","buttonDesign","$isDisabled","$hasIcon","$hasChildren","StyledIconWrapper","span","StyledMotionChildrenWrapper","div","StyledMotionWaitCursorWrapper"],"sources":["../../../../src/components/button/Button.styles.ts"],"sourcesContent":["import { motion } from 'framer-motion';\nimport styled, { css } from 'styled-components';\nimport type { FramerMotionBugFix, WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledButtonProps = WithTheme<{\n $hasIcon: boolean;\n $hasChildren: boolean;\n $isDisabled?: boolean;\n $isSecondary?: boolean;\n $ShouldShowTextAsRobotoMedium: boolean;\n}>;\n\nexport const StyledMotionButton = styled(motion.button)<StyledButtonProps>`\n ${({ $ShouldShowTextAsRobotoMedium }) =>\n $ShouldShowTextAsRobotoMedium &&\n css`\n font-size: 110%;\n font-family: 'Roboto Medium', serif;\n `}\n\n align-items: center;\n\n ${({ $isSecondary, theme }: StyledButtonProps) => {\n if ($isSecondary) {\n return css`\n background-color: ${theme['202']};\n color: ${theme.text};\n `;\n }\n\n return css`\n background-color: ${theme.buttonBackgroundColor ?? theme['408']};\n color: ${theme.buttonColor ?? 'white'};\n `;\n }}\n\n ${({ theme, $isSecondary }: StyledButtonProps) => {\n if (theme.buttonDesign === '2') {\n return css`\n background-color: transparent;\n border: 1px solid ${$isSecondary ? theme['202'] : theme.buttonBackgroundColor};\n box-shadow: none;\n `;\n }\n\n return css`\n border: none;\n box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.2);\n `;\n }}\n\n border-radius: 3px;\n cursor: ${({ $isDisabled }) => ($isDisabled ? 'default' : 'pointer')};\n display: inline-flex;\n line-height: 1.15;\n min-height: 32px;\n opacity: ${({ $isDisabled }) => ($isDisabled ? 0.5 : 1)};\n position: relative;\n user-select: none;\n transition: opacity 0.3s ease;\n\n ${({ $hasIcon, $hasChildren }) => {\n if ($hasIcon) {\n if ($hasChildren) {\n return css`\n padding: 7px 12px 7px 42px;\n `;\n }\n return css`\n padding: 7px 12px 7px 18px;\n `;\n }\n return css`\n padding: 7px 12px 7px 12px;\n `;\n }}\n`;\n\nexport const StyledIconWrapper = styled.span`\n align-items: center;\n background-color: rgba(255, 255, 255, 0.2);\n bottom: 0;\n display: flex;\n justify-content: center;\n left: 0;\n position: absolute;\n top: 0;\n width: 30px;\n`;\n\nexport const StyledMotionChildrenWrapper = styled(motion.div)<FramerMotionBugFix>``;\n\nexport const StyledMotionWaitCursorWrapper = styled(motion.div)<FramerMotionBugFix>`\n align-items: center;\n display: flex;\n justify-content: center;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,uBAAA,CAAAF,OAAA;AAAgD,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAA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AACA;AACA,CAAC;AAEM,MAAMC,2BAA2B,GAAAjB,OAAA,CAAAiB,2BAAA,GAAG,IAAAhB,yBAAM,EAACC,oBAAM,CAACgB,GAAG,CAAsB,EAAC;AAE5E,MAAMC,6BAA6B,GAAAnB,OAAA,CAAAmB,6BAAA,GAAG,IAAAlB,yBAAM,EAACC,oBAAM,CAACgB,GAAG,CAAsB;AACpF;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -38,6 +38,7 @@ const ColorSchemeProvider = ({
|
|
|
38
38
|
const [colors, setColors] = (0, _react.useState)({});
|
|
39
39
|
const [theme, setTheme] = (0, _react.useState)({});
|
|
40
40
|
const [internalDesignSettings, setInternalDesignSettings] = (0, _react.useState)();
|
|
41
|
+
const [internalParagraphFormat, setInternalParagraphFormat] = (0, _react.useState)();
|
|
41
42
|
|
|
42
43
|
// Empty object is used to prevent error if ColorSchemeProvider is rendered on server
|
|
43
44
|
const {
|
|
@@ -52,6 +53,9 @@ const ColorSchemeProvider = ({
|
|
|
52
53
|
void (0, _get.getDesignSettings)().then(result => {
|
|
53
54
|
setInternalDesignSettings(result);
|
|
54
55
|
});
|
|
56
|
+
void (0, _get.getParagraphFormat)().then(result => {
|
|
57
|
+
setInternalParagraphFormat(result);
|
|
58
|
+
});
|
|
55
59
|
}, [designSettings]);
|
|
56
60
|
(0, _react.useEffect)(() => {
|
|
57
61
|
const availableColors = (0, _colors.getAvailableColorList)();
|
|
@@ -98,10 +102,34 @@ const ColorSchemeProvider = ({
|
|
|
98
102
|
newTheme[key] = internalDesignSettings[key];
|
|
99
103
|
});
|
|
100
104
|
}
|
|
105
|
+
if (internalParagraphFormat) {
|
|
106
|
+
const {
|
|
107
|
+
colorResult,
|
|
108
|
+
themeResult
|
|
109
|
+
} = (0, _font.getHeadlineColorSelector)(internalParagraphFormat);
|
|
110
|
+
|
|
111
|
+
// Update chayns-colors
|
|
112
|
+
Object.keys(colorResult).forEach(key => {
|
|
113
|
+
// ToDo: Find better solution
|
|
114
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
115
|
+
// @ts-ignore
|
|
116
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
117
|
+
newColors[key] = colorResult[key];
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
// Update Theme
|
|
121
|
+
Object.keys(themeResult).forEach(key => {
|
|
122
|
+
// ToDo: Find better solution
|
|
123
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
124
|
+
// @ts-ignore
|
|
125
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
126
|
+
newTheme[key] = themeResult[key];
|
|
127
|
+
});
|
|
128
|
+
}
|
|
101
129
|
newTheme.fontSize = (0, _font.getFontSize)();
|
|
102
130
|
setTheme(newTheme);
|
|
103
131
|
setColors(newColors);
|
|
104
|
-
}, [color, colorMode, internalColor, internalColorMode, internalDesignSettings, secondaryColor]);
|
|
132
|
+
}, [color, colorMode, internalColor, internalColorMode, internalDesignSettings, internalParagraphFormat, secondaryColor]);
|
|
105
133
|
return /*#__PURE__*/_react.default.createElement(_styledComponents.ThemeProvider, {
|
|
106
134
|
theme: theme
|
|
107
135
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorSchemeProvider.js","names":["_colors","require","_chaynsApi","_react","_interopRequireWildcard","_styledComponents","_get","_font","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ColorMode","GlobalStyle","createGlobalStyle","generateFontFaces","ColorSchemeProvider","children","color","colorMode","cssVariables","secondaryColor","style","designSettings","colors","setColors","useState","theme","setTheme","internalDesignSettings","setInternalDesignSettings","internalColor","internalColorMode","useSite","useEffect","getDesignSettings","then","result","availableColors","getAvailableColorList","newColors","newTheme","forEach","colorName","hexColor","getColorFromPalette","rgbColor","hexToRgb255","g","b","Light","Dark","keys","key","convertIconStyle","iconStyle","fontSize","getFontSize","createElement","ThemeProvider","displayName","_default","exports"],"sources":["../../../../src/components/color-scheme-provider/ColorSchemeProvider.tsx"],"sourcesContent":["import { getAvailableColorList, getColorFromPalette, hexToRgb255 } from '@chayns/colors';\nimport { useSite } from 'chayns-api';\nimport React, { FC, ReactNode, useEffect, useState } from 'react';\nimport { createGlobalStyle, ThemeProvider } from 'styled-components';\nimport { getDesignSettings } from '../../api/theme/get';\nimport type { DesignSettings } from '../../types/colorSchemeProvider';\nimport { convertIconStyle, generateFontFaces, getFontSize } from '../../utils/font';\n\nenum ColorMode {\n Classic,\n Dark,\n Light,\n}\n\ntype ColorSchemeProviderProps = {\n /**\n * The content of the application or the components for which the styles should be set\n */\n children: ReactNode;\n /**\n * The hex color to be used for the children\n */\n color?: string;\n /**\n * The color mode to be used for the children\n */\n colorMode?: ColorMode;\n /**\n * Css variables to be added in addition to the chayns variables\n */\n cssVariables?: { [key: string]: string | number };\n /**\n * The design settings of a page.\n */\n designSettings?: DesignSettings;\n /**\n * The secondary hex color to be used for the children\n */\n secondaryColor?: string;\n /**\n * Additional styles set on the root element\n */\n style?: { [key: string]: string | number };\n};\n\nexport interface Theme {\n [key: string]: string;\n}\n\nexport type WithTheme<T> = T & {\n theme: Theme;\n};\n\n// ToDo remove type after the framer-motion bug is Fixed\nexport type FramerMotionBugFix = WithTheme<unknown>;\n\nconst GlobalStyle = createGlobalStyle`\n ${generateFontFaces}\n .ellipsis {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n`;\n\nconst ColorSchemeProvider: FC<ColorSchemeProviderProps> = ({\n children,\n color,\n colorMode,\n cssVariables = {},\n secondaryColor,\n style = {},\n designSettings,\n}) => {\n const [colors, setColors] = useState<Theme>({});\n const [theme, setTheme] = useState<Theme>({});\n const [internalDesignSettings, setInternalDesignSettings] = useState<DesignSettings>();\n\n // Empty object is used to prevent error if ColorSchemeProvider is rendered on server\n const { color: internalColor, colorMode: internalColorMode } = useSite() ?? {};\n\n useEffect(() => {\n if (designSettings) {\n setInternalDesignSettings(designSettings);\n\n return;\n }\n\n void getDesignSettings().then((result) => {\n setInternalDesignSettings(result);\n });\n }, [designSettings]);\n\n useEffect(() => {\n const availableColors = getAvailableColorList();\n\n const newColors: Theme = {};\n const newTheme: Theme = {};\n\n availableColors.forEach((colorName: string) => {\n const hexColor = getColorFromPalette(colorName, {\n color: color ?? internalColor,\n colorMode: colorMode ?? internalColorMode,\n secondaryColor,\n });\n\n if (hexColor) {\n const rgbColor = hexToRgb255(hexColor);\n\n newColors[`--chayns-color--${colorName}`] = hexColor;\n newTheme[colorName] = hexColor;\n\n if (rgbColor) {\n newColors[`--chayns-color-rgb--${colorName}`] =\n `${rgbColor.r}, ${rgbColor.g}, ${rgbColor.b}`;\n newTheme[`${colorName}-rgb`] = `${rgbColor.r}, ${rgbColor.g}, ${rgbColor.b}`;\n }\n }\n });\n\n switch (colorMode ?? internalColorMode) {\n case ColorMode.Light:\n newTheme.colorMode = 'light';\n break;\n case ColorMode.Dark:\n newTheme.colorMode = 'dark';\n break;\n default:\n newTheme.colorMode = 'classic';\n break;\n }\n\n if (internalDesignSettings) {\n Object.keys(internalDesignSettings).forEach((key) => {\n if (key === 'iconStyle') {\n newTheme[key] = convertIconStyle(internalDesignSettings.iconStyle);\n\n return;\n }\n\n // ToDo: Find better solution\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n newTheme[key] = internalDesignSettings[key];\n });\n }\n\n newTheme.fontSize = getFontSize();\n\n setTheme(newTheme);\n setColors(newColors);\n }, [\n color,\n colorMode,\n internalColor,\n internalColorMode,\n internalDesignSettings,\n secondaryColor,\n ]);\n\n return (\n <ThemeProvider theme={theme}>\n <div style={{ ...colors, ...cssVariables, ...style }}>{children}</div>\n <GlobalStyle />\n </ThemeProvider>\n );\n};\n\nColorSchemeProvider.displayName = 'ColorScheme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D,IAAIA,GAAG,KAAK,WAAW,EAAE;UACrBZ,QAAQ,CAACY,GAAG,CAAC,GAAG,IAAAC,sBAAgB,EAACzB,sBAAsB,CAAC0B,SAAS,CAAC;UAElE;QACJ;;QAEA;QACA;QACA;QACA;QACAd,QAAQ,CAACY,GAAG,CAAC,GAAGxB,sBAAsB,CAACwB,GAAG,CAAC;MAC/C,CAAC,CAAC;IACN;IAEAZ,QAAQ,CAACe,QAAQ,GAAG,IAAAC,iBAAW,EAAC,CAAC;IAEjC7B,QAAQ,CAACa,QAAQ,CAAC;IAClBhB,SAAS,CAACe,SAAS,CAAC;EACxB,CAAC,EAAE,CACCtB,KAAK,EACLC,SAAS,EACTY,aAAa,EACbC,iBAAiB,EACjBH,sBAAsB,EACtBR,cAAc,CACjB,CAAC;EAEF,oBACIlC,MAAA,CAAAW,OAAA,CAAA4D,aAAA,CAACrE,iBAAA,CAAAsE,aAAa;IAAChC,KAAK,EAAEA;EAAM,gBACxBxC,MAAA,CAAAW,OAAA,CAAA4D,aAAA;IAAKpC,KAAK,EAAE;MAAE,GAAGE,MAAM;MAAE,GAAGJ,YAAY;MAAE,GAAGE;IAAM;EAAE,GAAEL,QAAc,CAAC,eACtE9B,MAAA,CAAAW,OAAA,CAAA4D,aAAA,CAAC7C,WAAW,MAAE,CACH,CAAC;AAExB,CAAC;AAEDG,mBAAmB,CAAC4C,WAAW,GAAG,qBAAqB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAhE,OAAA,GAEzCkB,mBAAmB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ColorSchemeProvider.js","names":["_colors","require","_chaynsApi","_react","_interopRequireWildcard","_styledComponents","_get","_font","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ColorMode","GlobalStyle","createGlobalStyle","generateFontFaces","ColorSchemeProvider","children","color","colorMode","cssVariables","secondaryColor","style","designSettings","colors","setColors","useState","theme","setTheme","internalDesignSettings","setInternalDesignSettings","internalParagraphFormat","setInternalParagraphFormat","internalColor","internalColorMode","useSite","useEffect","getDesignSettings","then","result","getParagraphFormat","availableColors","getAvailableColorList","newColors","newTheme","forEach","colorName","hexColor","getColorFromPalette","rgbColor","hexToRgb255","g","b","Light","Dark","keys","key","convertIconStyle","iconStyle","colorResult","themeResult","getHeadlineColorSelector","fontSize","getFontSize","createElement","ThemeProvider","displayName","_default","exports"],"sources":["../../../../src/components/color-scheme-provider/ColorSchemeProvider.tsx"],"sourcesContent":["import { getAvailableColorList, getColorFromPalette, hexToRgb255 } from '@chayns/colors';\nimport { useSite } from 'chayns-api';\nimport React, { FC, ReactNode, useEffect, useState } from 'react';\nimport { createGlobalStyle, ThemeProvider } from 'styled-components';\nimport { getDesignSettings, getParagraphFormat } from '../../api/theme/get';\nimport type { DesignSettings, ParagraphFormat } from '../../types/colorSchemeProvider';\nimport {\n convertIconStyle,\n generateFontFaces,\n getFontSize,\n getHeadlineColorSelector,\n} from '../../utils/font';\n\nenum ColorMode {\n Classic,\n Dark,\n Light,\n}\n\ntype ColorSchemeProviderProps = {\n /**\n * The content of the application or the components for which the styles should be set\n */\n children: ReactNode;\n /**\n * The hex color to be used for the children\n */\n color?: string;\n /**\n * The color mode to be used for the children\n */\n colorMode?: ColorMode;\n /**\n * Css variables to be added in addition to the chayns variables\n */\n cssVariables?: { [key: string]: string | number };\n /**\n * The design settings of a page.\n */\n designSettings?: DesignSettings;\n /**\n * The secondary hex color to be used for the children\n */\n secondaryColor?: string;\n /**\n * Additional styles set on the root element\n */\n style?: { [key: string]: string | number };\n};\n\nexport interface Theme {\n [key: string]: string;\n}\n\nexport type WithTheme<T> = T & {\n theme: Theme;\n};\n\n// ToDo remove type after the framer-motion bug is Fixed\nexport type FramerMotionBugFix = WithTheme<unknown>;\n\nconst GlobalStyle = createGlobalStyle`\n ${generateFontFaces}\n .ellipsis {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n`;\n\nconst ColorSchemeProvider: FC<ColorSchemeProviderProps> = ({\n children,\n color,\n colorMode,\n cssVariables = {},\n secondaryColor,\n style = {},\n designSettings,\n}) => {\n const [colors, setColors] = useState<Theme>({});\n const [theme, setTheme] = useState<Theme>({});\n const [internalDesignSettings, setInternalDesignSettings] = useState<DesignSettings>();\n const [internalParagraphFormat, setInternalParagraphFormat] = useState<ParagraphFormat[]>();\n\n // Empty object is used to prevent error if ColorSchemeProvider is rendered on server\n const { color: internalColor, colorMode: internalColorMode } = useSite() ?? {};\n\n useEffect(() => {\n if (designSettings) {\n setInternalDesignSettings(designSettings);\n\n return;\n }\n\n void getDesignSettings().then((result) => {\n setInternalDesignSettings(result);\n });\n\n void getParagraphFormat().then((result) => {\n setInternalParagraphFormat(result);\n });\n }, [designSettings]);\n\n useEffect(() => {\n const availableColors = getAvailableColorList();\n\n const newColors: Theme = {};\n const newTheme: Theme = {};\n\n availableColors.forEach((colorName: string) => {\n const hexColor = getColorFromPalette(colorName, {\n color: color ?? internalColor,\n colorMode: colorMode ?? internalColorMode,\n secondaryColor,\n });\n\n if (hexColor) {\n const rgbColor = hexToRgb255(hexColor);\n\n newColors[`--chayns-color--${colorName}`] = hexColor;\n newTheme[colorName] = hexColor;\n\n if (rgbColor) {\n newColors[`--chayns-color-rgb--${colorName}`] =\n `${rgbColor.r}, ${rgbColor.g}, ${rgbColor.b}`;\n newTheme[`${colorName}-rgb`] = `${rgbColor.r}, ${rgbColor.g}, ${rgbColor.b}`;\n }\n }\n });\n\n switch (colorMode ?? internalColorMode) {\n case ColorMode.Light:\n newTheme.colorMode = 'light';\n break;\n case ColorMode.Dark:\n newTheme.colorMode = 'dark';\n break;\n default:\n newTheme.colorMode = 'classic';\n break;\n }\n\n if (internalDesignSettings) {\n Object.keys(internalDesignSettings).forEach((key) => {\n if (key === 'iconStyle') {\n newTheme[key] = convertIconStyle(internalDesignSettings.iconStyle);\n\n return;\n }\n\n // ToDo: Find better solution\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n newTheme[key] = internalDesignSettings[key];\n });\n }\n\n if (internalParagraphFormat) {\n const { colorResult, themeResult } = getHeadlineColorSelector(internalParagraphFormat);\n\n // Update chayns-colors\n Object.keys(colorResult).forEach((key) => {\n // ToDo: Find better solution\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n newColors[key] = colorResult[key];\n });\n\n // Update Theme\n Object.keys(themeResult).forEach((key) => {\n // ToDo: Find better solution\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n newTheme[key] = themeResult[key];\n });\n }\n\n newTheme.fontSize = getFontSize();\n\n setTheme(newTheme);\n setColors(newColors);\n }, [\n color,\n colorMode,\n internalColor,\n internalColorMode,\n internalDesignSettings,\n internalParagraphFormat,\n secondaryColor,\n ]);\n\n return (\n <ThemeProvider theme={theme}>\n <div style={{ ...colors, ...cssVariables, ...style }}>{children}</div>\n <GlobalStyle />\n </ThemeProvider>\n );\n};\n\nColorSchemeProvider.displayName = 'ColorSchemeProvider';\n\nexport default ColorSchemeProvider;\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,IAAA,GAAAL,OAAA;AAEA,IAAAM,KAAA,GAAAN,OAAA;AAK0B,SAAAO,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAL,wBA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+20,6 @@ let SmallWaitCursorSpeed = exports.SmallWaitCursorSpeed = /*#__PURE__*/function
|
|
|
20
20
|
return SmallWaitCursorSpeed;
|
|
21
21
|
}({});
|
|
22
22
|
const SmallWaitCursor = ({
|
|
23
|
-
color,
|
|
24
23
|
shouldHideBackground = false,
|
|
25
24
|
shouldHideWaitCursor = false,
|
|
26
25
|
size = SmallWaitCursorSize.Medium,
|
|
@@ -29,7 +28,7 @@ const SmallWaitCursor = ({
|
|
|
29
28
|
$shouldShowWaitCursor: !shouldHideWaitCursor,
|
|
30
29
|
$size: size
|
|
31
30
|
}, /*#__PURE__*/_react.default.createElement(_SmallWaitCursor.StyledSmallWaitCursorWaitCursor, {
|
|
32
|
-
$
|
|
31
|
+
$shouldHideBackground: shouldHideBackground,
|
|
33
32
|
$size: size,
|
|
34
33
|
$speed: speed
|
|
35
34
|
}), !shouldHideBackground && /*#__PURE__*/_react.default.createElement(_SmallWaitCursor.StyledSmallWaitCursorBackground, null));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmallWaitCursor.js","names":["_react","_interopRequireDefault","require","_SmallWaitCursor","obj","__esModule","default","SmallWaitCursorSize","exports","SmallWaitCursorSpeed","SmallWaitCursor","
|
|
1
|
+
{"version":3,"file":"SmallWaitCursor.js","names":["_react","_interopRequireDefault","require","_SmallWaitCursor","obj","__esModule","default","SmallWaitCursorSize","exports","SmallWaitCursorSpeed","SmallWaitCursor","shouldHideBackground","shouldHideWaitCursor","size","Medium","speed","createElement","StyledSmallWaitCursor","$shouldShowWaitCursor","$size","StyledSmallWaitCursorWaitCursor","$shouldHideBackground","$speed","StyledSmallWaitCursorBackground","displayName","_default"],"sources":["../../../../src/components/small-wait-cursor/SmallWaitCursor.tsx"],"sourcesContent":["// noinspection JSUnusedGlobalSymbols\n\nimport React, { FC } from 'react';\nimport {\n StyledSmallWaitCursor,\n StyledSmallWaitCursorBackground,\n StyledSmallWaitCursorWaitCursor,\n} from './SmallWaitCursor.styles';\n\nexport enum SmallWaitCursorSize {\n Small = 16,\n Medium = 30,\n}\n\nexport enum SmallWaitCursorSpeed {\n Slow = 1.5,\n Medium = 1,\n Fast = 0.5,\n}\n\nexport type SmallWaitCursorProps = {\n /**\n * Specifies whether the wait cursor should be displayed with a background.\n */\n shouldHideBackground?: boolean;\n /**\n * Specifies whether the wait cursor should be displayed.\n */\n shouldHideWaitCursor?: boolean;\n /**\n * The size of the wait cursor in pixels. Use the SmallWaitCursorSize enum for this prop.\n */\n size?: SmallWaitCursorSize | number;\n /**\n * The speed of the animation in seconds. Use the SmallWaitCursorSpeed enum for this prop.\n */\n speed?: SmallWaitCursorSpeed;\n};\n\nconst SmallWaitCursor: FC<SmallWaitCursorProps> = ({\n shouldHideBackground = false,\n shouldHideWaitCursor = false,\n size = SmallWaitCursorSize.Medium,\n speed = SmallWaitCursorSpeed.Medium,\n}) => (\n <StyledSmallWaitCursor $shouldShowWaitCursor={!shouldHideWaitCursor} $size={size}>\n <StyledSmallWaitCursorWaitCursor\n $shouldHideBackground={shouldHideBackground}\n $size={size}\n $speed={speed}\n />\n {!shouldHideBackground && <StyledSmallWaitCursorBackground />}\n </StyledSmallWaitCursor>\n);\n\nSmallWaitCursor.displayName = 'SmallWaitCursor';\n\nexport default SmallWaitCursor;\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AAIkC,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAPlC;AAAA,IASYG,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,0BAAnBA,mBAAmB;EAAnBA,mBAAmB,CAAnBA,mBAAmB;EAAnBA,mBAAmB,CAAnBA,mBAAmB;EAAA,OAAnBA,mBAAmB;AAAA;AAAA,IAKnBE,oBAAoB,GAAAD,OAAA,CAAAC,oBAAA,0BAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;AAyBhC,MAAMC,eAAyC,GAAGA,CAAC;EAC/CC,oBAAoB,GAAG,KAAK;EAC5BC,oBAAoB,GAAG,KAAK;EAC5BC,IAAI,GAAGN,mBAAmB,CAACO,MAAM;EACjCC,KAAK,GAAGN,oBAAoB,CAACK;AACjC,CAAC,kBACGd,MAAA,CAAAM,OAAA,CAAAU,aAAA,CAACb,gBAAA,CAAAc,qBAAqB;EAACC,qBAAqB,EAAE,CAACN,oBAAqB;EAACO,KAAK,EAAEN;AAAK,gBAC7Eb,MAAA,CAAAM,OAAA,CAAAU,aAAA,CAACb,gBAAA,CAAAiB,+BAA+B;EAC5BC,qBAAqB,EAAEV,oBAAqB;EAC5CQ,KAAK,EAAEN,IAAK;EACZS,MAAM,EAAEP;AAAM,CACjB,CAAC,EACD,CAACJ,oBAAoB,iBAAIX,MAAA,CAAAM,OAAA,CAAAU,aAAA,CAACb,gBAAA,CAAAoB,+BAA+B,MAAE,CACzC,CAC1B;AAEDb,eAAe,CAACc,WAAW,GAAG,iBAAiB;AAAC,IAAAC,QAAA,GAAAjB,OAAA,CAAAF,OAAA,GAEjCI,eAAe","ignoreList":[]}
|
|
@@ -46,9 +46,9 @@ const StyledSmallWaitCursorWaitCursor = exports.StyledSmallWaitCursorWaitCursor
|
|
|
46
46
|
border-style: solid;
|
|
47
47
|
border-width: 3px;
|
|
48
48
|
border-color: ${({
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}) => $
|
|
49
|
+
theme,
|
|
50
|
+
$shouldHideBackground
|
|
51
|
+
}) => theme.colorMode === 'dark' && $shouldHideBackground ? theme.headline : theme.primary};
|
|
52
52
|
height: ${({
|
|
53
53
|
$size
|
|
54
54
|
}) => `${$size - 10}px`};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmallWaitCursor.styles.js","names":["_styledComponents","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","StyledSmallWaitCursor","exports","styled","div","$size","$shouldShowWaitCursor","StyledSmallWaitCursorBackground","spin","keyframes","StyledSmallWaitCursorWaitCursor","$
|
|
1
|
+
{"version":3,"file":"SmallWaitCursor.styles.js","names":["_styledComponents","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","StyledSmallWaitCursor","exports","styled","div","$size","$shouldShowWaitCursor","StyledSmallWaitCursorBackground","spin","keyframes","StyledSmallWaitCursorWaitCursor","theme","$shouldHideBackground","colorMode","headline","primary","$speed"],"sources":["../../../../src/components/small-wait-cursor/SmallWaitCursor.styles.ts"],"sourcesContent":["import styled, { keyframes } from 'styled-components';\nimport type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\nimport type { SmallWaitCursorSize, SmallWaitCursorSpeed } from './SmallWaitCursor';\n\ntype StyledSmallWaitCursorProps = WithTheme<{\n $shouldShowWaitCursor: boolean;\n $size: SmallWaitCursorSize | number;\n}>;\n\nexport const StyledSmallWaitCursor = styled.div<StyledSmallWaitCursorProps>`\n position: relative;\n height: ${({ $size }) => $size}px;\n width: ${({ $size }) => $size}px;\n opacity: ${({ $shouldShowWaitCursor }) => ($shouldShowWaitCursor ? 1 : 0)};\n`;\n\ntype StyledSmallWaitCursorBackgroundProps = WithTheme<unknown>;\n\nexport const StyledSmallWaitCursorBackground = styled.div<StyledSmallWaitCursorBackgroundProps>`\n background-color: white;\n border-radius: 50%;\n height: 100%;\n width: 100%;\n position: relative;\n z-index: 1;\n box-shadow:\n 0 4px 12px 0 rgba(0, 0, 0, 0.2),\n 0 1px 1px rgba(0, 0, 0, 0.2);\n`;\n\ntype StyledSmallWaitCursorWaitCursorProps = WithTheme<{\n $size: SmallWaitCursorSize | number;\n $speed: SmallWaitCursorSpeed;\n $shouldHideBackground: boolean;\n}>;\n\nconst spin = keyframes`\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n`;\n\nexport const StyledSmallWaitCursorWaitCursor = styled.div<StyledSmallWaitCursorWaitCursorProps>`\n position: absolute;\n top: 5px;\n left: 5px;\n z-index: 2;\n border-style: solid;\n border-width: 3px;\n border-color: ${({ theme, $shouldHideBackground }: StyledSmallWaitCursorWaitCursorProps) =>\n theme.colorMode === 'dark' && $shouldHideBackground ? theme.headline : theme.primary};\n height: ${({ $size }) => `${$size - 10}px`};\n width: ${({ $size }) => `${$size - 10}px`};\n border-radius: 50%;\n display: inline-block;\n border-top: 3px solid transparent;\n\n animation: ${spin} ${({ $speed }) => $speed}s linear infinite;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAsD,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc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EAAEV;AAAM,CAAC,KAAM,GAAEA,KAAK,GAAG,EAAG,IAAI;AAC/C,aAAa,CAAC;EAAEA;AAAM,CAAC,KAAM,GAAEA,KAAK,GAAG,EAAG,IAAI;AAC9C;AACA;AACA;AACA;AACA,iBAAiBG,IAAK,IAAG,CAAC;EAAEQ;AAAO,CAAC,KAAKA,MAAO;AAChD,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colorSchemeProvider.js","names":["IconStyle","exports"],"sources":["../../../src/types/colorSchemeProvider.ts"],"sourcesContent":["export interface DesignSettings {\n accordionIcon: number;\n accordionLines: boolean;\n cardBorderRadius: number;\n cardBackgroundOpacity: number;\n cardShadow: number;\n iconStyle: IconStyle;\n}\n\nexport enum IconStyle {\n SOLID,\n REGULAR,\n LIGHT,\n DUOTONE,\n SHARP,\n}\n"],"mappings":";;;;;;IASYA,SAAS,GAAAC,OAAA,CAAAD,SAAA,0BAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAAA,OAATA,SAAS;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"colorSchemeProvider.js","names":["IconStyle","exports"],"sources":["../../../src/types/colorSchemeProvider.ts"],"sourcesContent":["export interface DesignSettings {\n accordionIcon: number;\n accordionLines: boolean;\n cardBorderRadius: number;\n cardBackgroundOpacity: number;\n cardShadow: number;\n iconStyle: IconStyle;\n}\n\nexport enum IconStyle {\n SOLID,\n REGULAR,\n LIGHT,\n DUOTONE,\n SHARP,\n}\n\nexport interface ParagraphFormat {\n selector: string;\n fontSizePx: number | null;\n lineHeight: number | null;\n marginBeforePx: number | null;\n marginAfterPx: number | null;\n color: string | null;\n fontId: number | null;\n backgroundColor: string | null;\n design: number | null;\n fontName: string | null;\n fontFactor: number | null;\n letterSpacing: number | null;\n wordSpacing: number | null;\n fontBackup: string | null;\n fontHasBold: boolean | null;\n}\n"],"mappings":";;;;;;IASYA,SAAS,GAAAC,OAAA,CAAAD,SAAA,0BAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAAA,OAATA,SAAS;AAAA","ignoreList":[]}
|
package/lib/cjs/utils/font.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getFontSize = exports.generateFontFaces = exports.convertIconStyle = void 0;
|
|
6
|
+
exports.getHeadlineColorSelector = exports.getFontSize = exports.generateFontFaces = exports.convertIconStyle = void 0;
|
|
7
7
|
var _colorSchemeProvider = require("../types/colorSchemeProvider");
|
|
8
8
|
const fonts = [{
|
|
9
9
|
family: 'Noto Color Emoji',
|
|
@@ -74,6 +74,88 @@ const getFontSize = () => {
|
|
|
74
74
|
return fontSize.replace('px', '');
|
|
75
75
|
};
|
|
76
76
|
exports.getFontSize = getFontSize;
|
|
77
|
+
const hexToRgb = hex => {
|
|
78
|
+
let r;
|
|
79
|
+
let g;
|
|
80
|
+
let b;
|
|
81
|
+
let a;
|
|
82
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i.exec(hex);
|
|
83
|
+
if (result) {
|
|
84
|
+
r = parseInt(result[1] ?? '0', 16);
|
|
85
|
+
g = parseInt(result[2] ?? '0', 16);
|
|
86
|
+
b = parseInt(result[3] ?? '0', 16);
|
|
87
|
+
a = result[4] ? parseInt(result[4], 16) / 100 : 1;
|
|
88
|
+
return {
|
|
89
|
+
r,
|
|
90
|
+
g,
|
|
91
|
+
b,
|
|
92
|
+
a
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
return undefined;
|
|
96
|
+
};
|
|
97
|
+
const getHeadlineColorSelector = data => {
|
|
98
|
+
const themeResult = {};
|
|
99
|
+
const colorResult = {};
|
|
100
|
+
const headlineMap = {
|
|
101
|
+
h1: 'headline-1',
|
|
102
|
+
h2: 'headline-2',
|
|
103
|
+
h3: 'headline-3',
|
|
104
|
+
h4: 'headline-4',
|
|
105
|
+
h5: 'headline-5',
|
|
106
|
+
h6: 'headline-6',
|
|
107
|
+
p: 'text',
|
|
108
|
+
footer: 'footer',
|
|
109
|
+
'.button': 'button'
|
|
110
|
+
};
|
|
111
|
+
data.forEach(({
|
|
112
|
+
selector,
|
|
113
|
+
color,
|
|
114
|
+
backgroundColor,
|
|
115
|
+
design
|
|
116
|
+
}) => {
|
|
117
|
+
var _selectors;
|
|
118
|
+
const selectors = selector.split(',');
|
|
119
|
+
const tag = (_selectors = selectors[selectors.length - 1]) === null || _selectors === void 0 ? void 0 : _selectors.trim();
|
|
120
|
+
const path = headlineMap[tag ?? ''];
|
|
121
|
+
if (!path) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (path === 'button' && backgroundColor) {
|
|
125
|
+
themeResult[`${path}BackgroundColor`] = backgroundColor;
|
|
126
|
+
if (color) {
|
|
127
|
+
themeResult[`${path}Color`] = color;
|
|
128
|
+
}
|
|
129
|
+
if (design) {
|
|
130
|
+
themeResult[`${path}Design`] = String(design);
|
|
131
|
+
}
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
if (!color) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
const hexPath = `--chayns-color--${path}`;
|
|
138
|
+
const rgbPath = `--chayns-color-rgb--${path}`;
|
|
139
|
+
colorResult[hexPath] = color;
|
|
140
|
+
themeResult[path] = color;
|
|
141
|
+
const rgb = hexToRgb(color);
|
|
142
|
+
if (!rgb) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
const {
|
|
146
|
+
r,
|
|
147
|
+
g,
|
|
148
|
+
b
|
|
149
|
+
} = rgb;
|
|
150
|
+
colorResult[rgbPath] = `${r}, ${g}, ${b}`;
|
|
151
|
+
themeResult[`${path}-rgb`] = `${r}, ${g}, ${b}`;
|
|
152
|
+
});
|
|
153
|
+
return {
|
|
154
|
+
colorResult,
|
|
155
|
+
themeResult
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
exports.getHeadlineColorSelector = getHeadlineColorSelector;
|
|
77
159
|
const generateFontFaces = () => fonts.map(font => `
|
|
78
160
|
@font-face {
|
|
79
161
|
font-display: swap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"font.js","names":["_colorSchemeProvider","require","fonts","family","src","unicodeRange","convertIconStyle","iconStyle","IconStyle","SOLID","DUOTONE","SHARP","LIGHT","exports","getFontSize","element","document","createElement","style","position","opacity","textContent","body","appendChild","fontSize","window","getComputedStyle","removeChild","replace","generateFontFaces","map","font","join"],"sources":["../../../src/utils/font.ts"],"sourcesContent":["import { IconStyle } from '../types/colorSchemeProvider';\n\nexport interface Font {\n family: string;\n src: string;\n unicodeRange?: string;\n}\n\nconst fonts: Font[] = [\n {\n family: 'Noto Color Emoji',\n src: 'https://api.chayns-static.space/font/NotoColorEmoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFabsE4tq3luCC7p-aXxcn.0.woff2',\n unicodeRange: 'U+1f1e6-1f1ff',\n },\n {\n family: 'Noto Color Emoji',\n src: 'https://api.chayns-static.space/font/NotoColorEmoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFabsE4tq3luCC7p-aXxcn.1.woff2',\n unicodeRange:\n 'U+200d, U+2620, U+26a7, U+fe0f, U+1f308, U+1f38c, U+1f3c1, U+1f3f3-1f3f4, U+1f6a9, U+e0062-e0063, U+e0065, U+e0067, U+e006c, U+e006e, U+e0073-e0074, U+e0077, U+e007f',\n },\n {\n family: 'Noto Color Emoji',\n src: 'https://api.chayns-static.space/font/NotoColorEmoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFabsE4tq3luCC7p-aXxcn.2.woff2',\n unicodeRange:\n 'U+23, U+2a, U+30-39, U+a9, U+ae, U+200d, U+203c, U+2049, U+20e3, U+2122, U+2139, U+2194-2199, U+21a9-21aa, U+23cf, U+23e9-23ef, U+23f8-23fa, U+24c2, U+25aa-25ab, U+25b6, U+25c0, U+25fb-25fe, U+2611, U+2622-2623, U+2626, U+262a, U+262e-262f, U+2638, U+2640, U+2642, U+2648-2653, U+2660, U+2663, U+2665-2666, U+2668, U+267b, U+267e-267f, U+2695, U+269b-269c, U+26a0, U+26a7, U+26aa-26ab, U+26ce, U+26d4, U+2705, U+2714, U+2716, U+271d, U+2721, U+2733-2734, U+2747, U+274c, U+274e, U+2753-2755, U+2757, U+2764, U+2795-2797, U+27a1, U+27b0, U+27bf, U+2934-2935, U+2b05-2b07, U+2b1b-2b1c, U+2b55, U+3030, U+303d, U+3297, U+3299, U+fe0f, U+1f170-1f171, U+1f17e-1f17f, U+1f18e, U+1f191-1f19a, U+1f201-1f202, U+1f21a, U+1f22f, U+1f232-1f23a, U+1f250-1f251, U+1f310, U+1f3a6, U+1f3b5-1f3b6, U+1f3bc, U+1f3e7, U+1f441, U+1f499-1f49c, U+1f49f-1f4a0, U+1f4a2, U+1f4ac-1f4ad, U+1f4b1-1f4b2, U+1f4b9, U+1f4db, U+1f4f2-1f4f6, U+1f500-1f50a, U+1f515, U+1f518-1f524, U+1f52f-1f53d, U+1f549, U+1f54e, U+1f5a4, U+1f5e8, U+1f5ef, U+1f6ab, U+1f6ad-1f6b1, U+1f6b3, U+1f6b7-1f6bc, U+1f6be, U+1f6c2-1f6c5, U+1f6d0-1f6d1, U+1f6d7, U+1f6dc, U+1f7e0-1f7eb, U+1f7f0, U+1f90d-1f90e, U+1f9e1, U+1fa75-1fa77, U+1faaf',\n },\n {\n family: 'Noto Color Emoji',\n src: 'https://api.chayns-static.space/font/NotoColorEmoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFabsE4tq3luCC7p-aXxcn.3.woff2',\n unicodeRange:\n 'U+231a-231b, U+2328, U+23f0-23f3, U+2602, U+260e, U+2692, U+2694, U+2696-2697, U+2699, U+26b0-26b1, U+26cf, U+26d1, U+26d3, U+2702, U+2709, U+270f, U+2712, U+fe0f, U+1f302, U+1f321, U+1f392-1f393, U+1f3a9, U+1f3bd, U+1f3ee, U+1f3f7, U+1f3fa, U+1f451-1f462, U+1f484, U+1f489-1f48a, U+1f48c-1f48e, U+1f4a1, U+1f4a3, U+1f4b0, U+1f4b3-1f4b8, U+1f4bb-1f4da, U+1f4dc-1f4f1, U+1f4ff, U+1f50b-1f514, U+1f516-1f517, U+1f526-1f529, U+1f52c-1f52e, U+1f550-1f567, U+1f56f-1f570, U+1f576, U+1f587, U+1f58a-1f58d, U+1f5a5, U+1f5a8, U+1f5b1-1f5b2, U+1f5c2-1f5c4, U+1f5d1-1f5d3, U+1f5dc-1f5de, U+1f5e1, U+1f5f3, U+1f6aa, U+1f6ac, U+1f6bd, U+1f6bf, U+1f6c1, U+1f6cb, U+1f6cd-1f6cf, U+1f6d2, U+1f6e0-1f6e1, U+1f6f0, U+1f97b-1f97f, U+1f9af, U+1f9ba, U+1f9e2-1f9e6, U+1f9ea-1f9ec, U+1f9ee-1f9f4, U+1f9f7-1f9ff, U+1fa71-1fa74, U+1fa79-1fa7b, U+1fa86, U+1fa91-1fa93, U+1fa96, U+1fa99-1faa0, U+1faa2-1faa7, U+1faaa-1faae',\n },\n {\n family: 'Noto Color Emoji',\n src: 'https://api.chayns-static.space/font/NotoColorEmoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFabsE4tq3luCC7p-aXxcn.4.woff2',\n unicodeRange:\n 'U+265f, U+26bd-26be, U+26f3, U+26f8, U+fe0f, U+1f004, U+1f0cf, U+1f380-1f384, U+1f386-1f38b, U+1f38d-1f391, U+1f396-1f397, U+1f399-1f39b, U+1f39e-1f39f, U+1f3a3-1f3a5, U+1f3a7-1f3a9, U+1f3ab-1f3b4, U+1f3b7-1f3bb, U+1f3bd-1f3c0, U+1f3c5-1f3c6, U+1f3c8-1f3c9, U+1f3cf-1f3d3, U+1f3f8-1f3f9, U+1f47e, U+1f4e2, U+1f4f7-1f4fd, U+1f52b, U+1f579, U+1f58c-1f58d, U+1f5bc, U+1f6f7, U+1f6f9, U+1f6fc, U+1f93f, U+1f941, U+1f945, U+1f947-1f94f, U+1f9e7-1f9e9, U+1f9f5-1f9f6, U+1fa70-1fa71, U+1fa80-1fa81, U+1fa83-1fa85, U+1fa87-1fa88, U+1fa94-1fa95, U+1fa97-1fa98, U+1faa1, U+1faa9',\n },\n {\n family: 'Noto Color Emoji',\n src: 'https://api.chayns-static.space/font/NotoColorEmoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFabsE4tq3luCC7p-aXxcn.5.woff2',\n unicodeRange:\n 'U+2693, U+26e9-26ea, U+26f1-26f2, U+26f4-26f5, U+26fa, U+26fd, U+2708, U+fe0f, U+1f301, U+1f303, U+1f306-1f307, U+1f309, U+1f310, U+1f3a0-1f3a2, U+1f3aa, U+1f3cd-1f3ce, U+1f3d5, U+1f3d7-1f3db, U+1f3df-1f3e6, U+1f3e8-1f3ed, U+1f3ef-1f3f0, U+1f488, U+1f492, U+1f4ba, U+1f54b-1f54d, U+1f5fa-1f5ff, U+1f680-1f6a2, U+1f6a4-1f6a8, U+1f6b2, U+1f6d1, U+1f6d5-1f6d6, U+1f6dd-1f6df, U+1f6e2-1f6e5, U+1f6e9, U+1f6eb-1f6ec, U+1f6f3-1f6f6, U+1f6f8, U+1f6fa-1f6fb, U+1f9bc-1f9bd, U+1f9ed, U+1f9f3, U+1fa7c',\n },\n {\n family: 'Noto Color Emoji',\n src: 'https://api.chayns-static.space/font/NotoColorEmoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFabsE4tq3luCC7p-aXxcn.6.woff2',\n unicodeRange:\n 'U+2615, U+fe0f, U+1f32d-1f330, U+1f336, U+1f33d, U+1f345-1f37f, U+1f382, U+1f52a, U+1f942-1f944, U+1f950-1f96f, U+1f99e, U+1f9aa, U+1f9c0-1f9cb, U+1fad0-1fadb',\n },\n {\n family: 'Noto Color Emoji',\n src: 'https://api.chayns-static.space/font/NotoColorEmoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFabsE4tq3luCC7p-aXxcn.7.woff2',\n unicodeRange:\n 'U+200d, U+2600-2601, U+2603-2604, U+2614, U+2618, U+26a1, U+26c4-26c5, U+26c8, U+26f0, U+2728, U+2744, U+2b1b, U+2b50, U+fe0f, U+1f300, U+1f304-1f305, U+1f308, U+1f30a-1f30f, U+1f311-1f321, U+1f324-1f32c, U+1f331-1f335, U+1f337-1f33c, U+1f33e-1f344, U+1f3d4, U+1f3d6, U+1f3dc-1f3de, U+1f3f5, U+1f400-1f43f, U+1f490, U+1f4a7, U+1f4ab, U+1f4ae, U+1f525, U+1f54a, U+1f573, U+1f577-1f578, U+1f648-1f64a, U+1f940, U+1f980-1f9ae, U+1f9ba, U+1fa90, U+1faa8, U+1fab0-1fabd, U+1fabf, U+1face-1facf, U+1fae7',\n },\n {\n family: 'Noto Color Emoji',\n src: 'https://api.chayns-static.space/font/NotoColorEmoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFabsE4tq3luCC7p-aXxcn.8.woff2',\n unicodeRange:\n 'U+200d, U+2640, U+2642, U+2695-2696, U+26f7, U+26f9, U+2708, U+2764, U+fe0f, U+1f33e, U+1f373, U+1f37c, U+1f384-1f385, U+1f393, U+1f3a4, U+1f3a8, U+1f3c2-1f3c4, U+1f3c7, U+1f3ca-1f3cc, U+1f3eb, U+1f3ed, U+1f3fb-1f3ff, U+1f466-1f478, U+1f47c, U+1f481-1f483, U+1f486-1f487, U+1f48b, U+1f48f, U+1f491, U+1f4bb-1f4bc, U+1f527, U+1f52c, U+1f574-1f575, U+1f57a, U+1f645-1f647, U+1f64b, U+1f64d-1f64e, U+1f680, U+1f692, U+1f6a3, U+1f6b4-1f6b6, U+1f6c0, U+1f6cc, U+1f91d, U+1f926, U+1f930-1f931, U+1f934-1f93a, U+1f93c-1f93e, U+1f977, U+1f9af-1f9b3, U+1f9b8-1f9b9, U+1f9bc-1f9bd, U+1f9cc-1f9cf, U+1f9d1-1f9df, U+1fa82, U+1fac3-1fac5',\n },\n {\n family: 'Noto Color Emoji',\n src: 'https://api.chayns-static.space/font/NotoColorEmoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFabsE4tq3luCC7p-aXxcn.9.woff2',\n unicodeRange:\n 'U+200d, U+261d, U+2620, U+2639-263a, U+2665, U+270a-270d, U+2728, U+2763-2764, U+2b50, U+fe0f, U+1f31a-1f31f, U+1f32b, U+1f383, U+1f389, U+1f3fb-1f3ff, U+1f440-1f450, U+1f463-1f465, U+1f479-1f47b, U+1f47d-1f480, U+1f485, U+1f48b-1f48c, U+1f493-1f49f, U+1f4a4-1f4a6, U+1f4a8-1f4ab, U+1f4af, U+1f525, U+1f573, U+1f590, U+1f595-1f596, U+1f5a4, U+1f5e3, U+1f600-1f644, U+1f648-1f64a, U+1f64c, U+1f64f, U+1f90c-1f925, U+1f927-1f92f, U+1f932-1f933, U+1f970-1f976, U+1f978-1f97a, U+1f9a0, U+1f9b4-1f9b7, U+1f9bb, U+1f9be-1f9bf, U+1f9d0, U+1f9e0-1f9e1, U+1fa75-1fa79, U+1fac0-1fac2, U+1fae0-1fae6, U+1fae8, U+1faf0-1faf8',\n },\n];\n\nexport const convertIconStyle = (iconStyle: IconStyle) => {\n switch (iconStyle) {\n case IconStyle.SOLID:\n return 'fa-solid';\n case IconStyle.DUOTONE:\n return 'fa-duotone';\n case IconStyle.SHARP:\n return 'fa-sharp';\n case IconStyle.LIGHT:\n return 'fa-light';\n default:\n return 'fa-regular';\n }\n};\n\nexport const getFontSize = () => {\n const element = document.createElement('p');\n\n element.style.position = 'absolute';\n element.style.opacity = '0';\n\n element.textContent = 'Ich war hier';\n\n document.body.appendChild(element);\n\n const { fontSize } = window.getComputedStyle(element);\n\n document.body.removeChild(element);\n\n return fontSize.replace('px', '');\n};\n\nexport const generateFontFaces = () =>\n fonts\n .map(\n (font) => `\n @font-face {\n font-display: swap;\n font-family: \"${font.family}\";\n font-style: normal;\n font-weight: 400;\n src: url(\"${font.src}\") format(\"woff2\");\n ${font.unicodeRange ? `unicode-range: ${font.unicodeRange};` : ''}\n }\n`,\n )\n .join('');\n"],"mappings":";;;;;;AAAA,IAAAA,oBAAA,GAAAC,OAAA;AAQA,MAAMC,KAAa,GAAG,CAClB;EACIC,MAAM,EAAE,kBAAkB;EAC1BC,GAAG,EAAE,kHAAkH;EACvHC,YAAY,EAAE;AAClB,CAAC,EACD;EACIF,MAAM,EAAE,kBAAkB;EAC1BC,GAAG,EAAE,kHAAkH;EACvHC,YAAY,EACR;AACR,CAAC,EACD;EACIF,MAAM,EAAE,kBAAkB;EAC1BC,GAAG,EAAE,kHAAkH;EACvHC,YAAY,EACR;AACR,CAAC,EACD;EACIF,MAAM,EAAE,kBAAkB;EAC1BC,GAAG,EAAE,kHAAkH;EACvHC,YAAY,EACR;AACR,CAAC,EACD;EACIF,MAAM,EAAE,kBAAkB;EAC1BC,GAAG,EAAE,kHAAkH;EACvHC,YAAY,EACR;AACR,CAAC,EACD;EACIF,MAAM,EAAE,kBAAkB;EAC1BC,GAAG,EAAE,kHAAkH;EACvHC,YAAY,EACR;AACR,CAAC,EACD;EACIF,MAAM,EAAE,kBAAkB;EAC1BC,GAAG,EAAE,kHAAkH;EACvHC,YAAY,EACR;AACR,CAAC,EACD;EACIF,MAAM,EAAE,kBAAkB;EAC1BC,GAAG,EAAE,kHAAkH;EACvHC,YAAY,EACR;AACR,CAAC,EACD;EACIF,MAAM,EAAE,kBAAkB;EAC1BC,GAAG,EAAE,kHAAkH;EACvHC,YAAY,EACR;AACR,CAAC,EACD;EACIF,MAAM,EAAE,kBAAkB;EAC1BC,GAAG,EAAE,kHAAkH;EACvHC,YAAY,EACR;AACR,CAAC,CACJ;AAEM,MAAMC,gBAAgB,GAAIC,SAAoB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}
|
|
1
|
+
{"version":3,"file":"font.js","names":["_colorSchemeProvider","require","fonts","family","src","unicodeRange","convertIconStyle","iconStyle","IconStyle","SOLID","DUOTONE","SHARP","LIGHT","exports","getFontSize","element","document","createElement","style","position","opacity","textContent","body","appendChild","fontSize","window","getComputedStyle","removeChild","replace","hexToRgb","hex","r","g","b","a","result","exec","parseInt","undefined","getHeadlineColorSelector","data","themeResult","colorResult","headlineMap","h1","h2","h3","h4","h5","h6","p","footer","forEach","selector","color","backgroundColor","design","_selectors","selectors","split","tag","length","trim","path","String","hexPath","rgbPath","rgb","generateFontFaces","map","font","join"],"sources":["../../../src/utils/font.ts"],"sourcesContent":["import { IconStyle, type ParagraphFormat } from '../types/colorSchemeProvider';\n\nexport interface Font {\n family: string;\n src: string;\n unicodeRange?: string;\n}\n\nconst fonts: Font[] = [\n {\n family: 'Noto Color Emoji',\n src: 'https://api.chayns-static.space/font/NotoColorEmoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFabsE4tq3luCC7p-aXxcn.0.woff2',\n unicodeRange: 'U+1f1e6-1f1ff',\n },\n {\n family: 'Noto Color Emoji',\n src: 'https://api.chayns-static.space/font/NotoColorEmoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFabsE4tq3luCC7p-aXxcn.1.woff2',\n unicodeRange:\n 'U+200d, U+2620, U+26a7, U+fe0f, U+1f308, U+1f38c, U+1f3c1, U+1f3f3-1f3f4, U+1f6a9, U+e0062-e0063, U+e0065, U+e0067, U+e006c, U+e006e, U+e0073-e0074, U+e0077, U+e007f',\n },\n {\n family: 'Noto Color Emoji',\n src: 'https://api.chayns-static.space/font/NotoColorEmoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFabsE4tq3luCC7p-aXxcn.2.woff2',\n unicodeRange:\n 'U+23, U+2a, U+30-39, U+a9, U+ae, U+200d, U+203c, U+2049, U+20e3, U+2122, U+2139, U+2194-2199, U+21a9-21aa, U+23cf, U+23e9-23ef, U+23f8-23fa, U+24c2, U+25aa-25ab, U+25b6, U+25c0, U+25fb-25fe, U+2611, U+2622-2623, U+2626, U+262a, U+262e-262f, U+2638, U+2640, U+2642, U+2648-2653, U+2660, U+2663, U+2665-2666, U+2668, U+267b, U+267e-267f, U+2695, U+269b-269c, U+26a0, U+26a7, U+26aa-26ab, U+26ce, U+26d4, U+2705, U+2714, U+2716, U+271d, U+2721, U+2733-2734, U+2747, U+274c, U+274e, U+2753-2755, U+2757, U+2764, U+2795-2797, U+27a1, U+27b0, U+27bf, U+2934-2935, U+2b05-2b07, U+2b1b-2b1c, U+2b55, U+3030, U+303d, U+3297, U+3299, U+fe0f, U+1f170-1f171, U+1f17e-1f17f, U+1f18e, U+1f191-1f19a, U+1f201-1f202, U+1f21a, U+1f22f, U+1f232-1f23a, U+1f250-1f251, U+1f310, U+1f3a6, U+1f3b5-1f3b6, U+1f3bc, U+1f3e7, U+1f441, U+1f499-1f49c, U+1f49f-1f4a0, U+1f4a2, U+1f4ac-1f4ad, U+1f4b1-1f4b2, U+1f4b9, U+1f4db, U+1f4f2-1f4f6, U+1f500-1f50a, U+1f515, U+1f518-1f524, U+1f52f-1f53d, U+1f549, U+1f54e, U+1f5a4, U+1f5e8, U+1f5ef, U+1f6ab, U+1f6ad-1f6b1, U+1f6b3, U+1f6b7-1f6bc, U+1f6be, U+1f6c2-1f6c5, U+1f6d0-1f6d1, U+1f6d7, U+1f6dc, U+1f7e0-1f7eb, U+1f7f0, U+1f90d-1f90e, U+1f9e1, U+1fa75-1fa77, U+1faaf',\n },\n {\n family: 'Noto Color Emoji',\n src: 'https://api.chayns-static.space/font/NotoColorEmoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFabsE4tq3luCC7p-aXxcn.3.woff2',\n unicodeRange:\n 'U+231a-231b, U+2328, U+23f0-23f3, U+2602, U+260e, U+2692, U+2694, U+2696-2697, U+2699, U+26b0-26b1, U+26cf, U+26d1, U+26d3, U+2702, U+2709, U+270f, U+2712, U+fe0f, U+1f302, U+1f321, U+1f392-1f393, U+1f3a9, U+1f3bd, U+1f3ee, U+1f3f7, U+1f3fa, U+1f451-1f462, U+1f484, U+1f489-1f48a, U+1f48c-1f48e, U+1f4a1, U+1f4a3, U+1f4b0, U+1f4b3-1f4b8, U+1f4bb-1f4da, U+1f4dc-1f4f1, U+1f4ff, U+1f50b-1f514, U+1f516-1f517, U+1f526-1f529, U+1f52c-1f52e, U+1f550-1f567, U+1f56f-1f570, U+1f576, U+1f587, U+1f58a-1f58d, U+1f5a5, U+1f5a8, U+1f5b1-1f5b2, U+1f5c2-1f5c4, U+1f5d1-1f5d3, U+1f5dc-1f5de, U+1f5e1, U+1f5f3, U+1f6aa, U+1f6ac, U+1f6bd, U+1f6bf, U+1f6c1, U+1f6cb, U+1f6cd-1f6cf, U+1f6d2, U+1f6e0-1f6e1, U+1f6f0, U+1f97b-1f97f, U+1f9af, U+1f9ba, U+1f9e2-1f9e6, U+1f9ea-1f9ec, U+1f9ee-1f9f4, U+1f9f7-1f9ff, U+1fa71-1fa74, U+1fa79-1fa7b, U+1fa86, U+1fa91-1fa93, U+1fa96, U+1fa99-1faa0, U+1faa2-1faa7, U+1faaa-1faae',\n },\n {\n family: 'Noto Color Emoji',\n src: 'https://api.chayns-static.space/font/NotoColorEmoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFabsE4tq3luCC7p-aXxcn.4.woff2',\n unicodeRange:\n 'U+265f, U+26bd-26be, U+26f3, U+26f8, U+fe0f, U+1f004, U+1f0cf, U+1f380-1f384, U+1f386-1f38b, U+1f38d-1f391, U+1f396-1f397, U+1f399-1f39b, U+1f39e-1f39f, U+1f3a3-1f3a5, U+1f3a7-1f3a9, U+1f3ab-1f3b4, U+1f3b7-1f3bb, U+1f3bd-1f3c0, U+1f3c5-1f3c6, U+1f3c8-1f3c9, U+1f3cf-1f3d3, U+1f3f8-1f3f9, U+1f47e, U+1f4e2, U+1f4f7-1f4fd, U+1f52b, U+1f579, U+1f58c-1f58d, U+1f5bc, U+1f6f7, U+1f6f9, U+1f6fc, U+1f93f, U+1f941, U+1f945, U+1f947-1f94f, U+1f9e7-1f9e9, U+1f9f5-1f9f6, U+1fa70-1fa71, U+1fa80-1fa81, U+1fa83-1fa85, U+1fa87-1fa88, U+1fa94-1fa95, U+1fa97-1fa98, U+1faa1, U+1faa9',\n },\n {\n family: 'Noto Color Emoji',\n src: 'https://api.chayns-static.space/font/NotoColorEmoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFabsE4tq3luCC7p-aXxcn.5.woff2',\n unicodeRange:\n 'U+2693, U+26e9-26ea, U+26f1-26f2, U+26f4-26f5, U+26fa, U+26fd, U+2708, U+fe0f, U+1f301, U+1f303, U+1f306-1f307, U+1f309, U+1f310, U+1f3a0-1f3a2, U+1f3aa, U+1f3cd-1f3ce, U+1f3d5, U+1f3d7-1f3db, U+1f3df-1f3e6, U+1f3e8-1f3ed, U+1f3ef-1f3f0, U+1f488, U+1f492, U+1f4ba, U+1f54b-1f54d, U+1f5fa-1f5ff, U+1f680-1f6a2, U+1f6a4-1f6a8, U+1f6b2, U+1f6d1, U+1f6d5-1f6d6, U+1f6dd-1f6df, U+1f6e2-1f6e5, U+1f6e9, U+1f6eb-1f6ec, U+1f6f3-1f6f6, U+1f6f8, U+1f6fa-1f6fb, U+1f9bc-1f9bd, U+1f9ed, U+1f9f3, U+1fa7c',\n },\n {\n family: 'Noto Color Emoji',\n src: 'https://api.chayns-static.space/font/NotoColorEmoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFabsE4tq3luCC7p-aXxcn.6.woff2',\n unicodeRange:\n 'U+2615, U+fe0f, U+1f32d-1f330, U+1f336, U+1f33d, U+1f345-1f37f, U+1f382, U+1f52a, U+1f942-1f944, U+1f950-1f96f, U+1f99e, U+1f9aa, U+1f9c0-1f9cb, U+1fad0-1fadb',\n },\n {\n family: 'Noto Color Emoji',\n src: 'https://api.chayns-static.space/font/NotoColorEmoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFabsE4tq3luCC7p-aXxcn.7.woff2',\n unicodeRange:\n 'U+200d, U+2600-2601, U+2603-2604, U+2614, U+2618, U+26a1, U+26c4-26c5, U+26c8, U+26f0, U+2728, U+2744, U+2b1b, U+2b50, U+fe0f, U+1f300, U+1f304-1f305, U+1f308, U+1f30a-1f30f, U+1f311-1f321, U+1f324-1f32c, U+1f331-1f335, U+1f337-1f33c, U+1f33e-1f344, U+1f3d4, U+1f3d6, U+1f3dc-1f3de, U+1f3f5, U+1f400-1f43f, U+1f490, U+1f4a7, U+1f4ab, U+1f4ae, U+1f525, U+1f54a, U+1f573, U+1f577-1f578, U+1f648-1f64a, U+1f940, U+1f980-1f9ae, U+1f9ba, U+1fa90, U+1faa8, U+1fab0-1fabd, U+1fabf, U+1face-1facf, U+1fae7',\n },\n {\n family: 'Noto Color Emoji',\n src: 'https://api.chayns-static.space/font/NotoColorEmoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFabsE4tq3luCC7p-aXxcn.8.woff2',\n unicodeRange:\n 'U+200d, U+2640, U+2642, U+2695-2696, U+26f7, U+26f9, U+2708, U+2764, U+fe0f, U+1f33e, U+1f373, U+1f37c, U+1f384-1f385, U+1f393, U+1f3a4, U+1f3a8, U+1f3c2-1f3c4, U+1f3c7, U+1f3ca-1f3cc, U+1f3eb, U+1f3ed, U+1f3fb-1f3ff, U+1f466-1f478, U+1f47c, U+1f481-1f483, U+1f486-1f487, U+1f48b, U+1f48f, U+1f491, U+1f4bb-1f4bc, U+1f527, U+1f52c, U+1f574-1f575, U+1f57a, U+1f645-1f647, U+1f64b, U+1f64d-1f64e, U+1f680, U+1f692, U+1f6a3, U+1f6b4-1f6b6, U+1f6c0, U+1f6cc, U+1f91d, U+1f926, U+1f930-1f931, U+1f934-1f93a, U+1f93c-1f93e, U+1f977, U+1f9af-1f9b3, U+1f9b8-1f9b9, U+1f9bc-1f9bd, U+1f9cc-1f9cf, U+1f9d1-1f9df, U+1fa82, U+1fac3-1fac5',\n },\n {\n family: 'Noto Color Emoji',\n src: 'https://api.chayns-static.space/font/NotoColorEmoji/v24/Yq6P-KqIXTD0t4D9z1ESnKM3-HpFabsE4tq3luCC7p-aXxcn.9.woff2',\n unicodeRange:\n 'U+200d, U+261d, U+2620, U+2639-263a, U+2665, U+270a-270d, U+2728, U+2763-2764, U+2b50, U+fe0f, U+1f31a-1f31f, U+1f32b, U+1f383, U+1f389, U+1f3fb-1f3ff, U+1f440-1f450, U+1f463-1f465, U+1f479-1f47b, U+1f47d-1f480, U+1f485, U+1f48b-1f48c, U+1f493-1f49f, U+1f4a4-1f4a6, U+1f4a8-1f4ab, U+1f4af, U+1f525, U+1f573, U+1f590, U+1f595-1f596, U+1f5a4, U+1f5e3, U+1f600-1f644, U+1f648-1f64a, U+1f64c, U+1f64f, U+1f90c-1f925, U+1f927-1f92f, U+1f932-1f933, U+1f970-1f976, U+1f978-1f97a, U+1f9a0, U+1f9b4-1f9b7, U+1f9bb, U+1f9be-1f9bf, U+1f9d0, U+1f9e0-1f9e1, U+1fa75-1fa79, U+1fac0-1fac2, U+1fae0-1fae6, U+1fae8, U+1faf0-1faf8',\n },\n];\n\nexport const convertIconStyle = (iconStyle: IconStyle) => {\n switch (iconStyle) {\n case IconStyle.SOLID:\n return 'fa-solid';\n case IconStyle.DUOTONE:\n return 'fa-duotone';\n case IconStyle.SHARP:\n return 'fa-sharp';\n case IconStyle.LIGHT:\n return 'fa-light';\n default:\n return 'fa-regular';\n }\n};\n\nexport const getFontSize = () => {\n const element = document.createElement('p');\n\n element.style.position = 'absolute';\n element.style.opacity = '0';\n\n element.textContent = 'Ich war hier';\n\n document.body.appendChild(element);\n\n const { fontSize } = window.getComputedStyle(element);\n\n document.body.removeChild(element);\n\n return fontSize.replace('px', '');\n};\n\nconst hexToRgb = (hex: string) => {\n let r: number;\n let g: number;\n let b: number;\n let a: number;\n\n const result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})?$/i.exec(hex);\n\n if (result) {\n r = parseInt(result[1] ?? '0', 16);\n g = parseInt(result[2] ?? '0', 16);\n b = parseInt(result[3] ?? '0', 16);\n a = result[4] ? parseInt(result[4], 16) / 100 : 1;\n\n return { r, g, b, a };\n }\n\n return undefined;\n};\n\nexport const getHeadlineColorSelector = (data: ParagraphFormat[]) => {\n const themeResult: { [key: string]: string } = {};\n const colorResult: { [key: string]: string } = {};\n const headlineMap: { [key: string]: string } = {\n h1: 'headline-1',\n h2: 'headline-2',\n h3: 'headline-3',\n h4: 'headline-4',\n h5: 'headline-5',\n h6: 'headline-6',\n p: 'text',\n footer: 'footer',\n '.button': 'button',\n };\n\n data.forEach(({ selector, color, backgroundColor, design }) => {\n const selectors = selector.split(',');\n\n const tag = selectors[selectors.length - 1]?.trim();\n\n const path = headlineMap[tag ?? ''];\n\n if (!path) {\n return;\n }\n\n if (path === 'button' && backgroundColor) {\n themeResult[`${path}BackgroundColor`] = backgroundColor;\n\n if (color) {\n themeResult[`${path}Color`] = color;\n }\n\n if (design) {\n themeResult[`${path}Design`] = String(design);\n }\n\n return;\n }\n\n if (!color) {\n return;\n }\n\n const hexPath = `--chayns-color--${path}`;\n const rgbPath = `--chayns-color-rgb--${path}`;\n\n colorResult[hexPath] = color;\n themeResult[path] = color;\n\n const rgb = hexToRgb(color);\n\n if (!rgb) {\n return;\n }\n\n const { r, g, b } = rgb;\n\n colorResult[rgbPath] = `${r}, ${g}, ${b}`;\n themeResult[`${path}-rgb`] = `${r}, ${g}, ${b}`;\n });\n\n return { colorResult, themeResult };\n};\n\nexport const generateFontFaces = () =>\n fonts\n .map(\n (font) => `\n @font-face {\n font-display: swap;\n font-family: \"${font.family}\";\n font-style: normal;\n font-weight: 400;\n src: url(\"${font.src}\") format(\"woff2\");\n ${font.unicodeRange ? `unicode-range: ${font.unicodeRange};` : ''}\n }\n`,\n )\n .join('');\n"],"mappings":";;;;;;AAAA,IAAAA,oBAAA,GAAAC,OAAA;AAQA,MAAMC,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;IAEA,MAAMW,OAAO,GAAI,mBAAkBF,IAAK,EAAC;IACzC,MAAMG,OAAO,GAAI,uBAAsBH,IAAK,EAAC;IAE7CrB,WAAW,CAACuB,OAAO,CAAC,GAAGX,KAAK;IAC5Bb,WAAW,CAACsB,IAAI,CAAC,GAAGT,KAAK;IAEzB,MAAMa,GAAG,GAAGtC,QAAQ,CAACyB,KAAK,CAAC;IAE3B,IAAI,CAACa,GAAG,EAAE;MACN;IACJ;IAEA,MAAM;MAAEpC,CAAC;MAAEC,CAAC;MAAEC;IAAE,CAAC,GAAGkC,GAAG;IAEvBzB,WAAW,CAACwB,OAAO,CAAC,GAAI,GAAEnC,CAAE,KAAIC,CAAE,KAAIC,CAAE,EAAC;IACzCQ,WAAW,CAAE,GAAEsB,IAAK,MAAK,CAAC,GAAI,GAAEhC,CAAE,KAAIC,CAAE,KAAIC,CAAE,EAAC;EACnD,CAAC,CAAC;EAEF,OAAO;IAAES,WAAW;IAAED;EAAY,CAAC;AACvC,CAAC;AAAC5B,OAAA,CAAA0B,wBAAA,GAAAA,wBAAA;AAEK,MAAM6B,iBAAiB,GAAGA,CAAA,KAC7BlE,KAAK,CACAmE,GAAG,CACCC,IAAI,IAAM;AACvB;AACA;AACA,oBAAoBA,IAAI,CAACnE,MAAO;AAChC;AACA;AACA,gBAAgBmE,IAAI,CAAClE,GAAI;AACzB,MAAMkE,IAAI,CAACjE,YAAY,GAAI,kBAAiBiE,IAAI,CAACjE,YAAa,GAAE,GAAG,EAAG;AACtE;AACA,CACQ,CAAC,CACAkE,IAAI,CAAC,EAAE,CAAC;AAAC1D,OAAA,CAAAuD,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
package/lib/esm/api/theme/get.js
CHANGED
|
@@ -11,4 +11,16 @@ export const getDesignSettings = async () => {
|
|
|
11
11
|
}
|
|
12
12
|
return undefined;
|
|
13
13
|
};
|
|
14
|
+
export const getParagraphFormat = async () => {
|
|
15
|
+
const {
|
|
16
|
+
id
|
|
17
|
+
} = getSite();
|
|
18
|
+
const response = await fetch(`https://api.chayns.net/css/${id}/paragraphFormat`, {
|
|
19
|
+
method: 'GET'
|
|
20
|
+
});
|
|
21
|
+
if (response.status === 200) {
|
|
22
|
+
return await response.json();
|
|
23
|
+
}
|
|
24
|
+
return undefined;
|
|
25
|
+
};
|
|
14
26
|
//# sourceMappingURL=get.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.js","names":["getSite","getDesignSettings","id","response","fetch","method","status","json","undefined"],"sources":["../../../../src/api/theme/get.ts"],"sourcesContent":["import { getSite } from 'chayns-api';\nimport type { DesignSettings } from '../../types/colorSchemeProvider';\n\nexport const getDesignSettings = async (): Promise<DesignSettings | undefined> => {\n const { id } = getSite();\n\n const response = await fetch(`https://api.chayns.net/css/${id}/style/v2`, {\n method: 'GET',\n });\n\n if (response.status === 200) {\n return (await response.json()) as DesignSettings;\n }\n\n return undefined;\n};\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,YAAY;AAGpC,OAAO,MAAMC,iBAAiB,GAAG,MAAAA,CAAA,KAAiD;EAC9E,MAAM;IAAEC;EAAG,CAAC,GAAGF,OAAO,CAAC,CAAC;EAExB,MAAMG,QAAQ,GAAG,MAAMC,KAAK,CAAE,8BAA6BF,EAAG,WAAU,EAAE;IACtEG,MAAM,EAAE;EACZ,CAAC,CAAC;EAEF,IAAIF,QAAQ,CAACG,MAAM,KAAK,GAAG,EAAE;IACzB,OAAQ,MAAMH,QAAQ,CAACI,IAAI,CAAC,CAAC;EACjC;EAEA,OAAOC,SAAS;AACpB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"get.js","names":["getSite","getDesignSettings","id","response","fetch","method","status","json","undefined","getParagraphFormat"],"sources":["../../../../src/api/theme/get.ts"],"sourcesContent":["import { getSite } from 'chayns-api';\nimport type { DesignSettings, ParagraphFormat } from '../../types/colorSchemeProvider';\n\nexport const getDesignSettings = async (): Promise<DesignSettings | undefined> => {\n const { id } = getSite();\n\n const response = await fetch(`https://api.chayns.net/css/${id}/style/v2`, {\n method: 'GET',\n });\n\n if (response.status === 200) {\n return (await response.json()) as DesignSettings;\n }\n\n return undefined;\n};\n\nexport const getParagraphFormat = async (): Promise<ParagraphFormat[] | undefined> => {\n const { id } = getSite();\n\n const response = await fetch(`https://api.chayns.net/css/${id}/paragraphFormat`, {\n method: 'GET',\n });\n\n if (response.status === 200) {\n return (await response.json()) as ParagraphFormat[];\n }\n\n return undefined;\n};\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,YAAY;AAGpC,OAAO,MAAMC,iBAAiB,GAAG,MAAAA,CAAA,KAAiD;EAC9E,MAAM;IAAEC;EAAG,CAAC,GAAGF,OAAO,CAAC,CAAC;EAExB,MAAMG,QAAQ,GAAG,MAAMC,KAAK,CAAE,8BAA6BF,EAAG,WAAU,EAAE;IACtEG,MAAM,EAAE;EACZ,CAAC,CAAC;EAEF,IAAIF,QAAQ,CAACG,MAAM,KAAK,GAAG,EAAE;IACzB,OAAQ,MAAMH,QAAQ,CAACI,IAAI,CAAC,CAAC;EACjC;EAEA,OAAOC,SAAS;AACpB,CAAC;AAED,OAAO,MAAMC,kBAAkB,GAAG,MAAAA,CAAA,KAAoD;EAClF,MAAM;IAAEP;EAAG,CAAC,GAAGF,OAAO,CAAC,CAAC;EAExB,MAAMG,QAAQ,GAAG,MAAMC,KAAK,CAAE,8BAA6BF,EAAG,kBAAiB,EAAE;IAC7EG,MAAM,EAAE;EACZ,CAAC,CAAC;EAEF,IAAIF,QAAQ,CAACG,MAAM,KAAK,GAAG,EAAE;IACzB,OAAQ,MAAMH,QAAQ,CAACI,IAAI,CAAC,CAAC;EACjC;EAEA,OAAOC,SAAS;AACpB,CAAC","ignoreList":[]}
|