Compare commits

...

3 Commits

Author SHA1 Message Date
徐涛
7f6c217d7e 优化色卡界面加载色卡颜色种类的处理过程。 2025-02-10 22:00:00 +08:00
徐涛
ccedaa62a6 调整Vite配置,方便开发服务器正常加载WASM。 2025-02-10 21:52:06 +08:00
徐涛
128eeb24ac 调整WASM加载。 2025-02-10 21:51:40 +08:00
3 changed files with 9 additions and 2 deletions

View File

@ -42,7 +42,6 @@ export function ColorFunctionProvider({ children }: WasmProviderProps) {
try {
await init();
setWasmInstance(funcs);
console.debug('[Load WASM]', 'Loaded');
} catch (e) {
console.error('[Load WASM]', e);
setError(e);

View File

@ -6,6 +6,7 @@ import { HSegmentedControl } from '../components/HSegmentedControl';
import { ScrollArea } from '../components/ScrollArea';
import { ColorDescription } from '../models';
import { ColorCard } from '../page-components/cards-detail/ColorCard';
import { mapToObject } from '../utls';
import styles from './CardsDetail.module.css';
type ColorModes = 'hex' | 'rgb' | 'hsl' | 'lab' | 'oklch';
@ -20,7 +21,11 @@ export function CardsDetail({ mainTag }: CardsDetailProps) {
return [];
}
try {
const embededCategories = colorFn.color_categories() as { label: string; value: string }[];
const embededCategories = colorFn.color_categories().map(mapToObject) as {
label: string;
value: string;
}[];
console.debug('[Fetch color categories]', embededCategories);
return embededCategories.filter((cate) => !isEqual(cate.value, 'unknown'));
} catch (e) {
console.error('[Fetch color categories]', e);

View File

@ -10,4 +10,7 @@ export default defineConfig({
cssModules: true,
},
},
optimizeDeps: {
exclude: ['color-module'],
},
});