From 40a355a42d4a9444dc753c04c6608dade2f06a23 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:27 +0200 Subject: Adding upstream version 125.0.1. Signed-off-by: Daniel Baumann --- .../.storybook/addon-fluent/withPseudoLocalization.mjs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'browser/components/storybook/.storybook/addon-fluent/withPseudoLocalization.mjs') diff --git a/browser/components/storybook/.storybook/addon-fluent/withPseudoLocalization.mjs b/browser/components/storybook/.storybook/addon-fluent/withPseudoLocalization.mjs index 9d6c62af38..74fd67a6cd 100644 --- a/browser/components/storybook/.storybook/addon-fluent/withPseudoLocalization.mjs +++ b/browser/components/storybook/.storybook/addon-fluent/withPseudoLocalization.mjs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -import { useEffect, useGlobals, addons } from "@storybook/addons"; +import { useEffect, useGlobals, useChannel } from "@storybook/preview-api"; import { DIRECTIONS, DIRECTION_BY_STRATEGY, @@ -25,11 +25,11 @@ export const withPseudoLocalization = (StoryFn, context) => { const [{ pseudoStrategy }] = useGlobals(); const direction = DIRECTION_BY_STRATEGY[pseudoStrategy] || DIRECTIONS.ltr; const isInDocs = context.viewMode === "docs"; - const channel = addons.getChannel(); + const emit = useChannel({}); useEffect(() => { if (pseudoStrategy) { - channel.emit(UPDATE_STRATEGY_EVENT, pseudoStrategy); + emit(UPDATE_STRATEGY_EVENT, pseudoStrategy); } }, [pseudoStrategy]); @@ -56,8 +56,7 @@ export const withPseudoLocalization = (StoryFn, context) => { */ export const withFluentStrings = (StoryFn, context) => { const [{ fluentStrings }, updateGlobals] = useGlobals(); - const channel = addons.getChannel(); - + const emit = useChannel({}); const fileName = context.component + ".ftl"; let strings = []; @@ -83,7 +82,7 @@ export const withFluentStrings = (StoryFn, context) => { } } - channel.emit(FLUENT_CHANGED, strings); + emit(FLUENT_CHANGED, strings, fileName); return StoryFn(); }; -- cgit v1.2.3