dozy 1.0.31 → 1.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,3 @@
1
- # dozy
2
-
3
- My shared typescript utilities.
1
+ # dozy
2
+
3
+ My shared typescript utilities.
Binary file
@@ -10,7 +10,7 @@
10
10
  @font-face {
11
11
  font-family: 'xaifont';
12
12
  src:
13
- url('/fonts/xaifont.woff2') format('woff2'),
13
+ url('./fonts/xaifont.woff2') format('woff2'),
14
14
  url('https://xaidozy.github.io/fonts/xaifont.woff2') format('woff2');
15
15
  font-display: swap;
16
16
  }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import { default as axios } from 'axios';
2
+ import * as ColorLib from 'culori';
3
+ import { Color } from 'culori';
2
4
  import * as l from 'lodash-es';
3
5
  import { default as z } from 'zod';
4
6
 
@@ -207,11 +209,39 @@ export declare function getColorMap(dark?: boolean): string[];
207
209
  export declare function Gens(literature: string, ...args: any[]): string;
208
210
  export declare let _res: (x: string) => string;
209
211
  export declare function __GensDirectives(): Items<(...args: string[]) => string>;
210
- export declare const DOZY = "1.0.31";
212
+ /**
213
+ * Register a custom color alias.
214
+ * @param name The name of the alias (e.g., 'abc', 'myColor')
215
+ * @param color The valid color string it maps to (e.g., '#ff0000', 'red')
216
+ */
217
+ export declare function registerCustomColor(name: string, color: string): void;
218
+ /**
219
+ * Smartly parses a color string.
220
+ * Supports:
221
+ * - All standard CSS colors (names, hex, rgb, hsl, oklch, etc.) via culori.
222
+ * - Hex strings without '#' (e.g., 'ff5555', 'abc', 'aabbccdd').
223
+ * - Custom aliases registered via registerCustomColor.
224
+ *
225
+ * @param input The color string to parse.
226
+ * @param fallback Optional fallback color string if parsing fails.
227
+ * @returns The parsed Color object or undefined if invalid.
228
+ */
229
+ export declare function smartParse(input: string | any, fallback?: string): Color | undefined;
230
+ /**
231
+ * Smartly parses a color and returns a CSS string.
232
+ * Defaults to Hex for sRGB colors, or CSS function for others (like oklch).
233
+ */
234
+ export declare function smartString(input: string | any, fallback?: string): string | undefined;
235
+ /**
236
+ * Check if a color string is valid (smartly).
237
+ */
238
+ export declare function isValidColor(input: string): boolean;
239
+ export declare const DOZY = "1.0.32";
211
240
  export * from "axios";
212
241
  export * from "zod";
213
242
 
214
243
  export {
244
+ ColorLib,
215
245
  axios,
216
246
  l,
217
247
  z,
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,2BAA2B,CAAA;AACzC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,wBAAwB,CAAA;AACtC,cAAc,kCAAkC,CAAA;AAEhD,cAAc,OAAO,CAAA;AACrB,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,OAAO,CAAA;AAExC,OAAO,KAAK,CAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,EAAE,CAAC,EAAE,CAAA;AAEZ,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,WAAW,CAAA;AAI/C,cAAc,KAAK,CAAA;AACnB,OAAO,EAAE,OAAO,IAAI,CAAC,EAAE,MAAM,KAAK,CAAA;AAElC,eAAO,MAAM,IAAI,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,2BAA2B,CAAA;AACzC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,wBAAwB,CAAA;AACtC,cAAc,kCAAkC,CAAA;A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