From 2b95fdc8b8b493621b572ccaf01b41f35991a60a Mon Sep 17 00:00:00 2001 From: chizukicn Date: Wed, 25 Oct 2023 15:23:25 +0800 Subject: [PATCH] chore: fix typo --- README.md | 10 +++++----- src/index.ts | 4 ++-- src/types.ts | 2 +- test/generate.test.ts | 4 ++-- test/utils.test.ts | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 1d3703b..40ef7c5 100644 --- a/README.md +++ b/README.md @@ -48,16 +48,16 @@ export default defineConfig({ ```css .text-primary\/72 { // hsla - color: hsla(var(--un-platte-primary-color-hsl) / 0.72); + color: hsla(var(--un-palette-primary-color-hsl) / 0.72); // rgba - // color: rgba(var(--un-platte-primary-color-rgb) / 0.72); + // color: rgba(var(--un-palette-primary-color-rgb) / 0.72); } .bg-primary\/36 { // hsla - background-color: hsla(var(--un-platte-primary-color-hsl) / 0.36); + background-color: hsla(var(--un-palette-primary-color-hsl) / 0.36); // rgba - // background-color: rgba(var(--un-platte-primary-color-rgb) / 0.36); + // background-color: rgba(var(--un-palette-primary-color-rgb) / 0.36); } ``` @@ -103,7 +103,7 @@ export interface PaletteOptions { } /** - * @default --un-platte-[name]-color + * @default --un-palette-[name]-color */ cssVarName?: CssVarName diff --git a/src/index.ts b/src/index.ts index 095dbcb..257b33e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -17,7 +17,7 @@ export const presetPalette = definePreset((options: PaletteOptions = {}) => { const { selector = ":root", attribute = "class", defaultValue = "default" } = colorMode; - const cssVarName: CssVarName = options.cssVarName || "un-platte-[name]-color"; + const cssVarName: CssVarName = options.cssVarName || "un-palette-[name]-color"; const colorComponents = getColorComponents(themeColors, defaultValue, colorFormat); @@ -28,7 +28,7 @@ export const presetPalette = definePreset((options: PaletteOptions = {}) => { } else if (typeof cssVarName === "function") { getVarName = name => normalizeVarName(cssVarName(name)); } else { - const prefix = cssVarName?.prefix ?? "un-platte-"; + const prefix = cssVarName?.prefix ?? "un-palette-"; const suffix = cssVarName?.suffix ?? "-color"; getVarName = name => normalizeVarName(`${prefix}${name}${suffix}`); } diff --git a/src/types.ts b/src/types.ts index 4b22ed7..ba1283f 100644 --- a/src/types.ts +++ b/src/types.ts @@ -40,7 +40,7 @@ export interface PaletteOptions { } /** - * @default --un-platte-[name]-color + * @default --un-palette-[name]-color */ cssVarName?: CssVarName diff --git a/test/generate.test.ts b/test/generate.test.ts index 1ebf81f..be3852f 100644 --- a/test/generate.test.ts +++ b/test/generate.test.ts @@ -15,7 +15,7 @@ describe("generate test", () => { const { css } = await uno.generate("bg-primary"); expect(css).toMatchInlineSnapshot(` "/* layer: palette */ - :root{--un-platte-primary-color-rgb:255 0 0;--un-platte-primary-color:rgb(var(--un-platte-primary-color-rgb));}" + :root{--un-palette-primary-color-rgb:255 0 0;--un-palette-primary-color:rgb(var(--un-palette-primary-color-rgb));}" `); }); @@ -35,7 +35,7 @@ describe("generate test", () => { }); expect(css).toMatchInlineSnapshot(` "/* layer: default */ - .bg-primary{--un-bg-opacity:1;background-color:rgb(var(--un-platte-primary-color-rgb) / var(--un-bg-opacity));}" + .bg-primary{--un-bg-opacity:1;background-color:rgb(var(--un-palette-primary-color-rgb) / var(--un-bg-opacity));}" `); }); }); diff --git a/test/utils.test.ts b/test/utils.test.ts index 0a2b088..6b826d5 100644 --- a/test/utils.test.ts +++ b/test/utils.test.ts @@ -15,7 +15,7 @@ describe("utils test", () => { }); it("normalizeVarName", () => { - expect(normalizeVarName("un-platte-primary-color")).toEqual("--un-platte-primary-color"); - expect(normalizeVarName("--un-platte-primary-color")).toEqual("--un-platte-primary-color"); + expect(normalizeVarName("un-palette-primary-color")).toEqual("--un-palette-primary-color"); + expect(normalizeVarName("--un-palette-primary-color")).toEqual("--un-palette-primary-color"); }); });