|
1 | 1 | import type { ReturnStyleType, ClassesObjectType, ExactClassesObjectType } from '../../_internal'; |
2 | | -import { isDevelopment, isDevAndTest, isServer, injectServerCSS, injectClientCSS, sheetCompiler, genBase62Hash } from '../../_internal'; |
3 | | -import styles from '../styles/style.module.css'; |
| 2 | +import { isDevAndTest, sheetCompiler, isDevelopment, injectServerCSS, genBase36Hash, isServer, injectClientCSS } from '../../_internal'; |
4 | 3 | import { createGlobalStyleSheetPromise, globalStyleSheetPromise, resolveGlobalStyleSheet } from './create-build-in-helper'; |
| 4 | +import styles from '../styles/style.module.css'; |
5 | 5 |
|
6 | 6 | export function create<T extends ClassesObjectType>(object: ExactClassesObjectType<T> | ClassesObjectType): ReturnStyleType<T> { |
7 | | - const base62Hash = genBase62Hash(object, 5); |
8 | | - const { styleSheet } = sheetCompiler(object, base62Hash); |
| 7 | + const base36Hash = genBase36Hash(object, 6); |
| 8 | + const { styleSheet } = sheetCompiler(object, base36Hash); |
9 | 9 | if (typeof globalStyleSheetPromise === 'undefined') createGlobalStyleSheetPromise(); |
10 | 10 | resolveGlobalStyleSheet(styleSheet); |
11 | 11 |
|
12 | 12 | return new Proxy(object, { |
13 | | - get: function (target, prop: string) { |
14 | | - if (typeof prop === 'string' && prop in target) { |
15 | | - const className = prop + '_' + base62Hash; |
16 | | - if (isDevelopment) isServer ? injectServerCSS(base62Hash, styleSheet, 'create') : injectClientCSS(base62Hash, styleSheet, 'create'); |
| 13 | + get: function (target, key: string) { |
| 14 | + if (typeof key === 'string' && key in target) { |
| 15 | + const className = key + '_' + base36Hash; |
| 16 | + if (isDevelopment) isServer ? injectServerCSS(base36Hash, styleSheet, 'create') : injectClientCSS(base36Hash, styleSheet, 'create'); |
17 | 17 | return isDevAndTest ? className : styles[className]; |
18 | 18 | } |
19 | 19 | }, |
|
0 commit comments