Skip to content

Commit

Permalink
fix(core): fix color palette types
Browse files Browse the repository at this point in the history
  • Loading branch information
fundon committed Dec 18, 2024
1 parent 2ceb6e9 commit 2f50643
Show file tree
Hide file tree
Showing 14 changed files with 194 additions and 193 deletions.
2 changes: 1 addition & 1 deletion packages/common/env/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"private": true,
"type": "module",
"devDependencies": {
"@blocksuite/affine": "0.19.2",
"@blocksuite/affine": "0.0.0-canary-20241218024138",
"vitest": "2.1.8"
},
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion packages/common/infra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@affine/debug": "workspace:*",
"@affine/env": "workspace:*",
"@affine/templates": "workspace:*",
"@blocksuite/affine": "0.19.2",
"@blocksuite/affine": "0.0.0-canary-20241218024138",
"@datastructures-js/binary-search-tree": "^5.3.2",
"eventemitter2": "^6.4.9",
"foxact": "^0.2.43",
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/apps/android/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@affine/component": "workspace:*",
"@affine/core": "workspace:*",
"@affine/i18n": "workspace:*",
"@blocksuite/affine": "0.19.2",
"@blocksuite/affine": "0.0.0-canary-20241218024138",
"@blocksuite/icons": "2.1.75",
"@capacitor/android": "^6.2.0",
"@capacitor/core": "^6.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/apps/electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@affine/i18n": "workspace:*",
"@affine/native": "workspace:*",
"@affine/nbstore": "workspace:*",
"@blocksuite/affine": "0.19.2",
"@blocksuite/affine": "0.0.0-canary-20241218024138",
"@electron-forge/cli": "^7.6.0",
"@electron-forge/core": "^7.6.0",
"@electron-forge/core-utils": "^7.6.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/apps/ios/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@affine/component": "workspace:*",
"@affine/core": "workspace:*",
"@affine/i18n": "workspace:*",
"@blocksuite/affine": "0.19.2",
"@blocksuite/affine": "0.0.0-canary-20241218024138",
"@blocksuite/icons": "2.1.75",
"@capacitor/app": "^6.0.2",
"@capacitor/browser": "^6.0.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/apps/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@affine/component": "workspace:*",
"@affine/core": "workspace:*",
"@affine/i18n": "workspace:*",
"@blocksuite/affine": "0.19.2",
"@blocksuite/affine": "0.0.0-canary-20241218024138",
"@blocksuite/icons": "2.1.75",
"@sentry/react": "^8.44.0",
"react": "^19.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"zod": "^3.24.1"
},
"devDependencies": {
"@blocksuite/affine": "0.19.2",
"@blocksuite/affine": "0.0.0-canary-20241218024138",
"@blocksuite/icons": "2.1.75",
"@chromatic-com/storybook": "^3.2.2",
"@storybook/addon-essentials": "^8.4.7",
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@affine/i18n": "workspace:*",
"@affine/templates": "workspace:*",
"@affine/track": "workspace:*",
"@blocksuite/affine": "0.19.2",
"@blocksuite/affine": "0.0.0-canary-20241218024138",
"@blocksuite/icons": "2.1.75",
"@capacitor/app": "^6.0.2",
"@capacitor/browser": "^6.0.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import {
FontFamilyMap,
FontStyle,
FontWeightMap,
LineColor,
LineColorMap,
PointStyle,
StrokeColor,
StrokeColorMap,
StrokeStyle,
TextAlign,
} from '@blocksuite/affine/blocks';
Expand Down Expand Up @@ -152,12 +152,12 @@ export const ConnectorSettings = () => {

const currentColor = useMemo(() => {
const color = settings.connector.stroke;
return getColorFromMap(color, LineColorMap);
return getColorFromMap(color, StrokeColorMap);
}, [getColorFromMap, settings.connector.stroke]);

const colorItems = useMemo(() => {
const { stroke } = settings.connector;
return Object.entries(LineColor).map(([name, value]) => {
return Object.entries(StrokeColor).map(([name, value]) => {
const handler = () => {
editorSetting.set('connector', { stroke: value });
};
Expand Down Expand Up @@ -322,7 +322,7 @@ export const ConnectorSettings = () => {

const textColorItems = useMemo(() => {
const { color } = settings.connector.labelStyle;
return Object.entries(LineColor).map(([name, value]) => {
return Object.entries(StrokeColor).map(([name, value]) => {
const handler = () => {
editorSetting.set('connector', {
labelStyle: {
Expand All @@ -346,7 +346,7 @@ export const ConnectorSettings = () => {

const textColor = useMemo(() => {
const { color } = settings.connector.labelStyle;
return getColorFromMap(color, LineColorMap);
return getColorFromMap(color, StrokeColorMap);
}, [getColorFromMap, settings]);

const getElements = useCallback((doc: Doc) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { MenuItem, MenuTrigger, Slider } from '@affine/component';
import { SettingRow } from '@affine/component/setting-components';
import { EditorSettingService } from '@affine/core/modules/editor-setting';
import { useI18n } from '@affine/i18n';
import { LineColor, LineColorMap } from '@blocksuite/affine/blocks';
import { StrokeColor, StrokeColorMap } from '@blocksuite/affine/blocks';
import type { Doc } from '@blocksuite/affine/store';
import { useFramework, useLiveData } from '@toeverything/infra';
import { useCallback, useMemo } from 'react';
Expand All @@ -22,12 +22,12 @@ export const PenSettings = () => {
const getColorFromMap = useColor();

const currentColor = useMemo(() => {
return getColorFromMap(settings.brush.color, LineColorMap);
return getColorFromMap(settings.brush.color, StrokeColorMap);
}, [getColorFromMap, settings.brush.color]);

const colorItems = useMemo(() => {
const { color } = settings.brush;
return Object.entries(LineColor).map(([name, value]) => {
return Object.entries(StrokeColor).map(([name, value]) => {
const handler = () => {
editorSetting.set('brush', { color: value });
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import {
FontStyle,
FontWeightMap,
getShapeName,
LineColor,
LineColorMap,
ShapeFillColor,
ShapeStyle,
ShapeType,
StrokeColor,
StrokeColorMap,
StrokeStyle,
TextAlign,
} from '@blocksuite/affine/blocks';
Expand Down Expand Up @@ -226,7 +226,7 @@ export const ShapeSettings = () => {

const borderColorItems = useMemo(() => {
const { strokeColor } = settings[`shape:${currentShape}`];
return Object.entries(LineColor).map(([name, value]) => {
return Object.entries(StrokeColor).map(([name, value]) => {
const handler = () => {
editorSetting.set(`shape:${currentShape}`, { strokeColor: value });
};
Expand Down Expand Up @@ -316,7 +316,7 @@ export const ShapeSettings = () => {

const textColorItems = useMemo(() => {
const { color } = settings[`shape:${currentShape}`];
return Object.entries(LineColor).map(([name, value]) => {
return Object.entries(StrokeColor).map(([name, value]) => {
const handler = () => {
editorSetting.set(`shape:${currentShape}`, { color: value });
};
Expand Down Expand Up @@ -375,12 +375,12 @@ export const ShapeSettings = () => {

const borderColor = useMemo(() => {
const color = settings[`shape:${currentShape}`].strokeColor;
return getColorFromMap(color, LineColorMap);
return getColorFromMap(color, StrokeColorMap);
}, [currentShape, getColorFromMap, settings]);

const textColor = useMemo(() => {
const color = settings[`shape:${currentShape}`].color;
return getColorFromMap(color, LineColorMap);
return getColorFromMap(color, StrokeColorMap);
}, [currentShape, getColorFromMap, settings]);

const height = currentDoc === 'flow' ? 456 : 180;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import {
FontFamilyMap,
FontStyle,
FontWeightMap,
LineColor,
LineColorMap,
StrokeColor,
StrokeColorMap,
TextAlign,
} from '@blocksuite/affine/blocks';
import type { Doc } from '@blocksuite/affine/store';
Expand Down Expand Up @@ -72,7 +72,7 @@ export const TextSettings = () => {

const colorItems = useMemo(() => {
const { color } = settings['affine:edgeless-text'];
return Object.entries(LineColor).map(([name, value]) => {
return Object.entries(StrokeColor).map(([name, value]) => {
const handler = () => {
editorSetting.set('affine:edgeless-text', { color: value });
};
Expand Down Expand Up @@ -137,7 +137,7 @@ export const TextSettings = () => {

const currentColor = useMemo(() => {
const { color } = settings['affine:edgeless-text'];
return getColorFromMap(color, LineColorMap);
return getColorFromMap(color, StrokeColorMap);
}, [getColorFromMap, settings]);

const getElements = useCallback((doc: Doc) => {
Expand Down
2 changes: 1 addition & 1 deletion tools/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"@affine/env": "workspace:*",
"@affine/templates": "workspace:*",
"@aws-sdk/client-s3": "^3.709.0",
"@blocksuite/affine": "0.19.2",
"@blocksuite/affine": "0.0.0-canary-20241218024138",
"@clack/core": "^0.3.5",
"@clack/prompts": "^0.8.2",
"@magic-works/i18n-codegen": "^0.6.1",
Expand Down
Loading

0 comments on commit 2f50643

Please sign in to comment.