storybook-i18n 2.0.3 → 2.0.5
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/dist/preview.d.ts +9 -2
- package/dist/preview.js +2 -2
- package/dist/preview.js.map +1 -1
- package/dist/preview.mjs +2 -2
- package/dist/preview.mjs.map +1 -1
- package/manager.d.ts +1 -0
- package/manager.js +1 -0
- package/package.json +1 -1
- package/preview.d.ts +1 -0
- package/preview.js +1 -0
package/dist/preview.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _storybook_types from '@storybook/types';
|
|
2
|
+
import { Renderer } from '@storybook/types';
|
|
2
3
|
|
|
3
|
-
declare const preview:
|
|
4
|
+
declare const preview: {
|
|
5
|
+
decorators: ((story: _storybook_types.PartialStoryFn<Renderer, _storybook_types.Args>, context: _storybook_types.StoryContext<Renderer, _storybook_types.Args>) => unknown)[];
|
|
6
|
+
globals: {
|
|
7
|
+
locale: string;
|
|
8
|
+
locales: {};
|
|
9
|
+
};
|
|
10
|
+
};
|
|
4
11
|
|
|
5
12
|
export { preview as default };
|
package/dist/preview.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var previewApi = require('@storybook/preview-api');
|
|
4
4
|
|
|
5
|
-
var e=(r,o)=>{let[
|
|
5
|
+
var e=(r,o)=>{let[i,n]=previewApi.useGlobals();return previewApi.useEffect(()=>{let{parameters:{locale:t}}=o;t&&n({locale:t});},[]),r(o)};var l={decorators:[e],globals:{locale:"",locales:{}}},m=l;
|
|
6
6
|
|
|
7
|
-
module.exports =
|
|
7
|
+
module.exports = m;
|
|
8
8
|
//# sourceMappingURL=out.js.map
|
|
9
9
|
//# sourceMappingURL=preview.js.map
|
package/dist/preview.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/withLocale.ts","../src/preview.ts"],"names":["useEffect","useGlobals","withLocale","story","context","_","updateGlobals","locale","preview","preview_default"],"mappings":"AAAA,OAAQ,aAAAA,EAAW,cAAAC,MAAiB,yBAO7B,IAAMC,EAAa,CACtBC,EACAC,IACC,CACD,GAAM,CAACC,EAAGC,CAAa,EAAIL,EAAW,EAEtC,OAAAD,EAAU,IAAM,CACZ,GAAM,CACF,WAAY,CAAC,OAAAO,CAAM,CACvB,EAAIH,EAEAG,GACAD,EAAc,CAAC,OAAAC,CAAM,CAAC,CAE9B,EAAG,CAAC,CAAC,EAEEJ,EAAMC,CAAO,CACxB,ECrBA,IAAMI,
|
|
1
|
+
{"version":3,"sources":["../src/withLocale.ts","../src/preview.ts"],"names":["useEffect","useGlobals","withLocale","story","context","_","updateGlobals","locale","preview","preview_default"],"mappings":"AAAA,OAAQ,aAAAA,EAAW,cAAAC,MAAiB,yBAO7B,IAAMC,EAAa,CACtBC,EACAC,IACC,CACD,GAAM,CAACC,EAAGC,CAAa,EAAIL,EAAW,EAEtC,OAAAD,EAAU,IAAM,CACZ,GAAM,CACF,WAAY,CAAC,OAAAO,CAAM,CACvB,EAAIH,EAEAG,GACAD,EAAc,CAAC,OAAAC,CAAM,CAAC,CAE9B,EAAG,CAAC,CAAC,EAEEJ,EAAMC,CAAO,CACxB,ECrBA,IAAMI,EAAU,CACZ,WAAY,CAACN,CAAU,EACvB,QAAS,CACL,OAAQ,GACR,QAAS,CAAC,CACd,CACJ,EAEOO,EAAQD","sourcesContent":["import {useEffect, useGlobals} from '@storybook/preview-api';\nimport {\n PartialStoryFn as StoryFunction,\n Renderer,\n StoryContext,\n} from '@storybook/types';\n\nexport const withLocale = (\n story: StoryFunction<Renderer>,\n context: StoryContext\n) => {\n const [_, updateGlobals] = useGlobals();\n\n useEffect(() => {\n const {\n parameters: {locale},\n } = context;\n\n if (locale) {\n updateGlobals({locale});\n }\n }, []);\n\n return story(context);\n};\n","import type {Renderer, ProjectAnnotations} from '@storybook/types';\nimport {withLocale} from './withLocale';\n\nconst preview = {\n decorators: [withLocale],\n globals: {\n locale: '',\n locales: {},\n },\n} satisfies ProjectAnnotations<Renderer>;\n\nexport default preview;\n"]}
|
package/dist/preview.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useGlobals, useEffect } from '@storybook/preview-api';
|
|
2
2
|
|
|
3
|
-
var e=(r,o)=>{let[
|
|
3
|
+
var e=(r,o)=>{let[i,n]=useGlobals();return useEffect(()=>{let{parameters:{locale:t}}=o;t&&n({locale:t});},[]),r(o)};var l={decorators:[e],globals:{locale:"",locales:{}}},m=l;
|
|
4
4
|
|
|
5
|
-
export {
|
|
5
|
+
export { m as default };
|
|
6
6
|
//# sourceMappingURL=out.js.map
|
|
7
7
|
//# sourceMappingURL=preview.mjs.map
|
package/dist/preview.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/withLocale.ts","../src/preview.ts"],"names":["useEffect","useGlobals","withLocale","story","context","_","updateGlobals","locale","preview","preview_default"],"mappings":"AAAA,OAAQ,aAAAA,EAAW,cAAAC,MAAiB,yBAO7B,IAAMC,EAAa,CACtBC,EACAC,IACC,CACD,GAAM,CAACC,EAAGC,CAAa,EAAIL,EAAW,EAEtC,OAAAD,EAAU,IAAM,CACZ,GAAM,CACF,WAAY,CAAC,OAAAO,CAAM,CACvB,EAAIH,EAEAG,GACAD,EAAc,CAAC,OAAAC,CAAM,CAAC,CAE9B,EAAG,CAAC,CAAC,EAEEJ,EAAMC,CAAO,CACxB,ECrBA,IAAMI,
|
|
1
|
+
{"version":3,"sources":["../src/withLocale.ts","../src/preview.ts"],"names":["useEffect","useGlobals","withLocale","story","context","_","updateGlobals","locale","preview","preview_default"],"mappings":"AAAA,OAAQ,aAAAA,EAAW,cAAAC,MAAiB,yBAO7B,IAAMC,EAAa,CACtBC,EACAC,IACC,CACD,GAAM,CAACC,EAAGC,CAAa,EAAIL,EAAW,EAEtC,OAAAD,EAAU,IAAM,CACZ,GAAM,CACF,WAAY,CAAC,OAAAO,CAAM,CACvB,EAAIH,EAEAG,GACAD,EAAc,CAAC,OAAAC,CAAM,CAAC,CAE9B,EAAG,CAAC,CAAC,EAEEJ,EAAMC,CAAO,CACxB,ECrBA,IAAMI,EAAU,CACZ,WAAY,CAACN,CAAU,EACvB,QAAS,CACL,OAAQ,GACR,QAAS,CAAC,CACd,CACJ,EAEOO,EAAQD","sourcesContent":["import {useEffect, useGlobals} from '@storybook/preview-api';\nimport {\n PartialStoryFn as StoryFunction,\n Renderer,\n StoryContext,\n} from '@storybook/types';\n\nexport const withLocale = (\n story: StoryFunction<Renderer>,\n context: StoryContext\n) => {\n const [_, updateGlobals] = useGlobals();\n\n useEffect(() => {\n const {\n parameters: {locale},\n } = context;\n\n if (locale) {\n updateGlobals({locale});\n }\n }, []);\n\n return story(context);\n};\n","import type {Renderer, ProjectAnnotations} from '@storybook/types';\nimport {withLocale} from './withLocale';\n\nconst preview = {\n decorators: [withLocale],\n globals: {\n locale: '',\n locales: {},\n },\n} satisfies ProjectAnnotations<Renderer>;\n\nexport default preview;\n"]}
|
package/manager.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/manager.d';
|
package/manager.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/manager';
|
package/package.json
CHANGED
package/preview.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/preview.d';
|
package/preview.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/preview';
|