@lobehub/ui 6.0.0-beta.9 → 6.0.1
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/README.md +3 -3
- package/es/Accordion/style.d.mts +1 -1
- package/es/CodeDiff/DiffPanel.mjs +2 -2
- package/es/CodeDiff/DiffPanel.mjs.map +1 -1
- package/es/Drawer/atoms.mjs +2 -1
- package/es/Drawer/atoms.mjs.map +1 -1
- package/es/Drawer/style.mjs.map +1 -1
- package/es/DropdownMenu/atoms.mjs +2 -1
- package/es/DropdownMenu/atoms.mjs.map +1 -1
- package/es/FloatingPanel/style.mjs +3 -2
- package/es/FloatingPanel/style.mjs.map +1 -1
- package/es/Form/Form.mjs +6 -2
- package/es/Form/Form.mjs.map +1 -1
- package/es/Form/style.mjs +3 -3
- package/es/Form/style.mjs.map +1 -1
- package/es/Form/type.d.mts +7 -0
- package/es/Modal/atoms.mjs +2 -1
- package/es/Modal/atoms.mjs.map +1 -1
- package/es/Popover/PopoverInGroup.mjs +2 -1
- package/es/Popover/PopoverInGroup.mjs.map +1 -1
- package/es/Popover/atoms.mjs +2 -1
- package/es/Popover/atoms.mjs.map +1 -1
- package/es/Popover/style.mjs +1 -1
- package/es/Popover/style.mjs.map +1 -1
- package/es/ProTable/hooks/useFetchData.mjs +1 -1
- package/es/ProTable/hooks/useFetchData.mjs.map +1 -1
- package/es/ProTable/parts/FieldControl.mjs +28 -11
- package/es/ProTable/parts/FieldControl.mjs.map +1 -1
- package/es/ProTable/style.mjs +9 -0
- package/es/ProTable/style.mjs.map +1 -1
- package/es/ProTable/type.d.mts +5 -2
- package/es/Segmented/Segmented.mjs +2 -1
- package/es/Segmented/Segmented.mjs.map +1 -1
- package/es/Segmented/type.d.mts +7 -0
- package/es/Select/atoms.mjs +2 -1
- package/es/Select/atoms.mjs.map +1 -1
- package/es/Switch/Switch.mjs +8 -1
- package/es/Switch/Switch.mjs.map +1 -1
- package/es/Switch/atoms.d.mts +7 -1
- package/es/Switch/atoms.mjs +20 -4
- package/es/Switch/atoms.mjs.map +1 -1
- package/es/Switch/style.mjs +33 -2
- package/es/Switch/style.mjs.map +1 -1
- package/es/Table/Table.mjs +14 -5
- package/es/Table/Table.mjs.map +1 -1
- package/es/Table/render/FixedFrost.mjs +11 -2
- package/es/Table/render/FixedFrost.mjs.map +1 -1
- package/es/Table/style.mjs +4 -0
- package/es/Table/style.mjs.map +1 -1
- package/es/Toast/dodge.mjs +0 -1
- package/es/Toast/dodge.mjs.map +1 -1
- package/es/Toast/dodge.stylex.mjs +1 -4
- package/es/Toast/dodge.stylex.mjs.map +1 -1
- package/es/Toast/style.mjs +1 -1
- package/es/Toast/style.mjs.map +1 -1
- package/es/Tooltip/TooltipInGroup.mjs +2 -1
- package/es/Tooltip/TooltipInGroup.mjs.map +1 -1
- package/es/Tooltip/TooltipStandalone.mjs +2 -1
- package/es/Tooltip/TooltipStandalone.mjs.map +1 -1
- package/es/Tooltip/style.mjs +2 -2
- package/es/Tooltip/style.mjs.map +1 -1
- package/es/color/index.d.mts +2 -1
- package/es/color/index.mjs +2 -1
- package/es/color/status/error.mjs +67 -0
- package/es/color/status/error.mjs.map +1 -0
- package/es/color/status/index.d.mts +11 -0
- package/es/color/status/index.mjs +15 -0
- package/es/color/status/index.mjs.map +1 -0
- package/es/color/status/info.mjs +67 -0
- package/es/color/status/info.mjs.map +1 -0
- package/es/color/status/success.mjs +67 -0
- package/es/color/status/success.mjs.map +1 -0
- package/es/color/status/warning.mjs +67 -0
- package/es/color/status/warning.mjs.map +1 -0
- package/es/hooks/useNativeButton.mjs +1 -0
- package/es/hooks/useNativeButton.mjs.map +1 -1
- package/es/index.d.mts +4 -2
- package/es/index.mjs +4 -2
- package/es/style.css +114 -23
- package/es/styles/index.d.mts +4 -2
- package/es/styles/index.mjs +4 -2
- package/es/styles/stylex/cssVar.stylex.mjs +3 -0
- package/es/styles/stylex/cssVar.stylex.mjs.map +1 -1
- package/es/styles/theme/createLobeToken.d.mts +11 -7
- package/es/styles/theme/createLobeToken.mjs +3 -2
- package/es/styles/theme/createLobeToken.mjs.map +1 -1
- package/es/styles/theme/customNeutral.d.mts +28 -0
- package/es/styles/theme/customNeutral.mjs +84 -0
- package/es/styles/theme/customNeutral.mjs.map +1 -0
- package/es/styles/theme/customPalette.d.mts +6 -0
- package/es/styles/theme/customPalette.mjs +32 -0
- package/es/styles/theme/customPalette.mjs.map +1 -0
- package/es/styles/theme/customPrimary.mjs +52 -17
- package/es/styles/theme/customPrimary.mjs.map +1 -1
- package/es/styles/theme/scope.d.mts +7 -5
- package/es/styles/theme/scope.mjs +105 -22
- package/es/styles/theme/scope.mjs.map +1 -1
- package/es/styles/theme/themeCss.d.mts +3 -0
- package/es/styles/theme/themeCss.mjs +46 -1
- package/es/styles/theme/themeCss.mjs.map +1 -1
- package/es/styles/theme/token/legacy.mjs +12 -12
- package/es/styles/theme/token/legacy.mjs.map +1 -1
- package/es/styles/theme/token/neutral.mjs +13 -7
- package/es/styles/theme/token/neutral.mjs.map +1 -1
- package/es/styles/theme/token/neutralText.d.mts +4 -0
- package/es/styles/theme/token/neutralText.mjs +91 -0
- package/es/styles/theme/token/neutralText.mjs.map +1 -0
- package/es/styles/theme/token/palette.mjs +16 -41
- package/es/styles/theme/token/palette.mjs.map +1 -1
- package/es/styles/theme/token/static.mjs +3 -0
- package/es/styles/theme/token/static.mjs.map +1 -1
- package/es/theme.css +293 -290
- package/es/utils/getElementRef.mjs +17 -0
- package/es/utils/getElementRef.mjs.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope.mjs","names":[],"sources":["../../../src/styles/theme/scope.tsx"],"sourcesContent":["'use client';\n\nimport {\n createContext,\n type CSSProperties,\n type ReactNode,\n use,\n useMemo,\n useSyncExternalStore,\n} from 'react';\n\nimport type { NeutralColors } from '../customTheme';\nimport { createLobeToken, type LobeToken } from './createLobeToken';\nimport {\n type CustomPrimaryColor,\n isCustomPrimaryColor,\n type LobePrimaryColor,\n} from './customPrimary';\nimport { getCustomPrimaryCss } from './themeCss';\nimport { staticToken } from './token/static';\n\nexport type LobeAppearance = 'light' | 'dark';\n\nexport interface LobeThemeState {\n appearance: LobeAppearance;\n neutralColor?: NeutralColors;\n primaryColor?: LobePrimaryColor;\n}\n\nconst ATTRIBUTES = ['data-theme', 'data-primary-color', 'data-neutral-color'];\n\nconst toAttributes = ({ appearance, neutralColor, primaryColor }: LobeThemeState) => ({\n 'data-neutral-color': neutralColor,\n 'data-primary-color': primaryColor,\n 'data-theme': appearance,\n});\n\nconst normalizePrimary = (color?: LobePrimaryColor) =>\n isCustomPrimaryColor(color) ? (color.toLowerCase() as CustomPrimaryColor) : color;\n\nconst customPrimaryStyleId = (color: CustomPrimaryColor) => `lobe-primary-${color.slice(1)}`;\n\nconst ensureCustomPrimaryStyle = (color: CustomPrimaryColor, doc: Document) => {\n const id = customPrimaryStyleId(color);\n if (doc.getElementById(id)) return;\n const style = doc.createElement('style');\n style.id = id;\n style.textContent = getCustomPrimaryCss(color);\n doc.head.append(style);\n};\n\nexport const setLobeTheme = (\n state: Partial<LobeThemeState>,\n root: HTMLElement = document.documentElement,\n) => {\n const next = { ...readThemeState(root), ...state };\n next.primaryColor = normalizePrimary(next.primaryColor);\n if (isCustomPrimaryColor(next.primaryColor))\n ensureCustomPrimaryStyle(next.primaryColor, root.ownerDocument);\n for (const [name, value] of Object.entries(toAttributes(next))) {\n if (value) root.setAttribute(name, value);\n else root.removeAttribute(name);\n }\n};\n\nconst readThemeState = (el: HTMLElement): LobeThemeState => ({\n appearance: el.dataset.theme === 'dark' ? 'dark' : 'light',\n neutralColor: (el.dataset.neutralColor as NeutralColors) || undefined,\n primaryColor: (el.dataset.primaryColor as LobePrimaryColor) || undefined,\n});\n\nconst stateKey = (state: LobeThemeState) =>\n `${state.appearance}|${state.primaryColor ?? ''}|${state.neutralColor ?? ''}`;\n\nconst SERVER_STATE: LobeThemeState = { appearance: 'light' };\nlet rootSnapshot: LobeThemeState = SERVER_STATE;\n\nconst getRootSnapshot = () => {\n const next = readThemeState(document.documentElement);\n if (stateKey(next) !== stateKey(rootSnapshot)) rootSnapshot = next;\n return rootSnapshot;\n};\n\nconst subscribeRoot = (onChange: () => void) => {\n const observer = new MutationObserver(onChange);\n observer.observe(document.documentElement, { attributeFilter: ATTRIBUTES, attributes: true });\n return () => observer.disconnect();\n};\n\nconst ThemeScopeContext = createContext<LobeThemeState | null>(null);\n\nconst useThemeState = () => {\n const scoped = use(ThemeScopeContext);\n const root = useSyncExternalStore(subscribeRoot, getRootSnapshot, () => SERVER_STATE);\n return scoped ?? root;\n};\n\nexport interface ThemeScopeProps extends Partial<LobeThemeState> {\n children?: ReactNode;\n className?: string;\n style?: CSSProperties;\n}\n\nexport const ThemeScope = ({\n appearance,\n children,\n className,\n neutralColor,\n primaryColor,\n style,\n}: ThemeScopeProps) => {\n const parent = useThemeState();\n const state = useMemo<LobeThemeState>(\n () => ({\n appearance: appearance ?? parent.appearance,\n neutralColor: neutralColor ?? parent.neutralColor,\n primaryColor: normalizePrimary(primaryColor) ?? parent.primaryColor,\n }),\n [appearance, neutralColor, primaryColor, parent],\n );\n const customPrimary = isCustomPrimaryColor(state.primaryColor) ? state.primaryColor : undefined;\n\n return (\n <ThemeScopeContext value={state}>\n {customPrimary && (\n <style href={customPrimaryStyleId(customPrimary)} precedence=\"lobe-theme\">\n {getCustomPrimaryCss(customPrimary)}\n </style>\n )}\n <div className={className} style={style} {...toAttributes(state)}>\n {children}\n </div>\n </ThemeScopeContext>\n );\n};\n\nexport const useThemeMode = () => {\n const { appearance } = useThemeState();\n return useMemo(() => ({ appearance, isDarkMode: appearance === 'dark' }), [appearance]);\n};\n\nexport type LobeTheme = LobeToken & { appearance: LobeAppearance; isDarkMode: boolean };\n\nconst themeCache = new Map<string, LobeTheme>();\n\nexport const useTheme = (): LobeTheme => {\n const state = useThemeState();\n const key = stateKey(state);\n let theme = themeCache.get(key);\n if (!theme) {\n theme = {\n ...createLobeToken(state),\n appearance: state.appearance,\n isDarkMode: state.appearance === 'dark',\n };\n themeCache.set(key, theme);\n }\n return theme;\n};\n\nconst breakpointQueries = {\n lg: `(min-width: ${staticToken.screenLG}px)`,\n md: `(min-width: ${staticToken.screenMD}px)`,\n sm: `(min-width: ${staticToken.screenSM}px)`,\n xl: `(min-width: ${staticToken.screenXL}px)`,\n xs: `(max-width: ${staticToken.screenXSMax}px)`,\n xxl: `(min-width: ${staticToken.screenXXL}px)`,\n xxxl: `(min-width: ${staticToken.screenXXXL}px)`,\n};\n\ntype Breakpoint = keyof typeof breakpointQueries;\nexport type ResponsiveState = Record<\n Breakpoint | 'mobile' | 'tablet' | 'laptop' | 'desktop',\n boolean\n>;\n\nconst toResponsive = (matches: Record<Breakpoint, boolean>): ResponsiveState => ({\n ...matches,\n desktop: matches.xxl,\n laptop: matches.lg,\n mobile: matches.xs,\n tablet: matches.md,\n});\n\nconst SERVER_RESPONSIVE = toResponsive({\n lg: false,\n md: false,\n sm: false,\n xl: false,\n xs: false,\n xxl: false,\n xxxl: false,\n});\nlet responsiveSnapshot = SERVER_RESPONSIVE;\n\nconst getResponsiveSnapshot = () => {\n const matches = Object.fromEntries(\n Object.entries(breakpointQueries).map(([key, query]) => [key, matchMedia(query).matches]),\n ) as Record<Breakpoint, boolean>;\n const changed = (Object.keys(matches) as Breakpoint[]).some(\n (key) => matches[key] !== responsiveSnapshot[key],\n );\n if (changed) responsiveSnapshot = toResponsive(matches);\n return responsiveSnapshot;\n};\n\nconst subscribeResponsive = (onChange: () => void) => {\n const lists = Object.values(breakpointQueries).map((query) => matchMedia(query));\n for (const list of lists) list.addEventListener('change', onChange);\n return () => {\n for (const list of lists) list.removeEventListener('change', onChange);\n };\n};\n\nexport const useResponsive = () =>\n useSyncExternalStore(subscribeResponsive, getResponsiveSnapshot, () => SERVER_RESPONSIVE);\n\nexport interface LobeThemeScriptProps {\n appearance?: LobeAppearance | 'system';\n neutralColor?: NeutralColors;\n nonce?: string;\n primaryColor?: LobePrimaryColor;\n}\n\nexport const LobeThemeScript = ({\n appearance,\n neutralColor,\n nonce,\n primaryColor,\n}: LobeThemeScriptProps) => {\n const primary = normalizePrimary(primaryColor);\n const custom = isCustomPrimaryColor(primary)\n ? [customPrimaryStyleId(primary), getCustomPrimaryCss(primary)]\n : [null, null];\n const args = JSON.stringify([\n appearance ?? null,\n primary ?? null,\n neutralColor ?? null,\n ...custom,\n ]);\n const script = `(function(a,p,n,i,c){var d=document.documentElement;if(a==='system')a=matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light';if(a)d.setAttribute('data-theme',a);else if(!d.hasAttribute('data-theme'))d.setAttribute('data-theme','light');if(p)d.setAttribute('data-primary-color',p);if(n)d.setAttribute('data-neutral-color',n);if(c&&!document.getElementById(i)){var s=document.createElement('style');s.id=i;s.textContent=c;document.head.appendChild(s);}}).apply(null,${args})`;\n\n return (\n <script suppressHydrationWarning dangerouslySetInnerHTML={{ __html: script }} nonce={nonce} />\n );\n};\n"],"mappings":";;;;;;;;AA6BA,MAAM,aAAa;CAAC;CAAc;CAAsB;AAAoB;AAE5E,MAAM,gBAAgB,EAAE,YAAY,cAAc,oBAAoC;CACpF,sBAAsB;CACtB,sBAAsB;CACtB,cAAc;AAChB;AAEA,MAAM,oBAAoB,UACxB,qBAAqB,KAAK,IAAK,MAAM,YAAY,IAA2B;AAE9E,MAAM,wBAAwB,UAA8B,gBAAgB,MAAM,MAAM,CAAC;AAEzF,MAAM,4BAA4B,OAA2B,QAAkB;CAC7E,MAAM,KAAK,qBAAqB,KAAK;CACrC,IAAI,IAAI,eAAe,EAAE,GAAG;CAC5B,MAAM,QAAQ,IAAI,cAAc,OAAO;CACvC,MAAM,KAAK;CACX,MAAM,cAAc,oBAAoB,KAAK;CAC7C,IAAI,KAAK,OAAO,KAAK;AACvB;AAEA,MAAa,gBACX,OACA,OAAoB,SAAS,oBAC1B;CACH,MAAM,OAAO;EAAE,GAAG,eAAe,IAAI;EAAG,GAAG;CAA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AI;CACJ,KAAK;CACL,MAAM;AACR,CAAC;AACD,IAAI,qBAAqB;AAEzB,MAAM,8BAA8B;CAClC,MAAM,UAAU,OAAO,YACrB,OAAO,QAAQ,iBAAiB,CAAC,CAAC,KAAK,CAAC,KAAK,WAAW,CAAC,KAAK,WAAW,KAAK,CAAC,CAAC,OAAO,CAAC,CAC1F;CAIA,IAHiB,OAAO,KAAK,OAAO,CAAC,CAAkB,MACpD,QAAQ,QAAQ,SAAS,mBAAmB,IAErC,GAAG,qBAAqB,aAAa,OAAO;CACtD,OAAO;AACT;AAEA,MAAM,uBAAuB,aAAyB;CACpD,MAAM,QAAQ,OAAO,OAAO,iBAAiB,CAAC,CAAC,KAAK,UAAU,WAAW,KAAK,CAAC;CAC/E,KAAK,MAAM,QAAQ,OAAO,KAAK,iBAAiB,UAAU,QAAQ;CAClE,aAAa;EACX,KAAK,MAAM,QAAQ,OAAO,KAAK,oBAAoB,UAAU,QAAQ;CACvE;AACF;AAEA,MAAa,sBACX,qBAAqB,qBAAqB,6BAA6B,iBAAiB;AAS1F,MAAa,mBAAmB,EAC9B,YACA,cACA,OACA,mBAC0B;CAC1B,MAAM,UAAU,iBAAiB,YAAY;CAC7C,MAAM,SAAS,qBAAqB,OAAO,IACvC,CAAC,qBAAqB,OAAO,GAAG,oBAAoB,OAAO,CAAC,IAC5D,CAAC,MAAM,IAAI;CAOf,MAAM,SAAS,8dANF,KAAK,UAAU;EAC1B,cAAc;EACd,WAAW;EACX,gBAAgB;EAChB,GAAG;CACL,CACgf,EAAE;CAElf,OACE,oBAAC,UAAD;EAAQ,0BAAA;EAAyB,yBAAyB,EAAE,QAAQ,OAAO;EAAU;CAAQ,CAAA;AAEjG"}
|
|
1
|
+
{"version":3,"file":"scope.mjs","names":[],"sources":["../../../src/styles/theme/scope.tsx"],"sourcesContent":["'use client';\n\nimport {\n createContext,\n type CSSProperties,\n type ReactNode,\n use,\n useMemo,\n useSyncExternalStore,\n} from 'react';\n\nimport { createLobeToken, type LobeToken } from './createLobeToken';\nimport { isCustomNeutral, type LobeNeutralColor } from './customNeutral';\nimport { getPaletteRevision, isRegisteredPalette, subscribePalettes } from './customPalette';\nimport {\n type CustomPrimaryColor,\n isCustomPrimaryColor,\n type LobePrimaryColor,\n} from './customPrimary';\nimport {\n getCustomNeutralCss,\n getCustomPaletteCss,\n getCustomPrimaryCss,\n getPaletteNeutralCss,\n} from './themeCss';\nimport { staticToken } from './token/static';\n\nexport type LobeAppearance = 'light' | 'dark';\n\nexport interface LobeThemeState {\n appearance: LobeAppearance;\n neutralColor?: LobeNeutralColor;\n palette?: string;\n primaryColor?: LobePrimaryColor;\n}\n\nconst ATTRIBUTES = ['data-theme', 'data-primary-color', 'data-neutral-color', 'data-palette'];\n\nconst toAttributes = ({ appearance, neutralColor, palette, primaryColor }: LobeThemeState) => ({\n 'data-neutral-color': neutralColor,\n 'data-palette': palette,\n 'data-primary-color': primaryColor,\n 'data-theme': appearance,\n});\n\nconst normalizePrimary = (color?: LobePrimaryColor) =>\n isCustomPrimaryColor(color) ? (color.toLowerCase() as CustomPrimaryColor) : color;\n\nconst customPrimaryStyleId = (color: CustomPrimaryColor) => `lobe-primary-${color.slice(1)}`;\n\nconst ensureCustomPrimaryStyle = (color: CustomPrimaryColor, doc: Document) => {\n const id = customPrimaryStyleId(color);\n if (doc.getElementById(id)) return;\n const style = doc.createElement('style');\n style.id = id;\n style.textContent = getCustomPrimaryCss(color);\n doc.head.append(style);\n};\n\nconst normalizeNeutral = (color?: LobeNeutralColor) =>\n color?.startsWith('#') ? color.toLowerCase() : color;\n\n/** Encodes hex vs registered name so `#0e1010` and a neutral named `0e1010` never collide. */\nconst neutralKey = (value: string) =>\n value.startsWith('#') ? `hex-${value.slice(1)}` : `name-${value}`;\n\nconst neutralStyleId = (value: string) => `lobe-neutral-${neutralKey(value)}`;\n\n/** Written every time (a re-registered neutral must replace its old rules). */\nconst ensureNeutralStyle = (value: string, doc: Document) => {\n const id = neutralStyleId(value);\n let style = doc.getElementById(id);\n if (!style) {\n style = doc.createElement('style');\n style.id = id;\n doc.head.append(style);\n }\n const css = getCustomNeutralCss(value);\n if (style.textContent !== css) style.textContent = css;\n};\n\nconst paletteStyleId = (name: string) => `lobe-palette-${name}`;\n\nconst ensurePaletteStyle = (name: string, doc: Document) => {\n const id = paletteStyleId(name);\n let style = doc.getElementById(id);\n if (!style) {\n style = doc.createElement('style');\n style.id = id;\n doc.head.append(style);\n }\n const css = getCustomPaletteCss(name);\n if (style.textContent !== css) style.textContent = css;\n};\n\nconst paletteNeutralStyleId = (name: string, neutral: string) =>\n `lobe-palette-${name}--neutral-${neutralKey(neutral)}`;\n\nconst ensurePaletteNeutralStyle = (name: string, neutral: string, doc: Document) => {\n const id = paletteNeutralStyleId(name, neutral);\n let style = doc.getElementById(id);\n if (!style) {\n style = doc.createElement('style');\n style.id = id;\n doc.head.append(style);\n }\n const css = getPaletteNeutralCss(name, neutral);\n if (style.textContent !== css) style.textContent = css;\n};\n\nexport const setLobeTheme = (\n state: Partial<LobeThemeState>,\n root: HTMLElement = document.documentElement,\n) => {\n const next = { ...readThemeState(root), ...state };\n next.primaryColor = normalizePrimary(next.primaryColor);\n if (isCustomPrimaryColor(next.primaryColor))\n ensureCustomPrimaryStyle(next.primaryColor, root.ownerDocument);\n next.neutralColor = normalizeNeutral(next.neutralColor);\n if (isCustomNeutral(next.neutralColor)) ensureNeutralStyle(next.neutralColor, root.ownerDocument);\n if (isRegisteredPalette(next.palette)) {\n ensurePaletteStyle(next.palette, root.ownerDocument);\n if (next.neutralColor)\n ensurePaletteNeutralStyle(next.palette, next.neutralColor, root.ownerDocument);\n }\n for (const [name, value] of Object.entries(toAttributes(next))) {\n if (value) root.setAttribute(name, value);\n else root.removeAttribute(name);\n }\n};\n\nconst readThemeState = (el: HTMLElement): LobeThemeState => ({\n appearance: el.dataset.theme === 'dark' ? 'dark' : 'light',\n neutralColor: el.dataset.neutralColor || undefined,\n palette: el.dataset.palette || undefined,\n primaryColor: (el.dataset.primaryColor as LobePrimaryColor) || undefined,\n});\n\nconst stateKey = (state: LobeThemeState) =>\n `${state.appearance}|${state.primaryColor ?? ''}|${state.neutralColor ?? ''}|${state.palette ?? ''}`;\n\nconst usePaletteRevision = () =>\n useSyncExternalStore(subscribePalettes, getPaletteRevision, getPaletteRevision);\n\nconst SERVER_STATE: LobeThemeState = { appearance: 'light' };\nlet rootSnapshot: LobeThemeState = SERVER_STATE;\n\nconst getRootSnapshot = () => {\n const next = readThemeState(document.documentElement);\n if (stateKey(next) !== stateKey(rootSnapshot)) rootSnapshot = next;\n return rootSnapshot;\n};\n\nconst subscribeRoot = (onChange: () => void) => {\n const observer = new MutationObserver(onChange);\n observer.observe(document.documentElement, { attributeFilter: ATTRIBUTES, attributes: true });\n return () => observer.disconnect();\n};\n\nconst ThemeScopeContext = createContext<LobeThemeState | null>(null);\n\nconst useThemeState = () => {\n const scoped = use(ThemeScopeContext);\n const root = useSyncExternalStore(subscribeRoot, getRootSnapshot, () => SERVER_STATE);\n return scoped ?? root;\n};\n\nexport interface ThemeScopeProps extends Partial<LobeThemeState> {\n children?: ReactNode;\n className?: string;\n style?: CSSProperties;\n}\n\nexport const ThemeScope = ({\n appearance,\n children,\n className,\n neutralColor,\n palette,\n primaryColor,\n style,\n}: ThemeScopeProps) => {\n const parent = useThemeState();\n const state = useMemo<LobeThemeState>(\n () => ({\n appearance: appearance ?? parent.appearance,\n neutralColor: normalizeNeutral(neutralColor) ?? parent.neutralColor,\n palette: palette ?? parent.palette,\n primaryColor: normalizePrimary(primaryColor) ?? parent.primaryColor,\n }),\n [appearance, neutralColor, palette, primaryColor, parent],\n );\n const customPrimary = isCustomPrimaryColor(state.primaryColor) ? state.primaryColor : undefined;\n const paletteRevision = usePaletteRevision();\n const customPalette = isRegisteredPalette(state.palette) ? state.palette : undefined;\n const customNeutral = isCustomNeutral(state.neutralColor) ? state.neutralColor : undefined;\n\n return (\n <ThemeScopeContext value={state}>\n {customPrimary && (\n <style href={customPrimaryStyleId(customPrimary)} precedence=\"lobe-theme\">\n {getCustomPrimaryCss(customPrimary)}\n </style>\n )}\n {customNeutral && (\n <style href={`${neutralStyleId(customNeutral)}-${paletteRevision}`} precedence=\"lobe-theme\">\n {getCustomNeutralCss(customNeutral)}\n </style>\n )}\n {customPalette && (\n <style href={`${paletteStyleId(customPalette)}-${paletteRevision}`} precedence=\"lobe-theme\">\n {getCustomPaletteCss(customPalette)}\n </style>\n )}\n {customPalette && state.neutralColor && (\n <style\n href={`${paletteNeutralStyleId(customPalette, state.neutralColor)}-${paletteRevision}`}\n precedence=\"lobe-theme\"\n >\n {getPaletteNeutralCss(customPalette, state.neutralColor)}\n </style>\n )}\n <div className={className} style={style} {...toAttributes(state)}>\n {children}\n </div>\n </ThemeScopeContext>\n );\n};\n\nexport const useThemeMode = () => {\n const { appearance } = useThemeState();\n return useMemo(() => ({ appearance, isDarkMode: appearance === 'dark' }), [appearance]);\n};\n\nexport type LobeTheme = LobeToken & { appearance: LobeAppearance; isDarkMode: boolean };\n\nconst themeCache = new Map<string, LobeTheme>();\n\nexport const useTheme = (): LobeTheme => {\n const state = useThemeState();\n const key = `${stateKey(state)}@${usePaletteRevision()}`;\n let theme = themeCache.get(key);\n if (!theme) {\n theme = {\n ...createLobeToken(state),\n appearance: state.appearance,\n isDarkMode: state.appearance === 'dark',\n };\n themeCache.set(key, theme);\n }\n return theme;\n};\n\nconst breakpointQueries = {\n lg: `(min-width: ${staticToken.screenLG}px)`,\n md: `(min-width: ${staticToken.screenMD}px)`,\n sm: `(min-width: ${staticToken.screenSM}px)`,\n xl: `(min-width: ${staticToken.screenXL}px)`,\n xs: `(max-width: ${staticToken.screenXSMax}px)`,\n xxl: `(min-width: ${staticToken.screenXXL}px)`,\n xxxl: `(min-width: ${staticToken.screenXXXL}px)`,\n};\n\ntype Breakpoint = keyof typeof breakpointQueries;\nexport type ResponsiveState = Record<\n Breakpoint | 'mobile' | 'tablet' | 'laptop' | 'desktop',\n boolean\n>;\n\nconst toResponsive = (matches: Record<Breakpoint, boolean>): ResponsiveState => ({\n ...matches,\n desktop: matches.xxl,\n laptop: matches.lg,\n mobile: matches.xs,\n tablet: matches.md,\n});\n\nconst SERVER_RESPONSIVE = toResponsive({\n lg: false,\n md: false,\n sm: false,\n xl: false,\n xs: false,\n xxl: false,\n xxxl: false,\n});\nlet responsiveSnapshot = SERVER_RESPONSIVE;\n\nconst getResponsiveSnapshot = () => {\n const matches = Object.fromEntries(\n Object.entries(breakpointQueries).map(([key, query]) => [key, matchMedia(query).matches]),\n ) as Record<Breakpoint, boolean>;\n const changed = (Object.keys(matches) as Breakpoint[]).some(\n (key) => matches[key] !== responsiveSnapshot[key],\n );\n if (changed) responsiveSnapshot = toResponsive(matches);\n return responsiveSnapshot;\n};\n\nconst subscribeResponsive = (onChange: () => void) => {\n const lists = Object.values(breakpointQueries).map((query) => matchMedia(query));\n for (const list of lists) list.addEventListener('change', onChange);\n return () => {\n for (const list of lists) list.removeEventListener('change', onChange);\n };\n};\n\nexport const useResponsive = () =>\n useSyncExternalStore(subscribeResponsive, getResponsiveSnapshot, () => SERVER_RESPONSIVE);\n\nexport interface LobeThemeScriptProps {\n appearance?: LobeAppearance | 'system';\n neutralColor?: LobeNeutralColor;\n nonce?: string;\n palette?: string;\n primaryColor?: LobePrimaryColor;\n}\n\nexport const LobeThemeScript = ({\n appearance,\n neutralColor,\n nonce,\n palette,\n primaryColor,\n}: LobeThemeScriptProps) => {\n const primary = normalizePrimary(primaryColor);\n const styles: [string, string][] = [];\n if (isCustomPrimaryColor(primary))\n styles.push([customPrimaryStyleId(primary), getCustomPrimaryCss(primary)]);\n const neutral = normalizeNeutral(neutralColor);\n if (isCustomNeutral(neutral))\n styles.push([neutralStyleId(neutral), getCustomNeutralCss(neutral)]);\n if (isRegisteredPalette(palette)) {\n styles.push([paletteStyleId(palette), getCustomPaletteCss(palette)]);\n if (neutral)\n styles.push([\n paletteNeutralStyleId(palette, neutral),\n getPaletteNeutralCss(palette, neutral),\n ]);\n }\n const args = JSON.stringify([\n appearance ?? null,\n primary ?? null,\n neutral ?? null,\n palette ?? null,\n styles,\n ]);\n const script = `(function(a,p,n,q,t){var d=document.documentElement;if(a==='system')a=matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light';if(a)d.setAttribute('data-theme',a);else if(!d.hasAttribute('data-theme'))d.setAttribute('data-theme','light');if(p)d.setAttribute('data-primary-color',p);if(n)d.setAttribute('data-neutral-color',n);if(q)d.setAttribute('data-palette',q);t.forEach(function(x){if(document.getElementById(x[0]))return;var s=document.createElement('style');s.id=x[0];s.textContent=x[1];document.head.appendChild(s);});}).apply(null,${args})`;\n\n return (\n <script suppressHydrationWarning dangerouslySetInnerHTML={{ __html: script }} nonce={nonce} />\n );\n};\n"],"mappings":";;;;;;;;;;AAoCA,MAAM,aAAa;CAAC;CAAc;CAAsB;CAAsB;AAAc;AAE5F,MAAM,gBAAgB,EAAE,YAAY,cAAc,SAAS,oBAAoC;CAC7F,sBAAsB;CACtB,gBAAgB;CAChB,sBAAsB;CACtB,cAAc;AAChB;AAEA,MAAM,oBAAoB,UACxB,qBAAqB,KAAK,IAAK,MAAM,YAAY,IAA2B;AAE9E,MAAM,wBAAwB,UAA8B,gBAAgB,MAAM,MAAM,CAAC;AAEzF,MAAM,4BAA4B,OAA2B,QAAkB;CAC7E,MAAM,KAAK,qBAAqB,KAAK;CACrC,IAAI,IAAI,eAAe,EAAE,GAAG;CAC5B,MAAM,QAAQ,IAAI,cAAc,OAAO;CACvC,MAAM,KAAK;CACX,MAAM,cAAc,oBAAoB,KAAK;CAC7C,IAAI,KAAK,OAAO,KAAK;AACvB;AAEA,MAAM,oBAAoB,UACxB,OAAO,WAAW,GAAG,IAAI,MAAM,YAAY,IAAI;;AAGjD,MAAM,cAAc,UAClB,MAAM,WAAW,GAAG,IAAI,OAAO,MAAM,MAAM,CAAC,MAAM,QAAQ;AAE5D,MAAM,kBAAkB,UAAkB,gBAAgB,WAAW,KAAK;;AAG1E,MAAM,sBAAsB,O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B;CACpD,MAAM,QAAQ,OAAO,OAAO,iBAAiB,CAAC,CAAC,KAAK,UAAU,WAAW,KAAK,CAAC;CAC/E,KAAK,MAAM,QAAQ,OAAO,KAAK,iBAAiB,UAAU,QAAQ;CAClE,aAAa;EACX,KAAK,MAAM,QAAQ,OAAO,KAAK,oBAAoB,UAAU,QAAQ;CACvE;AACF;AAEA,MAAa,sBACX,qBAAqB,qBAAqB,6BAA6B,iBAAiB;AAU1F,MAAa,mBAAmB,EAC9B,YACA,cACA,OACA,SACA,mBAC0B;CAC1B,MAAM,UAAU,iBAAiB,YAAY;CAC7C,MAAM,SAA6B,CAAC;CACpC,IAAI,qBAAqB,OAAO,GAC9B,OAAO,KAAK,CAAC,qBAAqB,OAAO,GAAG,oBAAoB,OAAO,CAAC,CAAC;CAC3E,MAAM,UAAU,iBAAiB,YAAY;CAC7C,IAAI,gBAAgB,OAAO,GACzB,OAAO,KAAK,CAAC,eAAe,OAAO,GAAG,oBAAoB,OAAO,CAAC,CAAC;CACrE,IAAI,oBAAoB,OAAO,GAAG;EAChC,OAAO,KAAK,CAAC,eAAe,OAAO,GAAG,oBAAoB,OAAO,CAAC,CAAC;EACnE,IAAI,SACF,OAAO,KAAK,CACV,sBAAsB,SAAS,OAAO,GACtC,qBAAqB,SAAS,OAAO,CACvC,CAAC;CACL;CAQA,MAAM,SAAS,uiBAPF,KAAK,UAAU;EAC1B,cAAc;EACd,WAAW;EACX,WAAW;EACX,WAAW;EACX;CACF,CACyjB,EAAE;CAE3jB,OACE,oBAAC,UAAD;EAAQ,0BAAA;EAAyB,yBAAyB,EAAE,QAAQ,OAAO;EAAU;CAAQ,CAAA;AAEjG"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { CustomPrimaryColor } from "./customPrimary.mjs";
|
|
2
2
|
//#region src/styles/theme/themeCss.d.ts
|
|
3
3
|
export declare const getCustomPrimaryCss: (color: CustomPrimaryColor) => string;
|
|
4
|
+
/** CSS for a custom neutral (6-digit hex or a `registerLobeNeutral` name); '' for presets. */
|
|
5
|
+
export declare const getCustomNeutralCss: (value: string) => string;
|
|
6
|
+
export declare const getCustomPaletteCss: (name: string) => string;
|
|
4
7
|
export declare const getThemeCss: () => string;
|
|
5
8
|
export declare const getGlobalCss: () => string;
|
|
6
9
|
//#endregion
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { isRegisteredPalette } from "./customPalette.mjs";
|
|
2
|
+
import { isCustomNeutral } from "./customNeutral.mjs";
|
|
1
3
|
import { neutralColors, primaryColors } from "../customTheme.mjs";
|
|
2
4
|
import { createLobeTokenGroups } from "./createLobeToken.mjs";
|
|
3
5
|
import { toCssVarName, toCssVariables } from "../css.mjs";
|
|
@@ -56,6 +58,49 @@ const getCustomPrimaryCss = (color) => {
|
|
|
56
58
|
primaryColor: hex
|
|
57
59
|
}).primary))).join("\n\n");
|
|
58
60
|
};
|
|
61
|
+
/** CSS for a custom neutral (6-digit hex or a `registerLobeNeutral` name); '' for presets. */
|
|
62
|
+
const getCustomNeutralCss = (value) => {
|
|
63
|
+
const key = value.startsWith("#") ? value.toLowerCase() : value;
|
|
64
|
+
if (!isCustomNeutral(key)) return "";
|
|
65
|
+
return ["light", "dark"].map((appearance) => rule(`[data-neutral-color='${key}']${appearanceSelector(appearance)}`, toCssVariables(createLobeTokenGroups({
|
|
66
|
+
appearance,
|
|
67
|
+
neutralColor: key
|
|
68
|
+
}).neutral))).join("\n\n");
|
|
69
|
+
};
|
|
70
|
+
const getCustomPaletteCss = (name) => {
|
|
71
|
+
if (!isRegisteredPalette(name)) return "";
|
|
72
|
+
return ["light", "dark"].map((appearance) => {
|
|
73
|
+
const { neutral, palette } = createLobeTokenGroups({
|
|
74
|
+
appearance,
|
|
75
|
+
palette: name
|
|
76
|
+
});
|
|
77
|
+
return rule(`[data-palette='${name}']${appearanceSelector(appearance)}`, toCssVariables({
|
|
78
|
+
...palette,
|
|
79
|
+
colorErrorOutline: neutral.colorErrorOutline,
|
|
80
|
+
colorWarningOutline: neutral.colorWarningOutline
|
|
81
|
+
}));
|
|
82
|
+
}).join("\n\n");
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* The outline tokens depend on both the neutral and the status palette, so the standalone
|
|
86
|
+
* neutral / palette stylesheets each compute them against the other's default. This rule
|
|
87
|
+
* (higher specificity) recomputes them for the actual combination.
|
|
88
|
+
*/
|
|
89
|
+
const getPaletteNeutralCss = (name, neutralColor) => {
|
|
90
|
+
if (!isRegisteredPalette(name) || !neutralColor) return "";
|
|
91
|
+
const key = neutralColor.startsWith("#") ? neutralColor.toLowerCase() : neutralColor;
|
|
92
|
+
return ["light", "dark"].map((appearance) => {
|
|
93
|
+
const { neutral } = createLobeTokenGroups({
|
|
94
|
+
appearance,
|
|
95
|
+
neutralColor: key,
|
|
96
|
+
palette: name
|
|
97
|
+
});
|
|
98
|
+
return rule(`[data-palette='${name}'][data-neutral-color='${key}']${appearanceSelector(appearance)}`, toCssVariables({
|
|
99
|
+
colorErrorOutline: neutral.colorErrorOutline,
|
|
100
|
+
colorWarningOutline: neutral.colorWarningOutline
|
|
101
|
+
}));
|
|
102
|
+
}).join("\n\n");
|
|
103
|
+
};
|
|
59
104
|
const essentialCss = `@layer lobe-ui {
|
|
60
105
|
.lobe-brand-loading path {
|
|
61
106
|
fill: currentcolor;
|
|
@@ -335,6 +380,6 @@ const getThemeCss = () => cached ??= [
|
|
|
335
380
|
].join("\n\n");
|
|
336
381
|
const getGlobalCss = () => `${layerOrder}\n\n${globalCss}`;
|
|
337
382
|
//#endregion
|
|
338
|
-
export { getCustomPrimaryCss, getGlobalCss, getThemeCss };
|
|
383
|
+
export { getCustomNeutralCss, getCustomPaletteCss, getCustomPrimaryCss, getGlobalCss, getPaletteNeutralCss, getThemeCss };
|
|
339
384
|
|
|
340
385
|
//# sourceMappingURL=themeCss.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeCss.mjs","names":[],"sources":["../../../src/styles/theme/themeCss.ts"],"sourcesContent":["import { toCssVariables, toCssVarName } from '../css';\nimport { neutralColors, primaryColors } from '../customTheme';\nimport { createLobeTokenGroups } from './createLobeToken';\nimport type { CustomPrimaryColor } from './customPrimary';\nimport type { LobeAppearance } from './scope';\n\nconst v = (key: string) => `var(${toCssVarName(key)})`;\n\nconst ring: Record<LobeAppearance, string> = {\n dark: '0 0 0 1px rgb(255 255 255 / 18%)',\n light: '0 0 0 1px rgb(0 0 0 / 5%)',\n};\n\n/* `initial` makes a light scope nested in a dark one fall back to each variant's own fill\n instead of inheriting the dark table surface. */\nconst surface: Record<LobeAppearance, Record<string, string>> = {\n dark: {\n '--lobe-fill-border': v('colorFillSecondary'),\n '--lobe-fill-border-strong': v('colorFill'),\n '--lobe-table-cell-bg': 'transparent',\n '--lobe-table-surface': v('colorFillQuaternary'),\n },\n light: {\n '--lobe-fill-border': v('colorFill'),\n '--lobe-fill-border-strong': `color-mix(in srgb, ${v('colorFill')}, ${v('colorText')} 15%)`,\n '--lobe-table-cell-bg': 'initial',\n '--lobe-table-surface': 'initial',\n },\n};\n\nconst rule = (selector: string, declarations: Record<string, number | string>) =>\n `${selector} {\\n${Object.entries(declarations)\n .map(([name, value]) => ` ${name}: ${value};`)\n .join('\\n')}\\n}`;\n\nconst appearanceRule = (selector: string, appearance: LobeAppearance) => {\n const { neutral, palette, primary, static: base } = createLobeTokenGroups({ appearance });\n const token =\n appearance === 'light'\n ? { ...base, ...palette, ...primary, ...neutral }\n : { ...palette, ...primary, ...neutral };\n\n return rule(selector, {\n ...toCssVariables(token),\n '--lobe-ring': ring[appearance],\n ...surface[appearance],\n 'color-scheme': appearance,\n });\n};\n\nconst appearanceSelector = (appearance: LobeAppearance) =>\n appearance === 'dark' ? \"[data-theme='dark']\" : \":not([data-theme='dark'])\";\n\nconst colorRules = (appearance: LobeAppearance) => [\n ...(Object.keys(primaryColors) as (keyof typeof primaryColors)[]).map((primaryColor) =>\n rule(\n `[data-primary-color='${primaryColor}']${appearanceSelector(appearance)}`,\n toCssVariables(createLobeTokenGroups({ appearance, primaryColor }).primary),\n ),\n ),\n ...(Object.keys(neutralColors) as (keyof typeof neutralColors)[]).map((neutralColor) =>\n rule(\n `[data-neutral-color='${neutralColor}']${appearanceSelector(appearance)}`,\n toCssVariables(createLobeTokenGroups({ appearance, neutralColor }).neutral),\n ),\n ),\n];\n\nexport const getCustomPrimaryCss = (color: CustomPrimaryColor) => {\n const hex = color.toLowerCase();\n return (['light', 'dark'] as const)\n .map((appearance) =>\n rule(\n `[data-primary-color='${hex}']${appearanceSelector(appearance)}`,\n toCssVariables(\n createLobeTokenGroups({ appearance, primaryColor: hex as CustomPrimaryColor }).primary,\n ),\n ),\n )\n .join('\\n\\n');\n};\n\nconst essentialCss = `@layer lobe-ui {\n .lobe-brand-loading path {\n fill: currentcolor;\n fill-opacity: 0;\n stroke: currentcolor;\n stroke-dasharray: 1000;\n stroke-dashoffset: 1000;\n stroke-width: 0.25em;\n\n animation:\n draw 2s cubic-bezier(0.4, 0, 0.2, 1) infinite,\n fill 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;\n }\n}\n\n@layer lobe-popup {\n .lobe-context-trigger[data-popup-open],\n .lobe-dropdown-menu-trigger[data-popup-open] {\n background: ${v('colorFillTertiary')};\n }\n}\n\n@layer lobe-base {\n :where(body, body [data-theme]) {\n color: ${v('colorText')};\n font-family: ${v('fontFamily')};\n font-size: ${v('fontSize')};\n line-height: ${v('lineHeight')};\n }\n\n :where(body) :where(a) {\n cursor: pointer;\n\n color: ${v('colorLink')};\n text-decoration: none;\n\n background-color: transparent;\n outline: none;\n\n transition: color ${v('motionDurationSlow')};\n }\n\n :where(body) :where(a):hover {\n color: ${v('colorLinkHover')};\n }\n\n :where(body) :where(a):active {\n color: ${v('colorLinkActive')};\n }\n\n :where(body) :where(a):focus-visible {\n outline: ${v('lineWidthFocus')} solid ${v('colorPrimaryBorder')};\n outline-offset: 1px;\n }\n\n :where(body) :where(a)[disabled] {\n cursor: not-allowed;\n color: ${v('colorTextDisabled')};\n }\n\n :where(.lobe-flex) {\n --lobe-flex: 0 1 auto;\n --lobe-flex-direction: column;\n --lobe-flex-wrap: nowrap;\n --lobe-flex-justify: flex-start;\n --lobe-flex-align: stretch;\n --lobe-flex-width: auto;\n --lobe-flex-height: auto;\n --lobe-flex-padding: 0;\n --lobe-flex-padding-inline: var(--lobe-flex-padding);\n --lobe-flex-padding-block: var(--lobe-flex-padding);\n --lobe-flex-gap: 0;\n\n display: flex;\n flex: var(--lobe-flex);\n flex-flow: var(--lobe-flex-direction) var(--lobe-flex-wrap);\n gap: var(--lobe-flex-gap);\n align-items: var(--lobe-flex-align);\n justify-content: var(--lobe-flex-justify);\n\n width: var(--lobe-flex-width);\n height: var(--lobe-flex-height);\n padding: var(--lobe-flex-padding);\n padding-block: var(--lobe-flex-padding-block);\n padding-inline: var(--lobe-flex-padding-inline);\n }\n\n .lobe-flex-hidden {\n display: none;\n }\n}\n\n@keyframes draw {\n 0% {\n stroke-dashoffset: 1000;\n }\n\n 100% {\n stroke-dashoffset: 0;\n }\n}\n\n@keyframes fill {\n 30% {\n fill-opacity: 0.05;\n }\n\n 100% {\n fill-opacity: 1;\n }\n}`;\n\nconst globalCss = `@layer lobe-base {\n :root {\n --font-settings: 'cv01', 'tnum', 'kern';\n --font-variations: 'opsz' auto, tabular-nums;\n\n font-synthesis: style;\n text-autospace: normal;\n }\n\n html {\n overscroll-behavior: none;\n }\n\n body {\n overflow: hidden auto;\n\n min-height: 100vh;\n margin: 0;\n padding: 0;\n\n font-feature-settings: var(--font-settings);\n font-variation-settings: var(--font-variations);\n font-optical-sizing: auto;\n font-kerning: normal;\n font-variant-ligatures: common-ligatures contextual;\n font-variant-numeric: tabular-nums;\n font-size-adjust: from-font;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n text-wrap: pretty;\n text-size-adjust: 100%;\n text-rendering: optimizelegibility;\n overflow-wrap: anywhere;\n vertical-align: baseline;\n\n background-color: ${v('colorBgLayout')};\n\n font-synthesis: style;\n\n -webkit-overflow-scrolling: touch;\n -webkit-tap-highlight-color: transparent;\n }\n\n html,\n body {\n width: 100%;\n height: 100%;\n }\n\n [tabindex='-1']:focus {\n outline: none;\n }\n\n [hidden] {\n display: none !important;\n }\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin-block: 0 0.5em;\n font-weight: 500;\n }\n\n p,\n ol,\n ul,\n dl,\n pre {\n margin-block: 0 1em;\n }\n\n ol ol,\n ul ul,\n ol ul,\n ul ol {\n margin-block-end: 0;\n }\n\n dd {\n margin-block-end: 0.5em;\n margin-inline-start: 0;\n }\n\n blockquote,\n figure {\n margin-block: 0 1em;\n margin-inline: 0;\n }\n\n img {\n border-style: none;\n vertical-align: middle;\n }\n\n table {\n border-collapse: collapse;\n }\n\n input,\n button,\n select,\n optgroup,\n textarea {\n margin: 0;\n\n font-family: inherit;\n font-size: inherit;\n line-height: inherit;\n color: inherit;\n }\n\n textarea {\n resize: vertical;\n overflow: auto;\n }\n\n fieldset {\n min-width: 0;\n margin: 0;\n padding: 0;\n border: 0;\n }\n\n code,\n kbd,\n samp,\n pre {\n font-family: ${v('fontFamilyCode')} !important;\n font-feature-settings:\n 'liga' 0,\n 'calt' 0;\n font-variant-ligatures: none;\n\n span {\n font-family: ${v('fontFamilyCode')} !important;\n }\n }\n\n ::selection {\n color: #000;\n background: ${v('yellow9')};\n\n -webkit-text-fill-color: unset !important;\n }\n\n * {\n scrollbar-color: ${v('colorFill')} transparent;\n scrollbar-width: thin;\n box-sizing: border-box;\n vertical-align: baseline;\n }\n}`;\n\nconst layerOrder = '@layer lobe-base, lobe-popup, lobe-ui;';\n\nlet cached: string | undefined;\n\nexport const getThemeCss = () =>\n (cached ??= [\n layerOrder,\n appearanceRule(\":root, [data-theme='light']\", 'light'),\n appearanceRule(\"[data-theme='dark']\", 'dark'),\n ...colorRules('light'),\n ...colorRules('dark'),\n essentialCss,\n ].join('\\n\\n'));\n\nexport const getGlobalCss = () => `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EJ,MAAa,oBACV,WAAW;CACV;CACA,eAAe,+BAA+B,OAAO;CACrD,eAAe,uBAAuB,MAAM;CAC5C,GAAG,WAAW,OAAO;CACrB,GAAG,WAAW,MAAM;CACpB;AACF,CAAC,CAAC,KAAK,MAAM;AAEf,MAAa,qBAAqB,GAAG,WAAW,MAAM"}
|
|
1
|
+
{"version":3,"file":"themeCss.mjs","names":[],"sources":["../../../src/styles/theme/themeCss.ts"],"sourcesContent":["import { toCssVariables, toCssVarName } from '../css';\nimport { neutralColors, primaryColors } from '../customTheme';\nimport { createLobeTokenGroups } from './createLobeToken';\nimport { isCustomNeutral } from './customNeutral';\nimport { isRegisteredPalette } from './customPalette';\nimport type { CustomPrimaryColor } from './customPrimary';\nimport type { LobeAppearance } from './scope';\n\nconst v = (key: string) => `var(${toCssVarName(key)})`;\n\nconst ring: Record<LobeAppearance, string> = {\n dark: '0 0 0 1px rgb(255 255 255 / 18%)',\n light: '0 0 0 1px rgb(0 0 0 / 5%)',\n};\n\n/* `initial` makes a light scope nested in a dark one fall back to each variant's own fill\n instead of inheriting the dark table surface. */\nconst surface: Record<LobeAppearance, Record<string, string>> = {\n dark: {\n '--lobe-fill-border': v('colorFillSecondary'),\n '--lobe-fill-border-strong': v('colorFill'),\n '--lobe-table-cell-bg': 'transparent',\n '--lobe-table-surface': v('colorFillQuaternary'),\n },\n light: {\n '--lobe-fill-border': v('colorFill'),\n '--lobe-fill-border-strong': `color-mix(in srgb, ${v('colorFill')}, ${v('colorText')} 15%)`,\n '--lobe-table-cell-bg': 'initial',\n '--lobe-table-surface': 'initial',\n },\n};\n\nconst rule = (selector: string, declarations: Record<string, number | string>) =>\n `${selector} {\\n${Object.entries(declarations)\n .map(([name, value]) => ` ${name}: ${value};`)\n .join('\\n')}\\n}`;\n\nconst appearanceRule = (selector: string, appearance: LobeAppearance) => {\n const { neutral, palette, primary, static: base } = createLobeTokenGroups({ appearance });\n const token =\n appearance === 'light'\n ? { ...base, ...palette, ...primary, ...neutral }\n : { ...palette, ...primary, ...neutral };\n\n return rule(selector, {\n ...toCssVariables(token),\n '--lobe-ring': ring[appearance],\n ...surface[appearance],\n 'color-scheme': appearance,\n });\n};\n\nconst appearanceSelector = (appearance: LobeAppearance) =>\n appearance === 'dark' ? \"[data-theme='dark']\" : \":not([data-theme='dark'])\";\n\nconst colorRules = (appearance: LobeAppearance) => [\n ...(Object.keys(primaryColors) as (keyof typeof primaryColors)[]).map((primaryColor) =>\n rule(\n `[data-primary-color='${primaryColor}']${appearanceSelector(appearance)}`,\n toCssVariables(createLobeTokenGroups({ appearance, primaryColor }).primary),\n ),\n ),\n ...(Object.keys(neutralColors) as (keyof typeof neutralColors)[]).map((neutralColor) =>\n rule(\n `[data-neutral-color='${neutralColor}']${appearanceSelector(appearance)}`,\n toCssVariables(createLobeTokenGroups({ appearance, neutralColor }).neutral),\n ),\n ),\n];\n\nexport const getCustomPrimaryCss = (color: CustomPrimaryColor) => {\n const hex = color.toLowerCase();\n return (['light', 'dark'] as const)\n .map((appearance) =>\n rule(\n `[data-primary-color='${hex}']${appearanceSelector(appearance)}`,\n toCssVariables(\n createLobeTokenGroups({ appearance, primaryColor: hex as CustomPrimaryColor }).primary,\n ),\n ),\n )\n .join('\\n\\n');\n};\n\n/** CSS for a custom neutral (6-digit hex or a `registerLobeNeutral` name); '' for presets. */\nexport const getCustomNeutralCss = (value: string) => {\n const key = value.startsWith('#') ? value.toLowerCase() : value;\n if (!isCustomNeutral(key)) return '';\n return (['light', 'dark'] as const)\n .map((appearance) =>\n rule(\n `[data-neutral-color='${key}']${appearanceSelector(appearance)}`,\n toCssVariables(createLobeTokenGroups({ appearance, neutralColor: key }).neutral),\n ),\n )\n .join('\\n\\n');\n};\n\nexport const getCustomPaletteCss = (name: string) => {\n if (!isRegisteredPalette(name)) return '';\n return (['light', 'dark'] as const)\n .map((appearance) => {\n const { neutral, palette } = createLobeTokenGroups({ appearance, palette: name });\n return rule(\n `[data-palette='${name}']${appearanceSelector(appearance)}`,\n toCssVariables({\n ...palette,\n colorErrorOutline: neutral.colorErrorOutline,\n colorWarningOutline: neutral.colorWarningOutline,\n }),\n );\n })\n .join('\\n\\n');\n};\n\n/**\n * The outline tokens depend on both the neutral and the status palette, so the standalone\n * neutral / palette stylesheets each compute them against the other's default. This rule\n * (higher specificity) recomputes them for the actual combination.\n */\nexport const getPaletteNeutralCss = (name: string, neutralColor: string) => {\n if (!isRegisteredPalette(name) || !neutralColor) return '';\n const key = neutralColor.startsWith('#') ? neutralColor.toLowerCase() : neutralColor;\n return (['light', 'dark'] as const)\n .map((appearance) => {\n const { neutral } = createLobeTokenGroups({ appearance, neutralColor: key, palette: name });\n return rule(\n `[data-palette='${name}'][data-neutral-color='${key}']${appearanceSelector(appearance)}`,\n toCssVariables({\n colorErrorOutline: neutral.colorErrorOutline,\n colorWarningOutline: neutral.colorWarningOutline,\n }),\n );\n })\n .join('\\n\\n');\n};\n\nconst essentialCss = `@layer lobe-ui {\n .lobe-brand-loading path {\n fill: currentcolor;\n fill-opacity: 0;\n stroke: currentcolor;\n stroke-dasharray: 1000;\n stroke-dashoffset: 1000;\n stroke-width: 0.25em;\n\n animation:\n draw 2s cubic-bezier(0.4, 0, 0.2, 1) infinite,\n fill 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;\n }\n}\n\n@layer lobe-popup {\n .lobe-context-trigger[data-popup-open],\n .lobe-dropdown-menu-trigger[data-popup-open] {\n background: ${v('colorFillTertiary')};\n }\n}\n\n@layer lobe-base {\n :where(body, body [data-theme]) {\n color: ${v('colorText')};\n font-family: ${v('fontFamily')};\n font-size: ${v('fontSize')};\n line-height: ${v('lineHeight')};\n }\n\n :where(body) :where(a) {\n cursor: pointer;\n\n color: ${v('colorLink')};\n text-decoration: none;\n\n background-color: transparent;\n outline: none;\n\n transition: color ${v('motionDurationSlow')};\n }\n\n :where(body) :where(a):hover {\n color: ${v('colorLinkHover')};\n }\n\n :where(body) :where(a):active {\n color: ${v('colorLinkActive')};\n }\n\n :where(body) :where(a):focus-visible {\n outline: ${v('lineWidthFocus')} solid ${v('colorPrimaryBorder')};\n outline-offset: 1px;\n }\n\n :where(body) :where(a)[disabled] {\n cursor: not-allowed;\n color: ${v('colorTextDisabled')};\n }\n\n :where(.lobe-flex) {\n --lobe-flex: 0 1 auto;\n --lobe-flex-direction: column;\n --lobe-flex-wrap: nowrap;\n --lobe-flex-justify: flex-start;\n --lobe-flex-align: stretch;\n --lobe-flex-width: auto;\n --lobe-flex-height: auto;\n --lobe-flex-padding: 0;\n --lobe-flex-padding-inline: var(--lobe-flex-padding);\n --lobe-flex-padding-block: var(--lobe-flex-padding);\n --lobe-flex-gap: 0;\n\n display: flex;\n flex: var(--lobe-flex);\n flex-flow: var(--lobe-flex-direction) var(--lobe-flex-wrap);\n gap: var(--lobe-flex-gap);\n align-items: var(--lobe-flex-align);\n justify-content: var(--lobe-flex-justify);\n\n width: var(--lobe-flex-width);\n height: var(--lobe-flex-height);\n padding: var(--lobe-flex-padding);\n padding-block: var(--lobe-flex-padding-block);\n padding-inline: var(--lobe-flex-padding-inline);\n }\n\n .lobe-flex-hidden {\n display: none;\n }\n}\n\n@keyframes draw {\n 0% {\n stroke-dashoffset: 1000;\n }\n\n 100% {\n stroke-dashoffset: 0;\n }\n}\n\n@keyframes fill {\n 30% {\n fill-opacity: 0.05;\n }\n\n 100% {\n fill-opacity: 1;\n }\n}`;\n\nconst globalCss = `@layer lobe-base {\n :root {\n --font-settings: 'cv01', 'tnum', 'kern';\n --font-variations: 'opsz' auto, tabular-nums;\n\n font-synthesis: style;\n text-autospace: normal;\n }\n\n html {\n overscroll-behavior: none;\n }\n\n body {\n overflow: hidden auto;\n\n min-height: 100vh;\n margin: 0;\n padding: 0;\n\n font-feature-settings: var(--font-settings);\n font-variation-settings: var(--font-variations);\n font-optical-sizing: auto;\n font-kerning: normal;\n font-variant-ligatures: common-ligatures contextual;\n font-variant-numeric: tabular-nums;\n font-size-adjust: from-font;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n text-wrap: pretty;\n text-size-adjust: 100%;\n text-rendering: optimizelegibility;\n overflow-wrap: anywhere;\n vertical-align: baseline;\n\n background-color: ${v('colorBgLayout')};\n\n font-synthesis: style;\n\n -webkit-overflow-scrolling: touch;\n -webkit-tap-highlight-color: transparent;\n }\n\n html,\n body {\n width: 100%;\n height: 100%;\n }\n\n [tabindex='-1']:focus {\n outline: none;\n }\n\n [hidden] {\n display: none !important;\n }\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin-block: 0 0.5em;\n font-weight: 500;\n }\n\n p,\n ol,\n ul,\n dl,\n pre {\n margin-block: 0 1em;\n }\n\n ol ol,\n ul ul,\n ol ul,\n ul ol {\n margin-block-end: 0;\n }\n\n dd {\n margin-block-end: 0.5em;\n margin-inline-start: 0;\n }\n\n blockquote,\n figure {\n margin-block: 0 1em;\n margin-inline: 0;\n }\n\n img {\n border-style: none;\n vertical-align: middle;\n }\n\n table {\n border-collapse: collapse;\n }\n\n input,\n button,\n select,\n optgroup,\n textarea {\n margin: 0;\n\n font-family: inherit;\n font-size: inherit;\n line-height: inherit;\n color: inherit;\n }\n\n textarea {\n resize: vertical;\n overflow: auto;\n }\n\n fieldset {\n min-width: 0;\n margin: 0;\n padding: 0;\n border: 0;\n }\n\n code,\n kbd,\n samp,\n pre {\n font-family: ${v('fontFamilyCode')} !important;\n font-feature-settings:\n 'liga' 0,\n 'calt' 0;\n font-variant-ligatures: none;\n\n span {\n font-family: ${v('fontFamilyCode')} !important;\n }\n }\n\n ::selection {\n color: #000;\n background: ${v('yellow9')};\n\n -webkit-text-fill-color: unset !important;\n }\n\n * {\n scrollbar-color: ${v('colorFill')} transparent;\n scrollbar-width: thin;\n box-sizing: border-box;\n vertical-align: baseline;\n }\n}`;\n\nconst layerOrder = '@layer lobe-base, lobe-popup, lobe-ui;';\n\nlet cached: string | undefined;\n\nexport const getThemeCss = () =>\n (cached ??= [\n layerOrder,\n appearanceRule(\":root, [data-theme='light']\", 'light'),\n appearanceRule(\"[data-theme='dark']\", 'dark'),\n ...colorRules('light'),\n ...colorRules('dark'),\n essentialCss,\n ].join('\\n\\n'));\n\nexport const getGlobalCss = () => `${layerOrder}\\n\\n${globalCss}`;\n"],"mappings":";;;;;;AAQA,MAAM,KAAK,QAAgB,OAAO,aAAa,GAAG,EAAE;AAEpD,MAAM,OAAuC;CAC3C,MAAM;CACN,OAAO;AACT;AAIA,MAAM,UAA0D;CAC9D,MAAM;EACJ,sBAAsB,EAAE,oBAAoB;EAC5C,6BAA6B,EAAE,WAAW;EAC1C,wBAAwB;EACxB,wBAAwB,EAAE,qBAAqB;CACjD;CACA,OAAO;EACL,sBAAsB,EAAE,WAAW;EACnC,6BAA6B,sBAAsB,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE;EACrF,wBAAwB;EACxB,wBAAwB;CAC1B;AACF;AAEA,MAAM,QAAQ,UAAkB,iBAC9B,GAAG,SAAS,MAAM,OAAO,QAAQ,YAAY,CAAC,CAC3C,KAAK,CAAC,MAAM,WAAW,KAAK,KAAK,IAAI,MAAM,EAAE,CAAC,CAC9C,KAAK,IAAI,EAAE;AAEhB,MAAM,kBAAkB,UAAkB,eAA+B;CACvE,MAAM,EAAE,SAAS,SAAS,SAAS,QAAQ,SAAS,sBAAsB,EAAE,WAAW,CAAC;CACxF,MAAM,QACJ,eAAe,UACX;EAAE,GAAG;EAAM,GAAG;EAAS,GAAG;EAAS,GAAG;CAAQ,IAC9C;EAAE,GAAG;EAAS,GAAG;EAAS,GAAG;CAAQ;CAE3C,OAAO,KAAK,UAAU;EACpB,GAAG,eAAe,KAAK;EACvB,eAAe,KAAK;EACpB,GAAG,QAAQ;EACX,gBAAgB;CAClB,CAAC;AACH;AAEA,MAAM,sBAAsB,eAC1B,eAAe,SAAS,wBAAwB;AAElD,MAAM,cAAc,eAA+B,CACjD,GAAI,OAAO,KAAK,aAAa,CAAC,CAAoC,KAAK,iBACrE,KACE,wBAAwB,aAAa,IAAI,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;;;uBAMR,EAAE,WAAW,EAAE;;;;;;AAOtC,MAAM,aAAa;AAEnB,IAAI;AAEJ,MAAa,oBACV,WAAW;CACV;CACA,eAAe,+BAA+B,OAAO;CACrD,eAAe,uBAAuB,MAAM;CAC5C,GAAG,WAAW,OAAO;CACrB,GAAG,WAAW,MAAM;CACpB;AACF,CAAC,CAAC,KAAK,MAAM;AAEf,MAAa,qBAAqB,GAAG,WAAW,MAAM"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
//#region src/styles/theme/token/legacy.ts
|
|
2
2
|
const legacyToken = {
|
|
3
3
|
dark: {
|
|
4
|
-
boxShadowCard: "\n 0 1px 2px -2px rgba(
|
|
5
|
-
boxShadowDrawerDown: "\n 0 -6px 16px 0 rgba(
|
|
6
|
-
boxShadowDrawerLeft: "\n 6px 0 16px 0 rgba(
|
|
7
|
-
boxShadowDrawerRight: "\n -6px 0 16px 0 rgba(
|
|
8
|
-
boxShadowDrawerUp: "\n 0 6px 16px 0 rgba(
|
|
9
|
-
boxShadowPopoverArrow: "2px 2px 5px rgba(
|
|
10
|
-
boxShadowTabsOverflowBottom: "inset 0 -10px 8px -8px rgba(
|
|
11
|
-
boxShadowTabsOverflowLeft: "inset 10px 0 8px -8px rgba(
|
|
12
|
-
boxShadowTabsOverflowRight: "inset -10px 0 8px -8px rgba(
|
|
13
|
-
boxShadowTabsOverflowTop: "inset 0 10px 8px -8px rgba(
|
|
4
|
+
boxShadowCard: "\n 0 1px 2px -2px rgba(0,0,0,0.16),\n 0 3px 6px 0 rgba(0,0,0,0.12),\n 0 5px 12px 4px rgba(0,0,0,0.09)\n ",
|
|
5
|
+
boxShadowDrawerDown: "\n 0 -6px 16px 0 rgba(0,0,0,0.08),\n 0 -3px 6px -4px rgba(0,0,0,0.12),\n 0 -9px 28px 8px rgba(0,0,0,0.05)\n ",
|
|
6
|
+
boxShadowDrawerLeft: "\n 6px 0 16px 0 rgba(0,0,0,0.08),\n 3px 0 6px -4px rgba(0,0,0,0.12),\n 9px 0 28px 8px rgba(0,0,0,0.05)\n ",
|
|
7
|
+
boxShadowDrawerRight: "\n -6px 0 16px 0 rgba(0,0,0,0.08),\n -3px 0 6px -4px rgba(0,0,0,0.12),\n -9px 0 28px 8px rgba(0,0,0,0.05)\n ",
|
|
8
|
+
boxShadowDrawerUp: "\n 0 6px 16px 0 rgba(0,0,0,0.08),\n 0 3px 6px -4px rgba(0,0,0,0.12),\n 0 9px 28px 8px rgba(0,0,0,0.05)\n ",
|
|
9
|
+
boxShadowPopoverArrow: "2px 2px 5px rgba(0,0,0,0.05)",
|
|
10
|
+
boxShadowTabsOverflowBottom: "inset 0 -10px 8px -8px rgba(0,0,0,0.08)",
|
|
11
|
+
boxShadowTabsOverflowLeft: "inset 10px 0 8px -8px rgba(0,0,0,0.08)",
|
|
12
|
+
boxShadowTabsOverflowRight: "inset -10px 0 8px -8px rgba(0,0,0,0.08)",
|
|
13
|
+
boxShadowTabsOverflowTop: "inset 0 10px 8px -8px rgba(0,0,0,0.08)",
|
|
14
14
|
colorBgBase: "#000",
|
|
15
15
|
colorBgBlur: "rgba(255,255,255,0.04)",
|
|
16
16
|
colorBgSolid: "rgba(255,255,255,0.95)",
|
|
@@ -19,9 +19,9 @@ const legacyToken = {
|
|
|
19
19
|
colorBorderDisabled: "#424242",
|
|
20
20
|
colorErrorBgActive: "#5b2526",
|
|
21
21
|
colorErrorBgFilledHover: "#441e1f",
|
|
22
|
-
colorShadow: "
|
|
22
|
+
colorShadow: "#000",
|
|
23
23
|
colorTextBase: "#fff",
|
|
24
|
-
dropShadowPopover: "drop-shadow(0 6px 16px rgba(
|
|
24
|
+
dropShadowPopover: "drop-shadow(0 6px 16px rgba(0,0,0,0.08)) drop-shadow(0 3px 6px rgba(0,0,0,0.12)) drop-shadow(0 9px 28px rgba(0,0,0,0.05))",
|
|
25
25
|
pink1: "#291321",
|
|
26
26
|
pink10: "#fad2e3",
|
|
27
27
|
pink2: "#40162f",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy.mjs","names":[],"sources":["../../../../src/styles/theme/token/legacy.ts"],"sourcesContent":["export const legacyToken = {\n dark: {\n boxShadowCard:\n '\\n 0 1px 2px -2px rgba(
|
|
1
|
+
{"version":3,"file":"legacy.mjs","names":[],"sources":["../../../../src/styles/theme/token/legacy.ts"],"sourcesContent":["export const legacyToken = {\n dark: {\n boxShadowCard:\n '\\n 0 1px 2px -2px rgba(0,0,0,0.16),\\n 0 3px 6px 0 rgba(0,0,0,0.12),\\n 0 5px 12px 4px rgba(0,0,0,0.09)\\n ',\n boxShadowDrawerDown:\n '\\n 0 -6px 16px 0 rgba(0,0,0,0.08),\\n 0 -3px 6px -4px rgba(0,0,0,0.12),\\n 0 -9px 28px 8px rgba(0,0,0,0.05)\\n ',\n boxShadowDrawerLeft:\n '\\n 6px 0 16px 0 rgba(0,0,0,0.08),\\n 3px 0 6px -4px rgba(0,0,0,0.12),\\n 9px 0 28px 8px rgba(0,0,0,0.05)\\n ',\n boxShadowDrawerRight:\n '\\n -6px 0 16px 0 rgba(0,0,0,0.08),\\n -3px 0 6px -4px rgba(0,0,0,0.12),\\n -9px 0 28px 8px rgba(0,0,0,0.05)\\n ',\n boxShadowDrawerUp:\n '\\n 0 6px 16px 0 rgba(0,0,0,0.08),\\n 0 3px 6px -4px rgba(0,0,0,0.12),\\n 0 9px 28px 8px rgba(0,0,0,0.05)\\n ',\n boxShadowPopoverArrow: '2px 2px 5px rgba(0,0,0,0.05)',\n boxShadowTabsOverflowBottom: 'inset 0 -10px 8px -8px rgba(0,0,0,0.08)',\n boxShadowTabsOverflowLeft: 'inset 10px 0 8px -8px rgba(0,0,0,0.08)',\n boxShadowTabsOverflowRight: 'inset -10px 0 8px -8px rgba(0,0,0,0.08)',\n boxShadowTabsOverflowTop: 'inset 0 10px 8px -8px rgba(0,0,0,0.08)',\n colorBgBase: '#000',\n colorBgBlur: 'rgba(255,255,255,0.04)',\n colorBgSolid: 'rgba(255,255,255,0.95)',\n colorBgSolidActive: 'rgba(255,255,255,0.9)',\n colorBgSolidHover: 'rgb(255,255,255)',\n colorBorderDisabled: '#424242',\n colorErrorBgActive: '#5b2526',\n colorErrorBgFilledHover: '#441e1f',\n colorShadow: '#000',\n colorTextBase: '#fff',\n dropShadowPopover:\n 'drop-shadow(0 6px 16px rgba(0,0,0,0.08)) drop-shadow(0 3px 6px rgba(0,0,0,0.12)) drop-shadow(0 9px 28px rgba(0,0,0,0.05))',\n pink1: '#291321',\n pink10: '#fad2e3',\n pink2: '#40162f',\n pink3: '#551c3b',\n pink4: '#75204f',\n pink5: '#a02669',\n pink6: '#cb2b83',\n pink7: '#e0529c',\n pink8: '#f37fb7',\n pink9: '#f8a8cc',\n pinkActive: '#e0529c',\n pinkHover: '#a02669',\n },\n light: {\n boxShadowCard:\n '\\n 0 1px 2px -2px rgba(0,0,0,0.16),\\n 0 3px 6px 0 rgba(0,0,0,0.12),\\n 0 5px 12px 4px rgba(0,0,0,0.09)\\n ',\n boxShadowDrawerDown:\n '\\n 0 -6px 16px 0 rgba(0,0,0,0.08),\\n 0 -3px 6px -4px rgba(0,0,0,0.12),\\n 0 -9px 28px 8px rgba(0,0,0,0.05)\\n ',\n boxShadowDrawerLeft:\n '\\n 6px 0 16px 0 rgba(0,0,0,0.08),\\n 3px 0 6px -4px rgba(0,0,0,0.12),\\n 9px 0 28px 8px rgba(0,0,0,0.05)\\n ',\n boxShadowDrawerRight:\n '\\n -6px 0 16px 0 rgba(0,0,0,0.08),\\n -3px 0 6px -4px rgba(0,0,0,0.12),\\n -9px 0 28px 8px rgba(0,0,0,0.05)\\n ',\n boxShadowDrawerUp:\n '\\n 0 6px 16px 0 rgba(0,0,0,0.08),\\n 0 3px 6px -4px rgba(0,0,0,0.12),\\n 0 9px 28px 8px rgba(0,0,0,0.05)\\n ',\n boxShadowPopoverArrow: '2px 2px 5px rgba(0,0,0,0.05)',\n boxShadowTabsOverflowBottom: 'inset 0 -10px 8px -8px rgba(0,0,0,0.08)',\n boxShadowTabsOverflowLeft: 'inset 10px 0 8px -8px rgba(0,0,0,0.08)',\n boxShadowTabsOverflowRight: 'inset -10px 0 8px -8px rgba(0,0,0,0.08)',\n boxShadowTabsOverflowTop: 'inset 0 10px 8px -8px rgba(0,0,0,0.08)',\n colorBgBase: '#fff',\n colorBgBlur: 'transparent',\n colorBgSolid: 'rgb(0,0,0)',\n colorBgSolidActive: 'rgba(0,0,0,0.95)',\n colorBgSolidHover: 'rgba(0,0,0,0.75)',\n colorBorderDisabled: '#d9d9d9',\n colorErrorBgActive: '#ffccc7',\n colorErrorBgFilledHover: '#ffdfdc',\n colorShadow: '#000',\n colorTextBase: '#000',\n dropShadowPopover:\n 'drop-shadow(0 6px 16px rgba(0,0,0,0.08)) drop-shadow(0 3px 6px rgba(0,0,0,0.12)) drop-shadow(0 9px 28px rgba(0,0,0,0.05))',\n pink1: '#fff0f6',\n pink10: '#520339',\n pink2: '#ffd6e7',\n pink3: '#ffadd2',\n pink4: '#ff85c0',\n pink5: '#f759ab',\n pink6: '#eb2f96',\n pink7: '#c41d7f',\n pink8: '#9e1068',\n pink9: '#780650',\n pinkActive: '#c41d7f',\n pinkHover: '#f759ab',\n },\n};\n"],"mappings":";AAAA,MAAa,cAAc;CACzB,MAAM;EACJ,eACE;EACF,qBACE;EACF,qBACE;EACF,sBACE;EACF,mBACE;EACF,uBAAuB;EACvB,6BAA6B;EAC7B,2BAA2B;EAC3B,4BAA4B;EAC5B,0BAA0B;EAC1B,aAAa;EACb,aAAa;EACb,cAAc;EACd,oBAAoB;EACpB,mBAAmB;EACnB,qBAAqB;EACrB,oBAAoB;EACpB,yBAAyB;EACzB,aAAa;EACb,eAAe;EACf,mBACE;EACF,OAAO;EACP,QAAQ;EACR,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,YAAY;EACZ,WAAW;CACb;CACA,OAAO;EACL,eACE;EACF,qBACE;EACF,qBACE;EACF,sBACE;EACF,mBACE;EACF,uBAAuB;EACvB,6BAA6B;EAC7B,2BAA2B;EAC3B,4BAA4B;EAC5B,0BAA0B;EAC1B,aAAa;EACb,aAAa;EACb,cAAc;EACd,oBAAoB;EACpB,mBAAmB;EACnB,qBAAqB;EACrB,oBAAoB;EACpB,yBAAyB;EACzB,aAAa;EACb,eAAe;EACf,mBACE;EACF,OAAO;EACP,QAAQ;EACR,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,YAAY;EACZ,WAAW;CACb;AACF"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import gray from "../../../color/colors/gray.mjs";
|
|
2
|
-
import { neutralColorScales } from "../../../color/neutrals/index.mjs";
|
|
3
1
|
import { mixColors, parseRgb } from "../../../utils/colorMath.mjs";
|
|
2
|
+
import { resolveNeutral } from "../customNeutral.mjs";
|
|
4
3
|
import { generateColorNeutralPalette } from "../generateColorPalette.mjs";
|
|
5
4
|
//#region src/styles/theme/token/neutral.ts
|
|
6
5
|
const isChannel = (value) => value >= 0 && value <= 255;
|
|
@@ -20,11 +19,18 @@ const getAlphaColor = (front, back) => {
|
|
|
20
19
|
return `rgb(${f.red},${f.green},${f.blue})`;
|
|
21
20
|
};
|
|
22
21
|
const createNeutralToken = (appearance, neutralColor, status) => {
|
|
23
|
-
const scale
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
const { scale, text } = resolveNeutral(neutralColor);
|
|
23
|
+
const [colorText, colorTextSecondary, colorTextTertiary, colorTextQuaternary] = text[appearance];
|
|
24
|
+
const token = {
|
|
25
|
+
...generateColorNeutralPalette({
|
|
26
|
+
appearance,
|
|
27
|
+
scale
|
|
28
|
+
}),
|
|
29
|
+
colorText,
|
|
30
|
+
colorTextQuaternary,
|
|
31
|
+
colorTextSecondary,
|
|
32
|
+
colorTextTertiary
|
|
33
|
+
};
|
|
28
34
|
return {
|
|
29
35
|
...token,
|
|
30
36
|
colorBgContainerDisabled: token.colorFillTertiary,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"neutral.mjs","names":[],"sources":["../../../../src/styles/theme/token/neutral.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"neutral.mjs","names":[],"sources":["../../../../src/styles/theme/token/neutral.ts"],"sourcesContent":["import { mixColors, parseRgb } from '@/utils/colorMath';\n\nimport { type LobeNeutralColor, resolveNeutral } from '../customNeutral';\nimport { generateColorNeutralPalette } from '../generateColorPalette';\n\nconst isChannel = (value: number) => value >= 0 && value <= 255;\n\n// port of antd's getAlphaColor: the most transparent rgba that renders `front` over `back`\nconst getAlphaColor = (front: string, back: string) => {\n const f = parseRgb(front);\n if (f.alpha !== undefined) return front;\n const b = parseRgb(back);\n\n for (let alpha = 0.01; alpha <= 1; alpha += 0.01) {\n const r = Math.round((f.red - b.red * (1 - alpha)) / alpha);\n const g = Math.round((f.green - b.green * (1 - alpha)) / alpha);\n const bl = Math.round((f.blue - b.blue * (1 - alpha)) / alpha);\n if (isChannel(r) && isChannel(g) && isChannel(bl)) {\n const a = Math.round(alpha * 100) / 100;\n return a === 1 ? `rgb(${r},${g},${bl})` : `rgba(${r},${g},${bl},${a})`;\n }\n }\n\n return `rgb(${f.red},${f.green},${f.blue})`;\n};\n\nexport const createNeutralToken = (\n appearance: 'light' | 'dark',\n neutralColor: LobeNeutralColor | undefined,\n status: { colorErrorBg: string; colorWarningBg: string },\n) => {\n const { scale, text } = resolveNeutral(neutralColor);\n const [colorText, colorTextSecondary, colorTextTertiary, colorTextQuaternary] = text[appearance];\n const token = {\n ...generateColorNeutralPalette({ appearance, scale }),\n colorText,\n colorTextQuaternary,\n colorTextSecondary,\n colorTextTertiary,\n };\n\n return {\n ...token,\n colorBgContainerDisabled: token.colorFillTertiary,\n colorBgContainerSecondary: mixColors(0.5, token.colorBgLayout, token.colorBgContainer),\n colorBgTextActive: token.colorFill,\n colorBgTextHover: token.colorFillSecondary,\n colorBorderBg: token.colorBgContainer,\n colorErrorOutline: getAlphaColor(status.colorErrorBg, token.colorBgContainer),\n colorFillAlter: token.colorFillQuaternary,\n colorFillContent: token.colorFillSecondary,\n colorFillContentHover: token.colorFill,\n colorIcon: token.colorTextTertiary,\n colorIconHover: token.colorText,\n colorSplit: getAlphaColor(token.colorBorderSecondary, token.colorBgContainer),\n colorTextDescription: token.colorTextTertiary,\n colorTextDisabled: token.colorTextQuaternary,\n colorTextHeading: token.colorText,\n colorTextLabel: token.colorTextSecondary,\n colorTextPlaceholder: token.colorTextQuaternary,\n colorWarningOutline: getAlphaColor(status.colorWarningBg, token.colorBgContainer),\n controlItemBgActiveDisabled: token.colorFill,\n controlItemBgHover: token.colorFillTertiary,\n controlTmpOutline: token.colorFillQuaternary,\n };\n};\n"],"mappings":";;;;AAKA,MAAM,aAAa,UAAkB,SAAS,KAAK,SAAS;AAG5D,MAAM,iBAAiB,OAAe,SAAiB;CACrD,MAAM,IAAI,SAAS,KAAK;CACxB,IAAI,EAAE,UAAU,KAAA,GAAW,OAAO;CAClC,MAAM,IAAI,SAAS,IAAI;CAEvB,KAAK,IAAI,QAAQ,KAAM,SAAS,GAAG,SAAS,KAAM;EAChD,MAAM,IAAI,KAAK,OAAO,EAAE,MAAM,EAAE,OAAO,IAAI,UAAU,KAAK;EAC1D,MAAM,IAAI,KAAK,OAAO,EAAE,QAAQ,EAAE,SAAS,IAAI,UAAU,KAAK;EAC9D,MAAM,KAAK,KAAK,OAAO,EAAE,OAAO,EAAE,QAAQ,IAAI,UAAU,KAAK;EAC7D,IAAI,UAAU,CAAC,KAAK,UAAU,CAAC,KAAK,UAAU,EAAE,GAAG;GACjD,MAAM,IAAI,KAAK,MAAM,QAAQ,GAAG,IAAI;GACpC,OAAO,MAAM,IAAI,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,KAAK,QAAQ,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,EAAE;EACtE;CAC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
|
16
|
+
},
|
|
17
|
+
mauve: {
|
|
18
|
+
dark: [
|
|
19
|
+
"#e9e5ec",
|
|
20
|
+
"#b6b3b9",
|
|
21
|
+
"#908e94",
|
|
22
|
+
"#6c6a70"
|
|
23
|
+
],
|
|
24
|
+
light: [
|
|
25
|
+
"#1f1f23",
|
|
26
|
+
"#67656b",
|
|
27
|
+
"#8b898f",
|
|
28
|
+
"#b1afb5"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
olive: {
|
|
32
|
+
dark: [
|
|
33
|
+
"#e5e7e1",
|
|
34
|
+
"#b2b5af",
|
|
35
|
+
"#8d908b",
|
|
36
|
+
"#696c67"
|
|
37
|
+
],
|
|
38
|
+
light: [
|
|
39
|
+
"#1d201c",
|
|
40
|
+
"#646762",
|
|
41
|
+
"#888b85",
|
|
42
|
+
"#aeb1aa"
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
sage: {
|
|
46
|
+
dark: [
|
|
47
|
+
"#e3e7e4",
|
|
48
|
+
"#b0b5b3",
|
|
49
|
+
"#8b908e",
|
|
50
|
+
"#676c6a"
|
|
51
|
+
],
|
|
52
|
+
light: [
|
|
53
|
+
"#1b201e",
|
|
54
|
+
"#616765",
|
|
55
|
+
"#868c89",
|
|
56
|
+
"#abb1ae"
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
sand: {
|
|
60
|
+
dark: [
|
|
61
|
+
"#e9e6dc",
|
|
62
|
+
"#b6b4ab",
|
|
63
|
+
"#918f87",
|
|
64
|
+
"#6c6b63"
|
|
65
|
+
],
|
|
66
|
+
light: [
|
|
67
|
+
"#1f201a",
|
|
68
|
+
"#67665f",
|
|
69
|
+
"#8b8a82",
|
|
70
|
+
"#b2b0a8"
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
slate: {
|
|
74
|
+
dark: [
|
|
75
|
+
"#e5e6ea",
|
|
76
|
+
"#b3b4b8",
|
|
77
|
+
"#8d8f93",
|
|
78
|
+
"#696b6f"
|
|
79
|
+
],
|
|
80
|
+
light: [
|
|
81
|
+
"#1d1f22",
|
|
82
|
+
"#646669",
|
|
83
|
+
"#888a8d",
|
|
84
|
+
"#aeb0b3"
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
//#endregion
|
|
89
|
+
export { neutralText };
|
|
90
|
+
|
|
91
|
+
//# sourceMappingURL=neutralText.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"neutralText.mjs","names":[],"sources":["../../../../src/styles/theme/token/neutralText.ts"],"sourcesContent":["export type NeutralTextLadder = Record<'dark' | 'light', [string, string, string, string]>;\n\nexport const neutralText: Record<string, NeutralTextLadder> = {\n gray: {\n dark: ['#e6e6e6', '#b4b4b4', '#8f8f8f', '#6b6b6b'],\n light: ['#1f1f1f', '#666666', '#8a8a8a', '#b0b0b0'],\n },\n mauve: {\n dark: ['#e9e5ec', '#b6b3b9', '#908e94', '#6c6a70'],\n light: ['#1f1f23', '#67656b', '#8b898f', '#b1afb5'],\n },\n olive: {\n dark: ['#e5e7e1', '#b2b5af', '#8d908b', '#696c67'],\n light: ['#1d201c', '#646762', '#888b85', '#aeb1aa'],\n },\n sage: {\n dark: ['#e3e7e4', '#b0b5b3', '#8b908e', '#676c6a'],\n light: ['#1b201e', '#616765', '#868c89', '#abb1ae'],\n },\n sand: {\n dark: ['#e9e6dc', '#b6b4ab', '#918f87', '#6c6b63'],\n light: ['#1f201a', '#67665f', '#8b8a82', '#b2b0a8'],\n },\n slate: {\n dark: ['#e5e6ea', '#b3b4b8', '#8d8f93', '#696b6f'],\n light: ['#1d1f22', '#646669', '#888a8d', '#aeb0b3'],\n },\n};\n"],"mappings":";AAEA,MAAa,cAAiD;CAC5D,MAAM;EACJ,MAAM;GAAC;GAAW;GAAW;GAAW;EAAS;EACjD,OAAO;GAAC;GAAW;GAAW;GAAW;EAAS;CACpD;CACA,OAAO;EACL,MAAM;GAAC;GAAW;GAAW;GAAW;EAAS;EACjD,OAAO;GAAC;GAAW;GAAW;GAAW;EAAS;CACpD;CACA,OAAO;EACL,MAAM;GAAC;GAAW;GAAW;GAAW;EAAS;EACjD,OAAO;GAAC;GAAW;GAAW;GAAW;EAAS;CACpD;CACA,MAAM;EACJ,MAAM;GAAC;GAAW;GAAW;GAAW;EAAS;EACjD,OAAO;GAAC;GAAW;GAAW;GAAW;EAAS;CACpD;CACA,MAAM;EACJ,MAAM;GAAC;GAAW;GAAW;GAAW;EAAS;EACjD,OAAO;GAAC;GAAW;GAAW;GAAW;EAAS;CACpD;CACA,OAAO;EACL,MAAM;GAAC;GAAW;GAAW;GAAW;EAAS;EACjD,OAAO;GAAC;GAAW;GAAW;GAAW;EAAS;CACpD;AACF"}
|
|
@@ -1,51 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
import geekblue from "../../../color/colors/geekblue.mjs";
|
|
3
|
-
import gold from "../../../color/colors/gold.mjs";
|
|
4
|
-
import green from "../../../color/colors/green.mjs";
|
|
5
|
-
import lime from "../../../color/colors/lime.mjs";
|
|
6
|
-
import red from "../../../color/colors/red.mjs";
|
|
7
|
-
import volcano from "../../../color/colors/volcano.mjs";
|
|
1
|
+
import { statusColorScales } from "../../../color/status/index.mjs";
|
|
8
2
|
import { generateColorPalette } from "../generateColorPalette.mjs";
|
|
9
3
|
import { generateCustomColorToken } from "../customToken.mjs";
|
|
10
4
|
import { legacyToken } from "./legacy.mjs";
|
|
11
5
|
import { shadowToken } from "./shadow.mjs";
|
|
12
6
|
//#region src/styles/theme/token/palette.ts
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
error: red,
|
|
16
|
-
info: blueGeekblueMix,
|
|
17
|
-
success: lime,
|
|
18
|
-
warning: gold
|
|
19
|
-
},
|
|
20
|
-
light: {
|
|
21
|
-
error: volcano,
|
|
22
|
-
info: geekblue,
|
|
23
|
-
success: green,
|
|
24
|
-
warning: gold
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
const createPaletteToken = (appearance) => {
|
|
28
|
-
const scales = statusScales[appearance];
|
|
29
|
-
const error = generateColorPalette({
|
|
30
|
-
appearance,
|
|
31
|
-
scale: scales.error,
|
|
32
|
-
type: "Error"
|
|
33
|
-
});
|
|
34
|
-
const info = generateColorPalette({
|
|
35
|
-
appearance,
|
|
36
|
-
scale: scales.info,
|
|
37
|
-
type: "Info"
|
|
38
|
-
});
|
|
39
|
-
const success = generateColorPalette({
|
|
7
|
+
const createStatusPalette = (appearance, scale, type) => {
|
|
8
|
+
const palette = generateColorPalette({
|
|
40
9
|
appearance,
|
|
41
|
-
scale
|
|
42
|
-
type
|
|
43
|
-
});
|
|
44
|
-
const warning = generateColorPalette({
|
|
45
|
-
appearance,
|
|
46
|
-
scale: scales.warning,
|
|
47
|
-
type: "Warning"
|
|
10
|
+
scale,
|
|
11
|
+
type
|
|
48
12
|
});
|
|
13
|
+
if (appearance === "dark") return palette;
|
|
14
|
+
return {
|
|
15
|
+
...palette,
|
|
16
|
+
[`color${type}Text`]: scale.light[10]
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
const createPaletteToken = (appearance, scales = statusColorScales) => {
|
|
20
|
+
const error = createStatusPalette(appearance, scales.error, "Error");
|
|
21
|
+
const info = createStatusPalette(appearance, scales.info, "Info");
|
|
22
|
+
const success = createStatusPalette(appearance, scales.success, "Success");
|
|
23
|
+
const warning = createStatusPalette(appearance, scales.warning, "Warning");
|
|
49
24
|
return {
|
|
50
25
|
...legacyToken[appearance],
|
|
51
26
|
...error,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"palette.mjs","names":[
|
|
1
|
+
{"version":3,"file":"palette.mjs","names":[],"sources":["../../../../src/styles/theme/token/palette.ts"],"sourcesContent":["import { type StatusColorScales, statusColorScales } from '@/color/status';\nimport type { ColorScaleItem } from '@/color/types';\n\nimport { generateCustomColorToken } from '../customToken';\nimport { generateColorPalette } from '../generateColorPalette';\nimport { legacyToken } from './legacy';\nimport { shadowToken } from './shadow';\n\nconst createStatusPalette = <T extends string>(\n appearance: 'light' | 'dark',\n scale: ColorScaleItem,\n type: T,\n) => {\n const palette = generateColorPalette({ appearance, scale, type });\n if (appearance === 'dark') return palette;\n return { ...palette, [`color${type}Text`]: scale.light[10] } as typeof palette;\n};\n\nexport const createPaletteToken = (\n appearance: 'light' | 'dark',\n scales: StatusColorScales = statusColorScales,\n) => {\n const error = createStatusPalette(appearance, scales.error, 'Error');\n const info = createStatusPalette(appearance, scales.info, 'Info');\n const success = createStatusPalette(appearance, scales.success, 'Success');\n const warning = createStatusPalette(appearance, scales.warning, 'Warning');\n\n return {\n ...legacyToken[appearance],\n ...error,\n ...info,\n ...success,\n ...warning,\n ...generateCustomColorToken(appearance === 'dark'),\n ...shadowToken[appearance],\n colorErrorAffix: error.colorError,\n colorHighlight: error.colorError,\n colorLink: info.colorInfoText,\n colorLinkActive: info.colorInfoTextActive,\n colorLinkHover: info.colorInfoTextHover,\n colorWarningAffix: warning.colorWarning,\n };\n};\n"],"mappings":";;;;;;AAQA,MAAM,uBACJ,YACA,OACA,SACG;CACH,MAAM,UAAU,qBAAqB;EAAE;EAAY;EAAO;CAAK,CAAC;CAChE,IAAI,eAAe,QAAQ,OAAO;CAClC,OAAO;EAAE,GAAG;GAAU,QAAQ,KAAK,QAAQ,MAAM,MAAM;CAAI;AAC7D;AAEA,MAAa,sBACX,YACA,SAA4B,sBACzB;CACH,MAAM,QAAQ,oBAAoB,YAAY,OAAO,OAAO,OAAO;CACnE,MAAM,OAAO,oBAAoB,YAAY,OAAO,MAAM,MAAM;CAChE,MAAM,UAAU,oBAAoB,YAAY,OAAO,SAAS,SAAS;CACzE,MAAM,UAAU,oBAAoB,YAAY,OAAO,SAAS,SAAS;CAEzE,OAAO;EACL,GAAG,YAAY;EACf,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG,yBAAyB,eAAe,MAAM;EACjD,GAAG,YAAY;EACf,iBAAiB,MAAM;EACvB,gBAAgB,MAAM;EACtB,WAAW,KAAK;EAChB,iBAAiB,KAAK;EACtB,gBAAgB,KAAK;EACrB,mBAAmB,QAAQ;CAC7B;AACF"}
|
|
@@ -60,6 +60,9 @@ const staticToken = {
|
|
|
60
60
|
motionEaseOutBack: "cubic-bezier(0.12, 0.4, 0.29, 1.46)",
|
|
61
61
|
motionEaseOutCirc: "cubic-bezier(0.08, 0.82, 0.17, 1)",
|
|
62
62
|
motionEaseOutQuint: "cubic-bezier(0.23, 1, 0.32, 1)",
|
|
63
|
+
motionSpringBouncy: "linear(0, 0.024, 0.086, 0.173, 0.274, 0.38, 0.485, 0.584, 0.675, 0.756, 0.825, 0.883, 0.931, 0.968, 0.997, 1.017, 1.031, 1.04, 1.045, 1.046, 1.045, 1.042, 1.038, 1.033, 1.028, 1.023, 1.019, 1.015, 1.011, 1.008, 1.005, 1)",
|
|
64
|
+
motionSpringSmooth: "linear(0, 0.036, 0.12, 0.225, 0.334, 0.438, 0.533, 0.616, 0.688, 0.748, 0.797, 0.838, 0.872, 0.898, 0.92, 0.937, 0.951, 0.962, 0.97, 0.977, 0.982, 0.986, 0.989, 0.992, 0.994, 0.995, 0.996, 0.997, 0.998, 0.998, 0.999, 1)",
|
|
65
|
+
motionSpringSnappy: "linear(0, 0.032, 0.111, 0.216, 0.33, 0.444, 0.552, 0.648, 0.731, 0.801, 0.858, 0.904, 0.939, 0.965, 0.984, 0.998, 1.006, 1.012, 1.014, 1.015, 1.015, 1.014, 1.012, 1.01, 1.009, 1.007, 1.006, 1.004, 1.003, 1.002, 1.002, 1)",
|
|
63
66
|
motionUnit: .1,
|
|
64
67
|
opacityImage: 1,
|
|
65
68
|
opacityLoading: .65,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"static.mjs","names":[],"sources":["../../../../src/styles/theme/token/static.ts"],"sourcesContent":["import { baseToken } from './base';\n\nexport const staticToken = {\n borderRadiusOuter: 6,\n colorTextLightSolid: '#fff',\n colorWhite: '#fff',\n controlHeightLG: 45,\n controlHeightSM: 27,\n controlHeightXS: 18,\n controlInteractiveSize: 18,\n controlOutlineWidth: 2,\n controlPaddingHorizontal: 12,\n controlPaddingHorizontalSM: 8,\n fontHeight: 22,\n fontHeightLG: 24,\n fontHeightSM: 20,\n fontSize: 14,\n fontSizeHeading1: 38,\n fontSizeHeading2: 30,\n fontSizeHeading3: 24,\n fontSizeHeading4: 20,\n fontSizeHeading5: 16,\n fontSizeIcon: 12,\n fontSizeLG: 16,\n fontSizeSM: 12,\n fontSizeXL: 20,\n fontWeightStrong: 600,\n lineHeight: 1.5714285714285714,\n lineHeightHeading1: 1.2105263157894737,\n lineHeightHeading2: 1.2666666666666666,\n lineHeightHeading3: 1.3333333333333333,\n lineHeightHeading4: 1.4,\n lineHeightHeading5: 1.5,\n lineHeightLG: 1.5,\n lineHeightSM: 1.6666666666666667,\n lineType: 'solid',\n lineWidth: 1,\n lineWidthBold: 2,\n lineWidthFocus: 3,\n linkDecoration: 'none',\n linkFocusDecoration: 'none',\n linkHoverDecoration: 'none',\n margin: 16,\n marginLG: 24,\n marginMD: 20,\n marginSM: 12,\n marginXL: 32,\n marginXS: 8,\n marginXXL: 48,\n marginXXS: 4,\n motionBase: 0,\n motionDurationFast: '0.1s',\n motionDurationMid: '0.2s',\n motionDurationSlow: '0.3s',\n motionEaseInBack: 'cubic-bezier(0.71, -0.46, 0.88, 0.6)',\n motionEaseInOut: 'cubic-bezier(0.645, 0.045, 0.355, 1)',\n motionEaseInOutCirc: 'cubic-bezier(0.78, 0.14, 0.15, 0.86)',\n motionEaseInQuint: 'cubic-bezier(0.755, 0.05, 0.855, 0.06)',\n motionEaseOut: 'cubic-bezier(0.215, 0.61, 0.355, 1)',\n motionEaseOutBack: 'cubic-bezier(0.12, 0.4, 0.29, 1.46)',\n motionEaseOutCirc: 'cubic-bezier(0.08, 0.82, 0.17, 1)',\n motionEaseOutQuint: 'cubic-bezier(0.23, 1, 0.32, 1)',\n motionUnit: 0.1,\n opacityImage: 1,\n opacityLoading: 0.65,\n padding: 16,\n paddingContentHorizontal: 16,\n paddingContentHorizontalLG: 24,\n paddingContentHorizontalSM: 16,\n paddingContentVertical: 12,\n paddingContentVerticalLG: 16,\n paddingContentVerticalSM: 8,\n paddingLG: 24,\n paddingMD: 20,\n paddingSM: 12,\n paddingXL: 32,\n paddingXS: 8,\n paddingXXS: 4,\n pink: '#EB2F96',\n screenLG: 992,\n screenLGMax: 1199,\n screenLGMin: 992,\n screenMD: 768,\n screenMDMax: 991,\n screenMDMin: 768,\n screenSM: 576,\n screenSMMax: 767,\n screenSMMin: 576,\n screenXL: 1200,\n screenXLMax: 1599,\n screenXLMin: 1200,\n screenXS: 480,\n screenXSMax: 575,\n screenXSMin: 480,\n screenXXL: 1600,\n screenXXLMax: 1919,\n screenXXLMin: 1600,\n screenXXXL: 1920,\n screenXXXLMin: 1920,\n size: 16,\n sizeLG: 24,\n sizeMD: 20,\n sizeMS: 16,\n sizePopupArrow: 16,\n sizeSM: 12,\n sizeStep: 4,\n sizeUnit: 4,\n sizeXL: 32,\n sizeXS: 8,\n sizeXXL: 48,\n sizeXXS: 4,\n zIndexBase: 0,\n zIndexPopupBase: 1000,\n ...baseToken,\n};\n"],"mappings":";;AAEA,MAAa,cAAc;CACzB,mBAAmB;CACnB,qBAAqB;CACrB,YAAY;CACZ,iBAAiB;CACjB,iBAAiB;CACjB,iBAAiB;CACjB,wBAAwB;CACxB,qBAAqB;CACrB,0BAA0B;CAC1B,4BAA4B;CAC5B,YAAY;CACZ,cAAc;CACd,cAAc;CACd,UAAU;CACV,kBAAkB;CAClB,kBAAkB;CAClB,kBAAkB;CAClB,kBAAkB;CAClB,kBAAkB;CAClB,cAAc;CACd,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,kBAAkB;CAClB,YAAY;CACZ,oBAAoB;CACpB,oBAAoB;CACpB,oBAAoB;CACpB,oBAAoB;CACpB,oBAAoB;CACpB,cAAc;CACd,cAAc;CACd,UAAU;CACV,WAAW;CACX,eAAe;CACf,gBAAgB;CAChB,gBAAgB;CAChB,qBAAqB;CACrB,qBAAqB;CACrB,QAAQ;CACR,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,WAAW;CACX,WAAW;CACX,YAAY;CACZ,oBAAoB;CACpB,mBAAmB;CACnB,oBAAoB;CACpB,kBAAkB;CAClB,iBAAiB;CACjB,qBAAqB;CACrB,mBAAmB;CACnB,eAAe;CACf,mBAAmB;CACnB,mBAAmB;CACnB,oBAAoB;CACpB,YAAY;CACZ,cAAc;CACd,gBAAgB;CAChB,SAAS;CACT,0BAA0B;CAC1B,4BAA4B;CAC5B,4BAA4B;CAC5B,wBAAwB;CACxB,0BAA0B;CAC1B,0BAA0B;CAC1B,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,YAAY;CACZ,MAAM;CACN,UAAU;CACV,aAAa;CACb,aAAa;CACb,UAAU;CACV,aAAa;CACb,aAAa;CACb,UAAU;CACV,aAAa;CACb,aAAa;CACb,UAAU;CACV,aAAa;CACb,aAAa;CACb,UAAU;CACV,aAAa;CACb,aAAa;CACb,WAAW;CACX,cAAc;CACd,cAAc;CACd,YAAY;CACZ,eAAe;CACf,MAAM;CACN,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,gBAAgB;CAChB,QAAQ;CACR,UAAU;CACV,UAAU;CACV,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,SAAS;CACT,YAAY;CACZ,iBAAiB;CACjB,GAAG;AACL"}
|
|
1
|
+
{"version":3,"file":"static.mjs","names":[],"sources":["../../../../src/styles/theme/token/static.ts"],"sourcesContent":["import { baseToken } from './base';\n\nexport const staticToken = {\n borderRadiusOuter: 6,\n colorTextLightSolid: '#fff',\n colorWhite: '#fff',\n controlHeightLG: 45,\n controlHeightSM: 27,\n controlHeightXS: 18,\n controlInteractiveSize: 18,\n controlOutlineWidth: 2,\n controlPaddingHorizontal: 12,\n controlPaddingHorizontalSM: 8,\n fontHeight: 22,\n fontHeightLG: 24,\n fontHeightSM: 20,\n fontSize: 14,\n fontSizeHeading1: 38,\n fontSizeHeading2: 30,\n fontSizeHeading3: 24,\n fontSizeHeading4: 20,\n fontSizeHeading5: 16,\n fontSizeIcon: 12,\n fontSizeLG: 16,\n fontSizeSM: 12,\n fontSizeXL: 20,\n fontWeightStrong: 600,\n lineHeight: 1.5714285714285714,\n lineHeightHeading1: 1.2105263157894737,\n lineHeightHeading2: 1.2666666666666666,\n lineHeightHeading3: 1.3333333333333333,\n lineHeightHeading4: 1.4,\n lineHeightHeading5: 1.5,\n lineHeightLG: 1.5,\n lineHeightSM: 1.6666666666666667,\n lineType: 'solid',\n lineWidth: 1,\n lineWidthBold: 2,\n lineWidthFocus: 3,\n linkDecoration: 'none',\n linkFocusDecoration: 'none',\n linkHoverDecoration: 'none',\n margin: 16,\n marginLG: 24,\n marginMD: 20,\n marginSM: 12,\n marginXL: 32,\n marginXS: 8,\n marginXXL: 48,\n marginXXS: 4,\n motionBase: 0,\n motionDurationFast: '0.1s',\n motionDurationMid: '0.2s',\n motionDurationSlow: '0.3s',\n motionEaseInBack: 'cubic-bezier(0.71, -0.46, 0.88, 0.6)',\n motionEaseInOut: 'cubic-bezier(0.645, 0.045, 0.355, 1)',\n motionEaseInOutCirc: 'cubic-bezier(0.78, 0.14, 0.15, 0.86)',\n motionEaseInQuint: 'cubic-bezier(0.755, 0.05, 0.855, 0.06)',\n motionEaseOut: 'cubic-bezier(0.215, 0.61, 0.355, 1)',\n motionEaseOutBack: 'cubic-bezier(0.12, 0.4, 0.29, 1.46)',\n motionEaseOutCirc: 'cubic-bezier(0.08, 0.82, 0.17, 1)',\n motionEaseOutQuint: 'cubic-bezier(0.23, 1, 0.32, 1)',\n motionSpringBouncy:\n 'linear(0, 0.024, 0.086, 0.173, 0.274, 0.38, 0.485, 0.584, 0.675, 0.756, 0.825, 0.883, 0.931, 0.968, 0.997, 1.017, 1.031, 1.04, 1.045, 1.046, 1.045, 1.042, 1.038, 1.033, 1.028, 1.023, 1.019, 1.015, 1.011, 1.008, 1.005, 1)',\n motionSpringSmooth:\n 'linear(0, 0.036, 0.12, 0.225, 0.334, 0.438, 0.533, 0.616, 0.688, 0.748, 0.797, 0.838, 0.872, 0.898, 0.92, 0.937, 0.951, 0.962, 0.97, 0.977, 0.982, 0.986, 0.989, 0.992, 0.994, 0.995, 0.996, 0.997, 0.998, 0.998, 0.999, 1)',\n motionSpringSnappy:\n 'linear(0, 0.032, 0.111, 0.216, 0.33, 0.444, 0.552, 0.648, 0.731, 0.801, 0.858, 0.904, 0.939, 0.965, 0.984, 0.998, 1.006, 1.012, 1.014, 1.015, 1.015, 1.014, 1.012, 1.01, 1.009, 1.007, 1.006, 1.004, 1.003, 1.002, 1.002, 1)',\n motionUnit: 0.1,\n opacityImage: 1,\n opacityLoading: 0.65,\n padding: 16,\n paddingContentHorizontal: 16,\n paddingContentHorizontalLG: 24,\n paddingContentHorizontalSM: 16,\n paddingContentVertical: 12,\n paddingContentVerticalLG: 16,\n paddingContentVerticalSM: 8,\n paddingLG: 24,\n paddingMD: 20,\n paddingSM: 12,\n paddingXL: 32,\n paddingXS: 8,\n paddingXXS: 4,\n pink: '#EB2F96',\n screenLG: 992,\n screenLGMax: 1199,\n screenLGMin: 992,\n screenMD: 768,\n screenMDMax: 991,\n screenMDMin: 768,\n screenSM: 576,\n screenSMMax: 767,\n screenSMMin: 576,\n screenXL: 1200,\n screenXLMax: 1599,\n screenXLMin: 1200,\n screenXS: 480,\n screenXSMax: 575,\n screenXSMin: 480,\n screenXXL: 1600,\n screenXXLMax: 1919,\n screenXXLMin: 1600,\n screenXXXL: 1920,\n screenXXXLMin: 1920,\n size: 16,\n sizeLG: 24,\n sizeMD: 20,\n sizeMS: 16,\n sizePopupArrow: 16,\n sizeSM: 12,\n sizeStep: 4,\n sizeUnit: 4,\n sizeXL: 32,\n sizeXS: 8,\n sizeXXL: 48,\n sizeXXS: 4,\n zIndexBase: 0,\n zIndexPopupBase: 1000,\n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