@nurl/panda-preset
Version:
Official Panda-CSS preset for the Ganglion Design System.
1 lines • 1.48 kB
Source Map (JSON)
{"version":3,"sources":["../../../../src/recipes/shared/helpers.ts"],"sourcesContent":["import type { Sentiment } from '../../theme/semantic-tokens/types'\n\nexport type RecipePalette<K extends Sentiment[]> = K[]\n\n/**\n * Creates a palette object for a slot recipe\n *\n * @param slots - Array of slot names\n * @param palettes - Array of palette names\n * @returns Object with the following shape:\n * {\n * [palette]: {\n * [slot]: {\n * colorPalette: palette\n * }\n * }\n */\nexport function getSlotRecipePalettes<\n const S extends string,\n const P extends Sentiment,\n>(\n slots: S[],\n palettes: P[],\n initialValue?: Record<P, Record<S, Record<'colorPalette', Sentiment>>>,\n) {\n return palettes.reduce(\n (acc, palette) => {\n acc[palette] = slots.reduce(\n (acc, slot) => {\n acc[slot] = {\n colorPalette: palette,\n }\n return acc\n },\n {} as Record<S, Record<'colorPalette', Sentiment>>,\n )\n return acc\n },\n initialValue ??\n ({} as Record<P, Record<S, Record<'colorPalette', Sentiment>>>),\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBO,SAAS,sBAId,OACA,UACA,cACA;AACA,SAAO,SAAS;AAAA,IACd,CAAC,KAAK,YAAY;AAChB,UAAI,OAAO,IAAI,MAAM;AAAA,QACnB,CAACA,MAAK,SAAS;AACb,UAAAA,KAAI,IAAI,IAAI;AAAA,YACV,cAAc;AAAA,UAChB;AACA,iBAAOA;AAAA,QACT;AAAA,QACA,CAAC;AAAA,MACH;AACA,aAAO;AAAA,IACT;AAAA,IACA,gBACG,CAAC;AAAA,EACN;AACF;","names":["acc"]}