, HTMLButtonElement> {
@@ -66,7 +66,7 @@ type LinkLike = ForwardRefExoticComponent<
Omit & RefAttributes & P
>;
-const ButtonOrLink: ButtonLike | LinkLike = forwardRef(ForwardRefFunction) as ButtonLike | LinkLike;
+const ButtonOrLink: ButtonLike | LinkLike = forwardRef(ForwardRefFunction);
ButtonOrLink.displayName = 'ButtonOrLink';
diff --git a/code/ui/components/src/components/bar/separator.tsx b/code/core/src/components/components/bar/separator.tsx
similarity index 94%
rename from code/ui/components/src/components/bar/separator.tsx
rename to code/core/src/components/components/bar/separator.tsx
index 316c432022c8..039c4257ad65 100644
--- a/code/ui/components/src/components/bar/separator.tsx
+++ b/code/core/src/components/components/bar/separator.tsx
@@ -1,5 +1,5 @@
import React, { Fragment } from 'react';
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
export interface SeparatorProps {
force?: boolean;
diff --git a/code/ui/components/src/components/brand/StorybookIcon.stories.tsx b/code/core/src/components/components/brand/StorybookIcon.stories.tsx
similarity index 100%
rename from code/ui/components/src/components/brand/StorybookIcon.stories.tsx
rename to code/core/src/components/components/brand/StorybookIcon.stories.tsx
diff --git a/code/ui/components/src/components/brand/StorybookIcon.tsx b/code/core/src/components/components/brand/StorybookIcon.tsx
similarity index 100%
rename from code/ui/components/src/components/brand/StorybookIcon.tsx
rename to code/core/src/components/components/brand/StorybookIcon.tsx
diff --git a/code/ui/components/src/components/brand/StorybookLogo.stories.tsx b/code/core/src/components/components/brand/StorybookLogo.stories.tsx
similarity index 100%
rename from code/ui/components/src/components/brand/StorybookLogo.stories.tsx
rename to code/core/src/components/components/brand/StorybookLogo.stories.tsx
diff --git a/code/ui/components/src/components/brand/StorybookLogo.tsx b/code/core/src/components/components/brand/StorybookLogo.tsx
similarity index 100%
rename from code/ui/components/src/components/brand/StorybookLogo.tsx
rename to code/core/src/components/components/brand/StorybookLogo.tsx
diff --git a/code/ui/components/src/components/clipboard/ClipboardCode.tsx b/code/core/src/components/components/clipboard/ClipboardCode.tsx
similarity index 88%
rename from code/ui/components/src/components/clipboard/ClipboardCode.tsx
rename to code/core/src/components/components/clipboard/ClipboardCode.tsx
index 577a6674f5d4..5954e466f62d 100644
--- a/code/ui/components/src/components/clipboard/ClipboardCode.tsx
+++ b/code/core/src/components/components/clipboard/ClipboardCode.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import { color, styled, typography } from '@storybook/theming';
+import { color, styled, typography } from '@storybook/core/theming';
const Code = styled.pre`
line-height: 18px;
diff --git a/code/ui/components/src/components/form/field/field.tsx b/code/core/src/components/components/form/field/field.tsx
similarity index 94%
rename from code/ui/components/src/components/form/field/field.tsx
rename to code/core/src/components/components/form/field/field.tsx
index bf4e5f00c1db..6ff17740691a 100644
--- a/code/ui/components/src/components/form/field/field.tsx
+++ b/code/core/src/components/components/form/field/field.tsx
@@ -1,6 +1,6 @@
import type { ReactNode } from 'react';
import React from 'react';
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
const Wrapper = styled.label(({ theme }) => ({
display: 'flex',
diff --git a/code/ui/components/src/components/form/form.stories.tsx b/code/core/src/components/components/form/form.stories.tsx
similarity index 98%
rename from code/ui/components/src/components/form/form.stories.tsx
rename to code/core/src/components/components/form/form.stories.tsx
index fb6070100d41..45470d60c848 100644
--- a/code/ui/components/src/components/form/form.stories.tsx
+++ b/code/core/src/components/components/form/form.stories.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import { action } from '@storybook/addon-actions';
import * as InputComponents from './input/input';
diff --git a/code/ui/components/src/components/form/index.tsx b/code/core/src/components/components/form/index.tsx
similarity index 86%
rename from code/ui/components/src/components/form/index.tsx
rename to code/core/src/components/components/form/index.tsx
index f35aef240b36..3407f342a862 100644
--- a/code/ui/components/src/components/form/index.tsx
+++ b/code/core/src/components/components/form/index.tsx
@@ -1,4 +1,4 @@
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import { Field } from './field/field';
import { Input, Select, Textarea } from './input/input';
import { Button } from '../Button/Button';
diff --git a/code/ui/components/src/components/form/input/input.tsx b/code/core/src/components/components/form/input/input.tsx
similarity index 89%
rename from code/ui/components/src/components/form/input/input.tsx
rename to code/core/src/components/components/form/input/input.tsx
index 0249a6e2e6e9..423da39326a0 100644
--- a/code/ui/components/src/components/form/input/input.tsx
+++ b/code/core/src/components/components/form/input/input.tsx
@@ -1,7 +1,7 @@
import type { HTMLProps, SelectHTMLAttributes } from 'react';
import React, { forwardRef } from 'react';
-import type { CSSObject, FunctionInterpolation } from '@storybook/theming';
-import { styled } from '@storybook/theming';
+import type { CSSObject, StorybookTheme } from '@storybook/core/theming';
+import { styled } from '@storybook/core/theming';
import TextareaAutoResize from 'react-textarea-autosize';
@@ -38,7 +38,7 @@ const styleResets: CSSObject = {
position: 'relative',
};
-const styles: FunctionInterpolation = ({ theme }) => ({
+const styles = (({ theme }: { theme: StorybookTheme }) => ({
...(styleResets as any),
transition: 'box-shadow 200ms ease-out, opacity 200ms ease-out',
@@ -71,13 +71,13 @@ const styles: FunctionInterpolation = ({ theme }) => ({
color: theme.textMutedColor,
opacity: 1,
},
-});
+})) as any;
export type Sizes = '100%' | 'flex' | 'auto';
export type Alignments = 'end' | 'center' | 'start';
export type ValidationStates = 'valid' | 'error' | 'warn';
-const sizes: FunctionInterpolation<{ size?: Sizes }> = ({ size }) => {
+const sizes = (({ size }: { size?: Sizes }) => {
switch (size) {
case '100%': {
return { width: '100%' };
@@ -90,13 +90,15 @@ const sizes: FunctionInterpolation<{ size?: Sizes }> = ({ size }) => {
return { display: 'inline' };
}
}
-};
-const alignment: FunctionInterpolation<{
+}) as any;
+const alignment = (({
+ align,
+}: {
size?: Sizes;
align?: Alignments;
valid?: ValidationStates;
height?: number;
-}> = ({ align }) => {
+}) => {
switch (align) {
case 'end': {
return { textAlign: 'right' };
@@ -109,8 +111,8 @@ const alignment: FunctionInterpolation<{
return { textAlign: 'left' };
}
}
-};
-const validation: FunctionInterpolation<{ valid: ValidationStates }> = ({ valid, theme }) => {
+}) as any;
+const validation = (({ valid, theme }: { valid: ValidationStates; theme: StorybookTheme }) => {
switch (valid) {
case 'valid': {
return { boxShadow: `${theme.color.positive} 0 0 0 1px inset !important` };
@@ -129,7 +131,7 @@ const validation: FunctionInterpolation<{ valid: ValidationStates }> = ({ valid,
return {};
}
}
-};
+}) as any;
type InputProps = Omit<
HTMLProps,
@@ -150,12 +152,7 @@ export const Input = Object.assign(
forwardRef(function Input({ size, valid, align, ...props }, ref) {
return ;
})
- )<{
- size?: Sizes;
- align?: Alignments;
- valid?: ValidationStates;
- height?: number;
- }>(styles, sizes, alignment, validation, {
+ )(styles, sizes, alignment, validation, {
minHeight: 32,
}),
{
diff --git a/code/ui/components/src/components/icon/icon.stories.tsx b/code/core/src/components/components/icon/icon.stories.tsx
similarity index 91%
rename from code/ui/components/src/components/icon/icon.stories.tsx
rename to code/core/src/components/components/icon/icon.stories.tsx
index 7954853498e6..64ecbd21be18 100644
--- a/code/ui/components/src/components/icon/icon.stories.tsx
+++ b/code/core/src/components/components/icon/icon.stories.tsx
@@ -1,6 +1,6 @@
import type { ComponentProps } from 'react';
import React from 'react';
-import { styled, css } from '@storybook/theming';
+import { styled, css } from '@storybook/core/theming';
import type { IconType } from './icon';
import { Icons, icons } from './icon';
@@ -70,6 +70,7 @@ export const Labels = (args: ComponentProps) => (
{Object.keys(icons).map((key) => (
-
+ {/* @ts-expect-error (not strict) */}
{key}
@@ -84,6 +85,7 @@ export const NoLabels = (args: ComponentProps) => (
{Object.keys(icons).map((key) => (
-
+ {/* @ts-expect-error (not strict) */}
))}
@@ -97,6 +99,7 @@ export const NoDeprecateWarning = (args: ComponentProps) => (
{Object.keys(icons).map((key) => (
-
+ {/* @ts-expect-error (not strict) */}
))}
diff --git a/code/ui/components/src/components/icon/icon.tsx b/code/core/src/components/components/icon/icon.tsx
similarity index 97%
rename from code/ui/components/src/components/icon/icon.tsx
rename to code/core/src/components/components/icon/icon.tsx
index 0976442b1179..ca80a0700954 100644
--- a/code/ui/components/src/components/icon/icon.tsx
+++ b/code/core/src/components/components/icon/icon.tsx
@@ -2,8 +2,8 @@ import type { ComponentProps } from 'react';
import React, { memo } from 'react';
import * as StorybookIcons from '@storybook/icons';
-import { styled } from '@storybook/theming';
-import { deprecate, logger } from '@storybook/client-logger';
+import { styled } from '@storybook/core/theming';
+import { deprecate, logger } from '@storybook/core/client-logger';
export type IconType = keyof typeof icons;
type NewIconTypes = (typeof icons)[IconType];
@@ -75,6 +75,7 @@ export const Symbols = memo(function Symbols({ icons: keys = Objec
style={{ position: 'absolute', width: 0, height: 0 }}
data-chromatic="ignore"
>
+ {/* @ts-expect-error (non strict) */}
{keys.map((key: IconType) => (
{icons[key]}
diff --git a/code/ui/components/src/components/placeholder/placeholder.stories.tsx b/code/core/src/components/components/placeholder/placeholder.stories.tsx
similarity index 100%
rename from code/ui/components/src/components/placeholder/placeholder.stories.tsx
rename to code/core/src/components/components/placeholder/placeholder.stories.tsx
diff --git a/code/ui/components/src/components/placeholder/placeholder.tsx b/code/core/src/components/components/placeholder/placeholder.tsx
similarity index 92%
rename from code/ui/components/src/components/placeholder/placeholder.tsx
rename to code/core/src/components/components/placeholder/placeholder.tsx
index ad2367a46e01..68f1c026d4d2 100644
--- a/code/ui/components/src/components/placeholder/placeholder.tsx
+++ b/code/core/src/components/components/placeholder/placeholder.tsx
@@ -1,5 +1,5 @@
import React, { Children } from 'react';
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
const Title = styled.div(({ theme }) => ({
fontWeight: theme.typography.weight.bold,
diff --git a/code/ui/components/src/components/shared/animation.ts b/code/core/src/components/components/shared/animation.ts
similarity index 68%
rename from code/ui/components/src/components/shared/animation.ts
rename to code/core/src/components/components/shared/animation.ts
index 5f178d5653bd..7838d880b93d 100644
--- a/code/ui/components/src/components/shared/animation.ts
+++ b/code/core/src/components/components/shared/animation.ts
@@ -1,4 +1,4 @@
-import { keyframes } from '@storybook/theming';
+import { keyframes } from '@storybook/core/theming';
export const rotate360 = keyframes`
from {
diff --git a/code/ui/components/src/components/spaced/Spaced.stories.tsx b/code/core/src/components/components/spaced/Spaced.stories.tsx
similarity index 96%
rename from code/ui/components/src/components/spaced/Spaced.stories.tsx
rename to code/core/src/components/components/spaced/Spaced.stories.tsx
index 26d4c3afafe7..4c84f6811661 100644
--- a/code/ui/components/src/components/spaced/Spaced.stories.tsx
+++ b/code/core/src/components/components/spaced/Spaced.stories.tsx
@@ -1,6 +1,6 @@
import type { ComponentProps } from 'react';
import React from 'react';
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import { Spaced } from './Spaced';
diff --git a/code/ui/components/src/components/spaced/Spaced.tsx b/code/core/src/components/components/spaced/Spaced.tsx
similarity index 96%
rename from code/ui/components/src/components/spaced/Spaced.tsx
rename to code/core/src/components/components/spaced/Spaced.tsx
index 3c999f602455..b4a79a919203 100644
--- a/code/ui/components/src/components/spaced/Spaced.tsx
+++ b/code/core/src/components/components/spaced/Spaced.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import { styled, ignoreSsrWarning } from '@storybook/theming';
+import { styled, ignoreSsrWarning } from '@storybook/core/theming';
const toNumber = (input: any) => (typeof input === 'number' ? input : Number(input));
diff --git a/code/ui/components/src/components/syntaxhighlighter/formatter.test.ts b/code/core/src/components/components/syntaxhighlighter/formatter.test.ts
similarity index 100%
rename from code/ui/components/src/components/syntaxhighlighter/formatter.test.ts
rename to code/core/src/components/components/syntaxhighlighter/formatter.test.ts
diff --git a/code/ui/components/src/components/syntaxhighlighter/formatter.ts b/code/core/src/components/components/syntaxhighlighter/formatter.ts
similarity index 100%
rename from code/ui/components/src/components/syntaxhighlighter/formatter.ts
rename to code/core/src/components/components/syntaxhighlighter/formatter.ts
diff --git a/code/ui/components/src/components/syntaxhighlighter/lazy-syntaxhighlighter.tsx b/code/core/src/components/components/syntaxhighlighter/lazy-syntaxhighlighter.tsx
similarity index 100%
rename from code/ui/components/src/components/syntaxhighlighter/lazy-syntaxhighlighter.tsx
rename to code/core/src/components/components/syntaxhighlighter/lazy-syntaxhighlighter.tsx
diff --git a/code/ui/components/src/components/syntaxhighlighter/syntaxhighlighter-types.ts b/code/core/src/components/components/syntaxhighlighter/syntaxhighlighter-types.ts
similarity index 100%
rename from code/ui/components/src/components/syntaxhighlighter/syntaxhighlighter-types.ts
rename to code/core/src/components/components/syntaxhighlighter/syntaxhighlighter-types.ts
diff --git a/code/ui/components/src/components/syntaxhighlighter/syntaxhighlighter.stories.tsx b/code/core/src/components/components/syntaxhighlighter/syntaxhighlighter.stories.tsx
similarity index 98%
rename from code/ui/components/src/components/syntaxhighlighter/syntaxhighlighter.stories.tsx
rename to code/core/src/components/components/syntaxhighlighter/syntaxhighlighter.stories.tsx
index 06f2a3a2cb43..4b817b756c79 100644
--- a/code/ui/components/src/components/syntaxhighlighter/syntaxhighlighter.stories.tsx
+++ b/code/core/src/components/components/syntaxhighlighter/syntaxhighlighter.stories.tsx
@@ -1,4 +1,4 @@
-import { ThemeProvider, ensure, themes } from '@storybook/theming';
+import { ThemeProvider, ensure, themes } from '@storybook/core/theming';
import type { ComponentProps } from 'react';
import React from 'react';
diff --git a/code/ui/components/src/components/syntaxhighlighter/syntaxhighlighter.tsx b/code/core/src/components/components/syntaxhighlighter/syntaxhighlighter.tsx
similarity index 96%
rename from code/ui/components/src/components/syntaxhighlighter/syntaxhighlighter.tsx
rename to code/core/src/components/components/syntaxhighlighter/syntaxhighlighter.tsx
index 42961976ac54..08a424fe31a0 100644
--- a/code/ui/components/src/components/syntaxhighlighter/syntaxhighlighter.tsx
+++ b/code/core/src/components/components/syntaxhighlighter/syntaxhighlighter.tsx
@@ -1,7 +1,7 @@
import type { MouseEvent } from 'react';
import React, { useCallback, useEffect, useState } from 'react';
-import { logger } from '@storybook/client-logger';
-import { styled } from '@storybook/theming';
+import { logger } from '@storybook/core/client-logger';
+import { styled } from '@storybook/core/theming';
import { global } from '@storybook/global';
import memoize from 'memoizerific';
@@ -177,7 +177,10 @@ const defaultRenderer: SyntaxHighlighterRenderer = ({ rows, stylesheet, useInlin
});
};
-const wrapRenderer = (renderer: SyntaxHighlighterRenderer, showLineNumbers: boolean) => {
+const wrapRenderer = (
+ renderer: SyntaxHighlighterRenderer | undefined,
+ showLineNumbers: boolean
+) => {
if (!showLineNumbers) {
return renderer;
}
@@ -201,8 +204,8 @@ export const SyntaxHighlighter = ({
bordered = false,
padded = false,
format = true,
- formatter = null,
- className = null,
+ formatter = undefined,
+ className = undefined,
showLineNumbers = false,
...rest
}: SyntaxHighlighterProps) => {
diff --git a/code/ui/components/src/components/tabs/EmptyTabContent.stories.tsx b/code/core/src/components/components/tabs/EmptyTabContent.stories.tsx
similarity index 95%
rename from code/ui/components/src/components/tabs/EmptyTabContent.stories.tsx
rename to code/core/src/components/components/tabs/EmptyTabContent.stories.tsx
index 3ef2da755f34..2501eb5f7c0b 100644
--- a/code/ui/components/src/components/tabs/EmptyTabContent.stories.tsx
+++ b/code/core/src/components/components/tabs/EmptyTabContent.stories.tsx
@@ -1,7 +1,7 @@
import React from 'react';
import { EmptyTabContent } from './EmptyTabContent';
import { DocumentIcon } from '@storybook/icons';
-import { Link } from '@storybook/components';
+import { Link } from '@storybook/core/components';
import type { Meta, StoryObj } from '@storybook/react';
export default {
diff --git a/code/ui/components/src/components/tabs/EmptyTabContent.tsx b/code/core/src/components/components/tabs/EmptyTabContent.tsx
similarity index 95%
rename from code/ui/components/src/components/tabs/EmptyTabContent.tsx
rename to code/core/src/components/components/tabs/EmptyTabContent.tsx
index eec65f6183d7..1ce8d5e5a9f8 100644
--- a/code/ui/components/src/components/tabs/EmptyTabContent.tsx
+++ b/code/core/src/components/components/tabs/EmptyTabContent.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
const Wrapper = styled.div(({ theme }) => ({
height: '100%',
diff --git a/code/ui/components/src/components/tabs/tabs.helpers.tsx b/code/core/src/components/components/tabs/tabs.helpers.tsx
similarity index 91%
rename from code/ui/components/src/components/tabs/tabs.helpers.tsx
rename to code/core/src/components/components/tabs/tabs.helpers.tsx
index b64b548d3f9c..2a26b6651139 100644
--- a/code/ui/components/src/components/tabs/tabs.helpers.tsx
+++ b/code/core/src/components/components/tabs/tabs.helpers.tsx
@@ -1,7 +1,7 @@
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import type { FC, PropsWithChildren, ReactChild, ReactElement, ReactNode } from 'react';
import React, { Children } from 'react';
-import type { Addon_RenderOptions } from '@storybook/types';
+import type { Addon_RenderOptions } from '@storybook/core/types';
import type { TabsProps } from './tabs';
export interface VisuallyHiddenProps {
@@ -14,6 +14,7 @@ export const VisuallyHidden = styled.div(({ active }) =>
export const childrenToList = (children: TabsProps['children']) =>
Children.toArray(children).map(
+ // @ts-expect-error (non strict)
({
props: { title, id, color, children: childrenOfChild },
}: ReactElement<{
diff --git a/code/ui/components/src/components/tabs/tabs.hooks.tsx b/code/core/src/components/components/tabs/tabs.hooks.tsx
similarity index 96%
rename from code/ui/components/src/components/tabs/tabs.hooks.tsx
rename to code/core/src/components/components/tabs/tabs.hooks.tsx
index d932b974b81e..d2606644d5a4 100644
--- a/code/ui/components/src/components/tabs/tabs.hooks.tsx
+++ b/code/core/src/components/components/tabs/tabs.hooks.tsx
@@ -1,6 +1,6 @@
import React, { useCallback, useLayoutEffect, useRef, useState } from 'react';
import { sanitize } from '@storybook/csf';
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import useResizeObserver from 'use-resize-observer';
import { TabButton } from '../bar/button';
import { TooltipLinkList } from '../tooltip/TooltipLinkList';
@@ -40,6 +40,7 @@ export function useList(list: ChildrenListComplete) {
const addonsRef = useRef();
const tabRefs = useRef(new Map());
const { width: tabBarWidth = 1 } = useResizeObserver({
+ // @ts-expect-error (non strict)
ref: tabBarRef,
});
@@ -77,6 +78,7 @@ export function useList(list: ChildrenListComplete) {
active,
onClick: (e) => {
e.preventDefault();
+ // @ts-expect-error (non strict)
actions.onSelect(id);
},
} as Link;
@@ -85,6 +87,7 @@ export function useList(list: ChildrenListComplete) {
}
>
;
export const StatefulStatic = {
render: (args) => (
-
+
{
(({ active, selected }: { active: boolean; selected: string }) =>
@@ -128,7 +128,7 @@ export const StatefulStatic = {
export const StatefulStaticWithSetButtonTextColors = {
render: (args) => (
-
+
{
(({ active, selected }: { active: boolean; selected: string }) =>
@@ -146,7 +146,11 @@ export const StatefulStaticWithSetButtonTextColors = {
export const StatefulStaticWithSetBackgroundColor = {
render: (args) => (
-
+
{
(({ active, selected }: { active: boolean; selected: string }) =>
@@ -204,7 +208,7 @@ export const StatefulDynamicWithOpenTooltip = {
});
},
render: (args) => (
-
+
{Object.entries(panels).map(([k, v]) => (
{/* @ts-expect-error (we know this is broken) */}
@@ -233,7 +237,7 @@ export const StatefulDynamicWithSelectedAddon = {
await StatefulDynamicWithOpenTooltip.play(context);
},
render: (args) => (
-
+
{Object.entries(panels).map(([k, v]) => (
{/* @ts-expect-error (we know this is broken) */}
@@ -251,14 +255,14 @@ export const StatefulNoInitial = {
export const StatelessBordered = {
render: (args) => (
{content}
@@ -388,7 +392,7 @@ export const StatefulWithStatefulPanel = {
return (
-
+
diff --git a/code/ui/components/src/components/tabs/tabs.tsx b/code/core/src/components/components/tabs/tabs.tsx
similarity index 95%
rename from code/ui/components/src/components/tabs/tabs.tsx
rename to code/core/src/components/components/tabs/tabs.tsx
index de3eb731d3be..318fc31c033a 100644
--- a/code/ui/components/src/components/tabs/tabs.tsx
+++ b/code/core/src/components/components/tabs/tabs.tsx
@@ -1,9 +1,9 @@
import type { FC, PropsWithChildren, ReactElement, ReactNode, SyntheticEvent } from 'react';
import React, { useMemo, Component, memo } from 'react';
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import { sanitize } from '@storybook/csf';
-import type { Addon_RenderOptions } from '@storybook/types';
+import type { Addon_RenderOptions } from '@storybook/core/types';
import { TabButton } from '../bar/button';
import { FlexBar } from '../bar/bar';
import { childrenToList, VisuallyHidden } from './tabs.helpers';
@@ -163,8 +163,10 @@ export const Tabs: FC = memo(
}
return (
+ // @ts-expect-error (non strict)
+ {/* @ts-expect-error (non strict) */}
{visibleList.map(({ title, id, active, color }, index) => {
const indexId = `index-${index}`;
@@ -182,6 +184,7 @@ export const Tabs: FC = memo(
textColor={color}
onClick={(e: SyntheticEvent) => {
e.preventDefault();
+ // @ts-expect-error (non strict)
actions.onSelect(id);
}}
role="tab"
@@ -223,10 +226,12 @@ export interface TabsStateState {
export class TabsState extends Component {
static defaultProps: TabsStateProps = {
children: [],
+ // @ts-expect-error (non strict)
initial: null,
absolute: false,
bordered: false,
backgroundColor: '',
+ // @ts-expect-error (non strict)
menuName: undefined,
};
diff --git a/code/ui/components/src/components/tooltip/ListItem.stories.tsx b/code/core/src/components/components/tooltip/ListItem.stories.tsx
similarity index 100%
rename from code/ui/components/src/components/tooltip/ListItem.stories.tsx
rename to code/core/src/components/components/tooltip/ListItem.stories.tsx
diff --git a/code/ui/components/src/components/tooltip/ListItem.tsx b/code/core/src/components/components/tooltip/ListItem.tsx
similarity index 96%
rename from code/ui/components/src/components/tooltip/ListItem.tsx
rename to code/core/src/components/components/tooltip/ListItem.tsx
index 5d5ebf763b99..58528169f165 100644
--- a/code/ui/components/src/components/tooltip/ListItem.tsx
+++ b/code/core/src/components/components/tooltip/ListItem.tsx
@@ -1,6 +1,6 @@
import type { ReactNode, ComponentProps } from 'react';
import React from 'react';
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import memoize from 'memoizerific';
import { transparentize } from 'polished';
@@ -194,10 +194,10 @@ const ListItem = ({
active = false,
disabled = false,
isIndented,
- href = null,
- onClick = null,
+ href = undefined,
+ onClick = undefined,
icon,
- LinkWrapper = null,
+ LinkWrapper = undefined,
...rest
}: ListItemProps) => {
const itemProps = getItemProps(onClick, href, LinkWrapper);
@@ -207,7 +207,7 @@ const ListItem = ({
-
{icon && {icon}}
{title || center ? (
-
+
{title && (
{title}
diff --git a/code/ui/components/src/components/tooltip/Tooltip.stories.tsx b/code/core/src/components/components/tooltip/Tooltip.stories.tsx
similarity index 97%
rename from code/ui/components/src/components/tooltip/Tooltip.stories.tsx
rename to code/core/src/components/components/tooltip/Tooltip.stories.tsx
index fc9e8802bae7..3ca9e21cfc11 100644
--- a/code/ui/components/src/components/tooltip/Tooltip.stories.tsx
+++ b/code/core/src/components/components/tooltip/Tooltip.stories.tsx
@@ -1,6 +1,6 @@
import type { ComponentProps } from 'react';
import React from 'react';
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import { Tooltip } from './Tooltip';
// Popper would position the tooltip absolutely. We just need to make sure we are pos:rel
diff --git a/code/ui/components/src/components/tooltip/Tooltip.tsx b/code/core/src/components/components/tooltip/Tooltip.tsx
similarity index 95%
rename from code/ui/components/src/components/tooltip/Tooltip.tsx
rename to code/core/src/components/components/tooltip/Tooltip.tsx
index 6f14a148bfeb..83fbebfd1c9c 100644
--- a/code/ui/components/src/components/tooltip/Tooltip.tsx
+++ b/code/core/src/components/components/tooltip/Tooltip.tsx
@@ -1,7 +1,7 @@
import React from 'react';
import memoize from 'memoizerific';
-import { styled, type Color, lighten } from '@storybook/theming';
+import { styled, type Color, lighten } from '@storybook/core/theming';
const match = memoize(1000)((requests, actual, value, fallback = 0) =>
actual.split('-')[0] === requests ? value : fallback
@@ -87,7 +87,7 @@ const Arrow = styled.div(
);
export interface WrapperProps {
- color: keyof Color;
+ color: keyof Color | undefined;
hidden?: boolean;
hasChrome: boolean;
}
@@ -101,7 +101,7 @@ const Wrapper = styled.div(
hasChrome
? {
background:
- theme.color[color] || color || theme.base === 'light'
+ (color && theme.color[color]) || color || theme.base === 'light'
? lighten(theme.background.app)
: theme.background.app,
filter: `
diff --git a/code/ui/components/src/components/tooltip/TooltipLinkList.stories.tsx b/code/core/src/components/components/tooltip/TooltipLinkList.stories.tsx
similarity index 100%
rename from code/ui/components/src/components/tooltip/TooltipLinkList.stories.tsx
rename to code/core/src/components/components/tooltip/TooltipLinkList.stories.tsx
diff --git a/code/ui/components/src/components/tooltip/TooltipLinkList.tsx b/code/core/src/components/components/tooltip/TooltipLinkList.tsx
similarity index 91%
rename from code/ui/components/src/components/tooltip/TooltipLinkList.tsx
rename to code/core/src/components/components/tooltip/TooltipLinkList.tsx
index fcb88ca25545..6f05bf2ec90d 100644
--- a/code/ui/components/src/components/tooltip/TooltipLinkList.tsx
+++ b/code/core/src/components/components/tooltip/TooltipLinkList.tsx
@@ -1,6 +1,6 @@
import type { SyntheticEvent } from 'react';
import React, { useCallback } from 'react';
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import type { LinkWrapperType, ListItemProps } from './ListItem';
import ListItem from './ListItem';
@@ -32,6 +32,7 @@ const Item = (props: ItemProps) => {
const { title, href, active } = rest;
const onClick = useCallback(
(event: SyntheticEvent) => {
+ // @ts-expect-error (non strict)
onClickFromProps(event, rest);
},
[onClickFromProps]
@@ -58,11 +59,13 @@ export interface TooltipLinkListProps {
LinkWrapper?: LinkWrapperType;
}
+// @ts-expect-error (non strict)
export const TooltipLinkList = ({ links, LinkWrapper = null }: TooltipLinkListProps) => {
const hasIcon = links.some((link) => link.icon);
return (
{links.map(({ isGatsby, ...p }) => (
+ // @ts-expect-error (non strict)
))}
diff --git a/code/ui/components/src/components/tooltip/TooltipMessage.stories.tsx b/code/core/src/components/components/tooltip/TooltipMessage.stories.tsx
similarity index 100%
rename from code/ui/components/src/components/tooltip/TooltipMessage.stories.tsx
rename to code/core/src/components/components/tooltip/TooltipMessage.stories.tsx
diff --git a/code/ui/components/src/components/tooltip/TooltipMessage.tsx b/code/core/src/components/components/tooltip/TooltipMessage.tsx
similarity index 96%
rename from code/ui/components/src/components/tooltip/TooltipMessage.tsx
rename to code/core/src/components/components/tooltip/TooltipMessage.tsx
index 7da93fc1474d..8af15a915013 100644
--- a/code/ui/components/src/components/tooltip/TooltipMessage.tsx
+++ b/code/core/src/components/components/tooltip/TooltipMessage.tsx
@@ -1,6 +1,6 @@
import type { ReactNode } from 'react';
import React from 'react';
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import { Link } from '../typography/link/link';
diff --git a/code/ui/components/src/components/tooltip/TooltipNote.stories.tsx b/code/core/src/components/components/tooltip/TooltipNote.stories.tsx
similarity index 100%
rename from code/ui/components/src/components/tooltip/TooltipNote.stories.tsx
rename to code/core/src/components/components/tooltip/TooltipNote.stories.tsx
diff --git a/code/ui/components/src/components/tooltip/TooltipNote.tsx b/code/core/src/components/components/tooltip/TooltipNote.tsx
similarity index 92%
rename from code/ui/components/src/components/tooltip/TooltipNote.tsx
rename to code/core/src/components/components/tooltip/TooltipNote.tsx
index 71ce08bacb82..2366525b0a5a 100644
--- a/code/ui/components/src/components/tooltip/TooltipNote.tsx
+++ b/code/core/src/components/components/tooltip/TooltipNote.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
const Note = styled.div(({ theme }) => ({
padding: '2px 6px',
diff --git a/code/ui/components/src/components/tooltip/WithTooltip.stories.tsx b/code/core/src/components/components/tooltip/WithTooltip.stories.tsx
similarity index 88%
rename from code/ui/components/src/components/tooltip/WithTooltip.stories.tsx
rename to code/core/src/components/components/tooltip/WithTooltip.stories.tsx
index 8ccb459095a0..4bfae3be6aad 100644
--- a/code/ui/components/src/components/tooltip/WithTooltip.stories.tsx
+++ b/code/core/src/components/components/tooltip/WithTooltip.stories.tsx
@@ -2,7 +2,7 @@ import type { FunctionComponent, ComponentProps } from 'react';
import React from 'react';
import type { StoryObj } from '@storybook/react';
import { expect, screen } from '@storybook/test';
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import { TooltipMessage } from './TooltipMessage';
import { WithToolTipState as WithTooltip } from './WithTooltip';
@@ -66,7 +66,7 @@ export const SimpleHover: StoryObj> = {
trigger: 'hover',
},
render: (args) => (
- } {...args}>
+ }>
Hover me!
),
@@ -78,7 +78,7 @@ export const SimpleHoverFunctional: StoryObj>
trigger: 'hover',
},
render: (args) => (
-
+
Hover me!
),
@@ -89,7 +89,7 @@ export const SimpleClick: StoryObj> = {
placement: 'top',
},
render: (args) => (
- } {...args}>
+ }>
Click me!
),
@@ -101,7 +101,7 @@ export const SimpleClickStartOpen: StoryObj>
startOpen: true,
},
render: (args) => (
- } {...args}>
+ }>
Click me!
),
@@ -116,7 +116,7 @@ export const SimpleClickCloseOnClick: StoryObj (
- } {...args}>
+ }>
Click me!
),
@@ -128,7 +128,7 @@ export const WithoutChrome: StoryObj> = {
hasChrome: false,
},
render: (args) => (
- } {...args}>
+ }>
Click me!
),
diff --git a/code/ui/components/src/components/tooltip/WithTooltip.tsx b/code/core/src/components/components/tooltip/WithTooltip.tsx
similarity index 94%
rename from code/ui/components/src/components/tooltip/WithTooltip.tsx
rename to code/core/src/components/components/tooltip/WithTooltip.tsx
index b14015aa0d10..63cb4e5d5d74 100644
--- a/code/ui/components/src/components/tooltip/WithTooltip.tsx
+++ b/code/core/src/components/components/tooltip/WithTooltip.tsx
@@ -1,7 +1,7 @@
import type { ComponentProps, ReactNode } from 'react';
import React, { useCallback, useState, useEffect } from 'react';
import ReactDOM from 'react-dom';
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import { global } from '@storybook/global';
import type { Config as ReactPopperTooltipConfig, PopperOptions } from 'react-popper-tooltip';
@@ -14,11 +14,13 @@ const { document } = global;
const TargetContainer = styled.div<{ trigger: ReactPopperTooltipConfig['trigger'] }>`
display: inline-block;
cursor: ${(props) =>
+ // @ts-expect-error (non strict)
props.trigger === 'hover' || props.trigger.includes('hover') ? 'default' : 'pointer'};
`;
const TargetSvgContainer = styled.g<{ trigger: ReactPopperTooltipConfig['trigger'] }>`
cursor: ${(props) =>
+ // @ts-expect-error (non strict)
props.trigger === 'hover' || props.trigger.includes('hover') ? 'default' : 'pointer'};
`;
@@ -125,6 +127,7 @@ const WithTooltipPure = ({
withArrows={withArrows}
{...getTooltipProps()}
>
+ {/* @ts-expect-error (non strict) */}
{typeof tooltip === 'function' ? tooltip({ onHide: () => onVisibleChange(false) }) : tooltip}
);
@@ -168,10 +171,13 @@ const WithToolTipState = ({
iframes.forEach((iframe) => {
const bind = () => {
try {
+ // @ts-expect-error (non strict)
if (iframe.contentWindow.document) {
+ // @ts-expect-error (non strict)
iframe.contentWindow.document.addEventListener('click', hide);
unbinders.push(() => {
try {
+ // @ts-expect-error (non strict)
iframe.contentWindow.document.removeEventListener('click', hide);
} catch (e) {
// logger.debug('Removing a click listener from iframe failed: ', e);
diff --git a/code/ui/components/src/components/tooltip/assets/ellipse.png b/code/core/src/components/components/tooltip/assets/ellipse.png
similarity index 100%
rename from code/ui/components/src/components/tooltip/assets/ellipse.png
rename to code/core/src/components/components/tooltip/assets/ellipse.png
diff --git a/code/ui/components/src/components/tooltip/lazy-WithTooltip.tsx b/code/core/src/components/components/tooltip/lazy-WithTooltip.tsx
similarity index 100%
rename from code/ui/components/src/components/tooltip/lazy-WithTooltip.tsx
rename to code/core/src/components/components/tooltip/lazy-WithTooltip.tsx
diff --git a/code/ui/components/src/components/typography/DocumentFormatting.tsx b/code/core/src/components/components/typography/DocumentFormatting.tsx
similarity index 100%
rename from code/ui/components/src/components/typography/DocumentFormatting.tsx
rename to code/core/src/components/components/typography/DocumentFormatting.tsx
diff --git a/code/ui/components/src/components/typography/DocumentWrapper.stories.tsx b/code/core/src/components/components/typography/DocumentWrapper.stories.tsx
similarity index 100%
rename from code/ui/components/src/components/typography/DocumentWrapper.stories.tsx
rename to code/core/src/components/components/typography/DocumentWrapper.stories.tsx
diff --git a/code/ui/components/src/components/typography/DocumentWrapper.tsx b/code/core/src/components/components/typography/DocumentWrapper.tsx
similarity index 98%
rename from code/ui/components/src/components/typography/DocumentWrapper.tsx
rename to code/core/src/components/components/typography/DocumentWrapper.tsx
index 153d728bdf66..8a3a8329d78b 100644
--- a/code/ui/components/src/components/typography/DocumentWrapper.tsx
+++ b/code/core/src/components/components/typography/DocumentWrapper.tsx
@@ -1,4 +1,4 @@
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
export const DocumentWrapper = styled.div(({ theme }) => ({
fontSize: `${theme.typography.size.s2}px`,
@@ -305,6 +305,6 @@ export const DocumentWrapper = styled.div(({ theme }) => ({
border: `1px solid ${theme.color.mediumlight}`,
backgroundColor: theme.color.lighter,
borderRadius: 3,
- color: theme.base === 'dark' && theme.color.darkest,
+ color: theme.base === 'dark' ? theme.color.darkest : theme.color.dark,
},
}));
diff --git a/code/ui/components/src/components/typography/ResetWrapper.tsx b/code/core/src/components/components/typography/ResetWrapper.tsx
similarity index 88%
rename from code/ui/components/src/components/typography/ResetWrapper.tsx
rename to code/core/src/components/components/typography/ResetWrapper.tsx
index 4d06195ae3f3..5f639a3fa093 100644
--- a/code/ui/components/src/components/typography/ResetWrapper.tsx
+++ b/code/core/src/components/components/typography/ResetWrapper.tsx
@@ -1,4 +1,4 @@
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import { withReset } from './lib/common';
/**
diff --git a/code/ui/components/src/components/typography/components.tsx b/code/core/src/components/components/typography/components.tsx
similarity index 100%
rename from code/ui/components/src/components/typography/components.tsx
rename to code/core/src/components/components/typography/components.tsx
diff --git a/code/ui/components/src/components/typography/elements/A.tsx b/code/core/src/components/components/typography/elements/A.tsx
similarity index 90%
rename from code/ui/components/src/components/typography/elements/A.tsx
rename to code/core/src/components/components/typography/elements/A.tsx
index 90fc1bf723ef..28e8ccc082d6 100644
--- a/code/ui/components/src/components/typography/elements/A.tsx
+++ b/code/core/src/components/components/typography/elements/A.tsx
@@ -1,4 +1,4 @@
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import { withReset } from '../lib/common';
import { Link } from './Link';
diff --git a/code/ui/components/src/components/typography/elements/Blockquote.tsx b/code/core/src/components/components/typography/elements/Blockquote.tsx
similarity index 87%
rename from code/ui/components/src/components/typography/elements/Blockquote.tsx
rename to code/core/src/components/components/typography/elements/Blockquote.tsx
index 6a7f7c9eb586..5692a72aa9f0 100644
--- a/code/ui/components/src/components/typography/elements/Blockquote.tsx
+++ b/code/core/src/components/components/typography/elements/Blockquote.tsx
@@ -1,4 +1,4 @@
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import { withReset, withMargin } from '../lib/common';
export const Blockquote = styled.blockquote(withReset, withMargin, ({ theme }) => ({
diff --git a/code/ui/components/src/components/typography/elements/Code.tsx b/code/core/src/components/components/typography/elements/Code.tsx
similarity index 97%
rename from code/ui/components/src/components/typography/elements/Code.tsx
rename to code/core/src/components/components/typography/elements/Code.tsx
index c2b643688a6e..7f67c12e645b 100644
--- a/code/ui/components/src/components/typography/elements/Code.tsx
+++ b/code/core/src/components/components/typography/elements/Code.tsx
@@ -1,4 +1,4 @@
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import type { ComponentProps } from 'react';
import React, { Children } from 'react';
import { SyntaxHighlighter } from '../../syntaxhighlighter/syntaxhighlighter';
diff --git a/code/ui/components/src/components/typography/elements/DL.tsx b/code/core/src/components/components/typography/elements/DL.tsx
similarity index 92%
rename from code/ui/components/src/components/typography/elements/DL.tsx
rename to code/core/src/components/components/typography/elements/DL.tsx
index 138ca41bdfe3..792df46878c3 100644
--- a/code/ui/components/src/components/typography/elements/DL.tsx
+++ b/code/core/src/components/components/typography/elements/DL.tsx
@@ -1,4 +1,4 @@
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import { withReset, withMargin } from '../lib/common';
export const DL = styled.dl(withReset, withMargin, {
diff --git a/code/ui/components/src/components/typography/elements/Div.tsx b/code/core/src/components/components/typography/elements/Div.tsx
similarity index 63%
rename from code/ui/components/src/components/typography/elements/Div.tsx
rename to code/core/src/components/components/typography/elements/Div.tsx
index 96d25302b4ca..bf70948dfa1d 100644
--- a/code/ui/components/src/components/typography/elements/Div.tsx
+++ b/code/core/src/components/components/typography/elements/Div.tsx
@@ -1,4 +1,4 @@
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import { withReset } from '../lib/common';
export const Div = styled.div(withReset);
diff --git a/code/ui/components/src/components/typography/elements/H1.tsx b/code/core/src/components/components/typography/elements/H1.tsx
similarity index 81%
rename from code/ui/components/src/components/typography/elements/H1.tsx
rename to code/core/src/components/components/typography/elements/H1.tsx
index 5c929ed45d41..9b306ab1343b 100644
--- a/code/ui/components/src/components/typography/elements/H1.tsx
+++ b/code/core/src/components/components/typography/elements/H1.tsx
@@ -1,4 +1,4 @@
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import { withReset, headerCommon } from '../lib/common';
export const H1 = styled.h1(withReset, headerCommon, ({ theme }) => ({
diff --git a/code/ui/components/src/components/typography/elements/H2.tsx b/code/core/src/components/components/typography/elements/H2.tsx
similarity index 83%
rename from code/ui/components/src/components/typography/elements/H2.tsx
rename to code/core/src/components/components/typography/elements/H2.tsx
index dfa946851d51..9d17758aefbe 100644
--- a/code/ui/components/src/components/typography/elements/H2.tsx
+++ b/code/core/src/components/components/typography/elements/H2.tsx
@@ -1,4 +1,4 @@
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import { withReset, headerCommon } from '../lib/common';
export const H2 = styled.h2(withReset, headerCommon, ({ theme }) => ({
diff --git a/code/ui/components/src/components/typography/elements/H3.tsx b/code/core/src/components/components/typography/elements/H3.tsx
similarity index 78%
rename from code/ui/components/src/components/typography/elements/H3.tsx
rename to code/core/src/components/components/typography/elements/H3.tsx
index bfc713a6b049..6eea8bd27af1 100644
--- a/code/ui/components/src/components/typography/elements/H3.tsx
+++ b/code/core/src/components/components/typography/elements/H3.tsx
@@ -1,4 +1,4 @@
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import { withReset, headerCommon } from '../lib/common';
export const H3 = styled.h3(withReset, headerCommon, ({ theme }) => ({
diff --git a/code/ui/components/src/components/typography/elements/H4.tsx b/code/core/src/components/components/typography/elements/H4.tsx
similarity index 78%
rename from code/ui/components/src/components/typography/elements/H4.tsx
rename to code/core/src/components/components/typography/elements/H4.tsx
index a3cc2668e871..edd0b2639224 100644
--- a/code/ui/components/src/components/typography/elements/H4.tsx
+++ b/code/core/src/components/components/typography/elements/H4.tsx
@@ -1,4 +1,4 @@
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import { withReset, headerCommon } from '../lib/common';
export const H4 = styled.h4(withReset, headerCommon, ({ theme }) => ({
diff --git a/code/ui/components/src/components/typography/elements/H5.tsx b/code/core/src/components/components/typography/elements/H5.tsx
similarity index 78%
rename from code/ui/components/src/components/typography/elements/H5.tsx
rename to code/core/src/components/components/typography/elements/H5.tsx
index 808b121f40e6..e06405f19092 100644
--- a/code/ui/components/src/components/typography/elements/H5.tsx
+++ b/code/core/src/components/components/typography/elements/H5.tsx
@@ -1,4 +1,4 @@
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import { withReset, headerCommon } from '../lib/common';
export const H5 = styled.h5(withReset, headerCommon, ({ theme }) => ({
diff --git a/code/ui/components/src/components/typography/elements/H6.tsx b/code/core/src/components/components/typography/elements/H6.tsx
similarity index 80%
rename from code/ui/components/src/components/typography/elements/H6.tsx
rename to code/core/src/components/components/typography/elements/H6.tsx
index 10639bab2711..bbf7b7cbb435 100644
--- a/code/ui/components/src/components/typography/elements/H6.tsx
+++ b/code/core/src/components/components/typography/elements/H6.tsx
@@ -1,4 +1,4 @@
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import { withReset, headerCommon } from '../lib/common';
export const H6 = styled.h6(withReset, headerCommon, ({ theme }) => ({
diff --git a/code/ui/components/src/components/typography/elements/HR.tsx b/code/core/src/components/components/typography/elements/HR.tsx
similarity index 74%
rename from code/ui/components/src/components/typography/elements/HR.tsx
rename to code/core/src/components/components/typography/elements/HR.tsx
index e639aeeb07ad..c5f054a36ec7 100644
--- a/code/ui/components/src/components/typography/elements/HR.tsx
+++ b/code/core/src/components/components/typography/elements/HR.tsx
@@ -1,4 +1,4 @@
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
export const HR = styled.hr(({ theme }) => ({
border: '0 none',
diff --git a/code/ui/components/src/components/typography/elements/Img.tsx b/code/core/src/components/components/typography/elements/Img.tsx
similarity index 53%
rename from code/ui/components/src/components/typography/elements/Img.tsx
rename to code/core/src/components/components/typography/elements/Img.tsx
index afe8edc2e7c9..ccd1cf1eb8e6 100644
--- a/code/ui/components/src/components/typography/elements/Img.tsx
+++ b/code/core/src/components/components/typography/elements/Img.tsx
@@ -1,4 +1,4 @@
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
export const Img = styled.img({
maxWidth: '100%',
diff --git a/code/ui/components/src/components/typography/elements/LI.tsx b/code/core/src/components/components/typography/elements/LI.tsx
similarity index 77%
rename from code/ui/components/src/components/typography/elements/LI.tsx
rename to code/core/src/components/components/typography/elements/LI.tsx
index 4dc7090bc6e9..4b18e602272d 100644
--- a/code/ui/components/src/components/typography/elements/LI.tsx
+++ b/code/core/src/components/components/typography/elements/LI.tsx
@@ -1,5 +1,5 @@
-import type { CSSObject } from '@storybook/theming';
-import { styled } from '@storybook/theming';
+import type { CSSObject } from '@storybook/core/theming';
+import { styled } from '@storybook/core/theming';
import { withReset, codeCommon } from '../lib/common';
export const LI = styled.li(withReset, ({ theme }) => ({
diff --git a/code/ui/components/src/components/typography/elements/Link.tsx b/code/core/src/components/components/typography/elements/Link.tsx
similarity index 72%
rename from code/ui/components/src/components/typography/elements/Link.tsx
rename to code/core/src/components/components/typography/elements/Link.tsx
index dbb48f48a149..daf1e5fb09c3 100644
--- a/code/ui/components/src/components/typography/elements/Link.tsx
+++ b/code/core/src/components/components/typography/elements/Link.tsx
@@ -1,6 +1,9 @@
import React from 'react';
-export const Link = ({ href: input, ...props }: React.AnchorHTMLAttributes) => {
+export const Link = ({
+ href: input = '',
+ ...props
+}: React.AnchorHTMLAttributes) => {
const isStorybookPath = /^\//.test(input);
const href = isStorybookPath ? `./?path=${input}` : input;
diff --git a/code/ui/components/src/components/typography/elements/OL.tsx b/code/core/src/components/components/typography/elements/OL.tsx
similarity index 72%
rename from code/ui/components/src/components/typography/elements/OL.tsx
rename to code/core/src/components/components/typography/elements/OL.tsx
index e1e0ec7ce462..50d171003582 100644
--- a/code/ui/components/src/components/typography/elements/OL.tsx
+++ b/code/core/src/components/components/typography/elements/OL.tsx
@@ -1,5 +1,5 @@
-import { styled } from '@storybook/theming';
-import type { Interpolation } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
+import type { Interpolation } from '@storybook/core/theming';
import { withReset, withMargin } from '../lib/common';
const listCommon: Interpolation = {
diff --git a/code/ui/components/src/components/typography/elements/P.tsx b/code/core/src/components/components/typography/elements/P.tsx
similarity index 72%
rename from code/ui/components/src/components/typography/elements/P.tsx
rename to code/core/src/components/components/typography/elements/P.tsx
index 86624fbe1ce9..c24405d69a5c 100644
--- a/code/ui/components/src/components/typography/elements/P.tsx
+++ b/code/core/src/components/components/typography/elements/P.tsx
@@ -1,5 +1,5 @@
-import type { CSSObject } from '@storybook/theming';
-import { styled } from '@storybook/theming';
+import type { CSSObject } from '@storybook/core/theming';
+import { styled } from '@storybook/core/theming';
import { withReset, withMargin, codeCommon } from '../lib/common';
export const P = styled.p(withReset, withMargin, ({ theme }) => ({
diff --git a/code/ui/components/src/components/typography/elements/Pre.tsx b/code/core/src/components/components/typography/elements/Pre.tsx
similarity index 94%
rename from code/ui/components/src/components/typography/elements/Pre.tsx
rename to code/core/src/components/components/typography/elements/Pre.tsx
index dabbda5e571f..4792fe8b387b 100644
--- a/code/ui/components/src/components/typography/elements/Pre.tsx
+++ b/code/core/src/components/components/typography/elements/Pre.tsx
@@ -1,4 +1,4 @@
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import { withReset, withMargin } from '../lib/common';
export const Pre = styled.pre(withReset, withMargin, ({ theme }) => ({
diff --git a/code/ui/components/src/components/typography/elements/Span.tsx b/code/core/src/components/components/typography/elements/Span.tsx
similarity index 96%
rename from code/ui/components/src/components/typography/elements/Span.tsx
rename to code/core/src/components/components/typography/elements/Span.tsx
index baea944c4a12..3c3a8a119576 100644
--- a/code/ui/components/src/components/typography/elements/Span.tsx
+++ b/code/core/src/components/components/typography/elements/Span.tsx
@@ -1,4 +1,4 @@
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import { withReset } from '../lib/common';
export const Span = styled.span(withReset, ({ theme }) => ({
diff --git a/code/ui/components/src/components/typography/elements/TT.tsx b/code/core/src/components/components/typography/elements/TT.tsx
similarity index 64%
rename from code/ui/components/src/components/typography/elements/TT.tsx
rename to code/core/src/components/components/typography/elements/TT.tsx
index 314155bfef32..af32c5954423 100644
--- a/code/ui/components/src/components/typography/elements/TT.tsx
+++ b/code/core/src/components/components/typography/elements/TT.tsx
@@ -1,4 +1,4 @@
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import { codeCommon } from '../lib/common';
export const TT = styled.title(codeCommon);
diff --git a/code/ui/components/src/components/typography/elements/Table.tsx b/code/core/src/components/components/typography/elements/Table.tsx
similarity index 95%
rename from code/ui/components/src/components/typography/elements/Table.tsx
rename to code/core/src/components/components/typography/elements/Table.tsx
index 4b4315abc3e8..d09639884f64 100644
--- a/code/ui/components/src/components/typography/elements/Table.tsx
+++ b/code/core/src/components/components/typography/elements/Table.tsx
@@ -1,4 +1,4 @@
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import { withReset, withMargin } from '../lib/common';
export const Table = styled.table(withReset, withMargin, ({ theme }) => ({
diff --git a/code/ui/components/src/components/typography/elements/UL.tsx b/code/core/src/components/components/typography/elements/UL.tsx
similarity index 72%
rename from code/ui/components/src/components/typography/elements/UL.tsx
rename to code/core/src/components/components/typography/elements/UL.tsx
index 08ff3150f1de..75bb7d5c9dab 100644
--- a/code/ui/components/src/components/typography/elements/UL.tsx
+++ b/code/core/src/components/components/typography/elements/UL.tsx
@@ -1,5 +1,5 @@
-import { styled } from '@storybook/theming';
-import type { Interpolation } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
+import type { Interpolation } from '@storybook/core/theming';
import { withReset, withMargin } from '../lib/common';
const listCommon: Interpolation = {
diff --git a/code/ui/components/src/components/typography/lib/common.tsx b/code/core/src/components/components/typography/lib/common.tsx
similarity index 98%
rename from code/ui/components/src/components/typography/lib/common.tsx
rename to code/core/src/components/components/typography/lib/common.tsx
index 6f7bf0158929..1cf1ccd9e93c 100644
--- a/code/ui/components/src/components/typography/lib/common.tsx
+++ b/code/core/src/components/components/typography/lib/common.tsx
@@ -1,5 +1,5 @@
import { transparentize } from 'polished';
-import type { CSSObject, FunctionInterpolation } from '@storybook/theming';
+import type { CSSObject, FunctionInterpolation } from '@storybook/core/theming';
export const headerCommon: FunctionInterpolation = ({ theme }) => ({
margin: '20px 0 8px',
diff --git a/code/ui/components/src/components/typography/lib/isReactChildString.tsx b/code/core/src/components/components/typography/lib/isReactChildString.tsx
similarity index 100%
rename from code/ui/components/src/components/typography/lib/isReactChildString.tsx
rename to code/core/src/components/components/typography/lib/isReactChildString.tsx
diff --git a/code/ui/components/src/components/typography/link/link.stories.tsx b/code/core/src/components/components/typography/link/link.stories.tsx
similarity index 100%
rename from code/ui/components/src/components/typography/link/link.stories.tsx
rename to code/core/src/components/components/typography/link/link.stories.tsx
diff --git a/code/ui/components/src/components/typography/link/link.test.tsx b/code/core/src/components/components/typography/link/link.test.tsx
similarity index 97%
rename from code/ui/components/src/components/typography/link/link.test.tsx
rename to code/core/src/components/components/typography/link/link.test.tsx
index 4232b9005446..ccf004e87657 100644
--- a/code/ui/components/src/components/typography/link/link.test.tsx
+++ b/code/core/src/components/components/typography/link/link.test.tsx
@@ -5,7 +5,7 @@ import type { AnchorHTMLAttributes } from 'react';
import React from 'react';
import { cleanup, render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
-import { ThemeProvider, themes, convert } from '@storybook/theming';
+import { ThemeProvider, themes, convert } from '@storybook/core/theming';
import type { LinkProps } from './link';
import { Link } from './link';
diff --git a/code/ui/components/src/components/typography/link/link.tsx b/code/core/src/components/components/typography/link/link.tsx
similarity index 98%
rename from code/ui/components/src/components/typography/link/link.tsx
rename to code/core/src/components/components/typography/link/link.tsx
index 10a62a2bf5f2..adb92701af28 100644
--- a/code/ui/components/src/components/typography/link/link.tsx
+++ b/code/core/src/components/components/typography/link/link.tsx
@@ -1,6 +1,6 @@
import type { AnchorHTMLAttributes, MouseEvent } from 'react';
import React from 'react';
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import { darken } from 'polished';
import { ChevronRightIcon } from '@storybook/icons';
diff --git a/code/ui/components/src/components/typography/typography.mdx b/code/core/src/components/components/typography/typography.mdx
similarity index 96%
rename from code/ui/components/src/components/typography/typography.mdx
rename to code/core/src/components/components/typography/typography.mdx
index 924ba223974a..8e07423757c7 100644
--- a/code/ui/components/src/components/typography/typography.mdx
+++ b/code/core/src/components/components/typography/typography.mdx
@@ -1,4 +1,4 @@
-import { typography } from '@storybook/theming';
+import { typography } from '@storybook/core/theming';
import { Meta, Typeset } from '@storybook/blocks';
export const fontSizes = ['l3', 'l2', 'l1', 'm3', 'm2', 'm1', 's3', 's2', 's1'].map(
diff --git a/code/ui/components/src/components/utils/getStoryHref.ts b/code/core/src/components/components/utils/getStoryHref.ts
similarity index 100%
rename from code/ui/components/src/components/utils/getStoryHref.ts
rename to code/core/src/components/components/utils/getStoryHref.ts
diff --git a/code/ui/components/src/index.ts b/code/core/src/components/index.ts
similarity index 97%
rename from code/ui/components/src/index.ts
rename to code/core/src/components/index.ts
index 372a684c315d..febbe94778e8 100644
--- a/code/ui/components/src/index.ts
+++ b/code/core/src/components/index.ts
@@ -1,5 +1,4 @@
-// eslint-disable-next-line @typescript-eslint/triple-slash-reference
-///
+///
import type { ElementType } from 'react';
import { createElement, forwardRef } from 'react';
diff --git a/code/lib/core-events/src/data/argtypes-info.ts b/code/core/src/core-events/data/argtypes-info.ts
similarity index 100%
rename from code/lib/core-events/src/data/argtypes-info.ts
rename to code/core/src/core-events/data/argtypes-info.ts
diff --git a/code/lib/core-events/src/data/create-new-story.ts b/code/core/src/core-events/data/create-new-story.ts
similarity index 100%
rename from code/lib/core-events/src/data/create-new-story.ts
rename to code/core/src/core-events/data/create-new-story.ts
diff --git a/code/lib/core-events/src/data/file-component-search.ts b/code/core/src/core-events/data/file-component-search.ts
similarity index 100%
rename from code/lib/core-events/src/data/file-component-search.ts
rename to code/core/src/core-events/data/file-component-search.ts
diff --git a/code/lib/core-events/src/data/request-response.ts b/code/core/src/core-events/data/request-response.ts
similarity index 100%
rename from code/lib/core-events/src/data/request-response.ts
rename to code/core/src/core-events/data/request-response.ts
diff --git a/code/lib/core-events/src/data/save-story.ts b/code/core/src/core-events/data/save-story.ts
similarity index 100%
rename from code/lib/core-events/src/data/save-story.ts
rename to code/core/src/core-events/data/save-story.ts
diff --git a/code/core/src/core-events/data/whats-new.ts b/code/core/src/core-events/data/whats-new.ts
new file mode 100644
index 000000000000..5dbd1227e014
--- /dev/null
+++ b/code/core/src/core-events/data/whats-new.ts
@@ -0,0 +1,20 @@
+export interface WhatsNewCache {
+ lastDismissedPost?: string;
+ lastReadPost?: string;
+}
+
+export type WhatsNewData =
+ | {
+ status: 'SUCCESS';
+ title: string;
+ url: string;
+ blogUrl?: string;
+ publishedAt: string;
+ excerpt: string;
+ postIsRead: boolean;
+ showNotification: boolean;
+ disableWhatsNewNotifications: boolean;
+ }
+ | {
+ status: 'ERROR';
+ };
diff --git a/code/lib/core-events/src/index.test.ts b/code/core/src/core-events/index.test.ts
similarity index 100%
rename from code/lib/core-events/src/index.test.ts
rename to code/core/src/core-events/index.test.ts
diff --git a/code/lib/core-events/src/index.ts b/code/core/src/core-events/index.ts
similarity index 93%
rename from code/lib/core-events/src/index.ts
rename to code/core/src/core-events/index.ts
index 8ce72f12a8dd..cbb1bef3c6af 100644
--- a/code/lib/core-events/src/index.ts
+++ b/code/core/src/core-events/index.ts
@@ -151,24 +151,4 @@ export * from './data/file-component-search';
export * from './data/argtypes-info';
export * from './data/request-response';
export * from './data/save-story';
-
-export interface WhatsNewCache {
- lastDismissedPost?: string;
- lastReadPost?: string;
-}
-
-export type WhatsNewData =
- | {
- status: 'SUCCESS';
- title: string;
- url: string;
- blogUrl?: string;
- publishedAt: string;
- excerpt: string;
- postIsRead: boolean;
- showNotification: boolean;
- disableWhatsNewNotifications: boolean;
- }
- | {
- status: 'ERROR';
- };
+export * from './data/whats-new';
diff --git a/code/lib/core-server/README.md b/code/core/src/core-server/README.md
similarity index 100%
rename from code/lib/core-server/README.md
rename to code/core/src/core-server/README.md
diff --git a/code/lib/core-server/src/__for-testing__/main.ts b/code/core/src/core-server/__for-testing__/main.ts
similarity index 87%
rename from code/lib/core-server/src/__for-testing__/main.ts
rename to code/core/src/core-server/__for-testing__/main.ts
index f9ca30bcc6be..d930ed1504a0 100644
--- a/code/lib/core-server/src/__for-testing__/main.ts
+++ b/code/core/src/core-server/__for-testing__/main.ts
@@ -5,8 +5,8 @@ import type { StorybookConfig } from '@storybook/react-webpack5';
const config: StorybookConfig = {
stories: [
- '../../ui/manager/src/**/*.stories.@(ts|tsx|js|jsx|mdx)',
- '../../ui/components/src/**/*.stories.@(ts|tsx|js|jsx|mdx)',
+ '../../core/src/manager/**/*.stories.@(ts|tsx|js|jsx|mdx)',
+ '../../core/src/components/**/*.stories.@(ts|tsx|js|jsx|mdx)',
'./../../addons/docs/**/*.stories.@(ts|tsx|js|jsx|mdx)',
'./../../addons/interactions/**/*.stories.@(ts|tsx|js|jsx|mdx)',
],
diff --git a/code/lib/core-server/src/__snapshots__/web-components-kitchen-sink_manager-dev-posix b/code/core/src/core-server/__snapshots__/web-components-kitchen-sink_manager-dev-posix
similarity index 100%
rename from code/lib/core-server/src/__snapshots__/web-components-kitchen-sink_manager-dev-posix
rename to code/core/src/core-server/__snapshots__/web-components-kitchen-sink_manager-dev-posix
diff --git a/code/lib/core-server/src/__snapshots__/web-components-kitchen-sink_manager-dev-windows b/code/core/src/core-server/__snapshots__/web-components-kitchen-sink_manager-dev-windows
similarity index 100%
rename from code/lib/core-server/src/__snapshots__/web-components-kitchen-sink_manager-dev-windows
rename to code/core/src/core-server/__snapshots__/web-components-kitchen-sink_manager-dev-windows
diff --git a/code/lib/core-server/src/__snapshots__/web-components-kitchen-sink_manager-prod-posix b/code/core/src/core-server/__snapshots__/web-components-kitchen-sink_manager-prod-posix
similarity index 100%
rename from code/lib/core-server/src/__snapshots__/web-components-kitchen-sink_manager-prod-posix
rename to code/core/src/core-server/__snapshots__/web-components-kitchen-sink_manager-prod-posix
diff --git a/code/lib/core-server/src/__snapshots__/web-components-kitchen-sink_manager-prod-windows b/code/core/src/core-server/__snapshots__/web-components-kitchen-sink_manager-prod-windows
similarity index 100%
rename from code/lib/core-server/src/__snapshots__/web-components-kitchen-sink_manager-prod-windows
rename to code/core/src/core-server/__snapshots__/web-components-kitchen-sink_manager-prod-windows
diff --git a/code/lib/core-server/src/__snapshots__/web-components-kitchen-sink_preview-dev-posix b/code/core/src/core-server/__snapshots__/web-components-kitchen-sink_preview-dev-posix
similarity index 100%
rename from code/lib/core-server/src/__snapshots__/web-components-kitchen-sink_preview-dev-posix
rename to code/core/src/core-server/__snapshots__/web-components-kitchen-sink_preview-dev-posix
diff --git a/code/lib/core-server/src/__snapshots__/web-components-kitchen-sink_preview-dev-windows b/code/core/src/core-server/__snapshots__/web-components-kitchen-sink_preview-dev-windows
similarity index 100%
rename from code/lib/core-server/src/__snapshots__/web-components-kitchen-sink_preview-dev-windows
rename to code/core/src/core-server/__snapshots__/web-components-kitchen-sink_preview-dev-windows
diff --git a/code/lib/core-server/src/__snapshots__/web-components-kitchen-sink_preview-prod-posix b/code/core/src/core-server/__snapshots__/web-components-kitchen-sink_preview-prod-posix
similarity index 100%
rename from code/lib/core-server/src/__snapshots__/web-components-kitchen-sink_preview-prod-posix
rename to code/core/src/core-server/__snapshots__/web-components-kitchen-sink_preview-prod-posix
diff --git a/code/lib/core-server/src/__snapshots__/web-components-kitchen-sink_preview-prod-windows b/code/core/src/core-server/__snapshots__/web-components-kitchen-sink_preview-prod-windows
similarity index 100%
rename from code/lib/core-server/src/__snapshots__/web-components-kitchen-sink_preview-prod-windows
rename to code/core/src/core-server/__snapshots__/web-components-kitchen-sink_preview-prod-windows
diff --git a/code/lib/core-server/src/build-dev.ts b/code/core/src/core-server/build-dev.ts
similarity index 94%
rename from code/lib/core-server/src/build-dev.ts
rename to code/core/src/core-server/build-dev.ts
index de47bcd7a575..f1c8cd8468c1 100644
--- a/code/lib/core-server/src/build-dev.ts
+++ b/code/core/src/core-server/build-dev.ts
@@ -1,4 +1,4 @@
-import type { BuilderOptions, CLIOptions, LoadOptions, Options } from '@storybook/types';
+import type { BuilderOptions, CLIOptions, LoadOptions, Options } from '@storybook/core/types';
import {
getProjectRoot,
loadAllPresets,
@@ -7,17 +7,17 @@ import {
resolvePathInStorybookCache,
serverResolve,
validateFrameworkName,
-} from '@storybook/core-common';
+} from '@storybook/core/common';
import prompts from 'prompts';
import invariant from 'tiny-invariant';
import { global } from '@storybook/global';
-import { oneWayHash, telemetry } from '@storybook/telemetry';
+import { oneWayHash, telemetry } from '@storybook/core/telemetry';
-import { join, relative, resolve } from 'path';
-import { deprecate } from '@storybook/node-logger';
+import { join, relative, resolve } from 'node:path';
+import { deprecate } from '@storybook/core/node-logger';
import { dedent } from 'ts-dedent';
import { readFile } from 'fs-extra';
-import { MissingBuilderError, NoStatsForViteDevError } from '@storybook/core-events/server-errors';
+import { MissingBuilderError, NoStatsForViteDevError } from '@storybook/core/server-errors';
import { storybookDevServer } from './dev-server';
import { outputStats } from './utils/output-stats';
import { outputStartupInformation } from './utils/output-startup-information';
@@ -104,7 +104,7 @@ export async function buildDevStandalone(
let presets = await loadAllPresets({
corePresets,
overridePresets: [
- require.resolve('@storybook/core-server/dist/presets/common-override-preset'),
+ require.resolve('@storybook/core/core-server/presets/common-override-preset'),
],
...options,
isCritical: true,
@@ -151,7 +151,7 @@ export async function buildDevStandalone(
// Load second pass: all presets are applied in order
presets = await loadAllPresets({
corePresets: [
- require.resolve('@storybook/core-server/dist/presets/common-preset'),
+ require.resolve('@storybook/core/core-server/presets/common-preset'),
...(managerBuilder.corePresets || []),
...(previewBuilder.corePresets || []),
...(resolvedRenderer ? [resolvedRenderer] : []),
@@ -159,7 +159,7 @@ export async function buildDevStandalone(
],
overridePresets: [
...(previewBuilder.overridePresets || []),
- require.resolve('@storybook/core-server/dist/presets/common-override-preset'),
+ require.resolve('@storybook/core/core-server/presets/common-override-preset'),
],
...options,
});
diff --git a/code/lib/core-server/src/build-static.ts b/code/core/src/core-server/build-static.ts
similarity index 89%
rename from code/lib/core-server/src/build-static.ts
rename to code/core/src/core-server/build-static.ts
index f1f842eaea28..16d7de1036bf 100644
--- a/code/lib/core-server/src/build-static.ts
+++ b/code/core/src/core-server/build-static.ts
@@ -1,17 +1,17 @@
import chalk from 'chalk';
import { copy, emptyDir, ensureDir } from 'fs-extra';
-import { dirname, join, relative, resolve } from 'path';
+import { dirname, join, relative, resolve } from 'node:path';
import { global } from '@storybook/global';
-import { logger } from '@storybook/node-logger';
-import { getPrecedingUpgrade, telemetry } from '@storybook/telemetry';
-import type { BuilderOptions, CLIOptions, LoadOptions, Options } from '@storybook/types';
+import { logger } from '@storybook/core/node-logger';
+import { getPrecedingUpgrade, telemetry } from '@storybook/core/telemetry';
+import type { BuilderOptions, CLIOptions, LoadOptions, Options } from '@storybook/core/types';
import {
loadAllPresets,
loadMainConfig,
logConfig,
normalizeStories,
resolveAddonName,
-} from '@storybook/core-common';
+} from '@storybook/core/common';
import { outputStats } from './utils/output-stats';
import { copyAllStaticFilesRelativeToMain } from './utils/copy-all-static-files';
@@ -36,7 +36,7 @@ export async function buildStaticStandalone(options: BuildStaticStandaloneOption
options.outputDir = resolve(options.outputDir);
options.configDir = resolve(options.configDir);
- logger.info(chalk`=> Cleaning outputDir: {cyan ${relative(process.cwd(), options.outputDir)}}`);
+ logger.info(`=> Cleaning outputDir: ${chalk.cyan(relative(process.cwd(), options.outputDir))}`);
if (options.outputDir === '/') {
throw new Error("Won't remove directory '/'. Check your outputDir!");
}
@@ -57,11 +57,11 @@ export async function buildStaticStandalone(options: BuildStaticStandaloneOption
logger.info('=> Loading presets');
let presets = await loadAllPresets({
corePresets: [
- require.resolve('@storybook/core-server/dist/presets/common-preset'),
+ require.resolve('@storybook/core/core-server/presets/common-preset'),
...corePresets,
],
overridePresets: [
- require.resolve('@storybook/core-server/dist/presets/common-override-preset'),
+ require.resolve('@storybook/core/core-server/presets/common-override-preset'),
],
isCritical: true,
...options,
@@ -76,7 +76,7 @@ export async function buildStaticStandalone(options: BuildStaticStandaloneOption
: undefined;
presets = await loadAllPresets({
corePresets: [
- require.resolve('@storybook/core-server/dist/presets/common-preset'),
+ require.resolve('@storybook/core/core-server/presets/common-preset'),
...(managerBuilder.corePresets || []),
...(previewBuilder.corePresets || []),
...(resolvedRenderer ? [resolvedRenderer] : []),
@@ -84,7 +84,7 @@ export async function buildStaticStandalone(options: BuildStaticStandaloneOption
],
overridePresets: [
...(previewBuilder.overridePresets || []),
- require.resolve('@storybook/core-server/dist/presets/common-override-preset'),
+ require.resolve('@storybook/core/core-server/presets/common-override-preset'),
],
...options,
build,
@@ -121,8 +121,8 @@ export async function buildStaticStandalone(options: BuildStaticStandaloneOption
}
const coreServerPublicDir = join(
- dirname(require.resolve('@storybook/core-server/package.json')),
- 'public'
+ dirname(require.resolve('@storybook/core/package.json')),
+ 'assets/browser'
);
effects.push(copy(coreServerPublicDir, options.outputDir));
diff --git a/code/lib/core-server/src/dev-server.ts b/code/core/src/core-server/dev-server.ts
similarity index 95%
rename from code/lib/core-server/src/dev-server.ts
rename to code/core/src/core-server/dev-server.ts
index f8805a75a690..1a8935d19a3a 100644
--- a/code/lib/core-server/src/dev-server.ts
+++ b/code/core/src/core-server/dev-server.ts
@@ -2,12 +2,12 @@ import express from 'express';
import compression from 'compression';
import invariant from 'tiny-invariant';
-import type { Options } from '@storybook/types';
+import type { Options } from '@storybook/core/types';
-import { logConfig } from '@storybook/core-common';
-import { logger } from '@storybook/node-logger';
+import { logConfig } from '@storybook/core/common';
+import { logger } from '@storybook/core/node-logger';
-import { MissingBuilderError } from '@storybook/core-events/server-errors';
+import { MissingBuilderError } from '@storybook/core/server-errors';
import { getMiddleware } from './utils/middleware';
import { getServerAddresses } from './utils/server-address';
import { getServer } from './utils/server-init';
diff --git a/code/lib/core-server/src/index.ts b/code/core/src/core-server/index.ts
similarity index 72%
rename from code/lib/core-server/src/index.ts
rename to code/core/src/core-server/index.ts
index 2bbd8ed13b3f..4906ddd9b1f5 100644
--- a/code/lib/core-server/src/index.ts
+++ b/code/core/src/core-server/index.ts
@@ -1,7 +1,6 @@
-// eslint-disable-next-line @typescript-eslint/triple-slash-reference
///
-export { getPreviewHeadTemplate, getPreviewBodyTemplate } from '@storybook/core-common';
+export { getPreviewHeadTemplate, getPreviewBodyTemplate } from '@storybook/core/common';
export * from './build-static';
export * from './build-dev';
diff --git a/code/lib/core-server/src/presets/common-manager.ts b/code/core/src/core-server/presets/common-manager.ts
similarity index 94%
rename from code/lib/core-server/src/presets/common-manager.ts
rename to code/core/src/core-server/presets/common-manager.ts
index bbc5432eeb31..f12d1d662751 100644
--- a/code/lib/core-server/src/presets/common-manager.ts
+++ b/code/core/src/core-server/presets/common-manager.ts
@@ -1,4 +1,4 @@
-import { addons } from '@storybook/manager-api';
+import { addons } from '@storybook/core/manager-api';
import { global } from '@storybook/global';
const STATIC_FILTER = 'static-filter';
diff --git a/code/lib/core-server/src/presets/common-override-preset.ts b/code/core/src/core-server/presets/common-override-preset.ts
similarity index 99%
rename from code/lib/core-server/src/presets/common-override-preset.ts
rename to code/core/src/core-server/presets/common-override-preset.ts
index 51d1af8998d4..83e6ed022ce6 100644
--- a/code/lib/core-server/src/presets/common-override-preset.ts
+++ b/code/core/src/core-server/presets/common-override-preset.ts
@@ -1,4 +1,4 @@
-import type { PresetProperty, TestBuildFlags } from '@storybook/types';
+import type { PresetProperty, TestBuildFlags } from '@storybook/core/types';
import { removeMDXEntries } from '../utils/remove-mdx-entries';
export const framework: PresetProperty<'framework'> = async (config) => {
diff --git a/code/lib/core-server/src/presets/common-preset.ts b/code/core/src/core-server/presets/common-preset.ts
similarity index 93%
rename from code/lib/core-server/src/presets/common-preset.ts
rename to code/core/src/core-server/presets/common-preset.ts
index 0089a4a74fa7..66371fcee3a8 100644
--- a/code/lib/core-server/src/presets/common-preset.ts
+++ b/code/core/src/core-server/presets/common-preset.ts
@@ -1,13 +1,13 @@
import { pathExists, readFile } from 'fs-extra';
-import { logger } from '@storybook/node-logger';
-import { telemetry } from '@storybook/telemetry';
+import { logger } from '@storybook/core/node-logger';
+import { telemetry } from '@storybook/core/telemetry';
import {
getDirectoryFromWorkingDir,
getPreviewBodyTemplate,
getPreviewHeadTemplate,
loadEnvs,
removeAddon as removeAddonBase,
-} from '@storybook/core-common';
+} from '@storybook/core/common';
import type {
CLIOptions,
CoreConfig,
@@ -15,11 +15,11 @@ import type {
Options,
PresetPropertyFn,
PresetProperty,
-} from '@storybook/types';
-import { readCsf } from '@storybook/csf-tools';
-import { join, dirname, isAbsolute } from 'path';
+} from '@storybook/core/types';
+import { readCsf } from '@storybook/core/csf-tools';
+import { join, dirname, isAbsolute } from 'node:path';
import { dedent } from 'ts-dedent';
-import type { Channel } from '@storybook/channels';
+import type { Channel } from '@storybook/core/channels';
import { parseStaticDir } from '../utils/server-statics';
import { defaultStaticDirs } from '../utils/constants';
import { initializeWhatsNew, type OptionsWithRequiredCache } from '../utils/whats-new';
@@ -30,7 +30,10 @@ import { initCreateNewStoryChannel } from '../server-channel/create-new-story-ch
const interpolate = (string: string, data: Record = {}) =>
Object.entries(data).reduce((acc, [k, v]) => acc.replace(new RegExp(`%${k}%`, 'g'), v), string);
-const defaultFavicon = require.resolve('@storybook/core-server/public/favicon.svg');
+const defaultFavicon = join(
+ dirname(require.resolve('@storybook/core/package.json')),
+ '/assets/browser/favicon.svg'
+);
export const staticDirs: PresetPropertyFn<'staticDirs'> = async (values = []) => [
...defaultStaticDirs,
@@ -278,5 +281,11 @@ export const tags = async (existing: any) => {
};
export const managerEntries = async (existing: any, options: Options) => {
- return [require.resolve('./common-manager'), ...(existing || [])];
+ return [
+ join(
+ dirname(require.resolve('@storybook/core/package.json')),
+ 'dist/core-server/presets/common-manager.js'
+ ),
+ ...(existing || []),
+ ];
};
diff --git a/code/lib/core-server/src/presets/favicon.test.ts b/code/core/src/core-server/presets/favicon.test.ts
similarity index 92%
rename from code/lib/core-server/src/presets/favicon.test.ts
rename to code/core/src/core-server/presets/favicon.test.ts
index fec09b755b56..2ba8666cc6a6 100644
--- a/code/lib/core-server/src/presets/favicon.test.ts
+++ b/code/core/src/core-server/presets/favicon.test.ts
@@ -1,11 +1,14 @@
import { expect, vi, it } from 'vitest';
-import { join } from 'path';
+import { dirname, join } from 'node:path';
import * as fs from 'fs-extra';
-import { logger } from '@storybook/node-logger';
+import { logger } from '@storybook/core/node-logger';
import * as m from './common-preset';
-const defaultFavicon = require.resolve('@storybook/core-server/public/favicon.svg');
+const defaultFavicon = join(
+ dirname(require.resolve('@storybook/core/package.json')),
+ '/assets/browser/favicon.svg'
+);
const createPath = (...p: string[]) => join(process.cwd(), ...p);
const createOptions = (locations: string[]): Parameters[1] => ({
@@ -35,7 +38,7 @@ vi.mock('fs-extra', () => {
};
});
-vi.mock('@storybook/node-logger', () => {
+vi.mock('@storybook/core/node-logger', () => {
return {
logger: {
warn: vi.fn(() => {}),
diff --git a/code/core/src/core-server/server-channel/create-new-story-channel.test.ts b/code/core/src/core-server/server-channel/create-new-story-channel.test.ts
new file mode 100644
index 000000000000..81b9d74fce93
--- /dev/null
+++ b/code/core/src/core-server/server-channel/create-new-story-channel.test.ts
@@ -0,0 +1,144 @@
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+import { initCreateNewStoryChannel } from './create-new-story-channel';
+import path from 'node:path';
+import type { ChannelTransport } from '@storybook/core/channels';
+import { Channel } from '@storybook/core/channels';
+import type { CreateNewStoryRequestPayload, RequestData } from '@storybook/core/core-events';
+import {
+ CREATE_NEW_STORYFILE_REQUEST,
+ CREATE_NEW_STORYFILE_RESPONSE,
+} from '@storybook/core/core-events';
+
+vi.mock('@storybook/core/common', async (importOriginal) => {
+ const actual = await importOriginal();
+ return {
+ ...actual,
+ getProjectRoot: vi.fn().mockReturnValue(process.cwd()),
+ };
+});
+
+const mockFs = vi.hoisted(() => {
+ return {
+ writeFile: vi.fn(),
+ };
+});
+
+vi.mock('node:fs/promises', async (importOriginal) => {
+ const actual = await importOriginal();
+ return {
+ ...actual,
+ writeFile: mockFs.writeFile,
+ };
+});
+
+describe(
+ 'createNewStoryChannel',
+ () => {
+ const transport = { setHandler: vi.fn(), send: vi.fn() } satisfies ChannelTransport;
+ const mockChannel = new Channel({ transport });
+ const createNewStoryFileEventListener = vi.fn();
+
+ beforeEach(() => {
+ transport.setHandler.mockClear();
+ transport.send.mockClear();
+ createNewStoryFileEventListener.mockClear();
+ });
+
+ describe('initCreateNewStoryChannel', () => {
+ it('should emit an event with a story id', async () => {
+ mockChannel.addListener(CREATE_NEW_STORYFILE_RESPONSE, createNewStoryFileEventListener);
+ const cwd = process.cwd();
+
+ initCreateNewStoryChannel(
+ mockChannel,
+ {
+ configDir: path.join(cwd, '.storybook'),
+ presets: {
+ apply: (val: string) => {
+ if (val === 'framework') {
+ return Promise.resolve('@storybook/nextjs');
+ }
+ if (val === 'stories') {
+ return Promise.resolve(['../src/**/*.stories.@(js|jsx|mjs|ts|tsx)']);
+ }
+ },
+ },
+ } as any,
+ { disableTelemetry: true }
+ );
+
+ mockChannel.emit(CREATE_NEW_STORYFILE_REQUEST, {
+ id: 'components-page--default',
+ payload: {
+ componentFilePath: 'src/components/Page.jsx',
+ componentExportName: 'Page',
+ componentIsDefaultExport: true,
+ },
+ });
+
+ await vi.waitFor(() => {
+ expect(createNewStoryFileEventListener).toHaveBeenCalled();
+ });
+
+ expect(createNewStoryFileEventListener).toHaveBeenCalledWith({
+ error: null,
+ id: 'components-page--default',
+ payload: {
+ storyId: 'components-page--default',
+ storyFilePath: path.join('src', 'components', 'Page.stories.jsx'),
+ exportedStoryName: 'Default',
+ },
+ success: true,
+ });
+ });
+
+ it('should emit an error event if an error occurs', async () => {
+ mockChannel.addListener(CREATE_NEW_STORYFILE_RESPONSE, createNewStoryFileEventListener);
+ const cwd = process.cwd();
+
+ mockFs.writeFile.mockImplementation(() => {
+ throw new Error('Failed to write file');
+ });
+
+ initCreateNewStoryChannel(
+ mockChannel,
+ {
+ configDir: path.join(cwd, '.storybook'),
+ presets: {
+ apply: (val: string) => {
+ if (val === 'framework') {
+ return Promise.resolve('@storybook/nextjs');
+ }
+ if (val === 'stories') {
+ return Promise.resolve(['../src/**/*.stories.@(js|jsx|mjs|ts|tsx)']);
+ }
+ },
+ },
+ } as any,
+ { disableTelemetry: true }
+ );
+
+ mockChannel.emit(CREATE_NEW_STORYFILE_REQUEST, {
+ id: 'components-page--default',
+ payload: {
+ componentFilePath: 'src/components/Page.jsx',
+ componentExportName: 'Page',
+ componentIsDefaultExport: true,
+ componentExportCount: 1,
+ },
+ } satisfies RequestData);
+
+ await vi.waitFor(() => {
+ expect(createNewStoryFileEventListener).toHaveBeenCalled();
+ });
+
+ expect(createNewStoryFileEventListener).toHaveBeenCalledWith({
+ error: 'Failed to write file',
+ id: 'components-page--default',
+ success: false,
+ });
+ });
+ });
+ },
+ { retry: 3 }
+);
diff --git a/code/lib/core-server/src/server-channel/create-new-story-channel.ts b/code/core/src/core-server/server-channel/create-new-story-channel.ts
similarity index 87%
rename from code/lib/core-server/src/server-channel/create-new-story-channel.ts
rename to code/core/src/core-server/server-channel/create-new-story-channel.ts
index 18d755afbd44..f30fdf2d57a3 100644
--- a/code/lib/core-server/src/server-channel/create-new-story-channel.ts
+++ b/code/core/src/core-server/server-channel/create-new-story-channel.ts
@@ -1,18 +1,18 @@
-import type { CoreConfig, Options } from '@storybook/types';
-import type { Channel } from '@storybook/channels';
-import { telemetry } from '@storybook/telemetry';
+import type { CoreConfig, Options } from '@storybook/core/types';
+import type { Channel } from '@storybook/core/channels';
+import { telemetry } from '@storybook/core/telemetry';
import type {
CreateNewStoryErrorPayload,
CreateNewStoryRequestPayload,
CreateNewStoryResponsePayload,
RequestData,
ResponseData,
-} from '@storybook/core-events';
+} from '@storybook/core/core-events';
import {
CREATE_NEW_STORYFILE_REQUEST,
CREATE_NEW_STORYFILE_RESPONSE,
-} from '@storybook/core-events';
-import fs from 'node:fs/promises';
+} from '@storybook/core/core-events';
+import { writeFile } from 'node:fs/promises';
import { existsSync } from 'node:fs';
import { getNewStoryFile } from '../utils/get-new-story-file';
import { getStoryId } from '../utils/get-story-id';
@@ -60,7 +60,7 @@ export function initCreateNewStoryChannel(
return;
}
- await fs.writeFile(storyFilePath, storyFileContent, 'utf-8');
+ await writeFile(storyFilePath, storyFileContent, 'utf-8');
channel.emit(CREATE_NEW_STORYFILE_RESPONSE, {
success: true,
diff --git a/code/lib/core-server/src/server-channel/file-search-channel.test.ts b/code/core/src/core-server/server-channel/file-search-channel.test.ts
similarity index 94%
rename from code/lib/core-server/src/server-channel/file-search-channel.test.ts
rename to code/core/src/core-server/server-channel/file-search-channel.test.ts
index d12af10ca261..bb27cfcb1e0d 100644
--- a/code/lib/core-server/src/server-channel/file-search-channel.test.ts
+++ b/code/core/src/core-server/server-channel/file-search-channel.test.ts
@@ -1,10 +1,12 @@
-import type { ChannelTransport } from '@storybook/channels';
-import { Channel } from '@storybook/channels';
-import type { RequestData, FileComponentSearchRequestPayload } from '@storybook/core-events';
+// @vitest-environment happy-dom
+
+import type { ChannelTransport } from '@storybook/core/channels';
+import { Channel } from '@storybook/core/channels';
+import type { RequestData, FileComponentSearchRequestPayload } from '@storybook/core/core-events';
import {
FILE_COMPONENT_SEARCH_RESPONSE,
FILE_COMPONENT_SEARCH_REQUEST,
-} from '@storybook/core-events';
+} from '@storybook/core/core-events';
import { beforeEach, describe, expect, vi, it } from 'vitest';
import { initFileSearchChannel } from './file-search-channel';
@@ -21,8 +23,8 @@ vi.mock('../utils/search-files', () => {
};
});
-vi.mock('@storybook/core-common', async (importOriginal) => {
- const actual = await importOriginal();
+vi.mock('@storybook/core/common', async (importOriginal) => {
+ const actual = await importOriginal();
return {
...actual,
getFrameworkName: vi.fn().mockResolvedValue('@storybook/react'),
diff --git a/code/lib/core-server/src/server-channel/file-search-channel.ts b/code/core/src/core-server/server-channel/file-search-channel.ts
similarity index 92%
rename from code/lib/core-server/src/server-channel/file-search-channel.ts
rename to code/core/src/core-server/server-channel/file-search-channel.ts
index 58e94fdfcc77..aaf6af62af35 100644
--- a/code/lib/core-server/src/server-channel/file-search-channel.ts
+++ b/code/core/src/core-server/server-channel/file-search-channel.ts
@@ -1,11 +1,11 @@
-import type { CoreConfig, Options, SupportedRenderers } from '@storybook/types';
-import type { Channel } from '@storybook/channels';
+import type { CoreConfig, Options, SupportedRenderers } from '@storybook/core/types';
+import type { Channel } from '@storybook/core/channels';
import {
extractProperRendererNameFromFramework,
getFrameworkName,
getProjectRoot,
-} from '@storybook/core-common';
-import path from 'path';
+} from '@storybook/core/common';
+import path from 'node:path';
import fs from 'fs/promises';
import { getParser } from '../utils/parser';
@@ -15,13 +15,13 @@ import type {
FileComponentSearchResponsePayload,
RequestData,
ResponseData,
-} from '@storybook/core-events';
+} from '@storybook/core/core-events';
import {
FILE_COMPONENT_SEARCH_REQUEST,
FILE_COMPONENT_SEARCH_RESPONSE,
-} from '@storybook/core-events';
+} from '@storybook/core/core-events';
import { doesStoryFileExist, getStoryMetadata } from '../utils/get-new-story-file';
-import { telemetry } from '@storybook/telemetry';
+import { telemetry } from '@storybook/core/telemetry';
export async function initFileSearchChannel(
channel: Channel,
diff --git a/code/lib/core-server/src/standalone.ts b/code/core/src/core-server/standalone.ts
similarity index 85%
rename from code/lib/core-server/src/standalone.ts
rename to code/core/src/core-server/standalone.ts
index 2820e37ff181..354a1852f54d 100644
--- a/code/lib/core-server/src/standalone.ts
+++ b/code/core/src/core-server/standalone.ts
@@ -1,10 +1,10 @@
-import { findPackageSync } from 'fd-package-json';
import { buildStaticStandalone } from './build-static';
import { buildDevStandalone } from './build-dev';
+import { dirname } from 'node:path';
async function build(options: any = {}, frameworkOptions: any = {}) {
const { mode = 'dev' } = options;
- const packageJson = findPackageSync(__dirname);
+ const packageJson = dirname(require.resolve('@storybook/core/package.json'));
const commonOptions = {
...options,
diff --git a/code/lib/core-server/src/typings.d.ts b/code/core/src/core-server/typings.d.ts
similarity index 61%
rename from code/lib/core-server/src/typings.d.ts
rename to code/core/src/core-server/typings.d.ts
index e6d9fc7e10a2..1dfb2f3e1917 100644
--- a/code/lib/core-server/src/typings.d.ts
+++ b/code/core/src/core-server/typings.d.ts
@@ -6,5 +6,5 @@ declare module '@aw-web-design/x-default-browser';
declare module '@discoveryjs/json-ext';
declare module 'watchpack';
-declare var FEATURES: import('@storybook/types').StorybookConfigRaw['features'];
-declare var TAGS_OPTIONS: import('@storybook/types').TagsOptions;
+declare var FEATURES: import('@storybook/core/types').StorybookConfigRaw['features'];
+declare var TAGS_OPTIONS: import('@storybook/core/types').TagsOptions;
diff --git a/code/lib/core-server/src/utils/IndexingError.ts b/code/core/src/core-server/utils/IndexingError.ts
similarity index 100%
rename from code/lib/core-server/src/utils/IndexingError.ts
rename to code/core/src/core-server/utils/IndexingError.ts
diff --git a/code/lib/core-server/src/utils/StoryIndexGenerator.test.ts b/code/core/src/core-server/utils/StoryIndexGenerator.test.ts
similarity index 98%
rename from code/lib/core-server/src/utils/StoryIndexGenerator.test.ts
rename to code/core/src/core-server/utils/StoryIndexGenerator.test.ts
index ff898cc8eb16..c23fcbdb3faf 100644
--- a/code/lib/core-server/src/utils/StoryIndexGenerator.test.ts
+++ b/code/core/src/core-server/utils/StoryIndexGenerator.test.ts
@@ -2,12 +2,12 @@
import { describe, beforeEach, it, expect, vi } from 'vitest';
-import path from 'path';
-import { normalizeStoriesEntry } from '@storybook/core-common';
-import type { NormalizedStoriesSpecifier, StoryIndexEntry } from '@storybook/types';
-import { readCsf, getStorySortParameter } from '@storybook/csf-tools';
+import path from 'node:path';
+import { normalizeStoriesEntry } from '@storybook/core/common';
+import type { NormalizedStoriesSpecifier, StoryIndexEntry } from '@storybook/core/types';
+import { readCsf, getStorySortParameter } from '@storybook/core/csf-tools';
import { toId } from '@storybook/csf';
-import { logger, once } from '@storybook/node-logger';
+import { logger, once } from '@storybook/core/node-logger';
import type { StoryIndexGeneratorOptions } from './StoryIndexGenerator';
import { StoryIndexGenerator } from './StoryIndexGenerator';
@@ -21,11 +21,11 @@ vi.mock('@storybook/csf', async (importOriginal) => {
};
});
-vi.mock('@storybook/node-logger');
+vi.mock('@storybook/core/node-logger');
const toIdMock = vi.mocked(toId);
-vi.mock('@storybook/csf-tools', async (importOriginal) => {
- const csfTools = await importOriginal();
+vi.mock('@storybook/core/csf-tools', async (importOriginal) => {
+ const csfTools = await importOriginal();
return {
...csfTools,
readCsf: vi.fn(csfTools.readCsf),
@@ -1508,6 +1508,7 @@ describe('StoryIndexGenerator', () => {
);
readCsfMock.mockClear();
+ expect(readCsfMock).toHaveBeenCalledTimes(0);
const generator = new StoryIndexGenerator([specifier], options);
await generator.initialize();
await generator.getIndex();
@@ -1527,11 +1528,12 @@ describe('StoryIndexGenerator', () => {
'./src/docs2/*.mdx',
options
);
-
+ readCsfMock.mockClear();
+ expect(readCsfMock).toHaveBeenCalledTimes(0);
const generator = new StoryIndexGenerator([storiesSpecifier, docsSpecifier], options);
await generator.initialize();
await generator.getIndex();
- expect(toId).toHaveBeenCalledTimes(5);
+ expect(toId).toHaveBeenCalledTimes(6);
toIdMock.mockClear();
await generator.getIndex();
@@ -1590,7 +1592,7 @@ describe('StoryIndexGenerator', () => {
const generator = new StoryIndexGenerator([storiesSpecifier, docsSpecifier], options);
await generator.initialize();
await generator.getIndex();
- expect(toId).toHaveBeenCalledTimes(5);
+ expect(toId).toHaveBeenCalledTimes(6);
generator.invalidate(docsSpecifier, './src/docs2/Title.mdx', false);
@@ -1612,13 +1614,13 @@ describe('StoryIndexGenerator', () => {
const generator = new StoryIndexGenerator([storiesSpecifier, docsSpecifier], options);
await generator.initialize();
await generator.getIndex();
- expect(toId).toHaveBeenCalledTimes(5);
+ expect(toId).toHaveBeenCalledTimes(6);
generator.invalidate(storiesSpecifier, './src/A.stories.js', false);
toIdMock.mockClear();
await generator.getIndex();
- expect(toId).toHaveBeenCalledTimes(2);
+ expect(toId).toHaveBeenCalledTimes(3);
});
it('does call the sort function a second time', async () => {
@@ -1712,7 +1714,7 @@ describe('StoryIndexGenerator', () => {
const generator = new StoryIndexGenerator([docsSpecifier, storiesSpecifier], options);
await generator.initialize();
await generator.getIndex();
- expect(toId).toHaveBeenCalledTimes(5);
+ expect(toId).toHaveBeenCalledTimes(6);
expect(Object.keys((await generator.getIndex()).entries)).toContain('notitle--docs');
@@ -1734,7 +1736,7 @@ describe('StoryIndexGenerator', () => {
const generator = new StoryIndexGenerator([docsSpecifier, storiesSpecifier], options);
await generator.initialize();
await generator.getIndex();
- expect(toId).toHaveBeenCalledTimes(5);
+ expect(toId).toHaveBeenCalledTimes(6);
expect(Object.keys((await generator.getIndex()).entries)).toContain('a--metaof');
diff --git a/code/lib/core-server/src/utils/StoryIndexGenerator.ts b/code/core/src/core-server/utils/StoryIndexGenerator.ts
similarity index 98%
rename from code/lib/core-server/src/utils/StoryIndexGenerator.ts
rename to code/core/src/core-server/utils/StoryIndexGenerator.ts
index 487447d18f4f..da1b21a5b00b 100644
--- a/code/lib/core-server/src/utils/StoryIndexGenerator.ts
+++ b/code/core/src/core-server/utils/StoryIndexGenerator.ts
@@ -1,10 +1,10 @@
-import path from 'path';
+import path from 'node:path';
import chalk from 'chalk';
import fs from 'fs-extra';
import slash from 'slash';
import invariant from 'tiny-invariant';
import * as TsconfigPaths from 'tsconfig-paths';
-import findUp from 'find-up';
+import { findUp } from 'find-up';
import type {
IndexEntry,
@@ -17,14 +17,14 @@ import type {
StoryIndex,
Indexer,
StorybookConfigRaw,
-} from '@storybook/types';
-import { userOrAutoTitleFromSpecifier, sortStoriesV7 } from '@storybook/preview-api';
-import { commonGlobOptions, normalizeStoryPath } from '@storybook/core-common';
-import { logger, once } from '@storybook/node-logger';
-import { getStorySortParameter, loadConfig } from '@storybook/csf-tools';
+} from '@storybook/core/types';
+import { userOrAutoTitleFromSpecifier, sortStoriesV7 } from '@storybook/core/preview-api';
+import { commonGlobOptions, normalizeStoryPath } from '@storybook/core/common';
+import { logger, once } from '@storybook/core/node-logger';
+import { getStorySortParameter, loadConfig } from '@storybook/core/csf-tools';
import { storyNameFromExport, toId, combineTags } from '@storybook/csf';
import { analyze } from '@storybook/docs-mdx';
-import dedent from 'ts-dedent';
+import { dedent } from 'ts-dedent';
import { autoName } from './autoName';
import { IndexingError, MultipleIndexingError } from './IndexingError';
diff --git a/code/lib/core-server/src/utils/__mockdata__/E.stories.ts b/code/core/src/core-server/utils/__mockdata__/E.stories.ts
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/E.stories.ts
rename to code/core/src/core-server/utils/__mockdata__/E.stories.ts
diff --git a/code/lib/core-server/src/utils/__mockdata__/complex/TwoStoryReferences.mdx b/code/core/src/core-server/utils/__mockdata__/complex/TwoStoryReferences.mdx
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/complex/TwoStoryReferences.mdx
rename to code/core/src/core-server/utils/__mockdata__/complex/TwoStoryReferences.mdx
diff --git a/code/lib/core-server/src/utils/__mockdata__/deeply/nested/single/File.stories.ts b/code/core/src/core-server/utils/__mockdata__/deeply/nested/single/File.stories.ts
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/deeply/nested/single/File.stories.ts
rename to code/core/src/core-server/utils/__mockdata__/deeply/nested/single/File.stories.ts
diff --git a/code/lib/core-server/src/utils/__mockdata__/docs-id-generation/A.stories.jsx b/code/core/src/core-server/utils/__mockdata__/docs-id-generation/A.stories.jsx
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/docs-id-generation/A.stories.jsx
rename to code/core/src/core-server/utils/__mockdata__/docs-id-generation/A.stories.jsx
diff --git a/code/lib/core-server/src/utils/__mockdata__/docs-id-generation/B.docs.mdx b/code/core/src/core-server/utils/__mockdata__/docs-id-generation/B.docs.mdx
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/docs-id-generation/B.docs.mdx
rename to code/core/src/core-server/utils/__mockdata__/docs-id-generation/B.docs.mdx
diff --git a/code/lib/core-server/src/utils/__mockdata__/docs-id-generation/B.stories.jsx b/code/core/src/core-server/utils/__mockdata__/docs-id-generation/B.stories.jsx
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/docs-id-generation/B.stories.jsx
rename to code/core/src/core-server/utils/__mockdata__/docs-id-generation/B.stories.jsx
diff --git a/code/lib/core-server/src/utils/__mockdata__/duplicate/A.stories.js b/code/core/src/core-server/utils/__mockdata__/duplicate/A.stories.js
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/duplicate/A.stories.js
rename to code/core/src/core-server/utils/__mockdata__/duplicate/A.stories.js
diff --git a/code/lib/core-server/src/utils/__mockdata__/duplicate/SecondA.stories.js b/code/core/src/core-server/utils/__mockdata__/duplicate/SecondA.stories.js
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/duplicate/SecondA.stories.js
rename to code/core/src/core-server/utils/__mockdata__/duplicate/SecondA.stories.js
diff --git a/code/lib/core-server/src/utils/__mockdata__/errors/A.mdx b/code/core/src/core-server/utils/__mockdata__/errors/A.mdx
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/errors/A.mdx
rename to code/core/src/core-server/utils/__mockdata__/errors/A.mdx
diff --git a/code/lib/core-server/src/utils/__mockdata__/errors/B.mdx b/code/core/src/core-server/utils/__mockdata__/errors/B.mdx
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/errors/B.mdx
rename to code/core/src/core-server/utils/__mockdata__/errors/B.mdx
diff --git a/code/lib/core-server/src/utils/__mockdata__/errors/MetaOfClashingDefaultName.mdx b/code/core/src/core-server/utils/__mockdata__/errors/MetaOfClashingDefaultName.mdx
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/errors/MetaOfClashingDefaultName.mdx
rename to code/core/src/core-server/utils/__mockdata__/errors/MetaOfClashingDefaultName.mdx
diff --git a/code/lib/core-server/src/utils/__mockdata__/errors/MetaOfClashingName.mdx b/code/core/src/core-server/utils/__mockdata__/errors/MetaOfClashingName.mdx
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/errors/MetaOfClashingName.mdx
rename to code/core/src/core-server/utils/__mockdata__/errors/MetaOfClashingName.mdx
diff --git a/code/lib/core-server/src/utils/__mockdata__/errors/MetaOfName.mdx b/code/core/src/core-server/utils/__mockdata__/errors/MetaOfName.mdx
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/errors/MetaOfName.mdx
rename to code/core/src/core-server/utils/__mockdata__/errors/MetaOfName.mdx
diff --git a/code/lib/core-server/src/utils/__mockdata__/errors/MetaOfNoName.mdx b/code/core/src/core-server/utils/__mockdata__/errors/MetaOfNoName.mdx
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/errors/MetaOfNoName.mdx
rename to code/core/src/core-server/utils/__mockdata__/errors/MetaOfNoName.mdx
diff --git a/code/lib/core-server/src/utils/__mockdata__/errors/NoMeta.stories.ts b/code/core/src/core-server/utils/__mockdata__/errors/NoMeta.stories.ts
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/errors/NoMeta.stories.ts
rename to code/core/src/core-server/utils/__mockdata__/errors/NoMeta.stories.ts
diff --git a/code/lib/core-server/src/utils/__mockdata__/errors/NoStories.stories.ts b/code/core/src/core-server/utils/__mockdata__/errors/NoStories.stories.ts
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/errors/NoStories.stories.ts
rename to code/core/src/core-server/utils/__mockdata__/errors/NoStories.stories.ts
diff --git a/code/lib/core-server/src/utils/__mockdata__/errors/duplicate/A.mdx b/code/core/src/core-server/utils/__mockdata__/errors/duplicate/A.mdx
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/errors/duplicate/A.mdx
rename to code/core/src/core-server/utils/__mockdata__/errors/duplicate/A.mdx
diff --git a/code/lib/core-server/src/utils/__mockdata__/preview.js b/code/core/src/core-server/utils/__mockdata__/preview.js
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/preview.js
rename to code/core/src/core-server/utils/__mockdata__/preview.js
diff --git a/code/lib/core-server/src/utils/__mockdata__/src/A.js b/code/core/src/core-server/utils/__mockdata__/src/A.js
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/src/A.js
rename to code/core/src/core-server/utils/__mockdata__/src/A.js
diff --git a/code/lib/core-server/src/utils/__mockdata__/src/A.stories.js b/code/core/src/core-server/utils/__mockdata__/src/A.stories.js
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/src/A.stories.js
rename to code/core/src/core-server/utils/__mockdata__/src/A.stories.js
diff --git a/code/lib/core-server/src/utils/__mockdata__/src/B.stories.ts b/code/core/src/core-server/utils/__mockdata__/src/B.stories.ts
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/src/B.stories.ts
rename to code/core/src/core-server/utils/__mockdata__/src/B.stories.ts
diff --git a/code/lib/core-server/src/utils/__mockdata__/src/C.js b/code/core/src/core-server/utils/__mockdata__/src/C.js
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/src/C.js
rename to code/core/src/core-server/utils/__mockdata__/src/C.js
diff --git a/code/lib/core-server/src/utils/__mockdata__/src/D.stories.jsx b/code/core/src/core-server/utils/__mockdata__/src/D.stories.jsx
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/src/D.stories.jsx
rename to code/core/src/core-server/utils/__mockdata__/src/D.stories.jsx
diff --git a/code/lib/core-server/src/utils/__mockdata__/src/F.story.ts b/code/core/src/core-server/utils/__mockdata__/src/F.story.ts
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/src/F.story.ts
rename to code/core/src/core-server/utils/__mockdata__/src/F.story.ts
diff --git a/code/lib/core-server/src/utils/__mockdata__/src/H.stories.mjs b/code/core/src/core-server/utils/__mockdata__/src/H.stories.mjs
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/src/H.stories.mjs
rename to code/core/src/core-server/utils/__mockdata__/src/H.stories.mjs
diff --git a/code/lib/core-server/src/utils/__mockdata__/src/componentPath/component.js b/code/core/src/core-server/utils/__mockdata__/src/componentPath/component.js
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/src/componentPath/component.js
rename to code/core/src/core-server/utils/__mockdata__/src/componentPath/component.js
diff --git a/code/lib/core-server/src/utils/__mockdata__/src/componentPath/extension.stories.js b/code/core/src/core-server/utils/__mockdata__/src/componentPath/extension.stories.js
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/src/componentPath/extension.stories.js
rename to code/core/src/core-server/utils/__mockdata__/src/componentPath/extension.stories.js
diff --git a/code/lib/core-server/src/utils/__mockdata__/src/componentPath/noExtension.stories.js b/code/core/src/core-server/utils/__mockdata__/src/componentPath/noExtension.stories.js
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/src/componentPath/noExtension.stories.js
rename to code/core/src/core-server/utils/__mockdata__/src/componentPath/noExtension.stories.js
diff --git a/code/lib/core-server/src/utils/__mockdata__/src/componentPath/package.stories.js b/code/core/src/core-server/utils/__mockdata__/src/componentPath/package.stories.js
similarity index 68%
rename from code/lib/core-server/src/utils/__mockdata__/src/componentPath/package.stories.js
rename to code/core/src/core-server/utils/__mockdata__/src/componentPath/package.stories.js
index 20509edcf2be..b218fc26b970 100644
--- a/code/lib/core-server/src/utils/__mockdata__/src/componentPath/package.stories.js
+++ b/code/core/src/core-server/utils/__mockdata__/src/componentPath/package.stories.js
@@ -1,4 +1,3 @@
-// eslint-disable-next-line import/no-unresolved
import component from 'component-package';
export default {
diff --git a/code/lib/core-server/src/utils/__mockdata__/src/docs2/ComponentReference.js b/code/core/src/core-server/utils/__mockdata__/src/docs2/ComponentReference.js
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/src/docs2/ComponentReference.js
rename to code/core/src/core-server/utils/__mockdata__/src/docs2/ComponentReference.js
diff --git a/code/lib/core-server/src/utils/__mockdata__/src/docs2/ComponentReference.mdx b/code/core/src/core-server/utils/__mockdata__/src/docs2/ComponentReference.mdx
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/src/docs2/ComponentReference.mdx
rename to code/core/src/core-server/utils/__mockdata__/src/docs2/ComponentReference.mdx
diff --git a/code/lib/core-server/src/utils/__mockdata__/src/docs2/MetaOf.mdx b/code/core/src/core-server/utils/__mockdata__/src/docs2/MetaOf.mdx
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/src/docs2/MetaOf.mdx
rename to code/core/src/core-server/utils/__mockdata__/src/docs2/MetaOf.mdx
diff --git a/code/lib/core-server/src/utils/__mockdata__/src/docs2/NoTitle.mdx b/code/core/src/core-server/utils/__mockdata__/src/docs2/NoTitle.mdx
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/src/docs2/NoTitle.mdx
rename to code/core/src/core-server/utils/__mockdata__/src/docs2/NoTitle.mdx
diff --git a/code/lib/core-server/src/utils/__mockdata__/src/docs2/SecondMetaOf.mdx b/code/core/src/core-server/utils/__mockdata__/src/docs2/SecondMetaOf.mdx
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/src/docs2/SecondMetaOf.mdx
rename to code/core/src/core-server/utils/__mockdata__/src/docs2/SecondMetaOf.mdx
diff --git a/code/lib/core-server/src/utils/__mockdata__/src/docs2/Template.mdx b/code/core/src/core-server/utils/__mockdata__/src/docs2/Template.mdx
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/src/docs2/Template.mdx
rename to code/core/src/core-server/utils/__mockdata__/src/docs2/Template.mdx
diff --git a/code/lib/core-server/src/utils/__mockdata__/src/docs2/Title.mdx b/code/core/src/core-server/utils/__mockdata__/src/docs2/Title.mdx
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/src/docs2/Title.mdx
rename to code/core/src/core-server/utils/__mockdata__/src/docs2/Title.mdx
diff --git a/code/lib/core-server/src/utils/__mockdata__/src/first-nested/deeply/F.stories.js b/code/core/src/core-server/utils/__mockdata__/src/first-nested/deeply/F.stories.js
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/src/first-nested/deeply/F.stories.js
rename to code/core/src/core-server/utils/__mockdata__/src/first-nested/deeply/F.stories.js
diff --git a/code/lib/core-server/src/utils/__mockdata__/src/nested/Button.stories.ts b/code/core/src/core-server/utils/__mockdata__/src/nested/Button.stories.ts
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/src/nested/Button.stories.ts
rename to code/core/src/core-server/utils/__mockdata__/src/nested/Button.stories.ts
diff --git a/code/lib/core-server/src/utils/__mockdata__/src/nested/Button.ts b/code/core/src/core-server/utils/__mockdata__/src/nested/Button.ts
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/src/nested/Button.ts
rename to code/core/src/core-server/utils/__mockdata__/src/nested/Button.ts
diff --git a/code/lib/core-server/src/utils/__mockdata__/src/second-nested/G.stories.ts b/code/core/src/core-server/utils/__mockdata__/src/second-nested/G.stories.ts
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/src/second-nested/G.stories.ts
rename to code/core/src/core-server/utils/__mockdata__/src/second-nested/G.stories.ts
diff --git a/code/lib/core-server/src/utils/__mockdata__/src/stories.ts b/code/core/src/core-server/utils/__mockdata__/src/stories.ts
similarity index 100%
rename from code/lib/core-server/src/utils/__mockdata__/src/stories.ts
rename to code/core/src/core-server/utils/__mockdata__/src/stories.ts
diff --git a/code/core/src/core-server/utils/__search-files-tests__/.gitignore b/code/core/src/core-server/utils/__search-files-tests__/.gitignore
new file mode 100644
index 000000000000..51685545cfff
--- /dev/null
+++ b/code/core/src/core-server/utils/__search-files-tests__/.gitignore
@@ -0,0 +1,2 @@
+src/ignored.js
+!src/node_modules
\ No newline at end of file
diff --git a/code/lib/core-server/src/utils/__search-files-tests__/README.md b/code/core/src/core-server/utils/__search-files-tests__/README.md
similarity index 100%
rename from code/lib/core-server/src/utils/__search-files-tests__/README.md
rename to code/core/src/core-server/utils/__search-files-tests__/README.md
diff --git a/code/lib/core-server/src/utils/__search-files-tests__/src/assets/asset.json b/code/core/src/core-server/utils/__search-files-tests__/src/assets/asset.css
similarity index 100%
rename from code/lib/core-server/src/utils/__search-files-tests__/src/assets/asset.json
rename to code/core/src/core-server/utils/__search-files-tests__/src/assets/asset.css
diff --git a/code/lib/core-server/src/utils/__search-files-tests__/src/es-module.stories.js b/code/core/src/core-server/utils/__search-files-tests__/src/assets/asset.json
similarity index 100%
rename from code/lib/core-server/src/utils/__search-files-tests__/src/es-module.stories.js
rename to code/core/src/core-server/utils/__search-files-tests__/src/assets/asset.json
diff --git a/code/lib/core-server/src/utils/__search-files-tests__/src/assets/asset.png b/code/core/src/core-server/utils/__search-files-tests__/src/assets/asset.png
similarity index 100%
rename from code/lib/core-server/src/utils/__search-files-tests__/src/assets/asset.png
rename to code/core/src/core-server/utils/__search-files-tests__/src/assets/asset.png
diff --git a/code/lib/core-server/src/utils/__search-files-tests__/src/commonjs-module-default.js b/code/core/src/core-server/utils/__search-files-tests__/src/commonjs-module-default.js
similarity index 100%
rename from code/lib/core-server/src/utils/__search-files-tests__/src/commonjs-module-default.js
rename to code/core/src/core-server/utils/__search-files-tests__/src/commonjs-module-default.js
diff --git a/code/lib/core-server/src/utils/__search-files-tests__/src/commonjs-module.js b/code/core/src/core-server/utils/__search-files-tests__/src/commonjs-module.js
similarity index 100%
rename from code/lib/core-server/src/utils/__search-files-tests__/src/commonjs-module.js
rename to code/core/src/core-server/utils/__search-files-tests__/src/commonjs-module.js
diff --git a/code/lib/core-server/src/utils/__search-files-tests__/src/es-module.js b/code/core/src/core-server/utils/__search-files-tests__/src/es-module.js
similarity index 100%
rename from code/lib/core-server/src/utils/__search-files-tests__/src/es-module.js
rename to code/core/src/core-server/utils/__search-files-tests__/src/es-module.js
diff --git a/code/core/src/core-server/utils/__search-files-tests__/src/es-module.stories.js b/code/core/src/core-server/utils/__search-files-tests__/src/es-module.stories.js
new file mode 100644
index 000000000000..ff8b4c56321a
--- /dev/null
+++ b/code/core/src/core-server/utils/__search-files-tests__/src/es-module.stories.js
@@ -0,0 +1 @@
+export default {};
diff --git a/code/lib/core-server/src/utils/__search-files-tests__/src/file-extensions/extension.cjs b/code/core/src/core-server/utils/__search-files-tests__/src/file-extensions/extension.cjs
similarity index 100%
rename from code/lib/core-server/src/utils/__search-files-tests__/src/file-extensions/extension.cjs
rename to code/core/src/core-server/utils/__search-files-tests__/src/file-extensions/extension.cjs
diff --git a/code/lib/core-server/src/utils/__search-files-tests__/src/file-extensions/extension.cts b/code/core/src/core-server/utils/__search-files-tests__/src/file-extensions/extension.cts
similarity index 100%
rename from code/lib/core-server/src/utils/__search-files-tests__/src/file-extensions/extension.cts
rename to code/core/src/core-server/utils/__search-files-tests__/src/file-extensions/extension.cts
diff --git a/code/lib/core-server/src/utils/__search-files-tests__/src/file-extensions/extension.js b/code/core/src/core-server/utils/__search-files-tests__/src/file-extensions/extension.js
similarity index 100%
rename from code/lib/core-server/src/utils/__search-files-tests__/src/file-extensions/extension.js
rename to code/core/src/core-server/utils/__search-files-tests__/src/file-extensions/extension.js
diff --git a/code/lib/core-server/src/utils/__search-files-tests__/src/file-extensions/extension.jsx b/code/core/src/core-server/utils/__search-files-tests__/src/file-extensions/extension.jsx
similarity index 100%
rename from code/lib/core-server/src/utils/__search-files-tests__/src/file-extensions/extension.jsx
rename to code/core/src/core-server/utils/__search-files-tests__/src/file-extensions/extension.jsx
diff --git a/code/lib/core-server/src/utils/__search-files-tests__/src/file-extensions/extension.mjs b/code/core/src/core-server/utils/__search-files-tests__/src/file-extensions/extension.mjs
similarity index 100%
rename from code/lib/core-server/src/utils/__search-files-tests__/src/file-extensions/extension.mjs
rename to code/core/src/core-server/utils/__search-files-tests__/src/file-extensions/extension.mjs
diff --git a/code/lib/core-server/src/utils/__search-files-tests__/src/file-extensions/extension.mts b/code/core/src/core-server/utils/__search-files-tests__/src/file-extensions/extension.mts
similarity index 100%
rename from code/lib/core-server/src/utils/__search-files-tests__/src/file-extensions/extension.mts
rename to code/core/src/core-server/utils/__search-files-tests__/src/file-extensions/extension.mts
diff --git a/code/lib/core-server/src/utils/__search-files-tests__/src/file-extensions/extension.ts b/code/core/src/core-server/utils/__search-files-tests__/src/file-extensions/extension.ts
similarity index 100%
rename from code/lib/core-server/src/utils/__search-files-tests__/src/file-extensions/extension.ts
rename to code/core/src/core-server/utils/__search-files-tests__/src/file-extensions/extension.ts
diff --git a/code/lib/core-server/src/utils/__search-files-tests__/src/file-extensions/extension.tsx b/code/core/src/core-server/utils/__search-files-tests__/src/file-extensions/extension.tsx
similarity index 100%
rename from code/lib/core-server/src/utils/__search-files-tests__/src/file-extensions/extension.tsx
rename to code/core/src/core-server/utils/__search-files-tests__/src/file-extensions/extension.tsx
diff --git a/code/lib/core-server/src/utils/__search-files-tests__/src/ignored.js b/code/core/src/core-server/utils/__search-files-tests__/src/ignored.js
similarity index 100%
rename from code/lib/core-server/src/utils/__search-files-tests__/src/ignored.js
rename to code/core/src/core-server/utils/__search-files-tests__/src/ignored.js
diff --git a/code/lib/core-server/src/utils/__search-files-tests__/src/no-export.js b/code/core/src/core-server/utils/__search-files-tests__/src/no-export.js
similarity index 100%
rename from code/lib/core-server/src/utils/__search-files-tests__/src/no-export.js
rename to code/core/src/core-server/utils/__search-files-tests__/src/no-export.js
diff --git a/code/lib/core-server/src/utils/__search-files-tests__/src/node_modules/file-in-common.js b/code/core/src/core-server/utils/__search-files-tests__/src/node_modules/file-in-common.js
similarity index 100%
rename from code/lib/core-server/src/utils/__search-files-tests__/src/node_modules/file-in-common.js
rename to code/core/src/core-server/utils/__search-files-tests__/src/node_modules/file-in-common.js
diff --git a/code/lib/core-server/src/utils/__search-files-tests__/src/tests/some.spec.ts b/code/core/src/core-server/utils/__search-files-tests__/src/tests/some.spec.ts
similarity index 100%
rename from code/lib/core-server/src/utils/__search-files-tests__/src/tests/some.spec.ts
rename to code/core/src/core-server/utils/__search-files-tests__/src/tests/some.spec.ts
diff --git a/code/lib/core-server/src/utils/__search-files-tests__/src/tests/some.test.ts b/code/core/src/core-server/utils/__search-files-tests__/src/tests/some.test.ts
similarity index 100%
rename from code/lib/core-server/src/utils/__search-files-tests__/src/tests/some.test.ts
rename to code/core/src/core-server/utils/__search-files-tests__/src/tests/some.test.ts
diff --git a/code/lib/core-server/src/utils/__tests__/IndexingError.test.ts b/code/core/src/core-server/utils/__tests__/IndexingError.test.ts
similarity index 100%
rename from code/lib/core-server/src/utils/__tests__/IndexingError.test.ts
rename to code/core/src/core-server/utils/__tests__/IndexingError.test.ts
diff --git a/code/lib/core-server/src/utils/__tests__/autoName.test.ts b/code/core/src/core-server/utils/__tests__/autoName.test.ts
similarity index 100%
rename from code/lib/core-server/src/utils/__tests__/autoName.test.ts
rename to code/core/src/core-server/utils/__tests__/autoName.test.ts
diff --git a/code/lib/core-server/src/utils/__tests__/index-extraction.test.ts b/code/core/src/core-server/utils/__tests__/index-extraction.test.ts
similarity index 98%
rename from code/lib/core-server/src/utils/__tests__/index-extraction.test.ts
rename to code/core/src/core-server/utils/__tests__/index-extraction.test.ts
index f9c9ee61bd27..01a880479b99 100644
--- a/code/lib/core-server/src/utils/__tests__/index-extraction.test.ts
+++ b/code/core/src/core-server/utils/__tests__/index-extraction.test.ts
@@ -1,13 +1,13 @@
import { describe, it, expect, vi } from 'vitest';
-import path from 'path';
-import { normalizeStoriesEntry } from '@storybook/core-common';
-import type { NormalizedStoriesSpecifier } from '@storybook/types';
+import path from 'node:path';
+import { normalizeStoriesEntry } from '@storybook/core/common';
+import type { NormalizedStoriesSpecifier } from '@storybook/core/types';
import type { StoryIndexGeneratorOptions } from '../StoryIndexGenerator';
import { AUTODOCS_TAG, StoryIndexGenerator } from '../StoryIndexGenerator';
-vi.mock('@storybook/node-logger');
+vi.mock('@storybook/core/node-logger');
const options: StoryIndexGeneratorOptions = {
configDir: path.join(__dirname, '..', '__mockdata__'),
diff --git a/code/lib/core-server/src/utils/__tests__/remove-mdx-stories.test.ts b/code/core/src/core-server/utils/__tests__/remove-mdx-stories.test.ts
similarity index 97%
rename from code/lib/core-server/src/utils/__tests__/remove-mdx-stories.test.ts
rename to code/core/src/core-server/utils/__tests__/remove-mdx-stories.test.ts
index ab0dbe1e0e6c..2dff9f7810e4 100644
--- a/code/lib/core-server/src/utils/__tests__/remove-mdx-stories.test.ts
+++ b/code/core/src/core-server/utils/__tests__/remove-mdx-stories.test.ts
@@ -1,7 +1,7 @@
import { glob as globOriginal } from 'glob';
-import { type StoriesEntry } from '@storybook/types';
-import { normalizeStoriesEntry } from '@storybook/core-common';
-import { join } from 'path';
+import { type StoriesEntry } from '@storybook/core/types';
+import { normalizeStoriesEntry } from '@storybook/core/common';
+import { join } from 'node:path';
import slash from 'slash';
import { vi, it, describe, expect } from 'vitest';
import { removeMDXEntries } from '../remove-mdx-entries';
diff --git a/code/lib/core-server/src/utils/__tests__/server-address.test.ts b/code/core/src/core-server/utils/__tests__/server-address.test.ts
similarity index 100%
rename from code/lib/core-server/src/utils/__tests__/server-address.test.ts
rename to code/core/src/core-server/utils/__tests__/server-address.test.ts
diff --git a/code/lib/core-server/src/utils/__tests__/server-channel.test.ts b/code/core/src/core-server/utils/__tests__/server-channel.test.ts
similarity index 98%
rename from code/lib/core-server/src/utils/__tests__/server-channel.test.ts
rename to code/core/src/core-server/utils/__tests__/server-channel.test.ts
index 8807a2a33abe..0078b6d78cfa 100644
--- a/code/lib/core-server/src/utils/__tests__/server-channel.test.ts
+++ b/code/core/src/core-server/utils/__tests__/server-channel.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, vi, it } from 'vitest';
import type { Server } from 'http';
-import { Channel } from '@storybook/channels';
+import { Channel } from '@storybook/core/channels';
import { EventEmitter } from 'events';
import { stringify } from 'telejson';
diff --git a/code/lib/core-server/src/utils/__tests__/server-statics.test.ts b/code/core/src/core-server/utils/__tests__/server-statics.test.ts
similarity index 99%
rename from code/lib/core-server/src/utils/__tests__/server-statics.test.ts
rename to code/core/src/core-server/utils/__tests__/server-statics.test.ts
index 54c985628def..7033bec57704 100644
--- a/code/lib/core-server/src/utils/__tests__/server-statics.test.ts
+++ b/code/core/src/core-server/utils/__tests__/server-statics.test.ts
@@ -1,6 +1,6 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
import fs from 'fs-extra';
-import path from 'path';
+import path from 'node:path';
import { onlyWindows, skipWindows } from '../../../../../vitest.helpers';
import { parseStaticDir } from '../server-statics';
diff --git a/code/lib/core-server/src/utils/autoName.ts b/code/core/src/core-server/utils/autoName.ts
similarity index 89%
rename from code/lib/core-server/src/utils/autoName.ts
rename to code/core/src/core-server/utils/autoName.ts
index 414d21c3783e..aa916c865664 100644
--- a/code/lib/core-server/src/utils/autoName.ts
+++ b/code/core/src/core-server/utils/autoName.ts
@@ -1,5 +1,5 @@
-import type { Path } from '@storybook/types';
-import { basename } from 'path';
+import type { Path } from '@storybook/core/types';
+import { basename } from 'node:path';
/**
* Calculate a name to use for a docs entry if not specified. The rule is:
diff --git a/code/lib/core-server/src/utils/build-or-throw.ts b/code/core/src/core-server/utils/build-or-throw.ts
similarity index 64%
rename from code/lib/core-server/src/utils/build-or-throw.ts
rename to code/core/src/core-server/utils/build-or-throw.ts
index ead45e5a4e37..a2dade3725c3 100644
--- a/code/lib/core-server/src/utils/build-or-throw.ts
+++ b/code/core/src/core-server/utils/build-or-throw.ts
@@ -1,4 +1,4 @@
-import { NoMatchingExportError } from '@storybook/core-events/server-errors';
+import { NoMatchingExportError } from '@storybook/core/server-errors';
export async function buildOrThrow(callback: () => Promise): Promise {
try {
@@ -6,8 +6,8 @@ export async function buildOrThrow(callback: () => Promise): Promise {
} catch (err: any) {
const builderErrors = err.errors as { text: string }[];
if (builderErrors) {
- const inconsistentVersionsError = builderErrors.find(
- (er) => er.text?.includes('No matching export')
+ const inconsistentVersionsError = builderErrors.find((er) =>
+ er.text?.includes('No matching export')
);
if (inconsistentVersionsError) {
diff --git a/code/core/src/core-server/utils/constants.ts b/code/core/src/core-server/utils/constants.ts
new file mode 100644
index 000000000000..5363b78cdcb9
--- /dev/null
+++ b/code/core/src/core-server/utils/constants.ts
@@ -0,0 +1,10 @@
+import { dirname, join } from 'node:path';
+
+export const DEBOUNCE = 100;
+
+export const defaultStaticDirs = [
+ {
+ from: join(dirname(require.resolve('@storybook/core/package.json')), 'assets', 'browser'),
+ to: '/sb-common-assets',
+ },
+];
diff --git a/code/lib/core-server/src/utils/copy-all-static-files.ts b/code/core/src/core-server/utils/copy-all-static-files.ts
similarity index 83%
rename from code/lib/core-server/src/utils/copy-all-static-files.ts
rename to code/core/src/core-server/utils/copy-all-static-files.ts
index 5b0fb5227353..344bc12eeb72 100644
--- a/code/lib/core-server/src/utils/copy-all-static-files.ts
+++ b/code/core/src/core-server/utils/copy-all-static-files.ts
@@ -1,8 +1,8 @@
import chalk from 'chalk';
import fs from 'fs-extra';
-import { join, relative } from 'path';
-import { logger } from '@storybook/node-logger';
-import { getDirectoryFromWorkingDir } from '@storybook/core-common';
+import { join, relative } from 'node:path';
+import { logger } from '@storybook/core/node-logger';
+import { getDirectoryFromWorkingDir } from '@storybook/core/common';
import { parseStaticDir } from './server-statics';
export async function copyAllStaticFiles(staticDirs: any[] | undefined, outputDir: string) {
@@ -15,11 +15,9 @@ export async function copyAllStaticFiles(staticDirs: any[] | undefined, outputDi
// we copy prebuild static files from node_modules/@storybook/manager & preview
if (!staticDir.includes('node_modules')) {
- logger.info(
- chalk`=> Copying static files: {cyan ${print(staticDir)}} => {cyan ${print(
- targetDir
- )}}`
- );
+ const from = chalk.cyan(print(staticDir));
+ const to = chalk.cyan(print(targetDir));
+ logger.info(`=> Copying static files: ${from} => ${to}`);
}
// Storybook's own files should not be overwritten, so we skip such files if we find them
@@ -61,7 +59,7 @@ export async function copyAllStaticFilesRelativeToMain(
const skipPaths = ['index.html', 'iframe.html'].map((f) => join(targetPath, f));
if (!from.includes('node_modules')) {
logger.info(
- chalk`=> Copying static files: {cyan ${print(from)}} at {cyan ${print(targetPath)}}`
+ `=> Copying static files: ${chalk.cyan(print(from))} at ${chalk.cyan(print(targetPath))}`
);
}
await fs.copy(from, targetPath, {
diff --git a/code/lib/core-server/src/utils/doTelemetry.ts b/code/core/src/core-server/utils/doTelemetry.ts
similarity index 95%
rename from code/lib/core-server/src/utils/doTelemetry.ts
rename to code/core/src/core-server/utils/doTelemetry.ts
index ecb494fc45f5..b7d039119c3b 100644
--- a/code/lib/core-server/src/utils/doTelemetry.ts
+++ b/code/core/src/core-server/utils/doTelemetry.ts
@@ -1,6 +1,6 @@
import invariant from 'tiny-invariant';
-import type { CoreConfig, Options, StoryIndex } from '@storybook/types';
-import { telemetry, getPrecedingUpgrade } from '@storybook/telemetry';
+import type { CoreConfig, Options, StoryIndex } from '@storybook/core/types';
+import { telemetry, getPrecedingUpgrade } from '@storybook/core/telemetry';
import { useStorybookMetadata } from './metadata';
import type { StoryIndexGenerator } from './StoryIndexGenerator';
import { summarizeIndex } from './summarizeIndex';
diff --git a/code/lib/core-server/src/utils/get-builders.ts b/code/core/src/core-server/utils/get-builders.ts
similarity index 82%
rename from code/lib/core-server/src/utils/get-builders.ts
rename to code/core/src/core-server/utils/get-builders.ts
index 9d6535559deb..13a5365c91e2 100644
--- a/code/lib/core-server/src/utils/get-builders.ts
+++ b/code/core/src/core-server/utils/get-builders.ts
@@ -1,9 +1,9 @@
-import type { Builder, Options } from '@storybook/types';
-import { MissingBuilderError } from '@storybook/core-events/server-errors';
+import type { Builder, Options } from '@storybook/core/types';
+import { MissingBuilderError } from '@storybook/core/server-errors';
import { pathToFileURL } from 'node:url';
export async function getManagerBuilder(): Promise> {
- return import('@storybook/builder-manager');
+ return import('@storybook/core/builder-manager');
}
export async function getPreviewBuilder(
diff --git a/code/lib/core-server/src/utils/get-caching-middleware.ts b/code/core/src/core-server/utils/get-caching-middleware.ts
similarity index 100%
rename from code/lib/core-server/src/utils/get-caching-middleware.ts
rename to code/core/src/core-server/utils/get-caching-middleware.ts
diff --git a/code/lib/core-server/src/utils/get-component-variable-name.test.ts b/code/core/src/core-server/utils/get-component-variable-name.test.ts
similarity index 100%
rename from code/lib/core-server/src/utils/get-component-variable-name.test.ts
rename to code/core/src/core-server/utils/get-component-variable-name.test.ts
diff --git a/code/lib/core-server/src/utils/get-component-variable-name.ts b/code/core/src/core-server/utils/get-component-variable-name.ts
similarity index 100%
rename from code/lib/core-server/src/utils/get-component-variable-name.ts
rename to code/core/src/core-server/utils/get-component-variable-name.ts
diff --git a/code/lib/core-server/src/utils/get-new-story-file.test.ts b/code/core/src/core-server/utils/get-new-story-file.test.ts
similarity index 95%
rename from code/lib/core-server/src/utils/get-new-story-file.test.ts
rename to code/core/src/core-server/utils/get-new-story-file.test.ts
index 91b06d9027b0..c1a4e5e083de 100644
--- a/code/lib/core-server/src/utils/get-new-story-file.test.ts
+++ b/code/core/src/core-server/utils/get-new-story-file.test.ts
@@ -1,9 +1,9 @@
import { describe, expect, it, vi } from 'vitest';
import { getNewStoryFile } from './get-new-story-file';
-import path from 'path';
+import path from 'node:path';
-vi.mock('@storybook/core-common', async (importOriginal) => {
- const actual = await importOriginal();
+vi.mock('@storybook/core/common', async (importOriginal) => {
+ const actual = await importOriginal();
return {
...actual,
getProjectRoot: vi.fn().mockReturnValue(require('path').join(__dirname)),
diff --git a/code/lib/core-server/src/utils/get-new-story-file.ts b/code/core/src/core-server/utils/get-new-story-file.ts
similarity index 96%
rename from code/lib/core-server/src/utils/get-new-story-file.ts
rename to code/core/src/core-server/utils/get-new-story-file.ts
index 32c50c2e5009..61de20234995 100644
--- a/code/lib/core-server/src/utils/get-new-story-file.ts
+++ b/code/core/src/core-server/utils/get-new-story-file.ts
@@ -1,15 +1,15 @@
-import type { Options } from '@storybook/types';
+import type { Options } from '@storybook/core/types';
import {
extractProperRendererNameFromFramework,
getFrameworkName,
getProjectRoot,
rendererPackages,
-} from '@storybook/core-common';
+} from '@storybook/core/common';
import path from 'node:path';
import fs from 'node:fs';
import { getTypeScriptTemplateForNewStoryFile } from './new-story-templates/typescript';
import { getJavaScriptTemplateForNewStoryFile } from './new-story-templates/javascript';
-import type { CreateNewStoryRequestPayload } from '@storybook/core-events';
+import type { CreateNewStoryRequestPayload } from '@storybook/core/core-events';
export async function getNewStoryFile(
{
diff --git a/code/lib/core-server/src/utils/get-server-channel.ts b/code/core/src/core-server/utils/get-server-channel.ts
similarity index 94%
rename from code/lib/core-server/src/utils/get-server-channel.ts
rename to code/core/src/core-server/utils/get-server-channel.ts
index 1a488afb06c9..d7f8c4721de7 100644
--- a/code/lib/core-server/src/utils/get-server-channel.ts
+++ b/code/core/src/core-server/utils/get-server-channel.ts
@@ -1,7 +1,7 @@
import WebSocket, { WebSocketServer } from 'ws';
import { isJSON, parse, stringify } from 'telejson';
-import type { ChannelHandler } from '@storybook/channels';
-import { Channel } from '@storybook/channels';
+import type { ChannelHandler } from '@storybook/core/channels';
+import { Channel } from '@storybook/core/channels';
type Server = NonNullable[0]>['server']>;
diff --git a/code/lib/core-server/src/utils/get-story-id.test.ts b/code/core/src/core-server/utils/get-story-id.test.ts
similarity index 98%
rename from code/lib/core-server/src/utils/get-story-id.test.ts
rename to code/core/src/core-server/utils/get-story-id.test.ts
index 243fbed6160f..26fedcbe03e9 100644
--- a/code/lib/core-server/src/utils/get-story-id.test.ts
+++ b/code/core/src/core-server/utils/get-story-id.test.ts
@@ -1,4 +1,4 @@
-import path from 'path';
+import path from 'node:path';
import { describe, expect, it } from 'vitest';
import { getStoryId } from './get-story-id';
diff --git a/code/lib/core-server/src/utils/get-story-id.ts b/code/core/src/core-server/utils/get-story-id.ts
similarity index 86%
rename from code/lib/core-server/src/utils/get-story-id.ts
rename to code/core/src/core-server/utils/get-story-id.ts
index eb73a52ae58a..ef44c263f094 100644
--- a/code/lib/core-server/src/utils/get-story-id.ts
+++ b/code/core/src/core-server/utils/get-story-id.ts
@@ -1,9 +1,9 @@
-import type { Options } from '@storybook/types';
-import dedent from 'ts-dedent';
-import { normalizeStories, normalizeStoryPath } from '@storybook/core-common';
-import path from 'path';
+import type { Options } from '@storybook/core/types';
+import { dedent } from 'ts-dedent';
+import { normalizeStories, normalizeStoryPath } from '@storybook/core/common';
+import path from 'node:path';
import { sanitize, storyNameFromExport, toId } from '@storybook/csf';
-import { userOrAutoTitleFromSpecifier } from '@storybook/preview-api';
+import { userOrAutoTitleFromSpecifier } from '@storybook/core/preview-api';
import { posix } from './posix';
interface StoryIdData {
diff --git a/code/lib/core-server/src/utils/getAccessControlMiddleware.ts b/code/core/src/core-server/utils/getAccessControlMiddleware.ts
similarity index 100%
rename from code/lib/core-server/src/utils/getAccessControlMiddleware.ts
rename to code/core/src/core-server/utils/getAccessControlMiddleware.ts
diff --git a/code/lib/core-server/src/utils/getStoryIndexGenerator.ts b/code/core/src/core-server/utils/getStoryIndexGenerator.ts
similarity index 90%
rename from code/lib/core-server/src/utils/getStoryIndexGenerator.ts
rename to code/core/src/core-server/utils/getStoryIndexGenerator.ts
index 9c2a32385db9..b61a5490c3b4 100644
--- a/code/lib/core-server/src/utils/getStoryIndexGenerator.ts
+++ b/code/core/src/core-server/utils/getStoryIndexGenerator.ts
@@ -1,5 +1,5 @@
-import type { DocsOptions, Options } from '@storybook/types';
-import { normalizeStories } from '@storybook/core-common';
+import type { DocsOptions, Options } from '@storybook/core/types';
+import { normalizeStories } from '@storybook/core/common';
import { useStoriesJson } from './stories-json';
import type { ServerChannel } from './get-server-channel';
import { StoryIndexGenerator } from './StoryIndexGenerator';
diff --git a/code/lib/core-server/src/utils/metadata.ts b/code/core/src/core-server/utils/metadata.ts
similarity index 90%
rename from code/lib/core-server/src/utils/metadata.ts
rename to code/core/src/core-server/utils/metadata.ts
index 319b001ea7b9..a3a2c755b33b 100644
--- a/code/lib/core-server/src/utils/metadata.ts
+++ b/code/core/src/core-server/utils/metadata.ts
@@ -1,6 +1,6 @@
import { writeJSON } from 'fs-extra';
import type { Request, Response, Router } from 'express';
-import { getStorybookMetadata } from '@storybook/telemetry';
+import { getStorybookMetadata } from '@storybook/core/telemetry';
export async function extractStorybookMetadata(outputFile: string, configDir: string) {
const storybookMetadata = await getStorybookMetadata(configDir);
diff --git a/code/lib/core-server/src/utils/middleware.ts b/code/core/src/core-server/utils/middleware.ts
similarity index 91%
rename from code/lib/core-server/src/utils/middleware.ts
rename to code/core/src/core-server/utils/middleware.ts
index d52875da9a25..33ad1e641771 100644
--- a/code/lib/core-server/src/utils/middleware.ts
+++ b/code/core/src/core-server/utils/middleware.ts
@@ -1,5 +1,5 @@
-import path from 'path';
-import fs from 'fs';
+import path from 'node:path';
+import fs from 'node:fs';
const fileExists = (basename: string) =>
['.js', '.cjs'].reduce((found: string, ext: string) => {
diff --git a/code/lib/core-server/src/utils/new-story-templates/javascript.test.ts b/code/core/src/core-server/utils/new-story-templates/javascript.test.ts
similarity index 100%
rename from code/lib/core-server/src/utils/new-story-templates/javascript.test.ts
rename to code/core/src/core-server/utils/new-story-templates/javascript.test.ts
diff --git a/code/lib/core-server/src/utils/new-story-templates/javascript.ts b/code/core/src/core-server/utils/new-story-templates/javascript.ts
similarity index 96%
rename from code/lib/core-server/src/utils/new-story-templates/javascript.ts
rename to code/core/src/core-server/utils/new-story-templates/javascript.ts
index e80e4d4b5a57..cc59e78cf34c 100644
--- a/code/lib/core-server/src/utils/new-story-templates/javascript.ts
+++ b/code/core/src/core-server/utils/new-story-templates/javascript.ts
@@ -1,4 +1,4 @@
-import dedent from 'ts-dedent';
+import { dedent } from 'ts-dedent';
import { getComponentVariableName } from '../get-component-variable-name';
interface JavaScriptTemplateData {
diff --git a/code/lib/core-server/src/utils/new-story-templates/typescript.test.ts b/code/core/src/core-server/utils/new-story-templates/typescript.test.ts
similarity index 100%
rename from code/lib/core-server/src/utils/new-story-templates/typescript.test.ts
rename to code/core/src/core-server/utils/new-story-templates/typescript.test.ts
diff --git a/code/lib/core-server/src/utils/new-story-templates/typescript.ts b/code/core/src/core-server/utils/new-story-templates/typescript.ts
similarity index 97%
rename from code/lib/core-server/src/utils/new-story-templates/typescript.ts
rename to code/core/src/core-server/utils/new-story-templates/typescript.ts
index d2513673ebb5..d9e0acaa12cc 100644
--- a/code/lib/core-server/src/utils/new-story-templates/typescript.ts
+++ b/code/core/src/core-server/utils/new-story-templates/typescript.ts
@@ -1,4 +1,4 @@
-import dedent from 'ts-dedent';
+import { dedent } from 'ts-dedent';
import { getComponentVariableName } from '../get-component-variable-name';
interface TypeScriptTemplateData {
diff --git a/code/lib/core-server/src/utils/open-in-browser.ts b/code/core/src/core-server/utils/open-in-browser.ts
similarity index 96%
rename from code/lib/core-server/src/utils/open-in-browser.ts
rename to code/core/src/core-server/utils/open-in-browser.ts
index ef798cd5242f..b4fe5d77d961 100644
--- a/code/lib/core-server/src/utils/open-in-browser.ts
+++ b/code/core/src/core-server/utils/open-in-browser.ts
@@ -1,4 +1,4 @@
-import { logger } from '@storybook/node-logger';
+import { logger } from '@storybook/core/node-logger';
import betterOpn from 'better-opn'; // betterOpn alias used because also loading open
import open from 'open';
import getDefaultBrowser from '@aw-web-design/x-default-browser';
diff --git a/code/lib/core-server/src/utils/output-startup-information.ts b/code/core/src/core-server/utils/output-startup-information.ts
similarity index 94%
rename from code/lib/core-server/src/utils/output-startup-information.ts
rename to code/core/src/core-server/utils/output-startup-information.ts
index bc4af06174ca..092a29671aa4 100644
--- a/code/lib/core-server/src/utils/output-startup-information.ts
+++ b/code/core/src/core-server/utils/output-startup-information.ts
@@ -1,10 +1,10 @@
import chalk from 'chalk';
-import { colors } from '@storybook/node-logger';
+import { colors } from '@storybook/core/node-logger';
import boxen from 'boxen';
import { dedent } from 'ts-dedent';
import Table from 'cli-table3';
import prettyTime from 'pretty-hrtime';
-import type { VersionCheck } from '@storybook/types';
+import type { VersionCheck } from '@storybook/core/types';
import { createUpdateMessage } from './update-check';
export function outputStartupInformation(options: {
diff --git a/code/lib/core-server/src/utils/output-stats.ts b/code/core/src/core-server/utils/output-stats.ts
similarity index 88%
rename from code/lib/core-server/src/utils/output-stats.ts
rename to code/core/src/core-server/utils/output-stats.ts
index dd560c661bb5..0b99ef1f4eb3 100644
--- a/code/lib/core-server/src/utils/output-stats.ts
+++ b/code/core/src/core-server/utils/output-stats.ts
@@ -1,9 +1,9 @@
import { stringifyStream } from '@discoveryjs/json-ext';
-import { logger } from '@storybook/node-logger';
-import type { Stats } from '@storybook/types';
+import { logger } from '@storybook/core/node-logger';
+import type { Stats } from '@storybook/core/types';
import chalk from 'chalk';
import fs from 'fs-extra';
-import path from 'path';
+import path from 'node:path';
export async function outputStats(directory: string, previewStats?: any, managerStats?: any) {
if (previewStats) {
diff --git a/code/lib/core-server/src/utils/parser/generic-parser.test.ts b/code/core/src/core-server/utils/parser/generic-parser.test.ts
similarity index 94%
rename from code/lib/core-server/src/utils/parser/generic-parser.test.ts
rename to code/core/src/core-server/utils/parser/generic-parser.test.ts
index 61bba2739f72..17995e7ec0f0 100644
--- a/code/lib/core-server/src/utils/parser/generic-parser.test.ts
+++ b/code/core/src/core-server/utils/parser/generic-parser.test.ts
@@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest';
-import path from 'path';
+import path from 'node:path';
import { GenericParser } from './generic-parser';
-import fs from 'fs';
+import fs from 'node:fs';
const genericParser = new GenericParser();
diff --git a/code/lib/core-server/src/utils/parser/generic-parser.ts b/code/core/src/core-server/utils/parser/generic-parser.ts
similarity index 100%
rename from code/lib/core-server/src/utils/parser/generic-parser.ts
rename to code/core/src/core-server/utils/parser/generic-parser.ts
diff --git a/code/lib/core-server/src/utils/parser/index.ts b/code/core/src/core-server/utils/parser/index.ts
similarity index 85%
rename from code/lib/core-server/src/utils/parser/index.ts
rename to code/core/src/core-server/utils/parser/index.ts
index 8f5183a49538..5e3aa13fd866 100644
--- a/code/lib/core-server/src/utils/parser/index.ts
+++ b/code/core/src/core-server/utils/parser/index.ts
@@ -1,4 +1,4 @@
-import type { SupportedRenderers } from '@storybook/types';
+import type { SupportedRenderers } from '@storybook/core/types';
import { GenericParser } from './generic-parser';
import type { Parser } from './types';
diff --git a/code/lib/core-server/src/utils/parser/types.ts b/code/core/src/core-server/utils/parser/types.ts
similarity index 100%
rename from code/lib/core-server/src/utils/parser/types.ts
rename to code/core/src/core-server/utils/parser/types.ts
diff --git a/code/lib/core-server/src/utils/posix.test.ts b/code/core/src/core-server/utils/posix.test.ts
similarity index 100%
rename from code/lib/core-server/src/utils/posix.test.ts
rename to code/core/src/core-server/utils/posix.test.ts
diff --git a/code/lib/core-server/src/utils/posix.ts b/code/core/src/core-server/utils/posix.ts
similarity index 100%
rename from code/lib/core-server/src/utils/posix.ts
rename to code/core/src/core-server/utils/posix.ts
diff --git a/code/lib/core-server/src/utils/remove-mdx-entries.ts b/code/core/src/core-server/utils/remove-mdx-entries.ts
similarity index 92%
rename from code/lib/core-server/src/utils/remove-mdx-entries.ts
rename to code/core/src/core-server/utils/remove-mdx-entries.ts
index ed93c1bc8d64..d9d5a285dcc6 100644
--- a/code/lib/core-server/src/utils/remove-mdx-entries.ts
+++ b/code/core/src/core-server/utils/remove-mdx-entries.ts
@@ -1,6 +1,6 @@
-import type { Options, StoriesEntry } from '@storybook/types';
-import { normalizeStories, commonGlobOptions } from '@storybook/core-common';
-import { isAbsolute, join, relative } from 'path';
+import type { Options, StoriesEntry } from '@storybook/core/types';
+import { normalizeStories, commonGlobOptions } from '@storybook/core/common';
+import { isAbsolute, join, relative } from 'node:path';
import slash from 'slash';
import { glob } from 'glob';
diff --git a/code/lib/core-server/src/utils/router.ts b/code/core/src/core-server/utils/router.ts
similarity index 100%
rename from code/lib/core-server/src/utils/router.ts
rename to code/core/src/core-server/utils/router.ts
diff --git a/code/lib/core-server/src/utils/save-story/duplicate-story-with-new-name.test.ts b/code/core/src/core-server/utils/save-story/duplicate-story-with-new-name.test.ts
similarity index 97%
rename from code/lib/core-server/src/utils/save-story/duplicate-story-with-new-name.test.ts
rename to code/core/src/core-server/utils/save-story/duplicate-story-with-new-name.test.ts
index 59250060f5d2..da4b26eabb25 100644
--- a/code/lib/core-server/src/utils/save-story/duplicate-story-with-new-name.test.ts
+++ b/code/core/src/core-server/utils/save-story/duplicate-story-with-new-name.test.ts
@@ -1,10 +1,10 @@
/* eslint-disable no-underscore-dangle */
import { describe, test, expect } from 'vitest';
-import { readCsf, printCsf } from '@storybook/csf-tools';
+import { readCsf, printCsf } from '@storybook/core/csf-tools';
import { duplicateStoryWithNewName } from './duplicate-story-with-new-name';
import { readFile } from 'fs/promises';
-import { join } from 'path';
+import { join } from 'node:path';
import { format } from 'prettier';
import { getDiff } from './getDiff';
diff --git a/code/lib/core-server/src/utils/save-story/duplicate-story-with-new-name.ts b/code/core/src/core-server/utils/save-story/duplicate-story-with-new-name.ts
similarity index 82%
rename from code/lib/core-server/src/utils/save-story/duplicate-story-with-new-name.ts
rename to code/core/src/core-server/utils/save-story/duplicate-story-with-new-name.ts
index 3ab01043752d..f93c02d12afe 100644
--- a/code/lib/core-server/src/utils/save-story/duplicate-story-with-new-name.ts
+++ b/code/core/src/core-server/utils/save-story/duplicate-story-with-new-name.ts
@@ -1,9 +1,12 @@
/* eslint-disable no-underscore-dangle */
-import type { CsfFile } from '@storybook/csf-tools';
-import * as traverse from '@babel/traverse';
+import type { CsfFile } from '@storybook/core/csf-tools';
import * as t from '@babel/types';
+import bt from '@babel/traverse';
import { SaveStoryError } from './utils';
+// @ts-expect-error (needed due to it's use of `exports.default`)
+const traverse = (bt.default || bt) as typeof bt;
+
type In = ReturnType;
export const duplicateStoryWithNewName = (csfFile: In, storyName: string, newStoryName: string) => {
@@ -15,7 +18,7 @@ export const duplicateStoryWithNewName = (csfFile: In, storyName: string, newSto
}
let found = false;
- traverse.default(cloned, {
+ traverse(cloned, {
Identifier(path) {
if (found) {
return;
@@ -41,7 +44,7 @@ export const duplicateStoryWithNewName = (csfFile: In, storyName: string, newSto
throw new SaveStoryError(`Creating a new story based on a CSF2 story is not supported`);
}
- traverse.default(csfFile._ast, {
+ traverse(csfFile._ast, {
Program(path) {
path.pushContainer(
'body',
diff --git a/code/lib/core-server/src/utils/save-story/getDiff.ts b/code/core/src/core-server/utils/save-story/getDiff.ts
similarity index 100%
rename from code/lib/core-server/src/utils/save-story/getDiff.ts
rename to code/core/src/core-server/utils/save-story/getDiff.ts
diff --git a/code/lib/core-server/src/utils/save-story/mocks/csf-variances.stories.tsx b/code/core/src/core-server/utils/save-story/mocks/csf-variances.stories.tsx
similarity index 100%
rename from code/lib/core-server/src/utils/save-story/mocks/csf-variances.stories.tsx
rename to code/core/src/core-server/utils/save-story/mocks/csf-variances.stories.tsx
diff --git a/code/lib/core-server/src/utils/save-story/mocks/data-variances.stories.tsx b/code/core/src/core-server/utils/save-story/mocks/data-variances.stories.tsx
similarity index 100%
rename from code/lib/core-server/src/utils/save-story/mocks/data-variances.stories.tsx
rename to code/core/src/core-server/utils/save-story/mocks/data-variances.stories.tsx
diff --git a/code/lib/core-server/src/utils/save-story/mocks/export-variances.stories.tsx b/code/core/src/core-server/utils/save-story/mocks/export-variances.stories.tsx
similarity index 100%
rename from code/lib/core-server/src/utils/save-story/mocks/export-variances.stories.tsx
rename to code/core/src/core-server/utils/save-story/mocks/export-variances.stories.tsx
diff --git a/code/lib/core-server/src/utils/save-story/mocks/typescript-constructs.stories.tsx b/code/core/src/core-server/utils/save-story/mocks/typescript-constructs.stories.tsx
similarity index 100%
rename from code/lib/core-server/src/utils/save-story/mocks/typescript-constructs.stories.tsx
rename to code/core/src/core-server/utils/save-story/mocks/typescript-constructs.stories.tsx
diff --git a/code/lib/core-server/src/utils/save-story/mocks/unsupported-csf-variances.stories.tsx b/code/core/src/core-server/utils/save-story/mocks/unsupported-csf-variances.stories.tsx
similarity index 100%
rename from code/lib/core-server/src/utils/save-story/mocks/unsupported-csf-variances.stories.tsx
rename to code/core/src/core-server/utils/save-story/mocks/unsupported-csf-variances.stories.tsx
diff --git a/code/lib/core-server/src/utils/save-story/save-story.ts b/code/core/src/core-server/utils/save-story/save-story.ts
similarity index 89%
rename from code/lib/core-server/src/utils/save-story/save-story.ts
rename to code/core/src/core-server/utils/save-story/save-story.ts
index 5c3f537a9c90..9d4c9df841b9 100644
--- a/code/lib/core-server/src/utils/save-story/save-story.ts
+++ b/code/core/src/core-server/utils/save-story/save-story.ts
@@ -1,23 +1,27 @@
/* eslint-disable no-underscore-dangle */
import fs from 'node:fs/promises';
-import type { Channel } from '@storybook/channels';
+import type { Channel } from '@storybook/core/channels';
import type {
RequestData,
ResponseData,
SaveStoryRequestPayload,
SaveStoryResponsePayload,
-} from '@storybook/core-events';
-import { SAVE_STORY_REQUEST, SAVE_STORY_RESPONSE, STORY_RENDERED } from '@storybook/core-events';
+} from '@storybook/core/core-events';
+import {
+ SAVE_STORY_REQUEST,
+ SAVE_STORY_RESPONSE,
+ STORY_RENDERED,
+} from '@storybook/core/core-events';
import { storyNameFromExport, toId } from '@storybook/csf';
-import { printCsf, readCsf } from '@storybook/csf-tools';
-import { logger } from '@storybook/node-logger';
-import type { CoreConfig, Options } from '@storybook/types';
-import { telemetry } from '@storybook/telemetry';
+import { printCsf, readCsf } from '@storybook/core/csf-tools';
+import { logger } from '@storybook/core/node-logger';
+import type { CoreConfig, Options } from '@storybook/core/types';
+import { telemetry } from '@storybook/core/telemetry';
-import { basename, join } from 'path';
+import { basename, join } from 'node:path';
import { updateArgsInCsfFile } from './update-args-in-csf-file';
import { duplicateStoryWithNewName } from './duplicate-story-with-new-name';
-import { formatFileContent } from '@storybook/core-common';
+import { formatFileContent } from '@storybook/core/common';
import { SaveStoryError } from './utils';
const parseArgs = (args: string): Record =>
diff --git a/code/lib/core-server/src/utils/save-story/update-args-in-csf-file.test.ts b/code/core/src/core-server/utils/save-story/update-args-in-csf-file.test.ts
similarity index 98%
rename from code/lib/core-server/src/utils/save-story/update-args-in-csf-file.test.ts
rename to code/core/src/core-server/utils/save-story/update-args-in-csf-file.test.ts
index 8f0f2fb6b737..c06f71de482f 100644
--- a/code/lib/core-server/src/utils/save-story/update-args-in-csf-file.test.ts
+++ b/code/core/src/core-server/utils/save-story/update-args-in-csf-file.test.ts
@@ -1,10 +1,10 @@
/* eslint-disable no-underscore-dangle */
import { describe, test, expect } from 'vitest';
-import { readCsf, printCsf } from '@storybook/csf-tools';
+import { readCsf, printCsf } from '@storybook/core/csf-tools';
import { updateArgsInCsfFile } from './update-args-in-csf-file';
import { readFile } from 'fs/promises';
-import { join } from 'path';
+import { join } from 'node:path';
import { format } from 'prettier';
import { getDiff } from './getDiff';
diff --git a/code/lib/core-server/src/utils/save-story/update-args-in-csf-file.ts b/code/core/src/core-server/utils/save-story/update-args-in-csf-file.ts
similarity index 95%
rename from code/lib/core-server/src/utils/save-story/update-args-in-csf-file.ts
rename to code/core/src/core-server/utils/save-story/update-args-in-csf-file.ts
index f32db42f7978..8446594f1c71 100644
--- a/code/lib/core-server/src/utils/save-story/update-args-in-csf-file.ts
+++ b/code/core/src/core-server/utils/save-story/update-args-in-csf-file.ts
@@ -1,8 +1,11 @@
import * as t from '@babel/types';
-import * as traverse from '@babel/traverse';
+import bt from '@babel/traverse';
import { valueToAST } from './valueToAST';
import { SaveStoryError } from './utils';
+// @ts-expect-error (needed due to it's use of `exports.default`)
+const traverse = (bt.default || bt) as typeof bt;
+
export const updateArgsInCsfFile = async (node: t.Node, input: Record) => {
let found = false;
const args = Object.fromEntries(
@@ -61,7 +64,7 @@ export const updateArgsInCsfFile = async (node: t.Node, input: Record {
diff --git a/code/lib/core-server/src/utils/search-files.ts b/code/core/src/core-server/utils/search-files.ts
similarity index 100%
rename from code/lib/core-server/src/utils/search-files.ts
rename to code/core/src/core-server/utils/search-files.ts
diff --git a/code/lib/core-server/src/utils/server-address.test.ts b/code/core/src/core-server/utils/server-address.test.ts
similarity index 96%
rename from code/lib/core-server/src/utils/server-address.test.ts
rename to code/core/src/core-server/utils/server-address.test.ts
index 85299cb12f7b..81f228c9abdf 100644
--- a/code/lib/core-server/src/utils/server-address.test.ts
+++ b/code/core/src/core-server/utils/server-address.test.ts
@@ -2,9 +2,11 @@ import { describe, it, expect, vi } from 'vitest';
import detectPort from 'detect-port';
import { getServerAddresses, getServerPort, getServerChannelUrl } from './server-address';
-vi.mock('os');
+vi.mock('os', () => ({
+ default: { release: () => '' },
+}));
vi.mock('detect-port');
-vi.mock('@storybook/node-logger');
+vi.mock('@storybook/core/node-logger');
describe('getServerAddresses', () => {
const port = 3000;
diff --git a/code/lib/core-server/src/utils/server-address.ts b/code/core/src/core-server/utils/server-address.ts
similarity index 96%
rename from code/lib/core-server/src/utils/server-address.ts
rename to code/core/src/core-server/utils/server-address.ts
index 4d49cf8a980a..a7c8f9f2d28a 100644
--- a/code/lib/core-server/src/utils/server-address.ts
+++ b/code/core/src/core-server/utils/server-address.ts
@@ -1,6 +1,6 @@
import os from 'os';
-import { logger } from '@storybook/node-logger';
+import { logger } from '@storybook/core/node-logger';
import detectFreePort from 'detect-port';
export function getServerAddresses(
diff --git a/code/lib/core-server/src/utils/server-init.ts b/code/core/src/core-server/utils/server-init.ts
similarity index 94%
rename from code/lib/core-server/src/utils/server-init.ts
rename to code/core/src/core-server/utils/server-init.ts
index 176c1e6bfd69..0888c37fde4a 100644
--- a/code/lib/core-server/src/utils/server-init.ts
+++ b/code/core/src/core-server/utils/server-init.ts
@@ -1,4 +1,4 @@
-import { logger } from '@storybook/node-logger';
+import { logger } from '@storybook/core/node-logger';
import type { Express } from 'express';
import { readFile } from 'fs-extra';
import http from 'http';
diff --git a/code/lib/core-server/src/utils/server-statics.ts b/code/core/src/core-server/utils/server-statics.ts
similarity index 85%
rename from code/lib/core-server/src/utils/server-statics.ts
rename to code/core/src/core-server/utils/server-statics.ts
index 2a0b93e1ca41..a2fd5cc8a25f 100644
--- a/code/lib/core-server/src/utils/server-statics.ts
+++ b/code/core/src/core-server/utils/server-statics.ts
@@ -1,11 +1,11 @@
-import { logger } from '@storybook/node-logger';
-import type { Options } from '@storybook/types';
-import { getDirectoryFromWorkingDir } from '@storybook/core-common';
+import { logger } from '@storybook/core/node-logger';
+import type { Options } from '@storybook/core/types';
+import { getDirectoryFromWorkingDir } from '@storybook/core/common';
import chalk from 'chalk';
import type { Router } from 'express';
import express from 'express';
import { pathExists } from 'fs-extra';
-import path, { basename, isAbsolute } from 'path';
+import path, { basename, isAbsolute } from 'node:path';
import { dedent } from 'ts-dedent';
@@ -34,7 +34,7 @@ export async function useStatics(router: Router, options: Options) {
// Don't log for the internal static dir
if (!targetEndpoint.startsWith('/sb-')) {
logger.info(
- chalk`=> Serving static files from {cyan ${staticDir}} at {cyan ${targetEndpoint}}`
+ `=> Serving static files from ${chalk.cyan(staticDir)} at ${chalk.cyan(targetEndpoint)}`
);
}
@@ -67,10 +67,10 @@ export const parseStaticDir = async (arg: string) => {
if (!(await pathExists(staticPath))) {
throw new Error(
- dedent(chalk`
- Failed to load static files, no such directory: {cyan ${staticPath}}
+ dedent`
+ Failed to load static files, no such directory: ${chalk.cyan(staticPath)}
Make sure this directory exists.
- `)
+ `
);
}
diff --git a/code/lib/core-server/src/utils/stories-json.test.ts b/code/core/src/core-server/utils/stories-json.test.ts
similarity index 98%
rename from code/lib/core-server/src/utils/stories-json.test.ts
rename to code/core/src/core-server/utils/stories-json.test.ts
index f770986cd2f6..84b201ab62f1 100644
--- a/code/lib/core-server/src/utils/stories-json.test.ts
+++ b/code/core/src/core-server/utils/stories-json.test.ts
@@ -2,10 +2,10 @@ import { describe, beforeEach, it, expect, vi } from 'vitest';
import type { Router, Request, Response } from 'express';
import Watchpack from 'watchpack';
-import path from 'path';
+import path from 'node:path';
import debounce from 'lodash/debounce.js';
-import { STORY_INDEX_INVALIDATED } from '@storybook/core-events';
-import { normalizeStoriesEntry } from '@storybook/core-common';
+import { STORY_INDEX_INVALIDATED } from '@storybook/core/core-events';
+import { normalizeStoriesEntry } from '@storybook/core/common';
import { useStoriesJson, DEBOUNCE } from './stories-json';
import type { ServerChannel } from './get-server-channel';
@@ -15,7 +15,7 @@ import { csfIndexer } from '../presets/common-preset';
vi.mock('watchpack');
vi.mock('lodash/debounce');
-vi.mock('@storybook/node-logger');
+vi.mock('@storybook/core/node-logger');
const workingDir = path.join(__dirname, '__mockdata__');
const normalizedStories = [
diff --git a/code/lib/core-server/src/utils/stories-json.ts b/code/core/src/core-server/utils/stories-json.ts
similarity index 94%
rename from code/lib/core-server/src/utils/stories-json.ts
rename to code/core/src/core-server/utils/stories-json.ts
index 71b29a54a30b..a85791dd6a9b 100644
--- a/code/lib/core-server/src/utils/stories-json.ts
+++ b/code/core/src/core-server/utils/stories-json.ts
@@ -1,11 +1,11 @@
-import { basename } from 'path';
+import { basename } from 'node:path';
import type { Router, Request, Response } from 'express';
import { writeJSON } from 'fs-extra';
-import type { NormalizedStoriesSpecifier, StoryIndex } from '@storybook/types';
+import type { NormalizedStoriesSpecifier, StoryIndex } from '@storybook/core/types';
import debounce from 'lodash/debounce.js';
-import { STORY_INDEX_INVALIDATED } from '@storybook/core-events';
+import { STORY_INDEX_INVALIDATED } from '@storybook/core/core-events';
import type { StoryIndexGenerator } from './StoryIndexGenerator';
import { watchStorySpecifiers } from './watch-story-specifiers';
import { watchConfig } from './watchConfig';
diff --git a/code/lib/core-server/src/utils/summarizeIndex.test.ts b/code/core/src/core-server/utils/summarizeIndex.test.ts
similarity index 100%
rename from code/lib/core-server/src/utils/summarizeIndex.test.ts
rename to code/core/src/core-server/utils/summarizeIndex.test.ts
diff --git a/code/lib/core-server/src/utils/summarizeIndex.ts b/code/core/src/core-server/utils/summarizeIndex.ts
similarity index 97%
rename from code/lib/core-server/src/utils/summarizeIndex.ts
rename to code/core/src/core-server/utils/summarizeIndex.ts
index 8b74ad8b7f5f..56b4b27ad929 100644
--- a/code/lib/core-server/src/utils/summarizeIndex.ts
+++ b/code/core/src/core-server/utils/summarizeIndex.ts
@@ -1,4 +1,4 @@
-import type { IndexEntry, StoryIndex } from '@storybook/types';
+import type { IndexEntry, StoryIndex } from '@storybook/core/types';
import { isMdxEntry, AUTODOCS_TAG, PLAY_FN_TAG } from './StoryIndexGenerator';
diff --git a/code/lib/core-server/src/utils/update-check.ts b/code/core/src/core-server/utils/update-check.ts
similarity index 91%
rename from code/lib/core-server/src/utils/update-check.ts
rename to code/core/src/core-server/utils/update-check.ts
index bb387e6e75f2..93bf3ac96688 100644
--- a/code/lib/core-server/src/utils/update-check.ts
+++ b/code/core/src/core-server/utils/update-check.ts
@@ -1,10 +1,9 @@
-import fetch from 'node-fetch';
import chalk from 'chalk';
-import { colors } from '@storybook/node-logger';
+import { colors } from '@storybook/core/node-logger';
import semver from 'semver';
import { dedent } from 'ts-dedent';
-import { cache } from '@storybook/core-common';
-import type { VersionCheck } from '@storybook/types';
+import { cache } from '@storybook/core/common';
+import type { VersionCheck } from '@storybook/core/types';
const { STORYBOOK_VERSION_BASE = 'https://storybook.js.org', CI } = process.env;
diff --git a/code/lib/core-server/src/utils/versionStatus.ts b/code/core/src/core-server/utils/versionStatus.ts
similarity index 74%
rename from code/lib/core-server/src/utils/versionStatus.ts
rename to code/core/src/core-server/utils/versionStatus.ts
index e268f64fc945..49e78269c6c2 100644
--- a/code/lib/core-server/src/utils/versionStatus.ts
+++ b/code/core/src/core-server/utils/versionStatus.ts
@@ -1,4 +1,4 @@
-import type { VersionCheck } from '@storybook/types';
+import type { VersionCheck } from '@storybook/core/types';
export const versionStatus = (versionCheck: VersionCheck) => {
if (versionCheck.error) return 'error';
diff --git a/code/lib/core-server/src/utils/warnOnIncompatibleAddons.ts b/code/core/src/core-server/utils/warnOnIncompatibleAddons.ts
similarity index 81%
rename from code/lib/core-server/src/utils/warnOnIncompatibleAddons.ts
rename to code/core/src/core-server/utils/warnOnIncompatibleAddons.ts
index 6d7359a21edb..df43ed0d7738 100644
--- a/code/lib/core-server/src/utils/warnOnIncompatibleAddons.ts
+++ b/code/core/src/core-server/utils/warnOnIncompatibleAddons.ts
@@ -1,8 +1,8 @@
-import { logger } from '@storybook/node-logger';
+import { logger } from '@storybook/core/node-logger';
import {
getIncompatibleStorybookPackages,
getIncompatiblePackagesSummary,
-} from '../../../cli/src/doctor/getIncompatibleStorybookPackages';
+} from '../../../../lib/cli/src/doctor/getIncompatibleStorybookPackages';
export const warnOnIncompatibleAddons = async (currentStorybookVersion: string) => {
const incompatiblePackagesList = await getIncompatibleStorybookPackages({
diff --git a/code/lib/core-server/src/utils/warnWhenUsingArgTypesRegex.ts b/code/core/src/core-server/utils/warnWhenUsingArgTypesRegex.ts
similarity index 90%
rename from code/lib/core-server/src/utils/warnWhenUsingArgTypesRegex.ts
rename to code/core/src/core-server/utils/warnWhenUsingArgTypesRegex.ts
index fa336373a8a4..c4ab825e51a0 100644
--- a/code/lib/core-server/src/utils/warnWhenUsingArgTypesRegex.ts
+++ b/code/core/src/core-server/utils/warnWhenUsingArgTypesRegex.ts
@@ -1,10 +1,10 @@
-import type { PackageJson, StorybookConfig } from '@storybook/types';
-import { getConfigInfo } from '@storybook/core-common';
+import type { PackageJson, StorybookConfig } from '@storybook/core/types';
+import { getConfigInfo } from '@storybook/core/common';
import { readFile } from 'fs-extra';
import * as babel from '@babel/core';
import type { BabelFile } from '@babel/core';
-import { babelParse } from '@storybook/csf-tools';
-import dedent from 'ts-dedent';
+import { babelParse } from '@storybook/core/csf-tools';
+import { dedent } from 'ts-dedent';
import chalk from 'chalk';
export async function warnWhenUsingArgTypesRegex(
diff --git a/code/lib/core-server/src/utils/watch-story-specifiers.test.ts b/code/core/src/core-server/utils/watch-story-specifiers.test.ts
similarity index 98%
rename from code/lib/core-server/src/utils/watch-story-specifiers.test.ts
rename to code/core/src/core-server/utils/watch-story-specifiers.test.ts
index 4a150cc0e7e2..7d93002ab37f 100644
--- a/code/lib/core-server/src/utils/watch-story-specifiers.test.ts
+++ b/code/core/src/core-server/utils/watch-story-specifiers.test.ts
@@ -1,6 +1,6 @@
import { describe, afterEach, it, expect, vi } from 'vitest';
-import { normalizeStoriesEntry } from '@storybook/core-common';
-import path from 'path';
+import { normalizeStoriesEntry } from '@storybook/core/common';
+import path from 'node:path';
import Watchpack from 'watchpack';
import { watchStorySpecifiers } from './watch-story-specifiers';
diff --git a/code/lib/core-server/src/utils/watch-story-specifiers.ts b/code/core/src/core-server/utils/watch-story-specifiers.ts
similarity index 97%
rename from code/lib/core-server/src/utils/watch-story-specifiers.ts
rename to code/core/src/core-server/utils/watch-story-specifiers.ts
index 414fd4c87617..068d626d8ad8 100644
--- a/code/lib/core-server/src/utils/watch-story-specifiers.ts
+++ b/code/core/src/core-server/utils/watch-story-specifiers.ts
@@ -1,10 +1,10 @@
import Watchpack from 'watchpack';
import slash from 'slash';
-import fs from 'fs';
-import path from 'path';
+import fs from 'node:fs';
+import path from 'node:path';
-import type { NormalizedStoriesSpecifier, Path } from '@storybook/types';
-import { commonGlobOptions } from '@storybook/core-common';
+import type { NormalizedStoriesSpecifier, Path } from '@storybook/core/types';
+import { commonGlobOptions } from '@storybook/core/common';
const isDirectory = (directory: Path) => {
try {
diff --git a/code/lib/core-server/src/utils/watchConfig.ts b/code/core/src/core-server/utils/watchConfig.ts
similarity index 93%
rename from code/lib/core-server/src/utils/watchConfig.ts
rename to code/core/src/core-server/utils/watchConfig.ts
index 99b85fe62e2a..614504a1b958 100644
--- a/code/lib/core-server/src/utils/watchConfig.ts
+++ b/code/core/src/core-server/utils/watchConfig.ts
@@ -1,5 +1,5 @@
import Watchpack from 'watchpack';
-import type { Path } from '@storybook/types';
+import type { Path } from '@storybook/core/types';
// copied from './watch-story-specifiers.ts'
/** Watch the .storybook dir for changes */
diff --git a/code/lib/core-server/src/utils/whats-new.ts b/code/core/src/core-server/utils/whats-new.ts
similarity index 90%
rename from code/lib/core-server/src/utils/whats-new.ts
rename to code/core/src/core-server/utils/whats-new.ts
index 3392c93d201f..024889025d00 100644
--- a/code/lib/core-server/src/utils/whats-new.ts
+++ b/code/core/src/core-server/utils/whats-new.ts
@@ -1,19 +1,18 @@
import fs from 'fs-extra';
-import { logger } from '@storybook/node-logger';
-import { telemetry } from '@storybook/telemetry';
-import { findConfigFile } from '@storybook/core-common';
-import type { CoreConfig, Options } from '@storybook/types';
-import { printConfig, readConfig } from '@storybook/csf-tools';
-import fetch from 'node-fetch';
-import type { Channel } from '@storybook/channels';
-import type { WhatsNewCache, WhatsNewData } from '@storybook/core-events';
+import { logger } from '@storybook/core/node-logger';
+import { telemetry } from '@storybook/core/telemetry';
+import { findConfigFile } from '@storybook/core/common';
+import type { CoreConfig, Options } from '@storybook/core/types';
+import { printConfig, readConfig } from '@storybook/core/csf-tools';
+import type { Channel } from '@storybook/core/channels';
+import type { WhatsNewCache, WhatsNewData } from '@storybook/core/core-events';
import {
REQUEST_WHATS_NEW_DATA,
RESULT_WHATS_NEW_DATA,
TELEMETRY_ERROR,
SET_WHATS_NEW_CACHE,
TOGGLE_WHATS_NEW_NOTIFICATIONS,
-} from '@storybook/core-events';
+} from '@storybook/core/core-events';
import invariant from 'tiny-invariant';
import { sendTelemetryError } from '../withTelemetry';
diff --git a/code/lib/core-server/src/withTelemetry.test.ts b/code/core/src/core-server/withTelemetry.test.ts
similarity index 98%
rename from code/lib/core-server/src/withTelemetry.test.ts
rename to code/core/src/core-server/withTelemetry.test.ts
index 99b6d99e1177..6c085b6dc9e9 100644
--- a/code/lib/core-server/src/withTelemetry.test.ts
+++ b/code/core/src/core-server/withTelemetry.test.ts
@@ -1,13 +1,13 @@
import prompts from 'prompts';
import { describe, beforeEach, it, expect, vi } from 'vitest';
-import { loadAllPresets, cache } from '@storybook/core-common';
-import { telemetry, oneWayHash } from '@storybook/telemetry';
+import { loadAllPresets, cache } from '@storybook/core/common';
+import { telemetry, oneWayHash } from '@storybook/core/telemetry';
import { getErrorLevel, sendTelemetryError, withTelemetry } from './withTelemetry';
vi.mock('prompts');
-vi.mock('@storybook/core-common');
-vi.mock('@storybook/telemetry');
+vi.mock('@storybook/core/common');
+vi.mock('@storybook/core/telemetry');
const cliOptions = {};
diff --git a/code/lib/core-server/src/withTelemetry.ts b/code/core/src/core-server/withTelemetry.ts
similarity index 94%
rename from code/lib/core-server/src/withTelemetry.ts
rename to code/core/src/core-server/withTelemetry.ts
index aca04a2c417b..68ac7668ae9b 100644
--- a/code/lib/core-server/src/withTelemetry.ts
+++ b/code/core/src/core-server/withTelemetry.ts
@@ -1,9 +1,9 @@
import prompts from 'prompts';
-import type { CLIOptions } from '@storybook/types';
-import { loadAllPresets, cache } from '@storybook/core-common';
-import { telemetry, getPrecedingUpgrade, oneWayHash } from '@storybook/telemetry';
-import type { EventType } from '@storybook/telemetry';
-import { logger } from '@storybook/node-logger';
+import type { CLIOptions } from '@storybook/core/types';
+import { loadAllPresets, cache } from '@storybook/core/common';
+import { telemetry, getPrecedingUpgrade, oneWayHash } from '@storybook/core/telemetry';
+import type { EventType } from '@storybook/core/telemetry';
+import { logger } from '@storybook/core/node-logger';
type TelemetryOptions = {
cliOptions: CLIOptions;
diff --git a/code/lib/csf-tools/src/ConfigFile.test.ts b/code/core/src/csf-tools/ConfigFile.test.ts
similarity index 100%
rename from code/lib/csf-tools/src/ConfigFile.test.ts
rename to code/core/src/csf-tools/ConfigFile.test.ts
diff --git a/code/lib/csf-tools/src/ConfigFile.ts b/code/core/src/csf-tools/ConfigFile.ts
similarity index 97%
rename from code/lib/csf-tools/src/ConfigFile.ts
rename to code/core/src/csf-tools/ConfigFile.ts
index 3aaa4810b2da..e531693e689a 100644
--- a/code/lib/csf-tools/src/ConfigFile.ts
+++ b/code/core/src/csf-tools/ConfigFile.ts
@@ -1,15 +1,21 @@
/* eslint-disable no-underscore-dangle */
-import fs from 'fs-extra';
-import dedent from 'ts-dedent';
+import { readFile, writeFile } from 'node:fs/promises';
+import { dedent } from 'ts-dedent';
import * as t from '@babel/types';
+import bg from '@babel/generator';
+import bt from '@babel/traverse';
-import * as generate from '@babel/generator';
-
-import * as traverse from '@babel/traverse';
import type { Options } from 'recast';
import * as recast from 'recast';
+
import { babelParse } from './babelParse';
+import type { PrintResultType } from './PrintResultType';
+
+// @ts-expect-error (needed due to it's use of `exports.default`)
+const traverse = (bt.default || bt) as typeof bt;
+// @ts-expect-error (needed due to it's use of `exports.default`)
+const generate = (bg.default || bg) as typeof bg;
const logger = console;
@@ -170,7 +176,7 @@ export class ConfigFile {
parse() {
// eslint-disable-next-line @typescript-eslint/no-this-alias
const self = this;
- traverse.default(this._ast, {
+ traverse(this._ast, {
ExportDefaultDeclaration: {
enter({ node, parent }) {
self.hasDefaultExport = true;
@@ -316,7 +322,7 @@ export class ConfigFile {
getFieldValue(path: string[]) {
const node = this.getFieldNode(path);
if (node) {
- const { code } = generate.default(node, {});
+ const { code } = generate(node, {});
const value = (0, eval)(`(() => (${code}))()`);
return value;
@@ -600,9 +606,9 @@ export class ConfigFile {
// we do this rather than t.valueToNode because apparently
// babel only preserves quotes if they are parsed from the original code.
if (quotes === 'single') {
- const { code } = generate.default(t.valueToNode(value), { jsescOption: { quotes } });
+ const { code } = generate(t.valueToNode(value), { jsescOption: { quotes } });
const program = babelParse(`const __x = ${code}`);
- traverse.default(program, {
+ traverse(program, {
VariableDeclaration: {
enter({ node }) {
if (
@@ -829,21 +835,21 @@ export const loadConfig = (code: string, fileName?: string) => {
return new ConfigFile(ast, code, fileName);
};
-export const formatConfig = (config: ConfigFile) => {
+export const formatConfig = (config: ConfigFile): string => {
return printConfig(config).code;
};
-export const printConfig = (config: ConfigFile, options: Options = {}) => {
+export const printConfig = (config: ConfigFile, options: Options = {}): PrintResultType => {
return recast.print(config._ast, options);
};
export const readConfig = async (fileName: string) => {
- const code = (await fs.readFile(fileName, 'utf-8')).toString();
+ const code = (await readFile(fileName, 'utf-8')).toString();
return loadConfig(code, fileName).parse();
};
export const writeConfig = async (config: ConfigFile, fileName?: string) => {
const fname = fileName || config.fileName;
if (!fname) throw new Error('Please specify a fileName for writeConfig');
- await fs.writeFile(fname, formatConfig(config));
+ await writeFile(fname, formatConfig(config));
};
diff --git a/code/lib/csf-tools/src/CsfFile.test.ts b/code/core/src/csf-tools/CsfFile.test.ts
similarity index 100%
rename from code/lib/csf-tools/src/CsfFile.test.ts
rename to code/core/src/csf-tools/CsfFile.test.ts
diff --git a/code/lib/csf-tools/src/CsfFile.ts b/code/core/src/csf-tools/CsfFile.ts
similarity index 96%
rename from code/lib/csf-tools/src/CsfFile.ts
rename to code/core/src/csf-tools/CsfFile.ts
index 8e2757733545..f748d1d2d4ba 100644
--- a/code/lib/csf-tools/src/CsfFile.ts
+++ b/code/core/src/csf-tools/CsfFile.ts
@@ -1,24 +1,25 @@
/* eslint-disable no-underscore-dangle */
-import fs from 'fs-extra';
+import { readFile, writeFile } from 'node:fs/promises';
import { dedent } from 'ts-dedent';
import * as t from '@babel/types';
+import bg from '@babel/generator';
+import bt from '@babel/traverse';
-import * as generate from '@babel/generator';
import * as recast from 'recast';
-import * as traverse from '@babel/traverse';
import { toId, isExportStory, storyNameFromExport } from '@storybook/csf';
-import type {
- Tag,
- StoryAnnotations,
- ComponentAnnotations,
- IndexedCSFFile,
- IndexInput,
-} from '@storybook/types';
+import type { ComponentAnnotations, StoryAnnotations, Tag } from '@storybook/core/types';
import type { Options } from 'recast';
import { babelParse } from './babelParse';
import { findVarInitialization } from './findVarInitialization';
+import type { PrintResultType } from './PrintResultType';
+import type { IndexInput, IndexedCSFFile } from '@storybook/core/types';
+
+// @ts-expect-error (needed due to it's use of `exports.default`)
+const traverse = (bt.default || bt) as typeof bt;
+// @ts-expect-error (needed due to it's use of `exports.default`)
+const generate = (bg.default || bg) as typeof bg;
const logger = console;
@@ -264,7 +265,7 @@ export class CsfFile {
parse() {
// eslint-disable-next-line @typescript-eslint/no-this-alias
const self = this;
- traverse.default(this._ast, {
+ traverse(this._ast, {
ExportDefaultDeclaration: {
enter({ node, parent }) {
let metaNode: t.ObjectExpression | undefined;
@@ -609,7 +610,7 @@ export const formatCsf = (
options: FormatOptions = { sourceMaps: false },
code?: string
) => {
- const result = generate.default(csf._ast, options, code);
+ const result = generate(csf._ast, options, code);
if (options.sourceMaps) {
return result;
}
@@ -619,17 +620,17 @@ export const formatCsf = (
/**
* Use this function, if you want to preserve styles. Uses recast under the hood.
*/
-export const printCsf = (csf: CsfFile, options: Options = {}) => {
+export const printCsf = (csf: CsfFile, options: Options = {}): PrintResultType => {
return recast.print(csf._ast, options);
};
export const readCsf = async (fileName: string, options: CsfOptions) => {
- const code = (await fs.readFile(fileName, 'utf-8')).toString();
+ const code = (await readFile(fileName, 'utf-8')).toString();
return loadCsf(code, { ...options, fileName });
};
export const writeCsf = async (csf: CsfFile, fileName?: string) => {
const fname = fileName || csf._fileName;
if (!fname) throw new Error('Please specify a fileName for writeCsf');
- await fs.writeFile(fileName as string, printCsf(csf).code);
+ await writeFile(fileName as string, printCsf(csf).code);
};
diff --git a/code/core/src/csf-tools/PrintResultType.ts b/code/core/src/csf-tools/PrintResultType.ts
new file mode 100644
index 000000000000..b3c450f0d457
--- /dev/null
+++ b/code/core/src/csf-tools/PrintResultType.ts
@@ -0,0 +1,5 @@
+export interface PrintResultType {
+ code: string;
+ map?: any;
+ toString(): string;
+}
diff --git a/code/lib/csf-tools/README.md b/code/core/src/csf-tools/README.md
similarity index 100%
rename from code/lib/csf-tools/README.md
rename to code/core/src/csf-tools/README.md
diff --git a/code/lib/csf-tools/src/babelParse.ts b/code/core/src/csf-tools/babelParse.ts
similarity index 87%
rename from code/lib/csf-tools/src/babelParse.ts
rename to code/core/src/csf-tools/babelParse.ts
index 43f49d4c166a..9e3aaf8b53de 100644
--- a/code/lib/csf-tools/src/babelParse.ts
+++ b/code/core/src/csf-tools/babelParse.ts
@@ -1,3 +1,4 @@
+import type * as t from '@babel/types';
import * as babelParser from '@babel/parser';
import * as recast from 'recast';
import type { ParserOptions } from '@babel/parser';
@@ -26,7 +27,7 @@ export const parserOptions: ParserOptions = {
tokens: true,
};
-export const babelParse = (code: string) => {
+export const babelParse = (code: string): t.File => {
return recast.parse(code, {
parser: {
parse(source: string) {
@@ -36,7 +37,11 @@ export const babelParse = (code: string) => {
});
};
-export const babelPrint = (ast: recast.types.ASTNode) => {
+interface ASTNode {
+ type: string;
+}
+
+export const babelPrint = (ast: ASTNode): string => {
return recast.print(ast, {
quote: 'single',
trailingComma: true,
diff --git a/code/lib/csf-tools/src/enrichCsf.test.ts b/code/core/src/csf-tools/enrichCsf.test.ts
similarity index 100%
rename from code/lib/csf-tools/src/enrichCsf.test.ts
rename to code/core/src/csf-tools/enrichCsf.test.ts
diff --git a/code/lib/csf-tools/src/enrichCsf.ts b/code/core/src/csf-tools/enrichCsf.ts
similarity index 96%
rename from code/lib/csf-tools/src/enrichCsf.ts
rename to code/core/src/csf-tools/enrichCsf.ts
index 8744b8359eaa..dc267458854d 100644
--- a/code/lib/csf-tools/src/enrichCsf.ts
+++ b/code/core/src/csf-tools/enrichCsf.ts
@@ -1,9 +1,12 @@
/* eslint-disable no-underscore-dangle */
import * as t from '@babel/types';
-import * as generate from '@babel/generator';
+import bg from '@babel/generator';
import type { CsfFile } from './CsfFile';
+// @ts-expect-error (needed due to it's use of `exports.default`)
+const generate = (bg.default || bg) as typeof bg;
+
export interface EnrichCsfOptions {
disableSource?: boolean;
disableDescription?: boolean;
@@ -141,7 +144,7 @@ export const enrichCsf = (csf: CsfFile, csfSource: CsfFile, options?: EnrichCsfO
export const extractSource = (node: t.Node) => {
const src = t.isVariableDeclarator(node) ? node.init : node;
- const { code } = generate.default(src as t.Node, {});
+ const { code } = generate(src as t.Node, {});
return code;
};
diff --git a/code/lib/csf-tools/src/findVarInitialization.ts b/code/core/src/csf-tools/findVarInitialization.ts
similarity index 100%
rename from code/lib/csf-tools/src/findVarInitialization.ts
rename to code/core/src/csf-tools/findVarInitialization.ts
diff --git a/code/lib/csf-tools/src/getStorySortParameter.test.ts b/code/core/src/csf-tools/getStorySortParameter.test.ts
similarity index 100%
rename from code/lib/csf-tools/src/getStorySortParameter.test.ts
rename to code/core/src/csf-tools/getStorySortParameter.test.ts
diff --git a/code/lib/csf-tools/src/getStorySortParameter.ts b/code/core/src/csf-tools/getStorySortParameter.ts
similarity index 91%
rename from code/lib/csf-tools/src/getStorySortParameter.ts
rename to code/core/src/csf-tools/getStorySortParameter.ts
index b6c65fd11486..07202029aba7 100644
--- a/code/lib/csf-tools/src/getStorySortParameter.ts
+++ b/code/core/src/csf-tools/getStorySortParameter.ts
@@ -1,12 +1,16 @@
import * as t from '@babel/types';
+import bt from '@babel/traverse';
+import bg from '@babel/generator';
-import * as traverse from '@babel/traverse';
-
-import * as generate from '@babel/generator';
import { dedent } from 'ts-dedent';
import { babelParse } from './babelParse';
import { findVarInitialization } from './findVarInitialization';
+// @ts-expect-error (needed due to it's use of `exports.default`)
+const traverse = (bt.default || bt) as typeof bt;
+// @ts-expect-error (needed due to it's use of `exports.default`)
+const generate = (bg.default || bg) as typeof bg;
+
const logger = console;
const getValue = (obj: t.ObjectExpression, key: string) => {
@@ -103,7 +107,7 @@ export const getStorySortParameter = (previewCode: string) => {
let storySort: t.Expression | undefined;
const ast = babelParse(previewCode);
- traverse.default(ast, {
+ traverse(ast, {
ExportNamedDeclaration: {
enter({ node }) {
if (t.isVariableDeclaration(node.declaration)) {
@@ -144,13 +148,13 @@ export const getStorySortParameter = (previewCode: string) => {
if (!storySort) return undefined;
if (t.isArrowFunctionExpression(storySort)) {
- const { code: sortCode } = generate.default(storySort, {});
+ const { code: sortCode } = generate(storySort, {});
return (0, eval)(sortCode);
}
if (t.isFunctionExpression(storySort)) {
- const { code: sortCode } = generate.default(storySort, {});
+ const { code: sortCode } = generate(storySort, {});
const functionName = storySort.id?.name;
// Wrap the function within an arrow function, call it, and return
const wrapper = `(a, b) => {
diff --git a/code/lib/csf-tools/src/index.ts b/code/core/src/csf-tools/index.ts
similarity index 100%
rename from code/lib/csf-tools/src/index.ts
rename to code/core/src/csf-tools/index.ts
diff --git a/code/lib/docs-tools/README.md b/code/core/src/docs-tools/README.md
similarity index 100%
rename from code/lib/docs-tools/README.md
rename to code/core/src/docs-tools/README.md
diff --git a/code/lib/docs-tools/src/argTypes/convert/__testfixtures__/proptypes/arrays.js b/code/core/src/docs-tools/argTypes/convert/__testfixtures__/proptypes/arrays.js
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/convert/__testfixtures__/proptypes/arrays.js
rename to code/core/src/docs-tools/argTypes/convert/__testfixtures__/proptypes/arrays.js
diff --git a/code/lib/docs-tools/src/argTypes/convert/__testfixtures__/proptypes/enums.js b/code/core/src/docs-tools/argTypes/convert/__testfixtures__/proptypes/enums.js
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/convert/__testfixtures__/proptypes/enums.js
rename to code/core/src/docs-tools/argTypes/convert/__testfixtures__/proptypes/enums.js
diff --git a/code/lib/docs-tools/src/argTypes/convert/__testfixtures__/proptypes/misc.js b/code/core/src/docs-tools/argTypes/convert/__testfixtures__/proptypes/misc.js
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/convert/__testfixtures__/proptypes/misc.js
rename to code/core/src/docs-tools/argTypes/convert/__testfixtures__/proptypes/misc.js
diff --git a/code/lib/docs-tools/src/argTypes/convert/__testfixtures__/proptypes/objects.js b/code/core/src/docs-tools/argTypes/convert/__testfixtures__/proptypes/objects.js
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/convert/__testfixtures__/proptypes/objects.js
rename to code/core/src/docs-tools/argTypes/convert/__testfixtures__/proptypes/objects.js
diff --git a/code/lib/docs-tools/src/argTypes/convert/__testfixtures__/proptypes/react.js b/code/core/src/docs-tools/argTypes/convert/__testfixtures__/proptypes/react.js
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/convert/__testfixtures__/proptypes/react.js
rename to code/core/src/docs-tools/argTypes/convert/__testfixtures__/proptypes/react.js
diff --git a/code/lib/docs-tools/src/argTypes/convert/__testfixtures__/proptypes/scalars.js b/code/core/src/docs-tools/argTypes/convert/__testfixtures__/proptypes/scalars.js
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/convert/__testfixtures__/proptypes/scalars.js
rename to code/core/src/docs-tools/argTypes/convert/__testfixtures__/proptypes/scalars.js
diff --git a/code/lib/docs-tools/src/argTypes/convert/__testfixtures__/typescript/aliases.tsx b/code/core/src/docs-tools/argTypes/convert/__testfixtures__/typescript/aliases.tsx
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/convert/__testfixtures__/typescript/aliases.tsx
rename to code/core/src/docs-tools/argTypes/convert/__testfixtures__/typescript/aliases.tsx
diff --git a/code/lib/docs-tools/src/argTypes/convert/__testfixtures__/typescript/arrays.tsx b/code/core/src/docs-tools/argTypes/convert/__testfixtures__/typescript/arrays.tsx
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/convert/__testfixtures__/typescript/arrays.tsx
rename to code/core/src/docs-tools/argTypes/convert/__testfixtures__/typescript/arrays.tsx
diff --git a/code/lib/docs-tools/src/argTypes/convert/__testfixtures__/typescript/enums.tsx b/code/core/src/docs-tools/argTypes/convert/__testfixtures__/typescript/enums.tsx
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/convert/__testfixtures__/typescript/enums.tsx
rename to code/core/src/docs-tools/argTypes/convert/__testfixtures__/typescript/enums.tsx
diff --git a/code/lib/docs-tools/src/argTypes/convert/__testfixtures__/typescript/functions.tsx b/code/core/src/docs-tools/argTypes/convert/__testfixtures__/typescript/functions.tsx
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/convert/__testfixtures__/typescript/functions.tsx
rename to code/core/src/docs-tools/argTypes/convert/__testfixtures__/typescript/functions.tsx
diff --git a/code/lib/docs-tools/src/argTypes/convert/__testfixtures__/typescript/interfaces.tsx b/code/core/src/docs-tools/argTypes/convert/__testfixtures__/typescript/interfaces.tsx
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/convert/__testfixtures__/typescript/interfaces.tsx
rename to code/core/src/docs-tools/argTypes/convert/__testfixtures__/typescript/interfaces.tsx
diff --git a/code/lib/docs-tools/src/argTypes/convert/__testfixtures__/typescript/intersections.tsx b/code/core/src/docs-tools/argTypes/convert/__testfixtures__/typescript/intersections.tsx
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/convert/__testfixtures__/typescript/intersections.tsx
rename to code/core/src/docs-tools/argTypes/convert/__testfixtures__/typescript/intersections.tsx
diff --git a/code/lib/docs-tools/src/argTypes/convert/__testfixtures__/typescript/optionals.tsx b/code/core/src/docs-tools/argTypes/convert/__testfixtures__/typescript/optionals.tsx
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/convert/__testfixtures__/typescript/optionals.tsx
rename to code/core/src/docs-tools/argTypes/convert/__testfixtures__/typescript/optionals.tsx
diff --git a/code/lib/docs-tools/src/argTypes/convert/__testfixtures__/typescript/records.tsx b/code/core/src/docs-tools/argTypes/convert/__testfixtures__/typescript/records.tsx
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/convert/__testfixtures__/typescript/records.tsx
rename to code/core/src/docs-tools/argTypes/convert/__testfixtures__/typescript/records.tsx
diff --git a/code/lib/docs-tools/src/argTypes/convert/__testfixtures__/typescript/scalars.tsx b/code/core/src/docs-tools/argTypes/convert/__testfixtures__/typescript/scalars.tsx
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/convert/__testfixtures__/typescript/scalars.tsx
rename to code/core/src/docs-tools/argTypes/convert/__testfixtures__/typescript/scalars.tsx
diff --git a/code/lib/docs-tools/src/argTypes/convert/__testfixtures__/typescript/tuples.tsx b/code/core/src/docs-tools/argTypes/convert/__testfixtures__/typescript/tuples.tsx
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/convert/__testfixtures__/typescript/tuples.tsx
rename to code/core/src/docs-tools/argTypes/convert/__testfixtures__/typescript/tuples.tsx
diff --git a/code/lib/docs-tools/src/argTypes/convert/__testfixtures__/typescript/unions.tsx b/code/core/src/docs-tools/argTypes/convert/__testfixtures__/typescript/unions.tsx
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/convert/__testfixtures__/typescript/unions.tsx
rename to code/core/src/docs-tools/argTypes/convert/__testfixtures__/typescript/unions.tsx
diff --git a/code/lib/docs-tools/src/argTypes/convert/convert.test.ts b/code/core/src/docs-tools/argTypes/convert/convert.test.ts
similarity index 99%
rename from code/lib/docs-tools/src/argTypes/convert/convert.test.ts
rename to code/core/src/docs-tools/argTypes/convert/convert.test.ts
index 8997f022c79a..3d33efd5ea73 100644
--- a/code/lib/docs-tools/src/argTypes/convert/convert.test.ts
+++ b/code/core/src/docs-tools/argTypes/convert/convert.test.ts
@@ -2,7 +2,7 @@ import { describe, it, expect } from 'vitest';
import mapValues from 'lodash/mapValues.js';
import { transformSync } from '@babel/core';
import requireFromString from 'require-from-string';
-import fs from 'fs';
+import fs from 'node:fs';
import { convert } from './index';
import { normalizeNewlines } from '../utils';
diff --git a/code/lib/docs-tools/src/argTypes/convert/flow/convert.ts b/code/core/src/docs-tools/argTypes/convert/flow/convert.ts
similarity index 92%
rename from code/lib/docs-tools/src/argTypes/convert/flow/convert.ts
rename to code/core/src/docs-tools/argTypes/convert/flow/convert.ts
index a6906589da75..0166ccfb86da 100644
--- a/code/lib/docs-tools/src/argTypes/convert/flow/convert.ts
+++ b/code/core/src/docs-tools/argTypes/convert/flow/convert.ts
@@ -1,5 +1,5 @@
-import { UnknownArgTypesError } from '@storybook/core-events/preview-errors';
-import type { SBType } from '@storybook/types';
+import { UnknownArgTypesError } from '@storybook/core/preview-errors';
+import type { SBType } from '@storybook/core/types';
import type { FlowType, FlowSigType, FlowLiteralType } from './types';
const isLiteral = (type: FlowType): type is FlowLiteralType => type.name === 'literal';
diff --git a/code/lib/docs-tools/src/argTypes/convert/flow/index.ts b/code/core/src/docs-tools/argTypes/convert/flow/index.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/convert/flow/index.ts
rename to code/core/src/docs-tools/argTypes/convert/flow/index.ts
diff --git a/code/lib/docs-tools/src/argTypes/convert/flow/types.ts b/code/core/src/docs-tools/argTypes/convert/flow/types.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/convert/flow/types.ts
rename to code/core/src/docs-tools/argTypes/convert/flow/types.ts
diff --git a/code/lib/docs-tools/src/argTypes/convert/index.ts b/code/core/src/docs-tools/argTypes/convert/index.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/convert/index.ts
rename to code/core/src/docs-tools/argTypes/convert/index.ts
diff --git a/code/lib/docs-tools/src/argTypes/convert/proptypes/convert.ts b/code/core/src/docs-tools/argTypes/convert/proptypes/convert.ts
similarity index 97%
rename from code/lib/docs-tools/src/argTypes/convert/proptypes/convert.ts
rename to code/core/src/docs-tools/argTypes/convert/proptypes/convert.ts
index f3c3edd92c09..895b275e244c 100644
--- a/code/lib/docs-tools/src/argTypes/convert/proptypes/convert.ts
+++ b/code/core/src/docs-tools/argTypes/convert/proptypes/convert.ts
@@ -1,5 +1,5 @@
import mapValues from 'lodash/mapValues.js';
-import type { SBType } from '@storybook/types';
+import type { SBType } from '@storybook/core/types';
import type { PTType } from './types';
import { parseLiteral } from '../utils';
diff --git a/code/lib/docs-tools/src/argTypes/convert/proptypes/index.ts b/code/core/src/docs-tools/argTypes/convert/proptypes/index.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/convert/proptypes/index.ts
rename to code/core/src/docs-tools/argTypes/convert/proptypes/index.ts
diff --git a/code/lib/docs-tools/src/argTypes/convert/proptypes/types.ts b/code/core/src/docs-tools/argTypes/convert/proptypes/types.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/convert/proptypes/types.ts
rename to code/core/src/docs-tools/argTypes/convert/proptypes/types.ts
diff --git a/code/lib/docs-tools/src/argTypes/convert/typescript/convert.ts b/code/core/src/docs-tools/argTypes/convert/typescript/convert.ts
similarity index 92%
rename from code/lib/docs-tools/src/argTypes/convert/typescript/convert.ts
rename to code/core/src/docs-tools/argTypes/convert/typescript/convert.ts
index def09e92a305..248dfba4f2b2 100644
--- a/code/lib/docs-tools/src/argTypes/convert/typescript/convert.ts
+++ b/code/core/src/docs-tools/argTypes/convert/typescript/convert.ts
@@ -1,5 +1,5 @@
-import { UnknownArgTypesError } from '@storybook/core-events/preview-errors';
-import type { SBType } from '@storybook/types';
+import { UnknownArgTypesError } from '@storybook/core/preview-errors';
+import type { SBType } from '@storybook/core/types';
import type { TSType, TSSigType } from './types';
import { parseLiteral } from '../utils';
diff --git a/code/lib/docs-tools/src/argTypes/convert/typescript/index.ts b/code/core/src/docs-tools/argTypes/convert/typescript/index.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/convert/typescript/index.ts
rename to code/core/src/docs-tools/argTypes/convert/typescript/index.ts
diff --git a/code/lib/docs-tools/src/argTypes/convert/typescript/types.ts b/code/core/src/docs-tools/argTypes/convert/typescript/types.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/convert/typescript/types.ts
rename to code/core/src/docs-tools/argTypes/convert/typescript/types.ts
diff --git a/code/lib/docs-tools/src/argTypes/convert/utils.ts b/code/core/src/docs-tools/argTypes/convert/utils.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/convert/utils.ts
rename to code/core/src/docs-tools/argTypes/convert/utils.ts
diff --git a/code/lib/docs-tools/src/argTypes/docgen/PropDef.ts b/code/core/src/docs-tools/argTypes/docgen/PropDef.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/docgen/PropDef.ts
rename to code/core/src/docs-tools/argTypes/docgen/PropDef.ts
diff --git a/code/lib/docs-tools/src/argTypes/docgen/createPropDef.ts b/code/core/src/docs-tools/argTypes/docgen/createPropDef.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/docgen/createPropDef.ts
rename to code/core/src/docs-tools/argTypes/docgen/createPropDef.ts
diff --git a/code/lib/docs-tools/src/argTypes/docgen/extractDocgenProps.test.ts b/code/core/src/docs-tools/argTypes/docgen/extractDocgenProps.test.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/docgen/extractDocgenProps.test.ts
rename to code/core/src/docs-tools/argTypes/docgen/extractDocgenProps.test.ts
diff --git a/code/lib/docs-tools/src/argTypes/docgen/extractDocgenProps.ts b/code/core/src/docs-tools/argTypes/docgen/extractDocgenProps.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/docgen/extractDocgenProps.ts
rename to code/core/src/docs-tools/argTypes/docgen/extractDocgenProps.ts
diff --git a/code/lib/docs-tools/src/argTypes/docgen/flow/createDefaultValue.ts b/code/core/src/docs-tools/argTypes/docgen/flow/createDefaultValue.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/docgen/flow/createDefaultValue.ts
rename to code/core/src/docs-tools/argTypes/docgen/flow/createDefaultValue.ts
diff --git a/code/lib/docs-tools/src/argTypes/docgen/flow/createPropDef.test.ts b/code/core/src/docs-tools/argTypes/docgen/flow/createPropDef.test.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/docgen/flow/createPropDef.test.ts
rename to code/core/src/docs-tools/argTypes/docgen/flow/createPropDef.test.ts
diff --git a/code/lib/docs-tools/src/argTypes/docgen/flow/createPropDef.ts b/code/core/src/docs-tools/argTypes/docgen/flow/createPropDef.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/docgen/flow/createPropDef.ts
rename to code/core/src/docs-tools/argTypes/docgen/flow/createPropDef.ts
diff --git a/code/lib/docs-tools/src/argTypes/docgen/flow/createType.ts b/code/core/src/docs-tools/argTypes/docgen/flow/createType.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/docgen/flow/createType.ts
rename to code/core/src/docs-tools/argTypes/docgen/flow/createType.ts
diff --git a/code/lib/docs-tools/src/argTypes/docgen/index.ts b/code/core/src/docs-tools/argTypes/docgen/index.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/docgen/index.ts
rename to code/core/src/docs-tools/argTypes/docgen/index.ts
diff --git a/code/lib/docs-tools/src/argTypes/docgen/typeScript/createDefaultValue.ts b/code/core/src/docs-tools/argTypes/docgen/typeScript/createDefaultValue.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/docgen/typeScript/createDefaultValue.ts
rename to code/core/src/docs-tools/argTypes/docgen/typeScript/createDefaultValue.ts
diff --git a/code/lib/docs-tools/src/argTypes/docgen/typeScript/createPropDef.test.ts b/code/core/src/docs-tools/argTypes/docgen/typeScript/createPropDef.test.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/docgen/typeScript/createPropDef.test.ts
rename to code/core/src/docs-tools/argTypes/docgen/typeScript/createPropDef.test.ts
diff --git a/code/lib/docs-tools/src/argTypes/docgen/typeScript/createPropDef.ts b/code/core/src/docs-tools/argTypes/docgen/typeScript/createPropDef.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/docgen/typeScript/createPropDef.ts
rename to code/core/src/docs-tools/argTypes/docgen/typeScript/createPropDef.ts
diff --git a/code/lib/docs-tools/src/argTypes/docgen/typeScript/createType.ts b/code/core/src/docs-tools/argTypes/docgen/typeScript/createType.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/docgen/typeScript/createType.ts
rename to code/core/src/docs-tools/argTypes/docgen/typeScript/createType.ts
diff --git a/code/lib/docs-tools/src/argTypes/docgen/types.ts b/code/core/src/docs-tools/argTypes/docgen/types.ts
similarity index 95%
rename from code/lib/docs-tools/src/argTypes/docgen/types.ts
rename to code/core/src/docs-tools/argTypes/docgen/types.ts
index ae8269a9838b..dc059af40ed5 100644
--- a/code/lib/docs-tools/src/argTypes/docgen/types.ts
+++ b/code/core/src/docs-tools/argTypes/docgen/types.ts
@@ -1,4 +1,4 @@
-import type { StrictArgTypes } from '@storybook/types';
+import type { StrictArgTypes } from '@storybook/core/types';
import type { PropDef } from './PropDef';
import type { Component } from '../types';
diff --git a/code/lib/docs-tools/src/argTypes/docgen/utils/defaultValue.ts b/code/core/src/docs-tools/argTypes/docgen/utils/defaultValue.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/docgen/utils/defaultValue.ts
rename to code/core/src/docs-tools/argTypes/docgen/utils/defaultValue.ts
diff --git a/code/lib/docs-tools/src/argTypes/docgen/utils/docgenInfo.ts b/code/core/src/docs-tools/argTypes/docgen/utils/docgenInfo.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/docgen/utils/docgenInfo.ts
rename to code/core/src/docs-tools/argTypes/docgen/utils/docgenInfo.ts
diff --git a/code/lib/docs-tools/src/argTypes/docgen/utils/index.ts b/code/core/src/docs-tools/argTypes/docgen/utils/index.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/docgen/utils/index.ts
rename to code/core/src/docs-tools/argTypes/docgen/utils/index.ts
diff --git a/code/lib/docs-tools/src/argTypes/docgen/utils/string.ts b/code/core/src/docs-tools/argTypes/docgen/utils/string.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/docgen/utils/string.ts
rename to code/core/src/docs-tools/argTypes/docgen/utils/string.ts
diff --git a/code/lib/docs-tools/src/argTypes/enhanceArgTypes.test.ts b/code/core/src/docs-tools/argTypes/enhanceArgTypes.test.ts
similarity index 98%
rename from code/lib/docs-tools/src/argTypes/enhanceArgTypes.test.ts
rename to code/core/src/docs-tools/argTypes/enhanceArgTypes.test.ts
index 5cae300b49e8..a3a83ab2c93c 100644
--- a/code/lib/docs-tools/src/argTypes/enhanceArgTypes.test.ts
+++ b/code/core/src/docs-tools/argTypes/enhanceArgTypes.test.ts
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
-import type { ArgTypes, StrictInputType } from '@storybook/types';
+import type { ArgTypes, StrictInputType } from '@storybook/core/types';
import { enhanceArgTypes } from './enhanceArgTypes';
expect.addSnapshotSerializer({
diff --git a/code/lib/docs-tools/src/argTypes/enhanceArgTypes.ts b/code/core/src/docs-tools/argTypes/enhanceArgTypes.ts
similarity index 87%
rename from code/lib/docs-tools/src/argTypes/enhanceArgTypes.ts
rename to code/core/src/docs-tools/argTypes/enhanceArgTypes.ts
index 09d82058a387..09736e160ce1 100644
--- a/code/lib/docs-tools/src/argTypes/enhanceArgTypes.ts
+++ b/code/core/src/docs-tools/argTypes/enhanceArgTypes.ts
@@ -1,5 +1,5 @@
-import type { Renderer, StoryContextForEnhancers } from '@storybook/types';
-import { combineParameters } from '@storybook/preview-api';
+import type { Renderer, StoryContextForEnhancers } from '@storybook/core/types';
+import { combineParameters } from '@storybook/core/preview-api';
export const enhanceArgTypes = (
context: StoryContextForEnhancers
diff --git a/code/lib/docs-tools/src/argTypes/index.ts b/code/core/src/docs-tools/argTypes/index.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/index.ts
rename to code/core/src/docs-tools/argTypes/index.ts
diff --git a/code/lib/docs-tools/src/argTypes/jsdocParser.test.ts b/code/core/src/docs-tools/argTypes/jsdocParser.test.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/jsdocParser.test.ts
rename to code/core/src/docs-tools/argTypes/jsdocParser.test.ts
diff --git a/code/lib/docs-tools/src/argTypes/jsdocParser.ts b/code/core/src/docs-tools/argTypes/jsdocParser.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/jsdocParser.ts
rename to code/core/src/docs-tools/argTypes/jsdocParser.ts
diff --git a/code/lib/docs-tools/src/argTypes/types.ts b/code/core/src/docs-tools/argTypes/types.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/types.ts
rename to code/core/src/docs-tools/argTypes/types.ts
diff --git a/code/lib/docs-tools/src/argTypes/typings.d.ts b/code/core/src/docs-tools/argTypes/typings.d.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/typings.d.ts
rename to code/core/src/docs-tools/argTypes/typings.d.ts
diff --git a/code/lib/docs-tools/src/argTypes/utils.test.ts b/code/core/src/docs-tools/argTypes/utils.test.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/utils.test.ts
rename to code/core/src/docs-tools/argTypes/utils.test.ts
diff --git a/code/lib/docs-tools/src/argTypes/utils.ts b/code/core/src/docs-tools/argTypes/utils.ts
similarity index 100%
rename from code/lib/docs-tools/src/argTypes/utils.ts
rename to code/core/src/docs-tools/argTypes/utils.ts
diff --git a/code/lib/docs-tools/src/hasDocsOrControls.ts b/code/core/src/docs-tools/hasDocsOrControls.ts
similarity index 83%
rename from code/lib/docs-tools/src/hasDocsOrControls.ts
rename to code/core/src/docs-tools/hasDocsOrControls.ts
index b1585ee534d7..14e423dd3071 100644
--- a/code/lib/docs-tools/src/hasDocsOrControls.ts
+++ b/code/core/src/docs-tools/hasDocsOrControls.ts
@@ -1,4 +1,4 @@
-import type { Options } from '@storybook/types';
+import type { Options } from '@storybook/core/types';
// `addons/x` is for the monorepo, `addon-x` is for normal usage
const packageRe = /(addons\/|addon-|addon-essentials\/)(docs|controls)/;
diff --git a/code/lib/docs-tools/src/index.ts b/code/core/src/docs-tools/index.ts
similarity index 100%
rename from code/lib/docs-tools/src/index.ts
rename to code/core/src/docs-tools/index.ts
diff --git a/code/lib/docs-tools/src/shared.ts b/code/core/src/docs-tools/shared.ts
similarity index 93%
rename from code/lib/docs-tools/src/shared.ts
rename to code/core/src/docs-tools/shared.ts
index 178bf46ca387..ca34c29c6e5e 100644
--- a/code/lib/docs-tools/src/shared.ts
+++ b/code/core/src/docs-tools/shared.ts
@@ -1,4 +1,4 @@
-export const ADDON_ID = 'storybook/docs';
+export const ADDON_ID = '@storybook/core/docs';
export const PANEL_ID = `${ADDON_ID}/panel`;
export const PARAM_KEY = `docs`;
diff --git a/code/core/src/index.ts b/code/core/src/index.ts
new file mode 100644
index 000000000000..15e1677a3050
--- /dev/null
+++ b/code/core/src/index.ts
@@ -0,0 +1,3 @@
+export {};
+
+console.log('This file should remain unused until we have figured out the best API');
diff --git a/code/lib/manager-api/src/context.ts b/code/core/src/manager-api/context.ts
similarity index 80%
rename from code/lib/manager-api/src/context.ts
rename to code/core/src/manager-api/context.ts
index a318d33f6bf7..c0e2053c4ff0 100644
--- a/code/lib/manager-api/src/context.ts
+++ b/code/core/src/manager-api/context.ts
@@ -1,4 +1,4 @@
import { createContext as ReactCreateContext } from 'react';
-import type { Combo } from './index';
+import type { Combo } from './root';
export const createContext = ({ api, state }: Combo) => ReactCreateContext({ api, state });
diff --git a/code/core/src/manager-api/index.ts b/code/core/src/manager-api/index.ts
new file mode 100644
index 000000000000..209b15df394b
--- /dev/null
+++ b/code/core/src/manager-api/index.ts
@@ -0,0 +1 @@
+export * from './root';
diff --git a/code/lib/manager-api/src/initial-state.ts b/code/core/src/manager-api/initial-state.ts
similarity index 88%
rename from code/lib/manager-api/src/initial-state.ts
rename to code/core/src/manager-api/initial-state.ts
index 16f0b7126280..fa862a9b5892 100644
--- a/code/lib/manager-api/src/initial-state.ts
+++ b/code/core/src/manager-api/initial-state.ts
@@ -1,6 +1,6 @@
import merge from './lib/merge';
-import type { State } from './index';
+import type { State } from './root';
interface Addition {
[key: string]: any;
diff --git a/code/lib/manager-api/src/lib/addons.ts b/code/core/src/manager-api/lib/addons.ts
similarity index 92%
rename from code/lib/manager-api/src/lib/addons.ts
rename to code/core/src/manager-api/lib/addons.ts
index 179e8441622c..c463a9ca4744 100644
--- a/code/lib/manager-api/src/lib/addons.ts
+++ b/code/core/src/manager-api/lib/addons.ts
@@ -1,7 +1,7 @@
import { global } from '@storybook/global';
-import type { Channel } from '@storybook/channels';
-import { SET_CONFIG } from '@storybook/core-events';
+import type { Channel } from '@storybook/core/channels';
+import { SET_CONFIG } from '@storybook/core/core-events';
import type {
Addon_Collection,
Addon_Config,
@@ -15,10 +15,10 @@ import type {
Addon_WrapperType,
Addon_SidebarBottomType,
Addon_SidebarTopType,
-} from '@storybook/types';
-import { Addon_TypesEnum } from '@storybook/types';
-import { logger } from '@storybook/client-logger';
-import type { API } from '../index';
+} from '@storybook/core/types';
+import { Addon_TypesEnum } from '@storybook/core/types';
+import { logger } from '@storybook/core/client-logger';
+import type { API } from '../root';
import { mockChannel } from './storybook-channel-mock';
export { Addon_Type as Addon, Addon_TypesEnum as types };
diff --git a/code/lib/manager-api/src/lib/events.ts b/code/core/src/manager-api/lib/events.ts
similarity index 87%
rename from code/lib/manager-api/src/lib/events.ts
rename to code/core/src/manager-api/lib/events.ts
index 1892d71ed57a..b896961187c3 100644
--- a/code/lib/manager-api/src/lib/events.ts
+++ b/code/core/src/manager-api/lib/events.ts
@@ -1,9 +1,9 @@
-import { logger } from '@storybook/client-logger';
+import { logger } from '@storybook/core/client-logger';
-import type { API_ComposedRef } from '@storybook/types';
+import type { API_ComposedRef } from '@storybook/core/types';
import { getSourceType } from '../modules/refs';
-import type { API } from '../index';
+import type { API } from '../root';
interface Meta {
ref?: API_ComposedRef;
diff --git a/code/lib/manager-api/src/lib/merge.ts b/code/core/src/manager-api/lib/merge.ts
similarity index 91%
rename from code/lib/manager-api/src/lib/merge.ts
rename to code/core/src/manager-api/lib/merge.ts
index 8ad0c203d7bb..e6b7eabf8e9e 100644
--- a/code/lib/manager-api/src/lib/merge.ts
+++ b/code/core/src/manager-api/lib/merge.ts
@@ -1,7 +1,7 @@
import mergeWith from 'lodash/mergeWith.js';
import isEqual from 'lodash/isEqual.js';
-import { logger } from '@storybook/client-logger';
+import { logger } from '@storybook/core/client-logger';
export default (a: TObj, b: Partial) =>
mergeWith({}, a, b, (objValue: TObj, srcValue: Partial) => {
diff --git a/code/lib/manager-api/src/lib/request-response.ts b/code/core/src/manager-api/lib/request-response.ts
similarity index 88%
rename from code/lib/manager-api/src/lib/request-response.ts
rename to code/core/src/manager-api/lib/request-response.ts
index bed05f576461..d76e1aca5659 100644
--- a/code/lib/manager-api/src/lib/request-response.ts
+++ b/code/core/src/manager-api/lib/request-response.ts
@@ -1,5 +1,5 @@
-import type { Channel } from '@storybook/channels';
-import type { RequestData, ResponseData } from '@storybook/core-events';
+import type { Channel } from '@storybook/core/channels';
+import type { RequestData, ResponseData } from '@storybook/core/core-events';
export class RequestResponseError | void> extends Error {
payload: Payload | undefined = undefined;
@@ -22,7 +22,7 @@ export const experimental_requestResponse = <
payload: RequestPayload,
timeout = 5000
): Promise => {
- let timeoutId: NodeJS.Timeout;
+ let timeoutId: ReturnType;
return new Promise((resolve, reject) => {
const request: RequestData = {
diff --git a/code/lib/manager-api/src/lib/shortcut.ts b/code/core/src/manager-api/lib/shortcut.ts
similarity index 100%
rename from code/lib/manager-api/src/lib/shortcut.ts
rename to code/core/src/manager-api/lib/shortcut.ts
diff --git a/code/lib/manager-api/src/lib/store-setup.ts b/code/core/src/manager-api/lib/store-setup.ts
similarity index 100%
rename from code/lib/manager-api/src/lib/store-setup.ts
rename to code/core/src/manager-api/lib/store-setup.ts
diff --git a/code/lib/manager-api/src/lib/stories.test.ts b/code/core/src/manager-api/lib/stories.test.ts
similarity index 99%
rename from code/lib/manager-api/src/lib/stories.test.ts
rename to code/core/src/manager-api/lib/stories.test.ts
index f8a7c5882cfb..5f005eef9e26 100644
--- a/code/lib/manager-api/src/lib/stories.test.ts
+++ b/code/core/src/manager-api/lib/stories.test.ts
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
-import type { StoryIndexV2, StoryIndexV3, API_PreparedStoryIndex } from '@storybook/types';
+import type { StoryIndexV2, StoryIndexV3, API_PreparedStoryIndex } from '@storybook/core/types';
import {
transformStoryIndexV2toV3,
transformStoryIndexV3toV4,
diff --git a/code/lib/manager-api/src/lib/stories.ts b/code/core/src/manager-api/lib/stories.ts
similarity index 99%
rename from code/lib/manager-api/src/lib/stories.ts
rename to code/core/src/manager-api/lib/stories.ts
index db8cc4c1efb3..c5d2823c5649 100644
--- a/code/lib/manager-api/src/lib/stories.ts
+++ b/code/core/src/manager-api/lib/stories.ts
@@ -21,9 +21,9 @@ import type {
API_HashEntry,
SetStoriesPayload,
StoryIndexV2,
-} from '@storybook/types';
+} from '@storybook/core/types';
-import { type API, combineParameters, type State } from '../index';
+import { type API, combineParameters, type State } from '../root';
import merge from './merge';
const TITLE_PATH_SEPARATOR = /\s*\/\s*/;
diff --git a/code/lib/manager-api/src/lib/storybook-channel-mock.ts b/code/core/src/manager-api/lib/storybook-channel-mock.ts
similarity index 73%
rename from code/lib/manager-api/src/lib/storybook-channel-mock.ts
rename to code/core/src/manager-api/lib/storybook-channel-mock.ts
index cde396320da0..2f8abbf20b5f 100644
--- a/code/lib/manager-api/src/lib/storybook-channel-mock.ts
+++ b/code/core/src/manager-api/lib/storybook-channel-mock.ts
@@ -1,4 +1,4 @@
-import { Channel } from '@storybook/channels';
+import { Channel } from '@storybook/core/channels';
export function mockChannel() {
const transport = {
diff --git a/code/lib/manager-api/src/lib/types.tsx b/code/core/src/manager-api/lib/types.tsx
similarity index 70%
rename from code/lib/manager-api/src/lib/types.tsx
rename to code/core/src/manager-api/lib/types.tsx
index a195f514999e..2b7a31e2498c 100644
--- a/code/lib/manager-api/src/lib/types.tsx
+++ b/code/core/src/manager-api/lib/types.tsx
@@ -1,7 +1,7 @@
-import type { API_ProviderData } from '@storybook/types';
-import type { RouterData } from '@storybook/router';
+import type { API_ProviderData } from '@storybook/core/types';
+import type { RouterData } from '@storybook/core/router';
-import type { API, State } from '../index';
+import type { API, State } from '../root';
import type Store from '../store';
export type ModuleFn = (
diff --git a/code/lib/manager-api/src/modules/addons.ts b/code/core/src/manager-api/modules/addons.ts
similarity index 97%
rename from code/lib/manager-api/src/modules/addons.ts
rename to code/core/src/manager-api/modules/addons.ts
index 99a1a359599c..2cefd4d9b39c 100644
--- a/code/lib/manager-api/src/modules/addons.ts
+++ b/code/core/src/manager-api/modules/addons.ts
@@ -4,8 +4,8 @@ import type {
Addon_Types,
Addon_TypesMapping,
API_StateMerger,
-} from '@storybook/types';
-import { Addon_TypesEnum } from '@storybook/types';
+} from '@storybook/core/types';
+import { Addon_TypesEnum } from '@storybook/core/types';
import type { ModuleFn } from '../lib/types';
import type { Options } from '../store';
diff --git a/code/lib/manager-api/src/modules/channel.ts b/code/core/src/manager-api/modules/channel.ts
similarity index 94%
rename from code/lib/manager-api/src/modules/channel.ts
rename to code/core/src/manager-api/modules/channel.ts
index 16084cfdd042..8fdc688cf81b 100644
--- a/code/lib/manager-api/src/modules/channel.ts
+++ b/code/core/src/manager-api/modules/channel.ts
@@ -1,7 +1,7 @@
-import type { Listener } from '@storybook/channels';
+import type { Listener } from '@storybook/core/channels';
-import type { API_Provider } from '@storybook/types';
-import type { API } from '../index';
+import type { API_Provider } from '@storybook/core/types';
+import type { API } from '../root';
import type { ModuleFn } from '../lib/types';
export interface SubAPI {
diff --git a/code/lib/manager-api/src/modules/globals.ts b/code/core/src/manager-api/modules/globals.ts
similarity index 96%
rename from code/lib/manager-api/src/modules/globals.ts
rename to code/core/src/manager-api/modules/globals.ts
index fd0c45514548..f66f0599e3dc 100644
--- a/code/lib/manager-api/src/modules/globals.ts
+++ b/code/core/src/manager-api/modules/globals.ts
@@ -1,7 +1,7 @@
-import { SET_GLOBALS, UPDATE_GLOBALS, GLOBALS_UPDATED } from '@storybook/core-events';
-import { logger } from '@storybook/client-logger';
+import { SET_GLOBALS, UPDATE_GLOBALS, GLOBALS_UPDATED } from '@storybook/core/core-events';
+import { logger } from '@storybook/core/client-logger';
import { dequal as deepEqual } from 'dequal';
-import type { SetGlobalsPayload, Globals, GlobalTypes } from '@storybook/types';
+import type { SetGlobalsPayload, Globals, GlobalTypes } from '@storybook/core/types';
import type { ModuleFn } from '../lib/types';
diff --git a/code/lib/manager-api/src/modules/layout.ts b/code/core/src/manager-api/modules/layout.ts
similarity index 98%
rename from code/lib/manager-api/src/modules/layout.ts
rename to code/core/src/manager-api/modules/layout.ts
index 7c8401e3c173..89bd0ab19afd 100644
--- a/code/lib/manager-api/src/modules/layout.ts
+++ b/code/core/src/manager-api/modules/layout.ts
@@ -1,13 +1,13 @@
import { global } from '@storybook/global';
import pick from 'lodash/pick.js';
import { dequal as deepEqual } from 'dequal';
-import { create } from '@storybook/theming/create';
-import { SET_CONFIG } from '@storybook/core-events';
-import type { ThemeVars } from '@storybook/theming';
+import { create } from '@storybook/core/theming/create';
+import { SET_CONFIG } from '@storybook/core/core-events';
+import type { ThemeVars } from '@storybook/core/theming';
-import type { API_Layout, API_PanelPositions, API_UI } from '@storybook/types';
+import type { API_Layout, API_PanelPositions, API_UI } from '@storybook/core/types';
import merge from '../lib/merge';
-import type { State } from '../index';
+import type { State } from '../root';
import type { ModuleFn } from '../lib/types';
const { document } = global;
diff --git a/code/lib/manager-api/src/modules/notifications.ts b/code/core/src/manager-api/modules/notifications.ts
similarity index 96%
rename from code/lib/manager-api/src/modules/notifications.ts
rename to code/core/src/manager-api/modules/notifications.ts
index a8ee3195b6b7..dcabddd628ec 100644
--- a/code/lib/manager-api/src/modules/notifications.ts
+++ b/code/core/src/manager-api/modules/notifications.ts
@@ -1,4 +1,4 @@
-import type { API_Notification } from '@storybook/types';
+import type { API_Notification } from '@storybook/core/types';
import partition from 'lodash/partition.js';
import type { ModuleFn } from '../lib/types';
diff --git a/code/lib/manager-api/src/modules/provider.ts b/code/core/src/manager-api/modules/provider.ts
similarity index 84%
rename from code/lib/manager-api/src/modules/provider.ts
rename to code/core/src/manager-api/modules/provider.ts
index c150bf90bf8b..730195392fcf 100644
--- a/code/lib/manager-api/src/modules/provider.ts
+++ b/code/core/src/manager-api/modules/provider.ts
@@ -1,4 +1,4 @@
-import type { API_IframeRenderer } from '@storybook/types';
+import type { API_IframeRenderer } from '@storybook/core/types';
import type { ModuleFn } from '../lib/types';
export interface SubAPI {
diff --git a/code/lib/manager-api/src/modules/refs.ts b/code/core/src/manager-api/modules/refs.ts
similarity index 99%
rename from code/lib/manager-api/src/modules/refs.ts
rename to code/core/src/manager-api/modules/refs.ts
index 4a5fca881f48..50901f281901 100644
--- a/code/lib/manager-api/src/modules/refs.ts
+++ b/code/core/src/manager-api/modules/refs.ts
@@ -9,7 +9,7 @@ import type {
API_IndexHash,
API_StoryMapper,
StoryIndex,
-} from '@storybook/types';
+} from '@storybook/core/types';
import {
transformSetStoriesStoryDataToPreparedStoryIndex,
diff --git a/code/lib/manager-api/src/modules/settings.ts b/code/core/src/manager-api/modules/settings.ts
similarity index 96%
rename from code/lib/manager-api/src/modules/settings.ts
rename to code/core/src/manager-api/modules/settings.ts
index 34a06c6c6dcd..24bd16c327d8 100644
--- a/code/lib/manager-api/src/modules/settings.ts
+++ b/code/core/src/manager-api/modules/settings.ts
@@ -1,4 +1,4 @@
-import type { API_Settings, StoryId } from '@storybook/types';
+import type { API_Settings, StoryId } from '@storybook/core/types';
import type { ModuleFn } from '../lib/types';
export interface SubAPI {
diff --git a/code/lib/manager-api/src/modules/shortcuts.ts b/code/core/src/manager-api/modules/shortcuts.ts
similarity index 99%
rename from code/lib/manager-api/src/modules/shortcuts.ts
rename to code/core/src/manager-api/modules/shortcuts.ts
index 892afa652ab7..1d4708425c92 100644
--- a/code/lib/manager-api/src/modules/shortcuts.ts
+++ b/code/core/src/manager-api/modules/shortcuts.ts
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { global } from '@storybook/global';
-import { FORCE_REMOUNT, PREVIEW_KEYDOWN } from '@storybook/core-events';
+import { FORCE_REMOUNT, PREVIEW_KEYDOWN } from '@storybook/core/core-events';
import type { ModuleFn } from '../lib/types';
diff --git a/code/lib/manager-api/src/modules/stories.ts b/code/core/src/manager-api/modules/stories.ts
similarity index 99%
rename from code/lib/manager-api/src/modules/stories.ts
rename to code/core/src/manager-api/modules/stories.ts
index 19ea80ce41f4..23edae60ad95 100644
--- a/code/lib/manager-api/src/modules/stories.ts
+++ b/code/core/src/manager-api/modules/stories.ts
@@ -22,7 +22,7 @@ import type {
API_StatusState,
API_StatusUpdate,
API_FilterFunction,
-} from '@storybook/types';
+} from '@storybook/core/types';
import {
PRELOAD_ENTRIES,
STORY_PREPARED,
@@ -41,8 +41,8 @@ import {
DOCS_PREPARED,
SET_CURRENT_STORY,
SET_CONFIG,
-} from '@storybook/core-events';
-import { logger } from '@storybook/client-logger';
+} from '@storybook/core/core-events';
+import { logger } from '@storybook/core/client-logger';
import { getEventMetadata } from '../lib/events';
@@ -54,7 +54,7 @@ import {
addPreparedStories,
} from '../lib/stories';
-import type { ComposedRef } from '../index';
+import type { ComposedRef } from '../root';
import type { ModuleFn } from '../lib/types';
const { fetch } = global;
diff --git a/code/lib/manager-api/src/modules/url.ts b/code/core/src/manager-api/modules/url.ts
similarity index 96%
rename from code/lib/manager-api/src/modules/url.ts
rename to code/core/src/manager-api/modules/url.ts
index 8896ab272899..2ad7a340839d 100644
--- a/code/lib/manager-api/src/modules/url.ts
+++ b/code/core/src/manager-api/modules/url.ts
@@ -4,13 +4,13 @@ import {
SET_CURRENT_STORY,
GLOBALS_UPDATED,
UPDATE_QUERY_PARAMS,
-} from '@storybook/core-events';
-import type { NavigateOptions } from '@storybook/router';
-import { queryFromLocation, buildArgsParam } from '@storybook/router';
+} from '@storybook/core/core-events';
+import type { NavigateOptions } from '@storybook/core/router';
+import { queryFromLocation, buildArgsParam } from '@storybook/core/router';
import { dequal as deepEqual } from 'dequal';
import { global } from '@storybook/global';
-import type { API_Layout, API_UI, Args } from '@storybook/types';
+import type { API_Layout, API_UI, Args } from '@storybook/core/types';
import type { ModuleArgs, ModuleFn } from '../lib/types';
import { defaultLayoutState } from './layout';
diff --git a/code/lib/manager-api/src/modules/versions.ts b/code/core/src/manager-api/modules/versions.ts
similarity index 99%
rename from code/lib/manager-api/src/modules/versions.ts
rename to code/core/src/manager-api/modules/versions.ts
index 8305523f2f0d..16015cde837d 100644
--- a/code/lib/manager-api/src/modules/versions.ts
+++ b/code/core/src/manager-api/modules/versions.ts
@@ -2,7 +2,7 @@ import { global } from '@storybook/global';
import semver from 'semver';
import memoize from 'memoizerific';
-import type { API_UnknownEntries, API_Version, API_Versions } from '@storybook/types';
+import type { API_UnknownEntries, API_Version, API_Versions } from '@storybook/core/types';
import { version as currentVersion } from '../version';
import type { ModuleFn } from '../lib/types';
diff --git a/code/lib/manager-api/src/modules/whatsnew.tsx b/code/core/src/manager-api/modules/whatsnew.tsx
similarity index 93%
rename from code/lib/manager-api/src/modules/whatsnew.tsx
rename to code/core/src/manager-api/modules/whatsnew.tsx
index abdda88d6b10..71e6b9e03d85 100644
--- a/code/lib/manager-api/src/modules/whatsnew.tsx
+++ b/code/core/src/manager-api/modules/whatsnew.tsx
@@ -1,12 +1,12 @@
import React from 'react';
import { global } from '@storybook/global';
-import type { WhatsNewCache, WhatsNewData } from '@storybook/core-events';
+import type { WhatsNewCache, WhatsNewData } from '@storybook/core/core-events';
import {
REQUEST_WHATS_NEW_DATA,
RESULT_WHATS_NEW_DATA,
SET_WHATS_NEW_CACHE,
TOGGLE_WHATS_NEW_NOTIFICATIONS,
-} from '@storybook/core-events';
+} from '@storybook/core/core-events';
import type { ModuleFn } from '../lib/types';
import { StorybookIcon } from '@storybook/icons';
@@ -59,11 +59,10 @@ export const init: ModuleFn = ({ fullAPI, store, provider }) => {
function getLatestWhatsNewPost(): Promise {
provider.channel?.emit(REQUEST_WHATS_NEW_DATA);
- return new Promise(
- (resolve) =>
- provider.channel?.once(RESULT_WHATS_NEW_DATA, ({ data }: { data: WhatsNewData }) =>
- resolve(data)
- )
+ return new Promise((resolve) =>
+ provider.channel?.once(RESULT_WHATS_NEW_DATA, ({ data }: { data: WhatsNewData }) =>
+ resolve(data)
+ )
);
}
diff --git a/code/lib/manager-api/src/index.tsx b/code/core/src/manager-api/root.tsx
similarity index 98%
rename from code/lib/manager-api/src/index.tsx
rename to code/core/src/manager-api/root.tsx
index 4e946fa5d618..e77e2eef9bc1 100644
--- a/code/lib/manager-api/src/index.tsx
+++ b/code/core/src/manager-api/root.tsx
@@ -28,17 +28,17 @@ import type {
API_StoryEntry,
Parameters,
StoryId,
-} from '@storybook/types';
+} from '@storybook/core/types';
import {
STORY_CHANGED,
SHARED_STATE_CHANGED,
SHARED_STATE_SET,
SET_STORIES,
-} from '@storybook/core-events';
-import type { RouterData } from '@storybook/router';
-import type { Listener } from '@storybook/channels';
-import { deprecate } from '@storybook/client-logger';
+} from '@storybook/core/core-events';
+import type { RouterData } from '@storybook/core/router';
+import type { Listener } from '@storybook/core/channels';
+import { deprecate } from '@storybook/core/client-logger';
import { createContext } from './context';
import type { Options } from './store';
diff --git a/code/lib/manager-api/src/shortcut.ts b/code/core/src/manager-api/shortcut.ts
similarity index 100%
rename from code/lib/manager-api/src/shortcut.ts
rename to code/core/src/manager-api/shortcut.ts
diff --git a/code/lib/manager-api/src/store.ts b/code/core/src/manager-api/store.ts
similarity index 98%
rename from code/lib/manager-api/src/store.ts
rename to code/core/src/manager-api/store.ts
index 284443e8a96a..ffb3b43dbc83 100644
--- a/code/lib/manager-api/src/store.ts
+++ b/code/core/src/manager-api/store.ts
@@ -2,7 +2,7 @@ import type { StoreAPI } from 'store2';
import store from 'store2';
import storeSetup from './lib/store-setup';
-import type { State } from './index';
+import type { State } from './root';
// setting up the store, overriding set and get to use telejson
storeSetup(store._);
diff --git a/code/lib/manager-api/src/tests/addons.test.js b/code/core/src/manager-api/tests/addons.test.js
similarity index 97%
rename from code/lib/manager-api/src/tests/addons.test.js
rename to code/core/src/manager-api/tests/addons.test.js
index b30cff92a7e7..8d0928d9f82d 100644
--- a/code/lib/manager-api/src/tests/addons.test.js
+++ b/code/core/src/manager-api/tests/addons.test.js
@@ -1,5 +1,5 @@
import { describe, it, expect, vi } from 'vitest';
-import { Addon_TypesEnum as types } from '@storybook/types';
+import { Addon_TypesEnum as types } from '@storybook/core/types';
import { init as initAddons } from '../modules/addons';
const PANELS = {
diff --git a/code/lib/manager-api/src/tests/events.test.ts b/code/core/src/manager-api/tests/events.test.ts
similarity index 97%
rename from code/lib/manager-api/src/tests/events.test.ts
rename to code/core/src/manager-api/tests/events.test.ts
index cd0ec857297c..ac0c4ed7887f 100644
--- a/code/lib/manager-api/src/tests/events.test.ts
+++ b/code/core/src/manager-api/tests/events.test.ts
@@ -1,6 +1,6 @@
import { describe, it, expect, vi } from 'vitest';
import { getEventMetadata } from '../lib/events';
-import type { API } from '../index';
+import type { API } from '../root';
vi.mock('@storybook/global', () => ({
global: {
diff --git a/code/lib/manager-api/src/tests/globals.test.ts b/code/core/src/manager-api/tests/globals.test.ts
similarity index 94%
rename from code/lib/manager-api/src/tests/globals.test.ts
rename to code/core/src/manager-api/tests/globals.test.ts
index 26574fed38c1..48ad8b854179 100644
--- a/code/lib/manager-api/src/tests/globals.test.ts
+++ b/code/core/src/manager-api/tests/globals.test.ts
@@ -1,9 +1,14 @@
import { describe, beforeEach, it, expect, vi } from 'vitest';
import { EventEmitter } from 'events';
-import { SET_STORIES, SET_GLOBALS, UPDATE_GLOBALS, GLOBALS_UPDATED } from '@storybook/core-events';
-
-import { logger as _logger } from '@storybook/client-logger';
-import type { API } from '../index';
+import {
+ SET_STORIES,
+ SET_GLOBALS,
+ UPDATE_GLOBALS,
+ GLOBALS_UPDATED,
+} from '@storybook/core/core-events';
+
+import { logger as _logger } from '@storybook/core/client-logger';
+import type { API } from '../root';
import type { SubAPI } from '../modules/globals';
import { init as initModule } from '../modules/globals';
import type { ModuleArgs } from '../lib/types';
@@ -13,7 +18,7 @@ import { getEventMetadata as _getEventData } from '../lib/events';
const getEventMetadata = vi.mocked(_getEventData, true);
const logger = vi.mocked(_logger, true);
-vi.mock('@storybook/client-logger');
+vi.mock('@storybook/core/client-logger');
vi.mock('../lib/events');
beforeEach(() => {
getEventMetadata.mockReset().mockReturnValue({ sourceType: 'local' } as any);
diff --git a/code/lib/manager-api/src/tests/layout.test.ts b/code/core/src/manager-api/tests/layout.test.ts
similarity index 98%
rename from code/lib/manager-api/src/tests/layout.test.ts
rename to code/core/src/manager-api/tests/layout.test.ts
index 1c537ab504f5..ab31a75502ab 100644
--- a/code/lib/manager-api/src/tests/layout.test.ts
+++ b/code/core/src/manager-api/tests/layout.test.ts
@@ -1,14 +1,14 @@
import type { Mock } from 'vitest';
import { expect, describe, beforeEach, it, vi } from 'vitest';
-import { themes } from '@storybook/theming';
-import type { API_Provider } from 'lib/types/src';
+import { themes } from '@storybook/core/theming';
+import type { API_Provider } from '@storybook/core/types';
import EventEmitter from 'events';
import type { SubAPI, SubState } from '../modules/layout';
import type { SubState as AddonsSubState } from '../modules/addons';
import { defaultLayoutState, init as initLayout } from '../modules/layout';
import type Store from '../store';
-import type { API, State } from '..';
+import type { API, State } from '../root';
import type { ModuleArgs } from '../lib/types';
describe('layout API', () => {
@@ -23,7 +23,7 @@ describe('layout API', () => {
beforeEach(() => {
currentState = {
...defaultLayoutState,
- selectedPanel: 'storybook/actions/panel',
+ selectedPanel: '@storybook/core/actions/panel',
theme: themes.light,
singleStory: false,
};
@@ -471,14 +471,14 @@ describe('layout API', () => {
});
it('should set selectedPanel initially', () => {
- const panelName = 'storybook/a11y/panel';
+ const panelName = '@storybook/core/a11y/panel';
layoutApi.setOptions({ selectedPanel: panelName });
expect(getLastSetStateArgs()[0].selectedPanel).toEqual(panelName);
});
it('should change selectedPanel if it is defined in the options and is different', () => {
- const panelName = 'storybook/a11y/panel';
+ const panelName = '@storybook/core/a11y/panel';
layoutApi.setOptions({});
layoutApi.setOptions({ selectedPanel: panelName });
diff --git a/code/lib/manager-api/src/tests/mockStoriesEntries.ts b/code/core/src/manager-api/tests/mockStoriesEntries.ts
similarity index 99%
rename from code/lib/manager-api/src/tests/mockStoriesEntries.ts
rename to code/core/src/manager-api/tests/mockStoriesEntries.ts
index a820307f4ef2..0bb2df381aa6 100644
--- a/code/lib/manager-api/src/tests/mockStoriesEntries.ts
+++ b/code/core/src/manager-api/tests/mockStoriesEntries.ts
@@ -1,4 +1,4 @@
-import type { StoryIndex, API_PreparedStoryIndex } from '@storybook/types';
+import type { StoryIndex, API_PreparedStoryIndex } from '@storybook/core/types';
export const mockEntries: StoryIndex['entries'] = {
'component-a--docs': {
diff --git a/code/lib/manager-api/src/tests/notifications.test.js b/code/core/src/manager-api/tests/notifications.test.js
similarity index 100%
rename from code/lib/manager-api/src/tests/notifications.test.js
rename to code/core/src/manager-api/tests/notifications.test.js
diff --git a/code/lib/manager-api/src/tests/ref-mockdata.login-required.json b/code/core/src/manager-api/tests/ref-mockdata.login-required.json
similarity index 100%
rename from code/lib/manager-api/src/tests/ref-mockdata.login-required.json
rename to code/core/src/manager-api/tests/ref-mockdata.login-required.json
diff --git a/code/lib/manager-api/src/tests/ref-mockdata.success.json b/code/core/src/manager-api/tests/ref-mockdata.success.json
similarity index 100%
rename from code/lib/manager-api/src/tests/ref-mockdata.success.json
rename to code/core/src/manager-api/tests/ref-mockdata.success.json
diff --git a/code/lib/manager-api/src/tests/refs.test.ts b/code/core/src/manager-api/tests/refs.test.ts
similarity index 99%
rename from code/lib/manager-api/src/tests/refs.test.ts
rename to code/core/src/manager-api/tests/refs.test.ts
index 022573616835..96d2b3b8d84f 100644
--- a/code/lib/manager-api/src/tests/refs.test.ts
+++ b/code/core/src/manager-api/tests/refs.test.ts
@@ -1,7 +1,7 @@
import { describe, it, expect, vi } from 'vitest';
import { global } from '@storybook/global';
-import type { StoryIndex } from 'lib/types/src';
-import type { State } from '..';
+import type { StoryIndex } from '@storybook/core/types';
+import type { State } from '../root';
import { transformStoryIndexToStoriesHash } from '../lib/stories';
import { getSourceType, init as initRefs } from '../modules/refs';
import type Store from '../store';
diff --git a/code/lib/manager-api/src/tests/shortcut.test.js b/code/core/src/manager-api/tests/shortcut.test.js
similarity index 100%
rename from code/lib/manager-api/src/tests/shortcut.test.js
rename to code/core/src/manager-api/tests/shortcut.test.js
diff --git a/code/lib/manager-api/src/tests/shortcuts.test.js b/code/core/src/manager-api/tests/shortcuts.test.js
similarity index 100%
rename from code/lib/manager-api/src/tests/shortcuts.test.js
rename to code/core/src/manager-api/tests/shortcuts.test.js
diff --git a/code/lib/manager-api/src/tests/store.test.js b/code/core/src/manager-api/tests/store.test.js
similarity index 100%
rename from code/lib/manager-api/src/tests/store.test.js
rename to code/core/src/manager-api/tests/store.test.js
diff --git a/code/lib/manager-api/src/tests/stories.test.ts b/code/core/src/manager-api/tests/stories.test.ts
similarity index 99%
rename from code/lib/manager-api/src/tests/stories.test.ts
rename to code/core/src/manager-api/tests/stories.test.ts
index 7fe6102d0fd4..ea02cdfd464b 100644
--- a/code/lib/manager-api/src/tests/stories.test.ts
+++ b/code/core/src/manager-api/tests/stories.test.ts
@@ -13,16 +13,16 @@ import {
CURRENT_STORY_WAS_SET,
STORY_MISSING,
DOCS_PREPARED,
-} from '@storybook/core-events';
+} from '@storybook/core/core-events';
import { EventEmitter } from 'events';
import { global } from '@storybook/global';
-import type { API_StoryEntry } from '@storybook/types';
+import type { API_StoryEntry } from '@storybook/core/types';
import { getEventMetadata as getEventMetadataOriginal } from '../lib/events';
import { init as initStories } from '../modules/stories';
import type Store from '../store';
-import type { API, State } from '..';
+import type { API, State } from '../root';
import { mockEntries, docsEntries, preparedEntries, navigationEntries } from './mockStoriesEntries';
import type { ModuleArgs } from '../lib/types';
diff --git a/code/lib/manager-api/src/tests/url.test.js b/code/core/src/manager-api/tests/url.test.js
similarity index 97%
rename from code/lib/manager-api/src/tests/url.test.js
rename to code/core/src/manager-api/tests/url.test.js
index 817cb118ff41..53946d7ab6b9 100644
--- a/code/lib/manager-api/src/tests/url.test.js
+++ b/code/core/src/manager-api/tests/url.test.js
@@ -1,11 +1,15 @@
import { describe, beforeEach, it, expect, vi } from 'vitest';
-import { SET_CURRENT_STORY, GLOBALS_UPDATED, UPDATE_QUERY_PARAMS } from '@storybook/core-events';
+import {
+ SET_CURRENT_STORY,
+ GLOBALS_UPDATED,
+ UPDATE_QUERY_PARAMS,
+} from '@storybook/core/core-events';
import EventEmitter from 'events';
import { init as initURL } from '../modules/url';
-vi.mock('@storybook/client-logger');
+vi.mock('@storybook/core/client-logger');
vi.useFakeTimers();
describe('initial state', () => {
diff --git a/code/lib/manager-api/src/tests/versions.test.js b/code/core/src/manager-api/tests/versions.test.js
similarity index 99%
rename from code/lib/manager-api/src/tests/versions.test.js
rename to code/core/src/manager-api/tests/versions.test.js
index fbd29142b8d0..4ed44dc50595 100644
--- a/code/lib/manager-api/src/tests/versions.test.js
+++ b/code/core/src/manager-api/tests/versions.test.js
@@ -24,7 +24,7 @@ vi.mock('@storybook/global', () => ({
},
}));
-vi.mock('@storybook/client-logger');
+vi.mock('@storybook/core/client-logger');
function createMockStore() {
let state = {
@@ -45,7 +45,7 @@ function createMockStore() {
};
}
-vi.mock('@storybook/client-logger');
+vi.mock('@storybook/core/client-logger');
describe('versions API', () => {
it('sets initial state with current version', async () => {
diff --git a/code/lib/manager-api/src/typings.d.ts b/code/core/src/manager-api/typings.d.ts
similarity index 75%
rename from code/lib/manager-api/src/typings.d.ts
rename to code/core/src/manager-api/typings.d.ts
index afbe02b0417f..2aa4cc366704 100644
--- a/code/lib/manager-api/src/typings.d.ts
+++ b/code/core/src/manager-api/typings.d.ts
@@ -2,8 +2,8 @@
declare var __STORYBOOK_ADDONS_MANAGER: any;
declare var CONFIG_TYPE: string;
-declare var FEATURES: import('@storybook/types').StorybookConfigRaw['features'];
-declare var TAGS_OPTIONS: import('@storybook/types').StorybookConfigRaw['tags'];
+declare var FEATURES: import('@storybook/core/types').StorybookConfigRaw['features'];
+declare var TAGS_OPTIONS: import('@storybook/core/types').StorybookConfigRaw['tags'];
declare var REFS: any;
declare var VERSIONCHECK: any;
declare var LOGLEVEL: 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent' | undefined;
diff --git a/code/lib/manager-api/src/version.ts b/code/core/src/manager-api/version.ts
similarity index 100%
rename from code/lib/manager-api/src/version.ts
rename to code/core/src/manager-api/version.ts
diff --git a/code/lib/core-events/src/errors/manager-errors.ts b/code/core/src/manager-errors.ts
similarity index 100%
rename from code/lib/core-events/src/errors/manager-errors.ts
rename to code/core/src/manager-errors.ts
diff --git a/code/ui/manager/src/App.tsx b/code/core/src/manager/App.tsx
similarity index 90%
rename from code/ui/manager/src/App.tsx
rename to code/core/src/manager/App.tsx
index 7ec337525c10..c4679ffe43ca 100644
--- a/code/ui/manager/src/App.tsx
+++ b/code/core/src/manager/App.tsx
@@ -1,7 +1,7 @@
import type { ComponentProps } from 'react';
import React from 'react';
-import { Global, createGlobal } from '@storybook/theming';
-import type { Addon_PageType } from '@storybook/types';
+import { Global, createGlobal } from '@storybook/core/theming';
+import type { Addon_PageType } from '@storybook/core/types';
import Sidebar from './container/Sidebar';
import Preview from './container/Preview';
import Panel from './container/Panel';
diff --git a/code/ui/manager/src/FakeProvider.tsx b/code/core/src/manager/FakeProvider.tsx
similarity index 92%
rename from code/ui/manager/src/FakeProvider.tsx
rename to code/core/src/manager/FakeProvider.tsx
index e94773404356..397a91b86a62 100644
--- a/code/ui/manager/src/FakeProvider.tsx
+++ b/code/core/src/manager/FakeProvider.tsx
@@ -1,6 +1,6 @@
import React from 'react';
-import { styled } from '@storybook/theming';
-import { addons } from '@storybook/manager-api';
+import { styled } from '@storybook/core/theming';
+import { addons } from '@storybook/core/manager-api';
import Provider from './provider';
export class FakeProvider extends Provider {
diff --git a/code/ui/manager/README.md b/code/core/src/manager/README.md
similarity index 100%
rename from code/ui/manager/README.md
rename to code/core/src/manager/README.md
diff --git a/code/ui/manager/src/__tests__/index.test.ts b/code/core/src/manager/__tests__/index.test.ts
similarity index 92%
rename from code/ui/manager/src/__tests__/index.test.ts
rename to code/core/src/manager/__tests__/index.test.ts
index 18224d4c10b9..ce85a45e293b 100644
--- a/code/ui/manager/src/__tests__/index.test.ts
+++ b/code/core/src/manager/__tests__/index.test.ts
@@ -1,3 +1,5 @@
+// @vitest-environment happy-dom
+
import { describe, it, expect } from 'vitest';
import { renderStorybookUI } from '..';
diff --git a/code/ui/manager/src/components/hooks/useMedia.tsx b/code/core/src/manager/components/hooks/useMedia.tsx
similarity index 100%
rename from code/ui/manager/src/components/hooks/useMedia.tsx
rename to code/core/src/manager/components/hooks/useMedia.tsx
diff --git a/code/ui/manager/src/components/layout/Layout.stories.tsx b/code/core/src/manager/components/layout/Layout.stories.tsx
similarity index 96%
rename from code/ui/manager/src/components/layout/Layout.stories.tsx
rename to code/core/src/manager/components/layout/Layout.stories.tsx
index 6c291c5f2fe8..53f8e54b0d15 100644
--- a/code/ui/manager/src/components/layout/Layout.stories.tsx
+++ b/code/core/src/manager/components/layout/Layout.stories.tsx
@@ -2,12 +2,12 @@ import { action } from '@storybook/addon-actions';
import type { FC, PropsWithChildren } from 'react';
import React, { useState } from 'react';
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import type { Meta, StoryObj } from '@storybook/react';
import { fn } from '@storybook/test';
import { Layout } from './Layout';
import { LayoutProvider } from './LayoutProvider';
-import { LocationProvider } from '@storybook/router';
+import { LocationProvider } from '@storybook/core/router';
import MobileNavigationStoriesMeta from '../mobile/navigation/MobileNavigation.stories';
const PlaceholderBlock = styled.div({
diff --git a/code/ui/manager/src/components/layout/Layout.tsx b/code/core/src/manager/components/layout/Layout.tsx
similarity index 96%
rename from code/ui/manager/src/components/layout/Layout.tsx
rename to code/core/src/manager/components/layout/Layout.tsx
index 3df7a5900dfb..82e6b532c9ae 100644
--- a/code/ui/manager/src/components/layout/Layout.tsx
+++ b/code/core/src/manager/components/layout/Layout.tsx
@@ -1,12 +1,12 @@
import React, { useEffect, useLayoutEffect, useState } from 'react';
-import { styled } from '@storybook/theming';
-import type { API_Layout, API_ViewMode } from '@storybook/types';
+import { styled } from '@storybook/core/theming';
+import type { API_Layout, API_ViewMode } from '@storybook/core/types';
import { useDragging } from './useDragging';
import { MobileNavigation } from '../mobile/navigation/MobileNavigation';
import { MEDIA_DESKTOP_BREAKPOINT } from '../../constants';
import { useLayout } from './LayoutProvider';
import { Notifications } from '../../container/Notifications';
-import { Match } from '@storybook/router';
+import { Match } from '@storybook/core/router';
interface InternalLayoutState {
isDragging: boolean;
@@ -245,8 +245,8 @@ const PanelContainer = styled.div<{ position: LayoutState['panelPosition'] }>(
gridArea: 'panel',
position: 'relative',
backgroundColor: theme.background.content,
- borderTop: position === 'bottom' ? `1px solid ${theme.color.border}` : null,
- borderLeft: position === 'right' ? `1px solid ${theme.color.border}` : null,
+ borderTop: position === 'bottom' ? `1px solid ${theme.color.border}` : undefined,
+ borderLeft: position === 'right' ? `1px solid ${theme.color.border}` : undefined,
})
);
@@ -268,13 +268,13 @@ const Drag = styled.div<{ orientation?: 'horizontal' | 'vertical'; position?: 'l
},
}),
({ orientation = 'vertical', position = 'left' }) => {
- if (orientation === 'vertical')
+ if (orientation === 'vertical') {
return {
width: position === 'left' ? 10 : 13,
height: '100%',
top: 0,
- right: position === 'left' ? '-7px' : null,
- left: position === 'right' ? '-7px' : null,
+ right: position === 'left' ? '-7px' : undefined,
+ left: position === 'right' ? '-7px' : undefined,
'&:after': {
width: 1,
@@ -286,6 +286,7 @@ const Drag = styled.div<{ orientation?: 'horizontal' | 'vertical'; position?: 'l
cursor: 'col-resize',
},
};
+ }
return {
width: '100%',
height: '13px',
diff --git a/code/ui/manager/src/components/layout/LayoutProvider.tsx b/code/core/src/manager/components/layout/LayoutProvider.tsx
similarity index 100%
rename from code/ui/manager/src/components/layout/LayoutProvider.tsx
rename to code/core/src/manager/components/layout/LayoutProvider.tsx
diff --git a/code/ui/manager/src/components/layout/useDragging.ts b/code/core/src/manager/components/layout/useDragging.ts
similarity index 95%
rename from code/ui/manager/src/components/layout/useDragging.ts
rename to code/core/src/manager/components/layout/useDragging.ts
index 6fe01bd7567e..4711354153b3 100644
--- a/code/ui/manager/src/components/layout/useDragging.ts
+++ b/code/core/src/manager/components/layout/useDragging.ts
@@ -128,6 +128,7 @@ export function useDragging({
}
return {
...state,
+ // @ts-expect-error (non strict)
navSize: clamp(sidebarDragX, 0, e.view.innerWidth),
};
}
@@ -136,8 +137,10 @@ export function useDragging({
state.panelPosition === 'bottom' ? 'bottomPanelHeight' : 'rightPanelWidth';
const panelDragSize =
state.panelPosition === 'bottom'
- ? e.view.innerHeight - e.clientY
- : e.view.innerWidth - e.clientX;
+ ? // @ts-expect-error (non strict)
+ e.view.innerHeight - e.clientY
+ : // @ts-expect-error (non strict)
+ e.view.innerWidth - e.clientX;
if (panelDragSize === state[sizeAxisState]) {
return state;
@@ -161,6 +164,7 @@ export function useDragging({
}
const sizeAxisMax =
+ // @ts-expect-error (non strict)
state.panelPosition === 'bottom' ? e.view.innerHeight : e.view.innerWidth;
return {
...state,
diff --git a/code/ui/manager/src/components/mobile/about/MobileAbout.stories.tsx b/code/core/src/manager/components/mobile/about/MobileAbout.stories.tsx
similarity index 96%
rename from code/ui/manager/src/components/mobile/about/MobileAbout.stories.tsx
rename to code/core/src/manager/components/mobile/about/MobileAbout.stories.tsx
index b36e2e0854f7..465db469cde9 100644
--- a/code/ui/manager/src/components/mobile/about/MobileAbout.stories.tsx
+++ b/code/core/src/manager/components/mobile/about/MobileAbout.stories.tsx
@@ -1,5 +1,5 @@
import type { Meta, StoryObj } from '@storybook/react';
-import { ManagerContext } from '@storybook/manager-api';
+import { ManagerContext } from '@storybook/core/manager-api';
import React, { useEffect } from 'react';
import { within } from '@storybook/test';
import { MobileAbout } from './MobileAbout';
diff --git a/code/ui/manager/src/components/mobile/about/MobileAbout.tsx b/code/core/src/manager/components/mobile/about/MobileAbout.tsx
similarity index 97%
rename from code/ui/manager/src/components/mobile/about/MobileAbout.tsx
rename to code/core/src/manager/components/mobile/about/MobileAbout.tsx
index 08103b877083..2b65bf59c5a0 100644
--- a/code/ui/manager/src/components/mobile/about/MobileAbout.tsx
+++ b/code/core/src/manager/components/mobile/about/MobileAbout.tsx
@@ -1,8 +1,8 @@
import type { FC } from 'react';
import React, { useRef } from 'react';
import { Transition, type TransitionStatus } from 'react-transition-group';
-import { styled } from '@storybook/theming';
-import { Link } from '@storybook/components';
+import { styled } from '@storybook/core/theming';
+import { Link } from '@storybook/core/components';
import { ArrowLeftIcon, GithubIcon, ShareAltIcon, StorybookIcon } from '@storybook/icons';
import { UpgradeBlock } from '../../upgrade/UpgradeBlock';
import { MOBILE_TRANSITION_DURATION } from '../../../constants';
diff --git a/code/ui/manager/src/components/mobile/navigation/MobileAddonsDrawer.tsx b/code/core/src/manager/components/mobile/navigation/MobileAddonsDrawer.tsx
similarity index 90%
rename from code/ui/manager/src/components/mobile/navigation/MobileAddonsDrawer.tsx
rename to code/core/src/manager/components/mobile/navigation/MobileAddonsDrawer.tsx
index 7c0027d610bc..b17ec5e55c5e 100644
--- a/code/ui/manager/src/components/mobile/navigation/MobileAddonsDrawer.tsx
+++ b/code/core/src/manager/components/mobile/navigation/MobileAddonsDrawer.tsx
@@ -1,6 +1,6 @@
import type { FC, ReactNode } from 'react';
import React from 'react';
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
interface MobileAddonsDrawerProps {
children: ReactNode;
diff --git a/code/ui/manager/src/components/mobile/navigation/MobileMenuDrawer.tsx b/code/core/src/manager/components/mobile/navigation/MobileMenuDrawer.tsx
similarity index 98%
rename from code/ui/manager/src/components/mobile/navigation/MobileMenuDrawer.tsx
rename to code/core/src/manager/components/mobile/navigation/MobileMenuDrawer.tsx
index bd3d0cf46f25..8c3ac21152b6 100644
--- a/code/ui/manager/src/components/mobile/navigation/MobileMenuDrawer.tsx
+++ b/code/core/src/manager/components/mobile/navigation/MobileMenuDrawer.tsx
@@ -1,6 +1,6 @@
import type { FC } from 'react';
import React, { useRef } from 'react';
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import { Transition } from 'react-transition-group';
import type { TransitionStatus } from 'react-transition-group/Transition';
import { MobileAbout } from '../about/MobileAbout';
diff --git a/code/ui/manager/src/components/mobile/navigation/MobileNavigation.stories.tsx b/code/core/src/manager/components/mobile/navigation/MobileNavigation.stories.tsx
similarity index 96%
rename from code/ui/manager/src/components/mobile/navigation/MobileNavigation.stories.tsx
rename to code/core/src/manager/components/mobile/navigation/MobileNavigation.stories.tsx
index 8978534f6890..b67bf15a3e62 100644
--- a/code/ui/manager/src/components/mobile/navigation/MobileNavigation.stories.tsx
+++ b/code/core/src/manager/components/mobile/navigation/MobileNavigation.stories.tsx
@@ -1,6 +1,6 @@
import type { Meta, StoryObj } from '@storybook/react';
import React from 'react';
-import { ManagerContext } from '@storybook/manager-api';
+import { ManagerContext } from '@storybook/core/manager-api';
import { within } from '@storybook/test';
import { startCase } from 'lodash';
import { MobileNavigation } from './MobileNavigation';
@@ -143,6 +143,7 @@ export const MenuOpen: Story = {
export const MenuClosed: Story = {
play: async (context) => {
+ // @ts-expect-error (non strict)
await MenuOpen.play(context);
await new Promise((resolve) => setTimeout(resolve, 500));
const overlay = await within(context.canvasElement).getByLabelText('Close navigation menu');
@@ -159,6 +160,7 @@ export const PanelOpen: Story = {
export const PanelClosed: Story = {
play: async (context) => {
+ // @ts-expect-error (non strict)
await PanelOpen.play(context);
await new Promise((resolve) => setTimeout(resolve, 500));
const closeButton = await within(context.canvasElement).getByTitle('Close addon panel');
diff --git a/code/ui/manager/src/components/mobile/navigation/MobileNavigation.tsx b/code/core/src/manager/components/mobile/navigation/MobileNavigation.tsx
similarity index 90%
rename from code/ui/manager/src/components/mobile/navigation/MobileNavigation.tsx
rename to code/core/src/manager/components/mobile/navigation/MobileNavigation.tsx
index ee3b8aa1a00d..963c56360f19 100644
--- a/code/ui/manager/src/components/mobile/navigation/MobileNavigation.tsx
+++ b/code/core/src/manager/components/mobile/navigation/MobileNavigation.tsx
@@ -1,8 +1,8 @@
import type { FC } from 'react';
import React from 'react';
-import { styled } from '@storybook/theming';
-import { IconButton } from '@storybook/components';
-import { useStorybookApi, useStorybookState } from '@storybook/manager-api';
+import { styled } from '@storybook/core/theming';
+import { IconButton } from '@storybook/core/components';
+import { useStorybookApi, useStorybookState } from '@storybook/core/manager-api';
import { BottomBarToggleIcon, MenuIcon } from '@storybook/icons';
import { MobileMenuDrawer } from './MobileMenuDrawer';
import { MobileAddonsDrawer } from './MobileAddonsDrawer';
@@ -25,9 +25,12 @@ const useFullStoryName = () => {
if (!currentStory) return '';
let fullStoryName = currentStory.renderLabel?.(currentStory, api) || currentStory.name;
+ // @ts-expect-error (non strict)
let node = index[currentStory.id];
+ // @ts-expect-error (non strict)
while ('parent' in node && node.parent && index[node.parent] && fullStoryName.length < 24) {
+ // @ts-expect-error (non strict)
node = index[node.parent];
const parentName = node.renderLabel?.(node, api) || node.name;
fullStoryName = `${parentName}/${fullStoryName}`;
diff --git a/code/ui/manager/src/components/notifications/NotificationItem.stories.tsx b/code/core/src/manager/components/notifications/NotificationItem.stories.tsx
similarity index 99%
rename from code/ui/manager/src/components/notifications/NotificationItem.stories.tsx
rename to code/core/src/manager/components/notifications/NotificationItem.stories.tsx
index 5ed3ee4b25cc..93588e4a5353 100644
--- a/code/ui/manager/src/components/notifications/NotificationItem.stories.tsx
+++ b/code/core/src/manager/components/notifications/NotificationItem.stories.tsx
@@ -1,6 +1,6 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
-import { LocationProvider } from '@storybook/router';
+import { LocationProvider } from '@storybook/core/router';
import type { Meta, StoryObj } from '@storybook/react';
import NotificationItem from './NotificationItem';
import {
diff --git a/code/ui/manager/src/components/notifications/NotificationItem.tsx b/code/core/src/manager/components/notifications/NotificationItem.tsx
similarity index 93%
rename from code/ui/manager/src/components/notifications/NotificationItem.tsx
rename to code/core/src/manager/components/notifications/NotificationItem.tsx
index f8e44fcd3660..b4450acafdc7 100644
--- a/code/ui/manager/src/components/notifications/NotificationItem.tsx
+++ b/code/core/src/manager/components/notifications/NotificationItem.tsx
@@ -1,10 +1,10 @@
import type { FC, SyntheticEvent } from 'react';
import React, { useCallback, useEffect, useRef } from 'react';
-import { type State } from '@storybook/manager-api';
-import { Link } from '@storybook/router';
-import { keyframes, styled, useTheme } from '@storybook/theming';
-import type { IconsProps } from '@storybook/components';
-import { IconButton, Icons } from '@storybook/components';
+import { type State } from '@storybook/core/manager-api';
+import { Link } from '@storybook/core/router';
+import { keyframes, styled, useTheme } from '@storybook/core/theming';
+import type { IconsProps } from '@storybook/core/components';
+import { IconButton, Icons } from '@storybook/core/components';
import { transparentize } from 'polished';
import { CloseAltIcon } from '@storybook/icons';
@@ -187,14 +187,16 @@ const NotificationItem: FC<{
if (onClear) onClear({ dismissed: false, timeout: true });
}, [onDismissNotification, onClear]);
- const timer = useRef(null);
+ const timer = useRef | null>(null);
useEffect(() => {
if (!duration) return;
timer.current = setTimeout(onTimeout, duration);
+ // @ts-expect-error (non strict)
return () => clearTimeout(timer.current);
}, [duration, onTimeout]);
const onDismiss = useCallback(() => {
+ // @ts-expect-error (non strict)
clearTimeout(timer.current);
onDismissNotification(id);
if (onClear) onClear({ dismissed: true, timeout: false });
diff --git a/code/ui/manager/src/components/notifications/NotificationList.stories.tsx b/code/core/src/manager/components/notifications/NotificationList.stories.tsx
similarity index 95%
rename from code/ui/manager/src/components/notifications/NotificationList.stories.tsx
rename to code/core/src/manager/components/notifications/NotificationList.stories.tsx
index e75c77965b03..d2842e5eb872 100644
--- a/code/ui/manager/src/components/notifications/NotificationList.stories.tsx
+++ b/code/core/src/manager/components/notifications/NotificationList.stories.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import { LocationProvider } from '@storybook/router';
+import { LocationProvider } from '@storybook/core/router';
import type { Meta, StoryObj } from '@storybook/react';
import { NotificationList } from './NotificationList';
diff --git a/code/ui/manager/src/components/notifications/NotificationList.tsx b/code/core/src/manager/components/notifications/NotificationList.tsx
similarity index 85%
rename from code/ui/manager/src/components/notifications/NotificationList.tsx
rename to code/core/src/manager/components/notifications/NotificationList.tsx
index d16942d57f0c..604ed50c5101 100644
--- a/code/ui/manager/src/components/notifications/NotificationList.tsx
+++ b/code/core/src/manager/components/notifications/NotificationList.tsx
@@ -1,8 +1,8 @@
import type { FC } from 'react';
import React from 'react';
-import type { State } from '@storybook/manager-api';
-import { styled } from '@storybook/theming';
-import type { CSSObject } from '@storybook/theming';
+import type { State } from '@storybook/core/manager-api';
+import { styled } from '@storybook/core/theming';
+import type { CSSObject } from '@storybook/core/theming';
import NotificationItem from './NotificationItem';
import { MEDIA_DESKTOP_BREAKPOINT } from '../../constants';
diff --git a/code/ui/manager/src/components/panel/Panel.stories.tsx b/code/core/src/manager/components/panel/Panel.stories.tsx
similarity index 95%
rename from code/ui/manager/src/components/panel/Panel.stories.tsx
rename to code/core/src/manager/components/panel/Panel.stories.tsx
index e4f5c8ed493e..7b6691c314cd 100644
--- a/code/ui/manager/src/components/panel/Panel.stories.tsx
+++ b/code/core/src/manager/components/panel/Panel.stories.tsx
@@ -1,9 +1,9 @@
import type { EventHandler, FocusEvent, MouseEvent } from 'react';
import React, { useCallback, useRef, useState } from 'react';
import { action } from '@storybook/addon-actions';
-import { Badge, Spaced } from '@storybook/components';
-import type { Addon_BaseType, Addon_Collection } from '@storybook/types';
-import { Addon_TypesEnum } from '@storybook/types';
+import { Badge, Spaced } from '@storybook/core/components';
+import type { Addon_BaseType, Addon_Collection } from '@storybook/core/types';
+import { Addon_TypesEnum } from '@storybook/core/types';
import { BellIcon } from '@storybook/icons';
import { AddonPanel } from './Panel';
import { defaultShortcuts } from '../../settings/defaultShortcuts';
@@ -90,9 +90,11 @@ export const JSXTitles = () => {
if (timer.current) {
return;
}
+ // @ts-expect-error (non strict)
timer.current = setInterval(() => {
setCount((c) => {
if (c === MAX) {
+ // @ts-expect-error (non strict)
clearInterval(timer.current);
timer.current = null;
return c;
diff --git a/code/ui/manager/src/components/panel/Panel.tsx b/code/core/src/manager/components/panel/Panel.tsx
similarity index 93%
rename from code/ui/manager/src/components/panel/Panel.tsx
rename to code/core/src/manager/components/panel/Panel.tsx
index 654ea6653849..dad5d7f9b85d 100644
--- a/code/ui/manager/src/components/panel/Panel.tsx
+++ b/code/core/src/manager/components/panel/Panel.tsx
@@ -1,9 +1,9 @@
import React, { Component } from 'react';
-import { Tabs, IconButton, Link, EmptyTabContent } from '@storybook/components';
-import type { State } from '@storybook/manager-api';
-import { shortcutToHumanString } from '@storybook/manager-api';
-import type { Addon_BaseType } from '@storybook/types';
-import { styled } from '@storybook/theming';
+import { Tabs, IconButton, Link, EmptyTabContent } from '@storybook/core/components';
+import type { State } from '@storybook/core/manager-api';
+import { shortcutToHumanString } from '@storybook/core/manager-api';
+import type { Addon_BaseType } from '@storybook/core/types';
+import { styled } from '@storybook/core/theming';
import { BottomBarIcon, CloseIcon, DocumentIcon, SidebarAltIcon } from '@storybook/icons';
import { useLayout } from '../layout/LayoutProvider';
diff --git a/code/ui/manager/src/components/preview/FramesRenderer.tsx b/code/core/src/manager/components/preview/FramesRenderer.tsx
similarity index 91%
rename from code/ui/manager/src/components/preview/FramesRenderer.tsx
rename to code/core/src/manager/components/preview/FramesRenderer.tsx
index a1a89a9e5041..ecf627be9df9 100644
--- a/code/ui/manager/src/components/preview/FramesRenderer.tsx
+++ b/code/core/src/manager/components/preview/FramesRenderer.tsx
@@ -1,10 +1,10 @@
import type { FC } from 'react';
import React, { useRef, Fragment } from 'react';
-import type { Combo } from '@storybook/manager-api';
-import { Consumer } from '@storybook/manager-api';
-import { Button, getStoryHref } from '@storybook/components';
-import { Global, styled } from '@storybook/theming';
-import type { CSSObject } from '@storybook/theming';
+import type { Combo } from '@storybook/core/manager-api';
+import { Consumer } from '@storybook/core/manager-api';
+import { Button, getStoryHref } from '@storybook/core/components';
+import { Global, styled } from '@storybook/core/theming';
+import type { CSSObject } from '@storybook/core/theming';
import { IFrame } from './Iframe';
import type { FramesRendererProps } from './utils/types';
import { stringifyQueryParams } from './utils/stringifyQueryParams';
diff --git a/code/ui/manager/src/components/preview/Iframe.stories.tsx b/code/core/src/manager/components/preview/Iframe.stories.tsx
similarity index 100%
rename from code/ui/manager/src/components/preview/Iframe.stories.tsx
rename to code/core/src/manager/components/preview/Iframe.stories.tsx
diff --git a/code/ui/manager/src/components/preview/Iframe.tsx b/code/core/src/manager/components/preview/Iframe.tsx
similarity index 92%
rename from code/ui/manager/src/components/preview/Iframe.tsx
rename to code/core/src/manager/components/preview/Iframe.tsx
index 5cc5e1f94b21..e7f0df251147 100644
--- a/code/ui/manager/src/components/preview/Iframe.tsx
+++ b/code/core/src/manager/components/preview/Iframe.tsx
@@ -1,7 +1,7 @@
import type { IframeHTMLAttributes } from 'react';
import React from 'react';
-import { styled } from '@storybook/theming';
-import { Zoom } from '@storybook/components';
+import { styled } from '@storybook/core/theming';
+import { Zoom } from '@storybook/core/components';
const StyledIframe = styled.iframe(({ theme }) => ({
backgroundColor: theme.background.preview,
diff --git a/code/ui/manager/src/components/preview/Preview.tsx b/code/core/src/manager/components/preview/Preview.tsx
similarity index 95%
rename from code/ui/manager/src/components/preview/Preview.tsx
rename to code/core/src/manager/components/preview/Preview.tsx
index 49c77ba6a125..2350b58f1b3f 100644
--- a/code/ui/manager/src/components/preview/Preview.tsx
+++ b/code/core/src/manager/components/preview/Preview.tsx
@@ -3,11 +3,11 @@ import React, { Fragment, useEffect, useRef, useState } from 'react';
import { Helmet } from 'react-helmet-async';
import { global } from '@storybook/global';
-import { Consumer, type Combo, merge, addons, types } from '@storybook/manager-api';
-import type { Addon_BaseType, Addon_WrapperType } from '@storybook/types';
-import { PREVIEW_BUILDER_PROGRESS, SET_CURRENT_STORY } from '@storybook/core-events';
+import { Consumer, type Combo, merge, addons, types } from '@storybook/core/manager-api';
+import type { Addon_BaseType, Addon_WrapperType } from '@storybook/core/types';
+import { PREVIEW_BUILDER_PROGRESS, SET_CURRENT_STORY } from '@storybook/core/core-events';
-import { Loader } from '@storybook/components';
+import { Loader } from '@storybook/core/components';
import * as S from './utils/components';
import { ZoomProvider, ZoomConsumer } from './tools/zoom';
@@ -95,6 +95,7 @@ const Preview = React.memo(function Preview(props) {
['story', 'docs'].includes(p.viewMode),
render: () => {
const { isMobile } = useLayout();
@@ -182,11 +183,13 @@ export const Tools = React.memo<{ list: Addon_BaseType[] }>(function Tools({ lis
function toolbarItemHasBeenExcluded(item: Partial, entry: LeafEntry | undefined) {
const parameters = entry?.type === 'story' && entry?.prepared ? entry?.parameters : {};
+ // @ts-expect-error (non strict)
const toolbarItemsFromStoryParameters = 'toolbar' in parameters ? parameters.toolbar : undefined;
const { toolbar: toolbarItemsFromAddonsConfig } = addons.getConfig();
const toolbarItems = merge(toolbarItemsFromAddonsConfig, toolbarItemsFromStoryParameters);
+ // @ts-expect-error (non strict)
return toolbarItems ? !!toolbarItems[item?.id]?.hidden : false;
}
diff --git a/code/ui/manager/src/components/preview/Wrappers.tsx b/code/core/src/manager/components/preview/Wrappers.tsx
similarity index 86%
rename from code/ui/manager/src/components/preview/Wrappers.tsx
rename to code/core/src/manager/components/preview/Wrappers.tsx
index b70385e928fd..a6ecc04a4afa 100644
--- a/code/ui/manager/src/components/preview/Wrappers.tsx
+++ b/code/core/src/manager/components/preview/Wrappers.tsx
@@ -1,7 +1,7 @@
import type { FC, PropsWithChildren } from 'react';
import React, { Fragment } from 'react';
-import type { Addon_WrapperType } from '@storybook/types';
-import { Addon_TypesEnum } from '@storybook/types';
+import type { Addon_WrapperType } from '@storybook/core/types';
+import { Addon_TypesEnum } from '@storybook/core/types';
import type { ApplyWrappersProps } from './utils/types';
import { IframeWrapper } from './utils/components';
diff --git a/code/ui/manager/src/components/preview/tools/addons.tsx b/code/core/src/manager/components/preview/tools/addons.tsx
similarity index 79%
rename from code/ui/manager/src/components/preview/tools/addons.tsx
rename to code/core/src/manager/components/preview/tools/addons.tsx
index 956a327ed840..a0beb24f768a 100644
--- a/code/ui/manager/src/components/preview/tools/addons.tsx
+++ b/code/core/src/manager/components/preview/tools/addons.tsx
@@ -1,8 +1,8 @@
import React from 'react';
-import { IconButton } from '@storybook/components';
-import { Consumer, types } from '@storybook/manager-api';
-import type { Combo } from '@storybook/manager-api';
-import type { Addon_BaseType } from '@storybook/types';
+import { IconButton } from '@storybook/core/components';
+import { Consumer, types } from '@storybook/core/manager-api';
+import type { Combo } from '@storybook/core/manager-api';
+import type { Addon_BaseType } from '@storybook/core/types';
import { BottomBarIcon, SidebarAltIcon } from '@storybook/icons';
const menuMapper = ({ api, state }: Combo) => ({
diff --git a/code/ui/manager/src/components/preview/tools/copy.tsx b/code/core/src/manager/components/preview/tools/copy.tsx
similarity index 77%
rename from code/ui/manager/src/components/preview/tools/copy.tsx
rename to code/core/src/manager/components/preview/tools/copy.tsx
index 59d72f3de850..2fdc098cffe4 100644
--- a/code/ui/manager/src/components/preview/tools/copy.tsx
+++ b/code/core/src/manager/components/preview/tools/copy.tsx
@@ -1,10 +1,10 @@
import { global } from '@storybook/global';
import React from 'react';
import copy from 'copy-to-clipboard';
-import { getStoryHref, IconButton } from '@storybook/components';
-import { Consumer, types } from '@storybook/manager-api';
-import type { Combo } from '@storybook/manager-api';
-import type { Addon_BaseType } from '@storybook/types';
+import { getStoryHref, IconButton } from '@storybook/core/components';
+import { Consumer, types } from '@storybook/core/manager-api';
+import type { Combo } from '@storybook/core/manager-api';
+import type { Addon_BaseType } from '@storybook/core/types';
import { LinkIcon } from '@storybook/icons';
const { PREVIEW_URL, document } = global;
@@ -12,6 +12,7 @@ const { PREVIEW_URL, document } = global;
const copyMapper = ({ state }: Combo) => {
const { storyId, refId, refs } = state;
const { location } = document;
+ // @ts-expect-error (non strict)
const ref = refs[refId];
let baseUrl = `${location.origin}${location.pathname}`;
if (!baseUrl.endsWith('/')) baseUrl += '/';
@@ -35,6 +36,7 @@ export const copyTool: Addon_BaseType = {
storyId ? (
copy(getStoryHref(baseUrl, storyId, queryParams))}
title="Copy canvas link"
>
diff --git a/code/ui/manager/src/components/preview/tools/eject.tsx b/code/core/src/manager/components/preview/tools/eject.tsx
similarity index 76%
rename from code/ui/manager/src/components/preview/tools/eject.tsx
rename to code/core/src/manager/components/preview/tools/eject.tsx
index 41c091ccc582..25bf9676c8d7 100644
--- a/code/ui/manager/src/components/preview/tools/eject.tsx
+++ b/code/core/src/manager/components/preview/tools/eject.tsx
@@ -1,15 +1,16 @@
import { global } from '@storybook/global';
import React from 'react';
-import { getStoryHref, IconButton } from '@storybook/components';
-import { Consumer, types } from '@storybook/manager-api';
-import type { Combo } from '@storybook/manager-api';
-import type { Addon_BaseType } from '@storybook/types';
+import { getStoryHref, IconButton } from '@storybook/core/components';
+import { Consumer, types } from '@storybook/core/manager-api';
+import type { Combo } from '@storybook/core/manager-api';
+import type { Addon_BaseType } from '@storybook/core/types';
import { ShareAltIcon } from '@storybook/icons';
const { PREVIEW_URL } = global;
const ejectMapper = ({ state }: Combo) => {
const { storyId, refId, refs } = state;
+ // @ts-expect-error (non strict)
const ref = refs[refId];
return {
@@ -31,6 +32,7 @@ export const ejectTool: Addon_BaseType = {
storyId ? (
({
@@ -15,6 +15,7 @@ export const menuTool: Addon_BaseType = {
title: 'menu',
id: 'menu',
type: types.TOOL,
+ // @ts-expect-error (non strict)
match: ({ viewMode }) => ['story', 'docs'].includes(viewMode),
render: () => (
diff --git a/code/ui/manager/src/components/preview/tools/remount.tsx b/code/core/src/manager/components/preview/tools/remount.tsx
similarity index 73%
rename from code/ui/manager/src/components/preview/tools/remount.tsx
rename to code/core/src/manager/components/preview/tools/remount.tsx
index ecc178a41677..1d8735b7dec3 100644
--- a/code/ui/manager/src/components/preview/tools/remount.tsx
+++ b/code/core/src/manager/components/preview/tools/remount.tsx
@@ -1,11 +1,11 @@
import type { ComponentProps } from 'react';
import React, { useState } from 'react';
-import { IconButton } from '@storybook/components';
-import { Consumer, types } from '@storybook/manager-api';
-import type { Combo } from '@storybook/manager-api';
-import { styled } from '@storybook/theming';
-import { FORCE_REMOUNT } from '@storybook/core-events';
-import type { Addon_BaseType } from '@storybook/types';
+import { IconButton } from '@storybook/core/components';
+import { Consumer, types } from '@storybook/core/manager-api';
+import type { Combo } from '@storybook/core/manager-api';
+import { styled } from '@storybook/core/theming';
+import { FORCE_REMOUNT } from '@storybook/core/core-events';
+import type { Addon_BaseType } from '@storybook/core/types';
import { SyncIcon } from '@storybook/icons';
interface AnimatedButtonProps {
@@ -13,11 +13,11 @@ interface AnimatedButtonProps {
}
const StyledAnimatedIconButton = styled(IconButton)<
- AnimatedButtonProps & ComponentProps
+ AnimatedButtonProps & Pick, 'disabled'>
>(({ theme, animating, disabled }) => ({
opacity: disabled ? 0.5 : 1,
svg: {
- animation: animating && `${theme.animation.rotate360} 1000ms ease-out`,
+ animation: animating ? `${theme.animation.rotate360} 1000ms ease-out` : undefined,
},
}));
diff --git a/code/ui/manager/src/components/preview/tools/zoom.tsx b/code/core/src/manager/components/preview/tools/zoom.tsx
similarity index 88%
rename from code/ui/manager/src/components/preview/tools/zoom.tsx
rename to code/core/src/manager/components/preview/tools/zoom.tsx
index cffe05ac4d0e..9af3c17d9c39 100644
--- a/code/ui/manager/src/components/preview/tools/zoom.tsx
+++ b/code/core/src/manager/components/preview/tools/zoom.tsx
@@ -1,9 +1,9 @@
import type { SyntheticEvent, MouseEventHandler, PropsWithChildren } from 'react';
import React, { Component, createContext, memo, useCallback } from 'react';
-import { IconButton, Separator } from '@storybook/components';
-import type { Addon_BaseType } from '@storybook/types';
-import { types } from '@storybook/manager-api';
+import { IconButton, Separator } from '@storybook/core/components';
+import type { Addon_BaseType } from '@storybook/core/types';
+import { types } from '@storybook/core/manager-api';
import { ZoomIcon, ZoomOutIcon, ZoomResetIcon } from '@storybook/icons';
const initialZoom = 1 as const;
@@ -41,12 +41,15 @@ const Zoom = memo<{
}>(function Zoom({ zoomIn, zoomOut, reset }) {
return (
<>
+ {/* @ts-expect-error (non strict) */}
+ {/* @ts-expect-error (non strict) */}
+ {/* @ts-expect-error (non strict) */}
diff --git a/code/ui/manager/src/components/preview/utils/components.ts b/code/core/src/manager/components/preview/utils/components.ts
similarity index 93%
rename from code/ui/manager/src/components/preview/utils/components.ts
rename to code/core/src/manager/components/preview/utils/components.ts
index a8c2d9b30f98..b9cd39b097a0 100644
--- a/code/ui/manager/src/components/preview/utils/components.ts
+++ b/code/core/src/manager/components/preview/utils/components.ts
@@ -1,5 +1,5 @@
-import { styled } from '@storybook/theming';
-import { Link } from '@storybook/router';
+import { styled } from '@storybook/core/theming';
+import { Link } from '@storybook/core/router';
export const PreviewContainer = styled.main({
display: 'flex',
diff --git a/code/ui/manager/src/components/preview/utils/stringifyQueryParams.tsx b/code/core/src/manager/components/preview/utils/stringifyQueryParams.tsx
similarity index 100%
rename from code/ui/manager/src/components/preview/utils/stringifyQueryParams.tsx
rename to code/core/src/manager/components/preview/utils/stringifyQueryParams.tsx
diff --git a/code/ui/manager/src/components/preview/utils/types.tsx b/code/core/src/manager/components/preview/utils/types.tsx
similarity index 85%
rename from code/ui/manager/src/components/preview/utils/types.tsx
rename to code/core/src/manager/components/preview/utils/types.tsx
index 7b0e60caefb5..2a1fd83c2e6d 100644
--- a/code/ui/manager/src/components/preview/utils/types.tsx
+++ b/code/core/src/manager/components/preview/utils/types.tsx
@@ -1,6 +1,11 @@
import type { ReactElement } from 'react';
-import type { State, API, LeafEntry } from '@storybook/manager-api';
-import type { Addon_BaseType, Addon_WrapperType, API_ViewMode, StoryId } from '@storybook/types';
+import type { State, API, LeafEntry } from '@storybook/core/manager-api';
+import type {
+ Addon_BaseType,
+ Addon_WrapperType,
+ API_ViewMode,
+ StoryId,
+} from '@storybook/core/types';
export interface PreviewProps {
api: API;
diff --git a/code/ui/manager/src/components/sidebar/Brand.tsx b/code/core/src/manager/components/sidebar/Brand.tsx
similarity index 92%
rename from code/ui/manager/src/components/sidebar/Brand.tsx
rename to code/core/src/manager/components/sidebar/Brand.tsx
index aa093da9ac16..f3c0a89c046a 100644
--- a/code/ui/manager/src/components/sidebar/Brand.tsx
+++ b/code/core/src/manager/components/sidebar/Brand.tsx
@@ -1,7 +1,7 @@
import React from 'react';
-import { styled, withTheme } from '@storybook/theming';
+import { styled, withTheme } from '@storybook/core/theming';
-import { StorybookLogo } from '@storybook/components';
+import { StorybookLogo } from '@storybook/core/components';
export const StorybookLogoStyled = styled(StorybookLogo)(({ theme }) => ({
width: 'auto',
diff --git a/code/ui/manager/src/components/sidebar/CreateNewStoryFileModal.tsx b/code/core/src/manager/components/sidebar/CreateNewStoryFileModal.tsx
similarity index 96%
rename from code/ui/manager/src/components/sidebar/CreateNewStoryFileModal.tsx
rename to code/core/src/manager/components/sidebar/CreateNewStoryFileModal.tsx
index 0e16ea234750..4c45bcc51645 100644
--- a/code/ui/manager/src/components/sidebar/CreateNewStoryFileModal.tsx
+++ b/code/core/src/manager/components/sidebar/CreateNewStoryFileModal.tsx
@@ -12,7 +12,7 @@ import type {
ResponseData,
SaveStoryRequestPayload,
SaveStoryResponsePayload,
-} from '@storybook/core-events';
+} from '@storybook/core/core-events';
import {
ARGTYPES_INFO_REQUEST,
ARGTYPES_INFO_RESPONSE,
@@ -22,9 +22,9 @@ import {
FILE_COMPONENT_SEARCH_RESPONSE,
SAVE_STORY_REQUEST,
SAVE_STORY_RESPONSE,
-} from '@storybook/core-events';
-import type { RequestResponseError } from '@storybook/manager-api';
-import { addons, experimental_requestResponse, useStorybookApi } from '@storybook/manager-api';
+} from '@storybook/core/core-events';
+import type { RequestResponseError } from '@storybook/core/manager-api';
+import { addons, experimental_requestResponse, useStorybookApi } from '@storybook/core/manager-api';
import { useDebounce } from '../../hooks/useDebounce';
import type { NewStoryPayload, SearchResult } from './FileSearchList';
@@ -182,6 +182,7 @@ export const CreateNewStoryFileModal = ({ open, onOpenChange }: CreateNewStoryFi
switch (e?.payload?.type as CreateNewStoryErrorPayload['type']) {
case 'STORY_FILE_EXISTS':
const err = e as RequestResponseError;
+ // @ts-expect-error (non strict)
await trySelectNewStory(api.selectStory, err.payload.kind);
handleStoryAlreadyExists();
break;
diff --git a/code/ui/manager/src/components/sidebar/Explorer.stories.tsx b/code/core/src/manager/components/sidebar/Explorer.stories.tsx
similarity index 100%
rename from code/ui/manager/src/components/sidebar/Explorer.stories.tsx
rename to code/core/src/manager/components/sidebar/Explorer.stories.tsx
diff --git a/code/ui/manager/src/components/sidebar/Explorer.tsx b/code/core/src/manager/components/sidebar/Explorer.tsx
similarity index 97%
rename from code/ui/manager/src/components/sidebar/Explorer.tsx
rename to code/core/src/manager/components/sidebar/Explorer.tsx
index 5f2e87d9352c..dae74f34e21c 100644
--- a/code/ui/manager/src/components/sidebar/Explorer.tsx
+++ b/code/core/src/manager/components/sidebar/Explorer.tsx
@@ -24,6 +24,7 @@ export const Explorer: FC = React.memo(function Explorer({
// Track highlighted nodes, keep it in sync with props and enable keyboard navigation
const [highlighted, setHighlighted, highlightedRef] = useHighlighted({
+ // @ts-expect-error (non strict)
containerRef,
isLoading,
isBrowsing,
diff --git a/code/ui/manager/src/components/sidebar/FIleSearchList.utils.tsx b/code/core/src/manager/components/sidebar/FIleSearchList.utils.tsx
similarity index 98%
rename from code/ui/manager/src/components/sidebar/FIleSearchList.utils.tsx
rename to code/core/src/manager/components/sidebar/FIleSearchList.utils.tsx
index 83e2dac00f83..87c2297a44f5 100644
--- a/code/ui/manager/src/components/sidebar/FIleSearchList.utils.tsx
+++ b/code/core/src/manager/components/sidebar/FIleSearchList.utils.tsx
@@ -24,7 +24,9 @@ export const useArrowKeyNavigation = ({
const maxIndex = rowVirtualizer.options.count;
const activeElement = document.activeElement;
+ // @ts-expect-error (non strict)
const rowIndex = parseInt(activeElement.getAttribute('data-index') || '-1', 10);
+ // @ts-expect-error (non strict)
const isActiveElementInput = activeElement.tagName === 'INPUT';
const getFirstElement = () =>
diff --git a/code/ui/manager/src/components/sidebar/FileList.tsx b/code/core/src/manager/components/sidebar/FileList.tsx
similarity index 99%
rename from code/ui/manager/src/components/sidebar/FileList.tsx
rename to code/core/src/manager/components/sidebar/FileList.tsx
index 420d4ce5dc6e..9f7cc75c290a 100644
--- a/code/ui/manager/src/components/sidebar/FileList.tsx
+++ b/code/core/src/manager/components/sidebar/FileList.tsx
@@ -1,4 +1,4 @@
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import { rgba } from 'polished';
export const FileListWrapper = styled('div')(({ theme }) => ({
diff --git a/code/ui/manager/src/components/sidebar/FileSearchList.stories.tsx b/code/core/src/manager/components/sidebar/FileSearchList.stories.tsx
similarity index 97%
rename from code/ui/manager/src/components/sidebar/FileSearchList.stories.tsx
rename to code/core/src/manager/components/sidebar/FileSearchList.stories.tsx
index 597b8b82581c..a1f9ca9d9df6 100644
--- a/code/ui/manager/src/components/sidebar/FileSearchList.stories.tsx
+++ b/code/core/src/manager/components/sidebar/FileSearchList.stories.tsx
@@ -21,6 +21,7 @@ export const Default: Story = {
args: {
isLoading: true,
searchResults: null,
+ // @ts-expect-error (non strict)
errorItemId: null,
},
};
@@ -29,6 +30,7 @@ export const Empty: Story = {
args: {
isLoading: false,
searchResults: [],
+ // @ts-expect-error (non strict)
errorItemId: null,
},
};
@@ -90,6 +92,7 @@ export const WithResults: Story = {
},
args: {
isLoading: false,
+ // @ts-expect-error (non strict)
errorItemId: null,
searchResults: [
{
diff --git a/code/ui/manager/src/components/sidebar/FileSearchList.tsx b/code/core/src/manager/components/sidebar/FileSearchList.tsx
similarity index 94%
rename from code/ui/manager/src/components/sidebar/FileSearchList.tsx
rename to code/core/src/manager/components/sidebar/FileSearchList.tsx
index 316704abfba6..9ba2fd205c47 100644
--- a/code/ui/manager/src/components/sidebar/FileSearchList.tsx
+++ b/code/core/src/manager/components/sidebar/FileSearchList.tsx
@@ -1,6 +1,6 @@
import React, { memo, useCallback, useMemo, useState } from 'react';
import { ChevronDownIcon, ChevronRightIcon, ComponentIcon } from '@storybook/icons';
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import { FileSearchListLoadingSkeleton } from './FileSearchListSkeleton';
import {
DefaultExport,
@@ -26,11 +26,11 @@ import { useVirtualizer } from '@tanstack/react-virtual';
import type {
CreateNewStoryRequestPayload,
FileComponentSearchResponsePayload,
-} from '@storybook/core-events';
-import { WithTooltip, TooltipNote } from '@storybook/components';
+} from '@storybook/core/core-events';
+import { WithTooltip, TooltipNote } from '@storybook/core/components';
import { useArrowKeyNavigation } from './FIleSearchList.utils';
-export type SearchResult = FileComponentSearchResponsePayload['files'][0];
+export type SearchResult = NonNullable[0];
export interface NewStoryPayload extends CreateNewStoryRequestPayload {
selectedItemId: string | number;
@@ -69,7 +69,7 @@ interface FileItemSelectionPayload {
interface FileItemComponentSelectionPayload {
searchResult: SearchResult;
- component: SearchResult['exportedComponents'][0];
+ component: NonNullable[0];
id: string;
}
@@ -115,6 +115,8 @@ export const FileSearchList = memo(function FileSearchList({
const rowVirtualizer = useVirtualizer({
count,
+ // @ts-expect-error (non strict)
+
getScrollElement: () => parentRef.current,
paddingStart: 16,
paddingEnd: 40,
@@ -122,10 +124,12 @@ export const FileSearchList = memo(function FileSearchList({
overscan: 2,
});
+ // @ts-expect-error (non strict)
useArrowKeyNavigation({ rowVirtualizer, parentRef, selectedItem });
const handleFileItemSelection = useCallback(
({ virtualItem, searchResult, itemId }: FileItemSelectionPayload) => {
+ // @ts-expect-error (non strict)
if (searchResult?.exportedComponents?.length > 1) {
setSelectedItem((sItem) => {
if (sItem === virtualItem.index) {
@@ -154,6 +158,7 @@ export const FileSearchList = memo(function FileSearchList({
componentFilePath: searchResult.filepath,
componentIsDefaultExport: component.default,
selectedItemId: id,
+ // @ts-expect-error (non strict)
componentExportCount: searchResult.exportedComponents.length,
});
},
@@ -191,6 +196,7 @@ export const FileSearchList = memo(function FileSearchList({
{itemSelected ? : }
+ {/* @ts-expect-error (non strict) */}
{searchResult?.exportedComponents?.length > 1 && itemSelected && (
0) {
return (
+ {/* @ts-expect-error (non strict) */}
({
diff --git a/code/ui/manager/src/components/sidebar/FileSearchModal.stories.tsx b/code/core/src/manager/components/sidebar/FileSearchModal.stories.tsx
similarity index 98%
rename from code/ui/manager/src/components/sidebar/FileSearchModal.stories.tsx
rename to code/core/src/manager/components/sidebar/FileSearchModal.stories.tsx
index aaa604953aea..e419bd2b57ab 100644
--- a/code/ui/manager/src/components/sidebar/FileSearchModal.stories.tsx
+++ b/code/core/src/manager/components/sidebar/FileSearchModal.stories.tsx
@@ -32,6 +32,7 @@ const meta = {
transform: 'translateZ(0)',
}}
>
+ {/* @ts-expect-error (non strict) */}
{Story({ args: { ...context.args, container } })}
);
diff --git a/code/ui/manager/src/components/sidebar/FileSearchModal.tsx b/code/core/src/manager/components/sidebar/FileSearchModal.tsx
similarity index 95%
rename from code/ui/manager/src/components/sidebar/FileSearchModal.tsx
rename to code/core/src/manager/components/sidebar/FileSearchModal.tsx
index 40f7b4e76ba9..9762c8222633 100644
--- a/code/ui/manager/src/components/sidebar/FileSearchModal.tsx
+++ b/code/core/src/manager/components/sidebar/FileSearchModal.tsx
@@ -1,6 +1,6 @@
import React, { useEffect, useState, useTransition } from 'react';
-import { Modal, Form } from '@storybook/components';
-import { styled } from '@storybook/theming';
+import { Modal, Form } from '@storybook/core/components';
+import { styled } from '@storybook/core/theming';
import { CloseAltIcon, SearchIcon, SyncIcon } from '@storybook/icons';
import type { NewStoryPayload, SearchResult } from './FileSearchList';
@@ -138,6 +138,7 @@ export const FileSearchModal = ({
container,
}: FileSearchModalProps) => {
const [modalContentRef, modalContentDimensions] = useMeasure
();
+ // @ts-expect-error (non strict)
const [modalMaxHeight, setModalMaxHeight] = useState(modalContentDimensions.height);
const [, startTransition] = useTransition();
// This internal state is used to maintain cursor position when the user types in the search input
@@ -145,7 +146,9 @@ export const FileSearchModal = ({
const [searchInputValue, setSearchInputValue] = useState(fileSearchQuery);
useEffect(() => {
+ // @ts-expect-error (non strict)
if (modalMaxHeight < modalContentDimensions.height) {
+ // @ts-expect-error (non strict)
setModalMaxHeight(modalContentDimensions.height);
}
}, [modalContentDimensions.height, modalMaxHeight]);
@@ -164,6 +167,7 @@ export const FileSearchModal = ({
}}
container={container}
>
+ {/* @ts-expect-error (non strict) */}
diff --git a/code/ui/manager/src/components/sidebar/FileSearchModal.utils.test.tsx b/code/core/src/manager/components/sidebar/FileSearchModal.utils.test.tsx
similarity index 100%
rename from code/ui/manager/src/components/sidebar/FileSearchModal.utils.test.tsx
rename to code/core/src/manager/components/sidebar/FileSearchModal.utils.test.tsx
diff --git a/code/ui/manager/src/components/sidebar/FileSearchModal.utils.tsx b/code/core/src/manager/components/sidebar/FileSearchModal.utils.tsx
similarity index 98%
rename from code/ui/manager/src/components/sidebar/FileSearchModal.utils.tsx
rename to code/core/src/manager/components/sidebar/FileSearchModal.utils.tsx
index f334aadc461c..1c947afc60ad 100644
--- a/code/ui/manager/src/components/sidebar/FileSearchModal.utils.tsx
+++ b/code/core/src/manager/components/sidebar/FileSearchModal.utils.tsx
@@ -26,6 +26,7 @@ export function extractSeededRequiredArgs(argTypes: ArgTypes) {
}
}
+ // @ts-expect-error (non strict)
setArgType(argType.type, acc, key);
return acc;
},
diff --git a/code/ui/manager/src/components/sidebar/Heading.stories.tsx b/code/core/src/manager/components/sidebar/Heading.stories.tsx
similarity index 97%
rename from code/ui/manager/src/components/sidebar/Heading.stories.tsx
rename to code/core/src/manager/components/sidebar/Heading.stories.tsx
index 34e08e7c02ea..ca14fdfa148a 100644
--- a/code/ui/manager/src/components/sidebar/Heading.stories.tsx
+++ b/code/core/src/manager/components/sidebar/Heading.stories.tsx
@@ -2,8 +2,8 @@
// @TODO: use addon-interactions and remove the rule disable above
import React from 'react';
import type { Meta, StoryObj, StoryFn } from '@storybook/react';
-import { ThemeProvider, useTheme } from '@storybook/theming';
-import type { Theme } from '@storybook/theming';
+import { ThemeProvider, useTheme } from '@storybook/core/theming';
+import type { Theme } from '@storybook/core/theming';
import { action } from '@storybook/addon-actions';
import { screen } from '@testing-library/dom';
diff --git a/code/ui/manager/src/components/sidebar/Heading.tsx b/code/core/src/manager/components/sidebar/Heading.tsx
similarity index 93%
rename from code/ui/manager/src/components/sidebar/Heading.tsx
rename to code/core/src/manager/components/sidebar/Heading.tsx
index e015f0828692..962e91bbc8a5 100644
--- a/code/ui/manager/src/components/sidebar/Heading.tsx
+++ b/code/core/src/manager/components/sidebar/Heading.tsx
@@ -1,9 +1,9 @@
import type { FC, ComponentProps } from 'react';
import React from 'react';
-import { styled } from '@storybook/theming';
-import { Button } from '@storybook/components';
+import { styled } from '@storybook/core/theming';
+import { Button } from '@storybook/core/components';
-import type { Addon_SidebarTopType } from '@storybook/types';
+import type { Addon_SidebarTopType } from '@storybook/core/types';
import { Brand } from './Brand';
import type { MenuList, SidebarMenuProps } from './Menu';
import { SidebarMenu } from './Menu';
diff --git a/code/ui/manager/src/components/sidebar/HighlightStyles.tsx b/code/core/src/manager/components/sidebar/HighlightStyles.tsx
similarity index 90%
rename from code/ui/manager/src/components/sidebar/HighlightStyles.tsx
rename to code/core/src/manager/components/sidebar/HighlightStyles.tsx
index 717f4e6df035..0683a04c9550 100644
--- a/code/ui/manager/src/components/sidebar/HighlightStyles.tsx
+++ b/code/core/src/manager/components/sidebar/HighlightStyles.tsx
@@ -1,9 +1,10 @@
import { transparentize } from 'polished';
import type { FC } from 'react';
import React from 'react';
-import { Global } from '@storybook/theming';
+import { Global } from '@storybook/core/theming';
import type { Highlight } from './types';
+// @ts-expect-error (non strict)
export const HighlightStyles: FC = ({ refId, itemId }) => (
{
diff --git a/code/ui/manager/src/components/sidebar/IconSymbols.stories.tsx b/code/core/src/manager/components/sidebar/IconSymbols.stories.tsx
similarity index 100%
rename from code/ui/manager/src/components/sidebar/IconSymbols.stories.tsx
rename to code/core/src/manager/components/sidebar/IconSymbols.stories.tsx
diff --git a/code/ui/manager/src/components/sidebar/IconSymbols.tsx b/code/core/src/manager/components/sidebar/IconSymbols.tsx
similarity index 98%
rename from code/ui/manager/src/components/sidebar/IconSymbols.tsx
rename to code/core/src/manager/components/sidebar/IconSymbols.tsx
index 589e909e00e4..8dec99d6e248 100644
--- a/code/ui/manager/src/components/sidebar/IconSymbols.tsx
+++ b/code/core/src/manager/components/sidebar/IconSymbols.tsx
@@ -1,4 +1,4 @@
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import type { FC } from 'react';
import React from 'react';
diff --git a/code/ui/manager/src/components/sidebar/Loader.tsx b/code/core/src/manager/components/sidebar/Loader.tsx
similarity index 96%
rename from code/ui/manager/src/components/sidebar/Loader.tsx
rename to code/core/src/manager/components/sidebar/Loader.tsx
index 8bc9f364d135..254626aa0b79 100644
--- a/code/ui/manager/src/components/sidebar/Loader.tsx
+++ b/code/core/src/manager/components/sidebar/Loader.tsx
@@ -1,6 +1,6 @@
import type { FC } from 'react';
import React, { Fragment } from 'react';
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
const LOADER_SEQUENCE = [0, 0, 1, 1, 2, 3, 3, 3, 1, 1, 1, 2, 2, 2, 3];
diff --git a/code/ui/manager/src/components/sidebar/Menu.stories.tsx b/code/core/src/manager/components/sidebar/Menu.stories.tsx
similarity index 93%
rename from code/ui/manager/src/components/sidebar/Menu.stories.tsx
rename to code/core/src/manager/components/sidebar/Menu.stories.tsx
index ca57b4780a67..2e83d1f78dd3 100644
--- a/code/ui/manager/src/components/sidebar/Menu.stories.tsx
+++ b/code/core/src/manager/components/sidebar/Menu.stories.tsx
@@ -2,10 +2,10 @@ import type { ComponentProps } from 'react';
import React from 'react';
import type { Meta, StoryObj } from '@storybook/react';
-import { TooltipLinkList } from '@storybook/components';
-import { styled } from '@storybook/theming';
+import { TooltipLinkList } from '@storybook/core/components';
+import { styled } from '@storybook/core/theming';
import { screen, userEvent, within, expect } from '@storybook/test';
-import type { State } from '@storybook/manager-api';
+import type { State } from '@storybook/core/manager-api';
import { LinkIcon } from '@storybook/icons';
import { SidebarMenu } from './Menu';
import { useMenu } from '../../container/Menu';
@@ -36,6 +36,7 @@ export const Real: Story = {
args: {
isHighlighted: true,
},
+ // @ts-expect-error (non strict)
render: (args) => ,
};
@@ -119,6 +120,7 @@ export const ExpandedWithoutWhatsNew: Story = {
await new Promise((res) => {
setTimeout(res, 500);
});
+ // @ts-expect-error (non strict)
await Expanded.play(context);
const releaseNotes = await canvas.queryByText(/What's new/);
await expect(releaseNotes).not.toBeInTheDocument();
diff --git a/code/ui/manager/src/components/sidebar/Menu.tsx b/code/core/src/manager/components/sidebar/Menu.tsx
similarity index 92%
rename from code/ui/manager/src/components/sidebar/Menu.tsx
rename to code/core/src/manager/components/sidebar/Menu.tsx
index bca52dd348ad..960fa8b58844 100644
--- a/code/ui/manager/src/components/sidebar/Menu.tsx
+++ b/code/core/src/manager/components/sidebar/Menu.tsx
@@ -1,10 +1,10 @@
import type { ComponentProps, FC } from 'react';
import React, { useMemo, useState } from 'react';
-import { styled } from '@storybook/theming';
+import { styled } from '@storybook/core/theming';
import { transparentize } from 'polished';
-import type { Button, TooltipLinkListLink } from '@storybook/components';
-import { WithTooltip, TooltipLinkList, IconButton } from '@storybook/components';
+import type { Button, TooltipLinkListLink } from '@storybook/core/components';
+import { WithTooltip, TooltipLinkList, IconButton } from '@storybook/core/components';
import { CloseIcon, CogIcon } from '@storybook/icons';
import { useLayout } from '../layout/LayoutProvider';
@@ -88,8 +88,10 @@ export const SidebarMenu: FC = ({ menu, isHighlighted, onClick
@@ -115,6 +117,7 @@ export const SidebarMenu: FC = ({ menu, isHighlighted, onClick
diff --git a/code/ui/manager/src/components/sidebar/RefBlocks.tsx b/code/core/src/manager/components/sidebar/RefBlocks.tsx
similarity index 95%
rename from code/ui/manager/src/components/sidebar/RefBlocks.tsx
rename to code/core/src/manager/components/sidebar/RefBlocks.tsx
index efeb56c2e6d9..d4fd979129ba 100644
--- a/code/ui/manager/src/components/sidebar/RefBlocks.tsx
+++ b/code/core/src/manager/components/sidebar/RefBlocks.tsx
@@ -2,9 +2,9 @@ import { global } from '@storybook/global';
import type { FC } from 'react';
import React, { useState, useCallback, Fragment } from 'react';
-import { WithTooltip, Spaced, Button, Link, ErrorFormatter } from '@storybook/components';
-import { logger } from '@storybook/client-logger';
-import { styled } from '@storybook/theming';
+import { WithTooltip, Spaced, Button, Link, ErrorFormatter } from '@storybook/core/components';
+import { logger } from '@storybook/core/client-logger';
+import { styled } from '@storybook/core/theming';
import { ChevronDownIcon, LockIcon, SyncIcon } from '@storybook/icons';
import { Loader, Contained } from './Loader';
@@ -89,6 +89,7 @@ export const AuthBlock: FC<{ loginUrl: string; id: string }> = ({ loginUrl, id }
Sign in to browse this Storybook.
+ {/* @ts-expect-error (non strict) */}