@koine/utils 2.0.0-alpha.3 → 2.0.0-alpha.4

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.
@@ -1,3 +1,11 @@
1
+ type PaletteShade = readonly [number, string];
2
+ type PaletteShades = readonly PaletteShade[];
3
+ type PaletteMapPair<T extends PaletteShade> = {
4
+ [Pair in T as `${Pair[0]}`]: Pair[1];
5
+ };
6
+ type PaletteMap<T extends PaletteShades> = {
7
+ [PS in T[number] as keyof PaletteMapPair<PS>]: PaletteMapPair<PS>[keyof PaletteMapPair<PS>];
8
+ };
1
9
  /**
2
10
  * Create palette, this is primarily thought to improve the reuse of a palette
3
11
  * definition between TailwindCSS and straight ES imports
@@ -8,5 +16,5 @@
8
16
  * object 3) A flat array of colors (no special sorting, same order as the `shades`
9
17
  * given as argument)
10
18
  */
11
- export declare const createPalette: <TName extends string, TShades extends readonly (readonly [number, string])[], TShade extends number = TShades[number][0]>(name: TName, shades: TShades) => readonly [Record<TShade, string>, Record<`${TName}-${TShades[number][0]}`, string>, unknown[]];
19
+ export declare const createPalette: <TName extends string, TShades extends PaletteShades, TColor = TShades[number][1], TMap = PaletteMap<TShades>>(name: TName, shades: TShades) => readonly [TMap, Record<`${TName}-${TShades[number][0]}`, string>, TColor[]];
12
20
  export default createPalette;
package/package.json CHANGED
@@ -11,6 +11,6 @@
11
11
  },
12
12
  "main": "./index.js",
13
13
  "types": "./index.d.ts",
14
- "version": "2.0.0-alpha.3",
14
+ "version": "2.0.0-alpha.4",
15
15
  "module": "./index.mjs"
16
16
  }