UNPKG

storybook-theme-switch-addon

Version:
1 lines 1.65 kB
{"version":3,"sources":["../src/constants.ts","../src/preview.ts"],"names":["ADDON_ID","TOOL_ID","PARAM_KEY","globalTypes","themes","preview","preview_default"],"mappings":"AAAO,IAAMA,EAAW,+BACXC,EAAU,GAAGD,SACbE,EAAY,QCKzB,IAAMC,EAAc,CAClB,YAAa,CACX,OAAQ,CACN,CACE,GAAI,gBACJ,MAAO,gBACP,IAAK,qBACP,EACA,CACE,GAAI,kBACJ,MAAO,kBACP,IAAK,uBACP,EACA,CACE,GAAI,iBACJ,MAAO,iBACP,IAAK,sBACP,CACF,CACF,CACF,EAEM,CAAE,OAAAC,CAAO,EAAID,EAAY,YAKzBE,EAAwC,CAC5C,QAAS,CACP,CAACH,CAAS,EAAG,MACf,EACA,YAAAC,CACF,EAEOG,EAAQD","sourcesContent":["export const ADDON_ID = \"storybook/theme-switch-addon\";\nexport const TOOL_ID = `${ADDON_ID}/tool`;\nexport const PARAM_KEY = \"theme\";\n","import type { Renderer, ProjectAnnotations } from \"@storybook/types\";\nimport { PARAM_KEY } from \"./constants\";\n\ntype ArrayElement<ArrType> = ArrType extends readonly (infer ElementType)[]\n ? ElementType\n : never;\n\nconst globalTypes = {\n stylesheets: {\n themes: [\n {\n id: \"primary-theme\",\n title: \"Primary theme\",\n url: \"./primary-theme.css\",\n },\n {\n id: \"secondary-theme\",\n title: \"Secondary theme\",\n url: \"./secondary-theme.css\",\n },\n {\n id: \"tertiary-theme\",\n title: \"Tertiary theme\",\n url: \"./tertiary-theme.css\",\n },\n ],\n },\n};\n\nconst { themes } = globalTypes.stylesheets;\n\nexport type GlobalTypes = typeof globalTypes;\nexport type Theme = ArrayElement<typeof themes>;\n\nconst preview: ProjectAnnotations<Renderer> = {\n globals: {\n [PARAM_KEY]: undefined,\n },\n globalTypes,\n};\n\nexport default preview;\n"]}