@lobehub/ui
Version:
Lobe UI is an open-source UI component library for building AIGC web apps
1 lines • 9.33 kB
Source Map (JSON)
{"version":3,"file":"style.mjs","names":[],"sources":["../../../src/awesome/Giscus/style.ts"],"sourcesContent":["import { css, useTheme } from 'antd-style';\nimport { rgba } from 'polished';\nimport { useMemo } from 'react';\n\nimport { safeReadableColor } from '@/utils/safeReadableColor';\n\nexport const useStyles = () => {\n const theme = useTheme();\n const colorText = theme.colorText;\n const colorTextSecondary = theme.colorTextSecondary;\n const colorTextTertiary = theme.colorTextTertiary;\n const colorRed = theme.colorError;\n const colorOrange = theme.colorWarning;\n const colorGreen = theme.colorSuccess;\n const colorBlue = theme.colorInfo;\n const loaderContainer = theme.isDarkMode\n ? 'https://github.com/images/modules/pulls/progressive-disclosure-line-dark.svg'\n : 'https://github.com/images/modules/pulls/progressive-disclosure-line.svg';\n const loadingImage = theme.isDarkMode\n ? 'https://github.githubassets.com/images/mona-loading-dark.gif'\n : 'https://github.githubassets.com/images/mona-loading-default.gif';\n const { styles } = css`\n main {\n --color-prettylights-syntax-comment: ${colorTextTertiary};\n --color-prettylights-syntax-constant: ${colorGreen};\n --color-prettylights-syntax-entity: ${colorOrange};\n --color-prettylights-syntax-storage-modifier-import: ${colorRed};\n --color-prettylights-syntax-entity-tag: ${colorBlue};\n --color-prettylights-syntax-keyword: ${colorBlue};\n --color-prettylights-syntax-string: ${colorGreen};\n --color-prettylights-syntax-variable: ${colorRed};\n --color-prettylights-syntax-brackethighlighter-unmatched: ${colorRed};\n --color-prettylights-syntax-invalid-illegal-text: ${colorTextSecondary};\n --color-prettylights-syntax-invalid-illegal-bg: ${rgba(colorRed, 0.4)};\n --color-prettylights-syntax-carriage-return-text: ${colorTextSecondary};\n --color-prettylights-syntax-carriage-return-bg: ${rgba(colorRed, 0.6)};\n --color-prettylights-syntax-string-regexp: ${colorGreen};\n --color-prettylights-syntax-markup-list: ${colorOrange};\n --color-prettylights-syntax-markup-heading: ${colorBlue};\n --color-prettylights-syntax-markup-italic: ${colorTextSecondary};\n --color-prettylights-syntax-markup-bold: ${colorTextSecondary};\n --color-prettylights-syntax-markup-deleted-text: ${colorTextSecondary};\n --color-prettylights-syntax-markup-deleted-bg: ${rgba(colorRed, 0.2)};\n --color-prettylights-syntax-markup-inserted-text: ${colorGreen};\n --color-prettylights-syntax-markup-inserted-bg: ${rgba(colorGreen, 0.2)};\n --color-prettylights-syntax-markup-changed-text: ${colorOrange};\n --color-prettylights-syntax-markup-changed-bg: ${rgba(colorRed, 0.2)};\n --color-prettylights-syntax-markup-ignored-text: ${colorTextSecondary};\n --color-prettylights-syntax-markup-ignored-bg: ${rgba(colorBlue, 0.2)};\n --color-prettylights-syntax-meta-diff-range: ${colorOrange};\n --color-prettylights-syntax-brackethighlighter-angle: ${colorTextSecondary};\n --color-prettylights-syntax-sublimelinter-gutter-mark: ${colorTextTertiary};\n --color-prettylights-syntax-constant-other-reference-link: ${colorBlue};\n --color-btn-text: ${theme.colorText};\n --color-btn-bg: ${theme.colorFillTertiary};\n --color-btn-border: ${theme.colorBorderSecondary};\n --color-btn-shadow: 0 0 transparent;\n --color-btn-inset-shadow: 0 0 transparent;\n --color-btn-hover-bg: ${theme.colorFillSecondary};\n --color-btn-hover-border: ${theme.colorBorder};\n --color-btn-active-bg: ${theme.colorFillSecondary};\n --color-btn-active-border: ${theme.colorBorder};\n --color-btn-selected-bg: ${theme.colorFillSecondary};\n --color-btn-primary-text: ${safeReadableColor(theme.colorPrimary)};\n --color-btn-primary-bg: ${theme.colorPrimary};\n --color-btn-primary-border: ${theme.colorPrimaryBorder};\n --color-btn-primary-shadow: 0 0 transparent;\n --color-btn-primary-inset-shadow: 0 0 transparent;\n --color-btn-primary-hover-bg: ${theme.colorPrimaryHover};\n --color-btn-primary-hover-border: ${theme.colorPrimaryBorderHover};\n --color-btn-primary-selected-bg: ${theme.colorPrimaryActive};\n --color-btn-primary-selected-shadow: 0 0 transparent;\n --color-btn-primary-disabled-text: ${rgba(safeReadableColor(theme.colorPrimary), 0.5)};\n --color-btn-primary-disabled-bg: ${rgba(theme.colorPrimary, 0.5)};\n --color-btn-primary-disabled-border: ${rgba(theme.colorPrimaryBorder, 0.5)};\n --color-action-list-item-default-hover-bg: ${theme.colorFillQuaternary};\n --color-segmented-control-bg: ${theme.colorFillTertiary};\n --color-segmented-control-button-bg: transparent;\n --color-segmented-control-button-selected-border: ${theme.colorBorder};\n --color-fg-default: ${theme.colorText};\n --color-fg-muted: ${theme.colorTextSecondary};\n --color-fg-subtle: ${theme.colorTextQuaternary};\n --color-canvas-default: transparent;\n --color-canvas-overlay: ${theme.colorBgElevated};\n --color-canvas-inset: transparent;\n --color-canvas-subtle: ${theme.colorFillQuaternary};\n --color-border-default: ${theme.colorBorder};\n --color-border-muted: ${theme.colorBorderSecondary};\n --color-neutral-muted: ${theme.colorFillQuaternary};\n --color-neutral-subtle: ${theme.colorFillTertiary};\n --color-accent-fg: ${theme.colorInfo};\n --color-accent-emphasis: ${theme.colorInfoBorderHover};\n --color-accent-muted: ${theme.colorInfoBorder};\n --color-accent-subtle: ${theme.colorInfoBg};\n --color-success-fg: ${theme.colorSuccess};\n --color-attention-fg: ${theme.colorWarning};\n --color-attention-muted: ${theme.colorWarningBorder};\n --color-attention-subtle: ${theme.colorWarningBg};\n --color-danger-fg: ${theme.colorError};\n --color-danger-muted: ${theme.colorErrorBorder};\n --color-danger-subtle: ${theme.colorErrorBg};\n --color-primer-shadow-inset: 0 0 transparent;\n --color-scale-gray-7: ${theme.colorBgContainer};\n --color-scale-blue-8: ${theme.colorInfoBg};\n --color-social-reaction-bg-hover: ${theme.colorFillSecondary};\n --color-social-reaction-bg-reacted-hover: ${theme.colorInfoBgHover};\n\n .markdown pre {\n color: ${colorText};\n }\n\n .pagination-loader-container {\n background-image: url(${loaderContainer});\n }\n\n .gsc-pagination-button {\n background-color: var(--color-btn-bg);\n }\n\n .gsc-reactions-popover {\n width: 170px;\n\n > .m-2 {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n }\n }\n\n .gsc-emoji-button.has-reacted {\n border-color: ${theme.colorInfoBorderHover};\n border-radius: ${theme.borderRadius}px;\n }\n\n .gsc-loading-image {\n background-image: url(${loadingImage});\n }\n }\n `;\n\n return useMemo(() => `data:text/css;base64,${btoa(styles)}`, [styles]);\n};\n\nexport const formatLang = (lang: string) => {\n if (['zh_CN', 'zh_TW'].includes(lang)) {\n return lang.replace('_', '-');\n } else if (lang === 'zh_HK') {\n return 'zh-TW';\n } else {\n return lang.split('_')[0];\n }\n};\n"],"mappings":";;;;;;AAMA,MAAa,kBAAkB;CAC7B,MAAM,QAAQ,UAAU;CACxB,MAAM,YAAY,MAAM;CACxB,MAAM,qBAAqB,MAAM;CACjC,MAAM,oBAAoB,MAAM;CAChC,MAAM,WAAW,MAAM;CACvB,MAAM,cAAc,MAAM;CAC1B,MAAM,aAAa,MAAM;CACzB,MAAM,YAAY,MAAM;CACxB,MAAM,kBAAkB,MAAM,aAC1B,iFACA;CACJ,MAAM,eAAe,MAAM,aACvB,iEACA;CACJ,MAAM,EAAE,WAAW,GAAG;;6CAEqB,kBAAkB;8CACjB,WAAW;4CACb,YAAY;6DACK,SAAS;gDACtB,UAAU;6CACb,UAAU;4CACX,WAAW;8CACT,SAAS;kEACW,SAAS;0DACjB,mBAAmB;wDACrB,KAAK,UAAU,GAAI,CAAC;0DAClB,mBAAmB;wDACrB,KAAK,UAAU,GAAI,CAAC;mDACzB,WAAW;iDACb,YAAY;oDACT,UAAU;mDACX,mBAAmB;iDACrB,mBAAmB;yDACX,mBAAmB;uDACrB,KAAK,UAAU,GAAI,CAAC;0DACjB,WAAW;wDACb,KAAK,YAAY,GAAI,CAAC;yDACrB,YAAY;uDACd,KAAK,UAAU,GAAI,CAAC;yDAClB,mBAAmB;uDACrB,KAAK,WAAW,GAAI,CAAC;qDACvB,YAAY;8DACH,mBAAmB;+DAClB,kBAAkB;mEACd,UAAU;0BACnD,MAAM,UAAU;wBAClB,MAAM,kBAAkB;4BACpB,MAAM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