Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ndelangen committed May 6, 2024
1 parent 314fbd6 commit f2218fa
Show file tree
Hide file tree
Showing 1,130 changed files with 38,636 additions and 3,486 deletions.
3 changes: 1 addition & 2 deletions code/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@ ember-output
!.eslintrc.js
!.eslintrc-markdown.js
!.storybook
lib/core-common/templates/base-preview-head.html
lib/core-server/src/utils/__search-files-tests__
core/assets
19 changes: 16 additions & 3 deletions code/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ module.exports = {
rules: {
'import/no-extraneous-dependencies': [
'error',
{ bundledDependencies: false, devDependencies: true },
{ bundledDependencies: false, devDependencies: true, peerDependencies: true },
],
},
},
Expand All @@ -107,7 +107,16 @@ module.exports = {
rules: {
'import/no-extraneous-dependencies': [
'error',
{ packageDir: [__dirname], devDependencies: true },
{ packageDir: [__dirname], devDependencies: true, peerDependencies: true },
],
},
},
{
files: ['**/core/**'],
rules: {
'import/no-extraneous-dependencies': [
'error',
{ packageDir: [__dirname], devDependencies: true, peerDependencies: true },
],
},
},
Expand All @@ -128,7 +137,11 @@ module.exports = {
rules: {
'import/no-extraneous-dependencies': [
'error',
{ packageDir: [__dirname, path.join(__dirname, 'ui', directory)], devDependencies: true },
{
packageDir: [__dirname, path.join(__dirname, 'ui', directory)],
devDependencies: true,
peerDependencies: true,
},
],
},
})),
Expand Down
7 changes: 3 additions & 4 deletions code/addons/a11y/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,11 @@
"axe-core": "^4.2.0"
},
"devDependencies": {
"@storybook/channels": "workspace:*",
"@storybook/client-logger": "workspace:*",
"@storybook/components": "workspace:*",
"@storybook/global": "^5.0.0",
"@storybook/icons": "^1.2.5",
"@storybook/manager-api": "workspace:*",
"@storybook/preview-api": "workspace:*",
"@storybook/theming": "workspace:*",
"@storybook/types": "workspace:*",
"@testing-library/react": "^14.0.0",
"lodash": "^4.17.21",
"react": "^18.2.0",
Expand All @@ -77,6 +73,9 @@
"resize-observer-polyfill": "^1.5.1",
"typescript": "^5.3.2"
},
"peerDependencies": {
"@storybook/core": "workspace:*"
},
"publishConfig": {
"access": "public"
},
Expand Down
4 changes: 2 additions & 2 deletions code/addons/a11y/src/a11yRunner.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { Mock } from 'vitest';
import { describe, beforeEach, it, expect, vi } from 'vitest';
import { addons } from '@storybook/preview-api';
import { addons } from '@storybook/core/dist/preview-api';
import { EVENTS } from './constants';

vi.mock('@storybook/preview-api');
vi.mock('@storybook/core/dist/preview-api');
const mockedAddons = vi.mocked(addons);

describe('a11yRunner', () => {
Expand Down
2 changes: 1 addition & 1 deletion code/addons/a11y/src/a11yRunner.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { global } from '@storybook/global';
import { addons } from '@storybook/preview-api';
import { addons } from '@storybook/core/dist/preview-api';
import { EVENTS } from './constants';
import type { A11yParameters } from './params';

Expand Down
2 changes: 1 addition & 1 deletion code/addons/a11y/src/components/A11yContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { themes, convert } from '@storybook/theming';
import type { Result } from 'axe-core';
import { useChannel, useAddonState, useStorybookApi } from '@storybook/manager-api';
import { STORY_CHANGED, STORY_RENDERED } from '@storybook/core-events';
import { STORY_CHANGED, STORY_RENDERED } from '@storybook/core/dist/core-events';
import { HIGHLIGHT } from '@storybook/addon-highlight';
import { ADDON_ID, EVENTS } from '../constants';

Expand Down
2 changes: 1 addition & 1 deletion code/addons/a11y/src/manager.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, it, expect, vi } from 'vitest';
import * as api from '@storybook/manager-api';
import type { Addon_BaseType } from '@storybook/types';
import type { Addon_BaseType } from '@storybook/core/dist/types';
import { PANEL_ID } from './constants';
import './manager';

Expand Down
7 changes: 3 additions & 4 deletions code/addons/actions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,26 +68,25 @@
"prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/addon-bundle.ts"
},
"dependencies": {
"@storybook/core-events": "workspace:*",
"@storybook/global": "^5.0.0",
"@types/uuid": "^9.0.1",
"dequal": "^2.0.2",
"polished": "^4.2.2",
"uuid": "^9.0.0"
},
"devDependencies": {
"@storybook/client-logger": "workspace:*",
"@storybook/components": "workspace:*",
"@storybook/manager-api": "workspace:*",
"@storybook/preview-api": "workspace:*",
"@storybook/theming": "workspace:*",
"@storybook/types": "workspace:*",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-inspector": "^6.0.0",
"telejson": "^7.2.0",
"typescript": "^5.3.2"
},
"peerDependencies": {
"@storybook/core": "workspace:*"
},
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 1 addition & 1 deletion code/addons/actions/src/addArgs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ArgsEnhancer } from '@storybook/types';
import type { ArgsEnhancer } from '@storybook/core/dist/types';
import { addActionsFromArgTypes, inferActionsFromArgTypesRegex } from './addArgsHelpers';

export const argsEnhancers: ArgsEnhancer[] = [
Expand Down
2 changes: 1 addition & 1 deletion code/addons/actions/src/addArgsHelpers.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
import type { StoryContext } from '@storybook/types';
import type { StoryContext } from '@storybook/core/dist/types';
import { inferActionsFromArgTypesRegex, addActionsFromArgTypes } from './addArgsHelpers';

describe('actions parameter enhancers', () => {
Expand Down
8 changes: 3 additions & 5 deletions code/addons/actions/src/addArgsHelpers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Args, Renderer, ArgsEnhancer } from '@storybook/types';
import type { Args, Renderer, ArgsEnhancer } from '@storybook/core/dist/types';
import { action } from './runtime/action';

// interface ActionsParameter {
Expand Down Expand Up @@ -51,13 +51,11 @@ export const addActionsFromArgTypes: ArgsEnhancer<Renderer> = (context) => {
return {};
}

const argTypesWithAction = Object.entries(argTypes).filter(
([name, argType]) => !!argType['action']
);
const argTypesWithAction = Object.entries(argTypes).filter(([name, argType]) => !!argType.action);

return argTypesWithAction.reduce((acc, [name, argType]) => {
if (isInInitialArgs(name, initialArgs)) {
acc[name] = action(typeof argType['action'] === 'string' ? argType['action'] : name);
acc[name] = action(typeof argType.action === 'string' ? argType.action : name);
}
return acc;
}, {} as Args);
Expand Down
2 changes: 1 addition & 1 deletion code/addons/actions/src/containers/ActionLogger/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { Component } from 'react';
import { dequal as deepEqual } from 'dequal';

import type { API } from '@storybook/manager-api';
import { STORY_CHANGED } from '@storybook/core-events';
import { STORY_CHANGED } from '@storybook/core/dist/core-events';

import { ActionLogger as ActionLoggerComponent } from '../../components/ActionLogger';
import type { ActionDisplay } from '../../models';
Expand Down
8 changes: 4 additions & 4 deletions code/addons/actions/src/decorator.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { global } from '@storybook/global';
import { useEffect, makeDecorator } from '@storybook/preview-api';
import type { PartialStoryFn, Renderer } from '@storybook/types';
import { useEffect, makeDecorator } from '@storybook/core/dist/preview-api';
import type { PartialStoryFn, Renderer } from '@storybook/core/dist/types';
import { actions } from './runtime/actions';

import { PARAM_KEY } from './constants';
Expand Down Expand Up @@ -62,8 +62,8 @@ export const withActions: <T extends Renderer>(storyFn: PartialStoryFn<T>) => T[
parameterName: PARAM_KEY,
skipIfNoParametersOrOptions: true,
wrapper: (getStory, context, { parameters }) => {
if (parameters?.['handles']) {
applyEventHandlers(actions, ...parameters['handles']);
if (parameters?.handles) {
applyEventHandlers(actions, ...parameters.handles);
}

return getStory(context);
Expand Down
2 changes: 1 addition & 1 deletion code/addons/actions/src/loaders.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-underscore-dangle */
import type { LoaderFunction } from '@storybook/types';
import type { LoaderFunction } from '@storybook/core/dist/types';
import { global } from '@storybook/global';
import type { onMockCall as onMockCallType } from '@storybook/test';
import { action } from './runtime';
Expand Down
2 changes: 1 addition & 1 deletion code/addons/actions/src/manager.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { addons, types, useAddonState, useChannel } from '@storybook/manager-api';
import { STORY_CHANGED } from '@storybook/core-events';
import { STORY_CHANGED } from '@storybook/core/dist/core-events';
import { Badge, Spaced } from '@storybook/components';
import ActionLogger from './containers/ActionLogger';
import { ADDON_ID, CLEAR_ID, EVENT_ID, PANEL_ID, PARAM_KEY } from './constants';
Expand Down
4 changes: 2 additions & 2 deletions code/addons/actions/src/runtime/__tests__/action.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { describe, it, expect, vi } from 'vitest';
import { addons } from '@storybook/preview-api';
import { addons } from '@storybook/core/dist/preview-api';
import { action, configureActions } from '../..';

vi.mock('@storybook/preview-api');
vi.mock('@storybook/core/dist/preview-api');

const createChannel = () => {
const channel = { emit: vi.fn() };
Expand Down
4 changes: 2 additions & 2 deletions code/addons/actions/src/runtime/__tests__/actions.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { describe, it, expect, vi } from 'vitest';
import { addons } from '@storybook/preview-api';
import { addons } from '@storybook/core/dist/preview-api';
import { actions } from '../..';

vi.mock('@storybook/preview-api');
vi.mock('@storybook/core/dist/preview-api');

const createChannel = () => {
const channel = { emit: vi.fn() };
Expand Down
8 changes: 4 additions & 4 deletions code/addons/actions/src/runtime/action.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { v4 as uuidv4 } from 'uuid';
import type { PreviewWeb } from '@storybook/preview-api';
import { addons } from '@storybook/preview-api';
import type { Renderer } from '@storybook/types';
import type { PreviewWeb } from '@storybook/core/dist/preview-api';
import { addons } from '@storybook/core/dist/preview-api';
import type { Renderer } from '@storybook/core/dist/types';
import { global } from '@storybook/global';
import { ImplicitActionsDuringRendering } from '@storybook/core-events/preview-errors';
import { ImplicitActionsDuringRendering } from '@storybook/core/dist/preview-errors';
import { EVENT_ID } from '../constants';
import type { ActionDisplay, ActionOptions, HandlerFunction } from '../models';
import { config } from './configureActions';
Expand Down
2 changes: 1 addition & 1 deletion code/addons/actions/src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
declare var FEATURES: import('@storybook/types').StorybookConfigRaw['features'];
declare var FEATURES: import('@storybook/core/dist/types').StorybookConfigRaw['features'];
6 changes: 3 additions & 3 deletions code/addons/backgrounds/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,17 @@
"ts-dedent": "^2.0.0"
},
"devDependencies": {
"@storybook/client-logger": "workspace:*",
"@storybook/components": "workspace:*",
"@storybook/icons": "^1.2.5",
"@storybook/manager-api": "workspace:*",
"@storybook/preview-api": "workspace:*",
"@storybook/theming": "workspace:*",
"@storybook/types": "workspace:*",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"typescript": "^5.3.2"
},
"peerDependencies": {
"@storybook/core": "workspace:*"
},
"publishConfig": {
"access": "public"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { useState, Fragment, useCallback, useMemo, memo } from 'react';
import memoize from 'memoizerific';

import { useParameter, useGlobals } from '@storybook/manager-api';
import { logger } from '@storybook/client-logger';
import { logger } from '@storybook/core/dist/client-logger';
import { IconButton, WithTooltip, TooltipLinkList } from '@storybook/components';

import { PhotoIcon } from '@storybook/icons';
Expand Down
8 changes: 6 additions & 2 deletions code/addons/backgrounds/src/decorators/withBackground.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { useMemo, useEffect } from '@storybook/preview-api';
import type { Renderer, PartialStoryFn as StoryFunction, StoryContext } from '@storybook/types';
import { useMemo, useEffect } from '@storybook/core/dist/preview-api';
import type {
Renderer,
PartialStoryFn as StoryFunction,
StoryContext,
} from '@storybook/core/dist/types';

import { PARAM_KEY as BACKGROUNDS_PARAM_KEY } from '../constants';
import {
Expand Down
8 changes: 6 additions & 2 deletions code/addons/backgrounds/src/decorators/withGrid.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { useMemo, useEffect } from '@storybook/preview-api';
import type { Renderer, PartialStoryFn as StoryFunction, StoryContext } from '@storybook/types';
import { useMemo, useEffect } from '@storybook/core/dist/preview-api';
import type {
Renderer,
PartialStoryFn as StoryFunction,
StoryContext,
} from '@storybook/core/dist/types';

import { clearStyles, addGridStyle } from '../helpers';
import { PARAM_KEY as BACKGROUNDS_PARAM_KEY } from '../constants';
Expand Down
2 changes: 1 addition & 1 deletion code/addons/backgrounds/src/helpers/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { global } from '@storybook/global';
import { dedent } from 'ts-dedent';

import { logger } from '@storybook/client-logger';
import { logger } from '@storybook/core/dist/client-logger';

import type { Background } from '../types';

Expand Down
2 changes: 1 addition & 1 deletion code/addons/backgrounds/src/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Addon_DecoratorFunction } from '@storybook/types';
import type { Addon_DecoratorFunction } from '@storybook/core/dist/types';
import { withBackground } from './decorators/withBackground';
import { withGrid } from './decorators/withGrid';
import { PARAM_KEY } from './constants';
Expand Down
8 changes: 3 additions & 5 deletions code/addons/controls/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,16 @@
"ts-dedent": "^2.0.0"
},
"devDependencies": {
"@storybook/client-logger": "workspace:*",
"@storybook/components": "workspace:*",
"@storybook/core-common": "workspace:*",
"@storybook/icons": "^1.2.5",
"@storybook/manager-api": "workspace:*",
"@storybook/node-logger": "workspace:*",
"@storybook/preview-api": "workspace:*",
"@storybook/theming": "workspace:*",
"@storybook/types": "workspace:*",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"peerDependencies": {
"@storybook/core": "workspace:*"
},
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 1 addition & 1 deletion code/addons/controls/src/ControlsPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from '@storybook/manager-api';
import { PureArgsTable as ArgsTable, type PresetColor, type SortType } from '@storybook/blocks';
import { styled } from '@storybook/theming';
import type { ArgTypes } from '@storybook/types';
import type { ArgTypes } from '@storybook/core/dist/types';

import { PARAM_KEY } from './constants';
import { SaveStory } from './SaveStory';
Expand Down
4 changes: 2 additions & 2 deletions code/addons/controls/src/manager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import type {
ResponseData,
SaveStoryRequestPayload,
SaveStoryResponsePayload,
} from '@storybook/core-events';
import { SAVE_STORY_REQUEST, SAVE_STORY_RESPONSE } from '@storybook/core-events';
} from '@storybook/core/dist/core-events';
import { SAVE_STORY_REQUEST, SAVE_STORY_RESPONSE } from '@storybook/core/dist/core-events';
import { addons, experimental_requestResponse, types, useArgTypes } from '@storybook/manager-api';
import { color } from '@storybook/theming';
import { ControlsPanel } from './ControlsPanel';
Expand Down
2 changes: 1 addition & 1 deletion code/addons/controls/src/preset/checkDocsLoaded.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { checkAddonOrder, serverRequire } from '@storybook/core-common';
import { checkAddonOrder, serverRequire } from '@storybook/core/dist/common';
import path from 'path';

export const checkDocsLoaded = (configDir: string) => {
Expand Down
2 changes: 1 addition & 1 deletion code/addons/controls/src/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ declare var PREVIEW_URL: any;
declare var __STORYBOOK_ADDONS_MANAGER: any;
declare var RELEASE_NOTES_DATA: any;

declare var FEATURES: import('@storybook/types').StorybookConfigRaw['features'];
declare var FEATURES: import('@storybook/core/dist/types').StorybookConfigRaw['features'];

declare var REFS: any;
declare var VERSIONCHECK: any;
Expand Down
2 changes: 1 addition & 1 deletion code/addons/controls/template/stories/basics.stories.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { global as globalThis } from '@storybook/global';
import type { PartialStoryFn, StoryContext } from '@storybook/types';
import type { PartialStoryFn, StoryContext } from '@storybook/core/dist/types';

export default {
component: globalThis.Components.Pre,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { global as globalThis } from '@storybook/global';
import type { PartialStoryFn, StoryContext } from '@storybook/types';
import type { PartialStoryFn, StoryContext } from '@storybook/core/dist/types';

export default {
component: globalThis.Components.Pre,
Expand Down
Loading

0 comments on commit f2218fa

Please sign in to comment.