Added dist files.

This commit is contained in:
Toastie (DCS Team) 2024-10-18 23:01:44 +13:00
parent 89ce6c8e80
commit 304e84174d
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4
15 changed files with 79 additions and 0 deletions

3
dist/index.d.ts vendored Normal file
View file

@ -0,0 +1,3 @@
declare const _default: {};
export { _default as default };

7
dist/index.js vendored Normal file
View file

@ -0,0 +1,7 @@
'use strict';
var e={};
module.exports = e;
//# sourceMappingURL=out.js.map
//# sourceMappingURL=index.js.map

1
dist/index.js.map vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"sources":["../src/index.ts"],"names":["src_default"],"mappings":"AACA,IAAOA,EAAQ,CAAC","sourcesContent":["// make it work with --isolatedModules\nexport default {};"]}

5
dist/index.mjs vendored Normal file
View file

@ -0,0 +1,5 @@
var e={};
export { e as default };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=index.mjs.map

1
dist/index.mjs.map vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"sources":["../src/index.ts"],"names":["src_default"],"mappings":"AACA,IAAOA,EAAQ,CAAC","sourcesContent":["// make it work with --isolatedModules\nexport default {};"]}

2
dist/manager.d.ts vendored Normal file
View file

@ -0,0 +1,2 @@
export { }

13
dist/manager.js vendored Normal file
View file

@ -0,0 +1,13 @@
'use strict';
var managerApi = require('@storybook/manager-api');
var r = require('react');
var components = require('@storybook/components');
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
var r__default = /*#__PURE__*/_interopDefault(r);
var o="valkyriecoms/storybook-addon-valkyrie-theme",e=`${o}/tool`,i="valkyrieTheme";var n=r.memo(function(){let [a,p]=r.useState(!1),[s,m]=managerApi.useGlobals();managerApi.useStorybookApi();let d=!!s[i];return r__default.default.createElement(components.WithTooltip,{placement:"top",closeOnOutsideClick:!0,tooltip:({onHide:u})=>r__default.default.createElement(components.TooltipLinkList,{links:["(clear)","l-light","l-coffee","l-apricot","l-rainy","l-botanical","l-vivid","l-cherry","l-sushi","l-u0","d-dark","d-persimmon","d-astro","d-future","d-botanical","d-green-lime","d-green-orange","d-cherry","d-ice","d-u0"].map((t,T)=>({id:t,title:t,onClick(){m({[i]:T?t:!1}),u();},value:t,active:t===s[i]}))}),onVisibleChange:p},r__default.default.createElement(components.IconButton,{key:e,active:d||a,title:"Switch theme"},r__default.default.createElement(components.Icons,{icon:"mirror"})))});managerApi.addons.register(o,()=>{managerApi.addons.add(e,{type:managerApi.types.TOOL,title:"Valkyrie theme",match:({viewMode:l})=>!!(l&&l.match(/^(story|docs)$/)),render:n});});
//# sourceMappingURL=out.js.map
//# sourceMappingURL=manager.js.map

1
dist/manager.js.map vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"sources":["../src/manager.ts","../src/constants.ts","../src/Tool.tsx"],"names":["addons","types","ADDON_ID","TOOL_ID","PARAM_KEY","EVENTS","React","memo","useState","useGlobals","useStorybookApi","Icons","IconButton","TooltipLinkList","WithTooltip","Tool","isTooltipVisible","setIsTooltipVisible","globals","updateGlobals","api","isActive","onHide","theme","i","viewMode"],"mappings":"AAAA,OAAS,UAAAA,EAAQ,SAAAC,MAAa,yBCAvB,IAAMC,EAAW,8CACXC,EAAU,GAAGD,SACbE,EAAY,gBAEZC,EAAS,CACpB,OAAQ,GAAGH,WACX,QAAS,GAAGA,YACZ,MAAO,GAAGA,SACZ,ECRA,OAAOI,GAAS,QAAAC,EAAM,YAAAC,MAAgB,QACtC,OAAS,cAAAC,EAAY,mBAAAC,MAAuB,yBAC5C,OAAS,SAAAC,EAAO,cAAAC,EAAY,mBAAAC,EAAiB,eAAAC,MAAmB,wBAGzD,IAAMC,EAAOR,EAAK,UAA2B,CAClD,GAAM,CAACS,EAAkBC,CAAmB,EAAIT,EAAS,EAAK,EACxD,CAACU,EAASC,CAAa,EAAIV,EAAW,EACtCW,EAAMV,EAAgB,EAEtBW,EAAW,CAAC,CAACH,EAAQd,CAAS,EAEpC,OACEE,EAAA,cAACQ,EAAA,CACC,UAAU,MACV,oBAAmB,GACnB,QAAS,CAAC,CAAE,OAAAQ,CAAO,IAEfhB,EAAA,cAACO,EAAA,CACC,MAAO,CACL,UACA,UACA,WACA,YACA,UACA,cACA,UACA,WACA,UACA,OACA,SACA,cACA,UACA,WACA,cACA,eACA,iBACA,WACA,QACA,MACF,EAAE,IAAI,CAACU,EAAOC,KAAO,CACnB,GAAID,EACJ,MAAOA,EACP,SAAU,CACRJ,EAAc,CACZ,CAACf,CAAS,EAAGoB,EAAID,EAAQ,EAC3B,CAAC,EACDD,EAAO,CACT,EACA,MAAOC,EACP,OAAQA,IAAUL,EAAQd,CAAS,CACrC,EAAE,EACJ,EAGJ,gBAAiBa,GAEjBX,EAAA,cAACM,EAAA,CACC,IAAKT,EACL,OAAQkB,GAAYL,EACpB,MAAM,gBAENV,EAAA,cAACK,EAAA,CAAM,KAAK,SAAS,CACvB,CACF,CAEJ,CAAC,EFxDDX,EAAO,SAASE,EAAU,IAAM,CAE9BF,EAAO,IAAIG,EAAS,CAClB,KAAMF,EAAM,KACZ,MAAO,iBACP,MAAO,CAAC,CAAE,SAAAwB,CAAS,IAAM,CAAC,EAAEA,GAAYA,EAAS,MAAM,gBAAgB,GACvE,OAAQV,CACV,CAAC,CACH,CAAC","sourcesContent":["import { addons, types } from \"@storybook/manager-api\";\nimport { ADDON_ID, TOOL_ID } from \"./constants\";\nimport { Tool } from \"./Tool\";\n\n/**\n * Note: if you want to use JSX in this file, rename it to `manager.tsx`\n * and update the entry prop in tsup.config.ts to use \"src/manager.tsx\",\n */\n\n// Register the addon\naddons.register(ADDON_ID, () => {\n // Register the tool\n addons.add(TOOL_ID, {\n type: types.TOOL,\n title: \"Valkyrie theme\",\n match: ({ viewMode }) => !!(viewMode && viewMode.match(/^(story|docs)$/)),\n render: Tool,\n });\n});","export const ADDON_ID = \"valkyriecoms/storybook-addon-valkyrie-theme\";\nexport const TOOL_ID = `${ADDON_ID}/tool`;\nexport const PARAM_KEY = `valkyrieTheme`;\n\nexport const EVENTS = {\n RESULT: `${ADDON_ID}/result`,\n REQUEST: `${ADDON_ID}/request`,\n CLEAR: `${ADDON_ID}/clear`,\n};","import React, { memo, useState } from \"react\";\nimport { useGlobals, useStorybookApi } from \"@storybook/manager-api\";\nimport { Icons, IconButton, TooltipLinkList, WithTooltip } from \"@storybook/components\";\nimport { ADDON_ID, PARAM_KEY, TOOL_ID } from \"./constants\";\n\nexport const Tool = memo(function MyAddonSelector() {\n const [isTooltipVisible, setIsTooltipVisible] = useState(false);\n const [globals, updateGlobals] = useGlobals();\n const api = useStorybookApi();\n\n const isActive = !!globals[PARAM_KEY];\n\n return (\n <WithTooltip\n placement=\"top\"\n closeOnOutsideClick\n tooltip={({ onHide }) => {\n return (\n <TooltipLinkList\n links={[\n '(clear)',\n 'l-light',\n 'l-coffee',\n 'l-apricot',\n 'l-rainy',\n 'l-botanical',\n 'l-vivid',\n 'l-cherry',\n 'l-sushi',\n 'l-u0',\n 'd-dark',\n 'd-persimmon',\n 'd-astro',\n 'd-future',\n 'd-botanical',\n 'd-green-lime',\n 'd-green-orange',\n 'd-cherry',\n 'd-ice',\n 'd-u0',\n ].map((theme, i) => ({\n id: theme,\n title: theme,\n onClick() {\n updateGlobals({\n [PARAM_KEY]: i ? theme : false,\n });\n onHide();\n },\n value: theme,\n active: theme === globals[PARAM_KEY],\n }))}\n />\n );\n }}\n onVisibleChange={setIsTooltipVisible}\n >\n <IconButton\n key={TOOL_ID}\n active={isActive || isTooltipVisible}\n title=\"Switch theme\"\n >\n <Icons icon=\"mirror\" />\n </IconButton>\n </WithTooltip>\n );\n});"]}

7
dist/manager.mjs vendored Normal file
View file

@ -0,0 +1,7 @@
import { useGlobals, useStorybookApi, addons, types } from '@storybook/manager-api';
import r, { memo, useState } from 'react';
import { WithTooltip, TooltipLinkList, IconButton, Icons } from '@storybook/components';
var o="valkyriecoms/storybook-addon-valkyrie-theme",e=`${o}/tool`,i="valkyrieTheme";var n=memo(function(){let [a,p]=useState(!1),[s,m]=useGlobals();useStorybookApi();let d=!!s[i];return r.createElement(WithTooltip,{placement:"top",closeOnOutsideClick:!0,tooltip:({onHide:u})=>r.createElement(TooltipLinkList,{links:["(clear)","l-light","l-coffee","l-apricot","l-rainy","l-botanical","l-vivid","l-cherry","l-sushi","l-u0","d-dark","d-persimmon","d-astro","d-future","d-botanical","d-green-lime","d-green-orange","d-cherry","d-ice","d-u0"].map((t,T)=>({id:t,title:t,onClick(){m({[i]:T?t:!1}),u();},value:t,active:t===s[i]}))}),onVisibleChange:p},r.createElement(IconButton,{key:e,active:d||a,title:"Switch theme"},r.createElement(Icons,{icon:"mirror"})))});addons.register(o,()=>{addons.add(e,{type:types.TOOL,title:"Valkyrie theme",match:({viewMode:l})=>!!(l&&l.match(/^(story|docs)$/)),render:n});});
//# sourceMappingURL=out.js.map
//# sourceMappingURL=manager.mjs.map

1
dist/manager.mjs.map vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"sources":["../src/manager.ts","../src/constants.ts","../src/Tool.tsx"],"names":["addons","types","ADDON_ID","TOOL_ID","PARAM_KEY","EVENTS","React","memo","useState","useGlobals","useStorybookApi","Icons","IconButton","TooltipLinkList","WithTooltip","Tool","isTooltipVisible","setIsTooltipVisible","globals","updateGlobals","api","isActive","onHide","theme","i","viewMode"],"mappings":"AAAA,OAAS,UAAAA,EAAQ,SAAAC,MAAa,yBCAvB,IAAMC,EAAW,8CACXC,EAAU,GAAGD,SACbE,EAAY,gBAEZC,EAAS,CACpB,OAAQ,GAAGH,WACX,QAAS,GAAGA,YACZ,MAAO,GAAGA,SACZ,ECRA,OAAOI,GAAS,QAAAC,EAAM,YAAAC,MAAgB,QACtC,OAAS,cAAAC,EAAY,mBAAAC,MAAuB,yBAC5C,OAAS,SAAAC,EAAO,cAAAC,EAAY,mBAAAC,EAAiB,eAAAC,MAAmB,wBAGzD,IAAMC,EAAOR,EAAK,UAA2B,CAClD,GAAM,CAACS,EAAkBC,CAAmB,EAAIT,EAAS,EAAK,EACxD,CAACU,EAASC,CAAa,EAAIV,EAAW,EACtCW,EAAMV,EAAgB,EAEtBW,EAAW,CAAC,CAACH,EAAQd,CAAS,EAEpC,OACEE,EAAA,cAACQ,EAAA,CACC,UAAU,MACV,oBAAmB,GACnB,QAAS,CAAC,CAAE,OAAAQ,CAAO,IAEfhB,EAAA,cAACO,EAAA,CACC,MAAO,CACL,UACA,UACA,WACA,YACA,UACA,cACA,UACA,WACA,UACA,OACA,SACA,cACA,UACA,WACA,cACA,eACA,iBACA,WACA,QACA,MACF,EAAE,IAAI,CAACU,EAAOC,KAAO,CACnB,GAAID,EACJ,MAAOA,EACP,SAAU,CACRJ,EAAc,CACZ,CAACf,CAAS,EAAGoB,EAAID,EAAQ,EAC3B,CAAC,EACDD,EAAO,CACT,EACA,MAAOC,EACP,OAAQA,IAAUL,EAAQd,CAAS,CACrC,EAAE,EACJ,EAGJ,gBAAiBa,GAEjBX,EAAA,cAACM,EAAA,CACC,IAAKT,EACL,OAAQkB,GAAYL,EACpB,MAAM,gBAENV,EAAA,cAACK,EAAA,CAAM,KAAK,SAAS,CACvB,CACF,CAEJ,CAAC,EFxDDX,EAAO,SAASE,EAAU,IAAM,CAE9BF,EAAO,IAAIG,EAAS,CAClB,KAAMF,EAAM,KACZ,MAAO,iBACP,MAAO,CAAC,CAAE,SAAAwB,CAAS,IAAM,CAAC,EAAEA,GAAYA,EAAS,MAAM,gBAAgB,GACvE,OAAQV,CACV,CAAC,CACH,CAAC","sourcesContent":["import { addons, types } from \"@storybook/manager-api\";\nimport { ADDON_ID, TOOL_ID } from \"./constants\";\nimport { Tool } from \"./Tool\";\n\n/**\n * Note: if you want to use JSX in this file, rename it to `manager.tsx`\n * and update the entry prop in tsup.config.ts to use \"src/manager.tsx\",\n */\n\n// Register the addon\naddons.register(ADDON_ID, () => {\n // Register the tool\n addons.add(TOOL_ID, {\n type: types.TOOL,\n title: \"Valkyrie theme\",\n match: ({ viewMode }) => !!(viewMode && viewMode.match(/^(story|docs)$/)),\n render: Tool,\n });\n});","export const ADDON_ID = \"valkyriecoms/storybook-addon-valkyrie-theme\";\nexport const TOOL_ID = `${ADDON_ID}/tool`;\nexport const PARAM_KEY = `valkyrieTheme`;\n\nexport const EVENTS = {\n RESULT: `${ADDON_ID}/result`,\n REQUEST: `${ADDON_ID}/request`,\n CLEAR: `${ADDON_ID}/clear`,\n};","import React, { memo, useState } from \"react\";\nimport { useGlobals, useStorybookApi } from \"@storybook/manager-api\";\nimport { Icons, IconButton, TooltipLinkList, WithTooltip } from \"@storybook/components\";\nimport { ADDON_ID, PARAM_KEY, TOOL_ID } from \"./constants\";\n\nexport const Tool = memo(function MyAddonSelector() {\n const [isTooltipVisible, setIsTooltipVisible] = useState(false);\n const [globals, updateGlobals] = useGlobals();\n const api = useStorybookApi();\n\n const isActive = !!globals[PARAM_KEY];\n\n return (\n <WithTooltip\n placement=\"top\"\n closeOnOutsideClick\n tooltip={({ onHide }) => {\n return (\n <TooltipLinkList\n links={[\n '(clear)',\n 'l-light',\n 'l-coffee',\n 'l-apricot',\n 'l-rainy',\n 'l-botanical',\n 'l-vivid',\n 'l-cherry',\n 'l-sushi',\n 'l-u0',\n 'd-dark',\n 'd-persimmon',\n 'd-astro',\n 'd-future',\n 'd-botanical',\n 'd-green-lime',\n 'd-green-orange',\n 'd-cherry',\n 'd-ice',\n 'd-u0',\n ].map((theme, i) => ({\n id: theme,\n title: theme,\n onClick() {\n updateGlobals({\n [PARAM_KEY]: i ? theme : false,\n });\n onHide();\n },\n value: theme,\n active: theme === globals[PARAM_KEY],\n }))}\n />\n );\n }}\n onVisibleChange={setIsTooltipVisible}\n >\n <IconButton\n key={TOOL_ID}\n active={isActive || isTooltipVisible}\n title=\"Switch theme\"\n >\n <Icons icon=\"mirror\" />\n </IconButton>\n </WithTooltip>\n );\n});"]}

20
dist/preview.d.ts vendored Normal file
View file

@ -0,0 +1,20 @@
import { ProjectAnnotations, Renderer } from '@storybook/types';
/**
* A decorator is a way to wrap a story in extra rendering functionality. Many addons define decorators
* in order to augment stories:
* - with extra rendering
* - gather details about how a story is rendered
*
* When writing stories, decorators are typically used to wrap stories with extra markup or context mocking.
*
* https://storybook.js.org/docs/react/writing-stories/decorators
*/
/**
* Note: if you want to use JSX in this file, rename it to `preview.tsx`
* and update the entry prop in tsup.config.ts to use "src/preview.tsx",
*/
declare const preview: ProjectAnnotations<Renderer>;
export { preview as default };

9
dist/preview.js vendored Normal file
View file

@ -0,0 +1,9 @@
'use strict';
var previewApi = require('@storybook/preview-api');
var o="valkyrieTheme";var s=(e,n)=>{let[l]=previewApi.useGlobals(),r=l[o],{theme:a}=n.globals;return previewApi.useEffect(()=>{i(r);},[r,a]),e()};function i(e){e?document.documentElement.dataset.misskeyTheme=e:delete document.documentElement.dataset.misskeyTheme;}var p={decorators:[s],globals:{[o]:!1}},S=p;
module.exports = S;
//# sourceMappingURL=out.js.map
//# sourceMappingURL=preview.js.map

1
dist/preview.js.map vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"sources":["../src/constants.ts","../src/withGlobals.ts","../src/preview.ts"],"names":["ADDON_ID","TOOL_ID","PARAM_KEY","EVENTS","useEffect","useGlobals","withGlobals","StoryFn","context","globals","state","theme","applyToolState","preview","preview_default"],"mappings":"AAAO,IAAMA,EAAW,8CACXC,EAAU,GAAGD,SACbE,EAAY,gBAEZC,EAAS,CACpB,OAAQ,GAAGH,WACX,QAAS,GAAGA,YACZ,MAAO,GAAGA,SACZ,ECHA,OAAS,aAAAI,EAAW,cAAAC,MAAkB,yBAG/B,IAAMC,EAAc,CACzBC,EACAC,IACG,CACH,GAAM,CAACC,CAAO,EAAIJ,EAAW,EACvBK,EAAQD,EAAQP,CAAS,EACzB,CAAE,MAAAS,CAAM,EAAIH,EAAQ,QAE1B,OAAAJ,EAAU,IAAM,CACdQ,EAAeF,CAAK,CACtB,EAAG,CAACA,EAAOC,CAAK,CAAC,EAEVJ,EAAQ,CACjB,EAEA,SAASK,EAAeF,EAAuB,CACzCA,EACF,SAAS,gBAAgB,QAAQ,aAAeA,EAEhD,OAAO,SAAS,gBAAgB,QAAQ,YAE5C,CCVA,IAAMG,EAAwC,CAC5C,WAAY,CAACP,CAAW,EACxB,QAAS,CACP,CAACJ,CAAS,EAAG,EACf,CACF,EAEOY,EAAQD","sourcesContent":["export const ADDON_ID = \"valkyriecoms/storybook-addon-valkyrie-theme\";\nexport const TOOL_ID = `${ADDON_ID}/tool`;\nexport const PARAM_KEY = `valkyrieTheme`;\n\nexport const EVENTS = {\n RESULT: `${ADDON_ID}/result`,\n REQUEST: `${ADDON_ID}/request`,\n CLEAR: `${ADDON_ID}/clear`,\n};","import type {\n Renderer,\n PartialStoryFn as StoryFunction,\n StoryContext,\n} from \"@storybook/types\";\nimport { useEffect, useGlobals } from \"@storybook/preview-api\";\nimport { PARAM_KEY } from \"./constants\";\n\nexport const withGlobals = (\n StoryFn: StoryFunction<Renderer>,\n context: StoryContext<Renderer>\n) => {\n const [globals] = useGlobals();\n const state = globals[PARAM_KEY];\n const { theme } = context.globals;\n\n useEffect(() => {\n applyToolState(state);\n }, [state, theme]);\n\n return StoryFn();\n};\n\nfunction applyToolState(state: string | false) {\n if (state) {\n document.documentElement.dataset.misskeyTheme = state;\n } else {\n delete document.documentElement.dataset.misskeyTheme;\n }\n}","/**\n * A decorator is a way to wrap a story in extra “rendering” functionality. Many addons define decorators\n * in order to augment stories:\n * - with extra rendering\n * - gather details about how a story is rendered\n *\n * When writing stories, decorators are typically used to wrap stories with extra markup or context mocking.\n *\n * https://storybook.js.org/docs/react/writing-stories/decorators\n */\nimport type { Renderer, ProjectAnnotations } from \"@storybook/types\";\nimport { PARAM_KEY } from \"./constants\";\nimport { withGlobals } from \"./withGlobals\";\n\n/**\n * Note: if you want to use JSX in this file, rename it to `preview.tsx`\n * and update the entry prop in tsup.config.ts to use \"src/preview.tsx\",\n */\n\nconst preview: ProjectAnnotations<Renderer> = {\n decorators: [withGlobals],\n globals: {\n [PARAM_KEY]: false,\n },\n};\n\nexport default preview;"]}

7
dist/preview.mjs vendored Normal file
View file

@ -0,0 +1,7 @@
import { useGlobals, useEffect } from '@storybook/preview-api';
var o="valkyrieTheme";var s=(e,n)=>{let[l]=useGlobals(),r=l[o],{theme:a}=n.globals;return useEffect(()=>{i(r);},[r,a]),e()};function i(e){e?document.documentElement.dataset.misskeyTheme=e:delete document.documentElement.dataset.misskeyTheme;}var p={decorators:[s],globals:{[o]:!1}},S=p;
export { S as default };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=preview.mjs.map

1
dist/preview.mjs.map vendored Normal file
View file

@ -0,0 +1 @@
{"version":3,"sources":["../src/constants.ts","../src/withGlobals.ts","../src/preview.ts"],"names":["ADDON_ID","TOOL_ID","PARAM_KEY","EVENTS","useEffect","useGlobals","withGlobals","StoryFn","context","globals","state","theme","applyToolState","preview","preview_default"],"mappings":"AAAO,IAAMA,EAAW,8CACXC,EAAU,GAAGD,SACbE,EAAY,gBAEZC,EAAS,CACpB,OAAQ,GAAGH,WACX,QAAS,GAAGA,YACZ,MAAO,GAAGA,SACZ,ECHA,OAAS,aAAAI,EAAW,cAAAC,MAAkB,yBAG/B,IAAMC,EAAc,CACzBC,EACAC,IACG,CACH,GAAM,CAACC,CAAO,EAAIJ,EAAW,EACvBK,EAAQD,EAAQP,CAAS,EACzB,CAAE,MAAAS,CAAM,EAAIH,EAAQ,QAE1B,OAAAJ,EAAU,IAAM,CACdQ,EAAeF,CAAK,CACtB,EAAG,CAACA,EAAOC,CAAK,CAAC,EAEVJ,EAAQ,CACjB,EAEA,SAASK,EAAeF,EAAuB,CACzCA,EACF,SAAS,gBAAgB,QAAQ,aAAeA,EAEhD,OAAO,SAAS,gBAAgB,QAAQ,YAE5C,CCVA,IAAMG,EAAwC,CAC5C,WAAY,CAACP,CAAW,EACxB,QAAS,CACP,CAACJ,CAAS,EAAG,EACf,CACF,EAEOY,EAAQD","sourcesContent":["export const ADDON_ID = \"valkyriecoms/storybook-addon-valkyrie-theme\";\nexport const TOOL_ID = `${ADDON_ID}/tool`;\nexport const PARAM_KEY = `valkyrieTheme`;\n\nexport const EVENTS = {\n RESULT: `${ADDON_ID}/result`,\n REQUEST: `${ADDON_ID}/request`,\n CLEAR: `${ADDON_ID}/clear`,\n};","import type {\n Renderer,\n PartialStoryFn as StoryFunction,\n StoryContext,\n} from \"@storybook/types\";\nimport { useEffect, useGlobals } from \"@storybook/preview-api\";\nimport { PARAM_KEY } from \"./constants\";\n\nexport const withGlobals = (\n StoryFn: StoryFunction<Renderer>,\n context: StoryContext<Renderer>\n) => {\n const [globals] = useGlobals();\n const state = globals[PARAM_KEY];\n const { theme } = context.globals;\n\n useEffect(() => {\n applyToolState(state);\n }, [state, theme]);\n\n return StoryFn();\n};\n\nfunction applyToolState(state: string | false) {\n if (state) {\n document.documentElement.dataset.misskeyTheme = state;\n } else {\n delete document.documentElement.dataset.misskeyTheme;\n }\n}","/**\n * A decorator is a way to wrap a story in extra “rendering” functionality. Many addons define decorators\n * in order to augment stories:\n * - with extra rendering\n * - gather details about how a story is rendered\n *\n * When writing stories, decorators are typically used to wrap stories with extra markup or context mocking.\n *\n * https://storybook.js.org/docs/react/writing-stories/decorators\n */\nimport type { Renderer, ProjectAnnotations } from \"@storybook/types\";\nimport { PARAM_KEY } from \"./constants\";\nimport { withGlobals } from \"./withGlobals\";\n\n/**\n * Note: if you want to use JSX in this file, rename it to `preview.tsx`\n * and update the entry prop in tsup.config.ts to use \"src/preview.tsx\",\n */\n\nconst preview: ProjectAnnotations<Renderer> = {\n decorators: [withGlobals],\n globals: {\n [PARAM_KEY]: false,\n },\n};\n\nexport default preview;"]}