fix: update i18n - update schema fields descriptions

This commit is contained in:
2026-09-13 07:16:46 +05:00
parent 4de42b1e40
commit 08c9fbce3b
10 changed files with 287 additions and 57 deletions
+57 -13
View File
@@ -1,5 +1,5 @@
import { imgTool, textGen, type ToolEntry } from "./types";
import { field, toolSchema } from "../registry-schema";
import { hasTransparency, isGrayscale, orientationOf } from "../core/analyze";
import { encode } from "../core/io";
import {
extractByColor,
isGrayscaleish,
@@ -7,10 +7,10 @@ import {
rarityPredicate,
renderPredicateMask,
} from "../core/masks";
import { hasTransparency, isGrayscale, orientationOf } from "../core/analyze";
import { encode } from "../core/io";
import { base64ToBytes, looksLikePng, stripDataUri } from "../core/textio";
import { t } from "../i18n/t";
import { field, toolSchema } from "../registry-schema";
import { imgTool, textGen, type ToolEntry } from "./types";
interface ExtractColorParams {
color: string;
@@ -18,8 +18,14 @@ interface ExtractColorParams {
}
export const extractColorSchema = toolSchema<ExtractColorParams>({
color: field.color({ default: "#00ff88" }),
tolerance: field.slider({ min: 0, max: 50, step: 1, default: 10 }),
color: field.color({ label: "fields.color", default: "#00ff88" }),
tolerance: field.slider({
label: "fields.colorTolerance",
min: 0,
max: 50,
step: 1,
default: 10,
}),
});
const extractColor: ToolEntry<ExtractColorParams> = {
@@ -41,14 +47,21 @@ interface MaskParams {
const maskBaseFields = {
mode: field.select({
label: "fields.mode",
default: "binary",
options: [
{ value: "binary", label: "Black & white mask" },
{ value: "highlight", label: "Color highlight" },
],
}),
color: field.color({ default: "#ff00aa" }),
opacity: field.slider({ min: 0, max: 100, step: 5, default: 70 }),
color: field.color({ label: "fields.highlightColor", default: "#ff00aa" }),
opacity: field.slider({
label: "fields.opacity",
min: 0,
max: 100,
step: 5,
default: 70,
}),
};
function renderMask(
@@ -66,6 +79,7 @@ function renderMask(
export const showTransparentSchema = toolSchema<MaskParams>({
...maskBaseFields,
mode: field.select({
label: "fields.mode",
default: "highlight",
options: [
{ value: "binary", label: "Black & white mask" },
@@ -91,7 +105,13 @@ interface GrayscalePixelsParams extends MaskParams {
export const showGrayscalePixelsSchema = toolSchema<GrayscalePixelsParams>({
...maskBaseFields,
tolerance: field.slider({ min: 0, max: 64, step: 1, default: 0 }),
tolerance: field.slider({
label: "fields.channelTolerance",
min: 0,
max: 64,
step: 1,
default: 0,
}),
});
const showGrayscalePixels: ToolEntry<GrayscalePixelsParams> = {
@@ -113,7 +133,13 @@ interface ColorPixelsParams extends MaskParams {
export const showColorPixelsSchema = toolSchema<ColorPixelsParams>({
...maskBaseFields,
tolerance: field.slider({ min: 0, max: 64, step: 1, default: 8 }),
tolerance: field.slider({
label: "fields.channelTolerance",
min: 0,
max: 64,
step: 1,
default: 8,
}),
});
const showColorPixels: ToolEntry<ColorPixelsParams> = {
@@ -135,7 +161,13 @@ interface LightPixelParams extends MaskParams {
export const lightPixelMaskSchema = toolSchema<LightPixelParams>({
...maskBaseFields,
threshold: field.slider({ min: 0, max: 100, step: 1, default: 70 }),
threshold: field.slider({
label: "fields.lumaThreshold",
min: 0,
max: 100,
step: 1,
default: 70,
}),
});
const lightPixelMask: ToolEntry<LightPixelParams> = {
@@ -156,7 +188,13 @@ interface DarkPixelParams extends MaskParams {
export const darkPixelMaskSchema = toolSchema<DarkPixelParams>({
...maskBaseFields,
threshold: field.slider({ min: 0, max: 100, step: 1, default: 30 }),
threshold: field.slider({
label: "fields.lumaThreshold",
min: 0,
max: 100,
step: 1,
default: 30,
}),
});
const darkPixelMask: ToolEntry<DarkPixelParams> = {
@@ -177,7 +215,13 @@ interface UniqueColorParams extends MaskParams {
export const uniqueColorMaskSchema = toolSchema<UniqueColorParams>({
...maskBaseFields,
rarity: field.slider({ min: 1, max: 50, step: 1, default: 1 }),
rarity: field.slider({
label: "fields.rarity",
min: 1,
max: 50,
step: 1,
default: 1,
}),
});
const uniqueColorMask: ToolEntry<UniqueColorParams> = {
+26 -8
View File
@@ -1,6 +1,6 @@
import { imgTool, textGen, type ToolEntry } from "./types";
import { field, toolSchema } from "../registry-schema";
import { flattenOntoColor } from "../core/alpha";
import { decodeBytes, decodeSvgText, toBase64, toDataUrl } from "../core/io";
import { hexToPixels, pixelsToHex } from "../core/text";
import {
base64ToBytes,
bytesToImage,
@@ -9,12 +9,18 @@ import {
rgbValuesToImage,
stripDataUri,
} from "../core/textio";
import { hexToPixels, pixelsToHex } from "../core/text";
import { clonePixelImage } from "../core/types";
import { decodeBytes, decodeSvgText, toBase64, toDataUrl } from "../core/io";
import { field, toolSchema } from "../registry-schema";
import { imgTool, textGen, type ToolEntry } from "./types";
const widthProps = (defaultValue: number) =>
field.number({ min: 1, max: 10000, step: 1, default: defaultValue });
field.number({
label: "fields.width",
min: 1,
max: 10000,
step: 1,
default: defaultValue,
});
interface ConvertToJpgParams {
background: string;
@@ -22,8 +28,14 @@ interface ConvertToJpgParams {
}
export const convertToJpgSchema = toolSchema<ConvertToJpgParams>({
background: field.color({ default: "#ffffff" }),
quality: field.slider({ min: 1, max: 100, step: 1, default: 90 }),
background: field.color({ label: "fields.background", default: "#ffffff" }),
quality: field.slider({
label: "fields.quality",
min: 1,
max: 100,
step: 1,
default: 90,
}),
});
const convertToJpg: ToolEntry<ConvertToJpgParams> = {
@@ -43,7 +55,13 @@ interface ConvertToWebpParams {
}
export const convertToWebpSchema = toolSchema<ConvertToWebpParams>({
quality: field.slider({ min: 1, max: 100, step: 1, default: 90 }),
quality: field.slider({
label: "fields.quality",
min: 1,
max: 100,
step: 1,
default: 90,
}),
});
const convertToWebp: ToolEntry<ConvertToWebpParams> = {
+77 -16
View File
@@ -1,21 +1,27 @@
import { imgTool, type ToolEntry } from "./types";
import { field, toolSchema } from "../registry-schema";
import { gaussianBlur, sharpen as sharpenImage } from "../core/convolution";
import { vignette } from "../core/effects";
import { jpegRoundtrip } from "../core/io";
import {
addNoise,
pixelate,
shuffleBlocks,
silhouette,
} from "../core/pixel-fx";
import { gaussianBlur, sharpen as sharpenImage } from "../core/convolution";
import { vignette } from "../core/effects";
import { jpegRoundtrip } from "../core/io";
import { field, toolSchema } from "../registry-schema";
import { imgTool, type ToolEntry } from "./types";
interface BlurParams {
radius: number;
}
export const blurSchema = toolSchema<BlurParams>({
radius: field.slider({ min: 1, max: 32, step: 1, default: 4 }),
radius: field.slider({
label: "fields.radius",
min: 1,
max: 32,
step: 1,
default: 4,
}),
});
const blurTool: ToolEntry<BlurParams> = {
@@ -34,7 +40,13 @@ interface SharpenParams {
}
export const sharpenSchema = toolSchema<SharpenParams>({
strength: field.slider({ min: 0, max: 100, step: 1, default: 50 }),
strength: field.slider({
label: "fields.strength",
min: 0,
max: 100,
step: 1,
default: 50,
}),
});
const sharpenTool: ToolEntry<SharpenParams> = {
@@ -54,8 +66,14 @@ interface SilhouetteParams {
}
export const silhouetteSchema = toolSchema<SilhouetteParams>({
color: field.color({ default: "#111318" }),
threshold: field.slider({ min: 0, max: 100, step: 1, default: 10 }),
color: field.color({ label: "fields.fillColor", default: "#111318" }),
threshold: field.slider({
label: "fields.threshold",
min: 0,
max: 100,
step: 1,
default: 10,
}),
});
const silhouetteTool: ToolEntry<SilhouetteParams> = {
@@ -74,7 +92,13 @@ interface VignetteParams {
}
export const vignetteSchema = toolSchema<VignetteParams>({
strength: field.slider({ min: 0, max: 100, step: 5, default: 50 }),
strength: field.slider({
label: "fields.strength",
min: 0,
max: 100,
step: 5,
default: 50,
}),
});
const vignetteTool: ToolEntry<VignetteParams> = {
@@ -93,7 +117,13 @@ interface PixelateParams {
}
export const pixelateSchema = toolSchema<PixelateParams>({
blockSize: field.slider({ min: 2, max: 64, step: 1, default: 8 }),
blockSize: field.slider({
label: "fields.blockSize",
min: 2,
max: 64,
step: 1,
default: 8,
}),
});
const pixelateTool: ToolEntry<PixelateParams> = {
@@ -114,8 +144,20 @@ interface RandomizePixelsParams {
export const randomizePixelsSchema = toolSchema<RandomizePixelsParams>(
{
blockSize: field.slider({ min: 1, max: 64, step: 1, default: 8 }),
seed: field.number({ min: 0, max: 999999, step: 1, default: 42 }),
blockSize: field.slider({
label: "fields.blockSize",
min: 1,
max: 64,
step: 1,
default: 8,
}),
seed: field.number({
label: "fields.seed",
min: 0,
max: 999999,
step: 1,
default: 42,
}),
},
{
layout: {
@@ -145,15 +187,28 @@ interface AddNoiseParams {
export const addNoiseSchema = toolSchema<AddNoiseParams>(
{
amount: field.slider({ min: 0, max: 100, step: 1, default: 25 }),
amount: field.slider({
label: "fields.amount",
min: 0,
max: 100,
step: 1,
default: 25,
}),
mode: field.select({
label: "fields.mode",
default: "mono",
options: [
{ value: "mono", label: "Monochrome grain" },
{ value: "color", label: "Color noise" },
],
}),
seed: field.number({ min: 0, max: 999999, step: 1, default: 1234 }),
seed: field.number({
label: "fields.seed",
min: 0,
max: 999999,
step: 1,
default: 1234,
}),
},
{
layout: {
@@ -181,7 +236,13 @@ interface JpegArtifactsParams {
}
export const jpegArtifactsSchema = toolSchema<JpegArtifactsParams>({
quality: field.slider({ min: 1, max: 50, step: 1, default: 10 }),
quality: field.slider({
label: "fields.quality",
min: 1,
max: 50,
step: 1,
default: 10,
}),
});
const jpegArtifacts: ToolEntry<JpegArtifactsParams> = {