repo stringlengths 7 64 | file_url stringlengths 81 338 | file_path stringlengths 5 257 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:25:31 2026-01-05 01:50:38 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/filterArgTypes.ts | code/core/src/preview-api/modules/store/filterArgTypes.ts | import type { StrictArgTypes } from 'storybook/internal/types';
import { pickBy } from 'es-toolkit/object';
export type PropDescriptor = string[] | RegExp;
const matches = (name: string, descriptor: PropDescriptor) =>
Array.isArray(descriptor) ? descriptor.includes(name) : name.match(descriptor);
export const fil... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/parameters.test.ts | code/core/src/preview-api/modules/store/parameters.test.ts | import { describe, expect, it } from 'vitest';
import { combineParameters } from './parameters';
describe('client-api.parameters', () => {
it('merges different sets of parameters by key, preferencing last', () => {
expect(combineParameters({ a: 'b', c: 'd' }, { e: 'f', a: 'g' })).toEqual({
a: 'g',
c... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/storySort.ts | code/core/src/preview-api/modules/store/storySort.ts | import type {
Addon_StorySortComparatorV7,
Addon_StorySortObjectParameter,
} from 'storybook/internal/types';
import type { IndexEntry } from 'storybook/internal/types';
const STORY_KIND_PATH_SEPARATOR = /\s*\/\s*/;
export const storySort =
(options: Addon_StorySortObjectParameter = {}): Addon_StorySortComparat... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/GlobalsStore.ts | code/core/src/preview-api/modules/store/GlobalsStore.ts | import { logger } from 'storybook/internal/client-logger';
import type { GlobalTypes, Globals } from 'storybook/internal/types';
import { DEEPLY_EQUAL, deepDiff } from './args';
import { getValuesFromArgTypes } from './csf/getValuesFromArgTypes';
export class GlobalsStore {
// We use ! here because TS doesn't analy... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/inferArgTypes.test.ts | code/core/src/preview-api/modules/store/inferArgTypes.test.ts | import { describe, expect, it, vi } from 'vitest';
import { logger } from 'storybook/internal/client-logger';
import { inferArgTypes } from './inferArgTypes';
vi.mock('storybook/internal/client-logger');
describe('inferArgTypes', () => {
it('infers scalar types', () => {
expect(
inferArgTypes({
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/parameters.ts | code/core/src/preview-api/modules/store/parameters.ts | // Utilities for handling parameters
import type { Parameters } from 'storybook/internal/types';
import { isPlainObject } from 'es-toolkit/predicate';
/**
* Safely combine parameters recursively. Only copy objects when needed. Algorithm = always
* overwrite the existing value UNLESS both values are plain objects. I... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/inferArgTypes.ts | code/core/src/preview-api/modules/store/inferArgTypes.ts | import { logger } from 'storybook/internal/client-logger';
import type { ArgTypesEnhancer, Renderer, SBType } from 'storybook/internal/types';
import { mapValues } from 'es-toolkit/object';
import { dedent } from 'ts-dedent';
import { combineParameters } from './parameters';
const inferType = (value: any, name: stri... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/decorators.ts | code/core/src/preview-api/modules/store/decorators.ts | import type {
DecoratorFunction,
LegacyStoryFn,
PartialStoryFn,
Renderer,
StoryContext,
StoryContextUpdate,
} from 'storybook/internal/types';
export function decorateStory<TRenderer extends Renderer>(
storyFn: LegacyStoryFn<TRenderer>,
decorator: DecoratorFunction<TRenderer>,
bindWithContext: (story... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/decorators.test.ts | code/core/src/preview-api/modules/store/decorators.test.ts | import { describe, expect, it } from 'vitest';
import type { Renderer, StoryContext } from 'storybook/internal/types';
import { defaultDecorateStory } from './decorators';
function makeContext(input: Record<string, any> = {}): StoryContext<Renderer> {
return {
id: 'id',
kind: 'kind',
name: 'name',
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/inferControls.ts | code/core/src/preview-api/modules/store/inferControls.ts | import { logger } from 'storybook/internal/client-logger';
import type {
ArgTypesEnhancer,
Renderer,
SBEnumType,
StrictInputType,
} from 'storybook/internal/types';
import { mapValues } from 'es-toolkit/object';
import { filterArgTypes } from './filterArgTypes';
import { combineParameters } from './parameters... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/autoTitle.test.ts | code/core/src/preview-api/modules/store/autoTitle.test.ts | import { describe, expect, it } from 'vitest';
import { normalizeStoriesEntry } from 'storybook/internal/common';
import { userOrAutoTitleFromSpecifier as userOrAuto } from './autoTitle';
expect.addSnapshotSerializer({
print: (val: any) => val,
test: (val: any) => true,
});
// Make these two the same so `normal... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/args.ts | code/core/src/preview-api/modules/store/args.ts | import { once } from 'storybook/internal/client-logger';
import type {
ArgTypes,
Args,
InputType,
Renderer,
SBType,
StoryContext,
} from 'storybook/internal/types';
import { isEqual as deepEqual, isPlainObject } from 'es-toolkit/predicate';
import { dedent } from 'ts-dedent';
const INCOMPATIBLE = Symbol('... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/inferControls.test.ts | code/core/src/preview-api/modules/store/inferControls.test.ts | import type { MockInstance } from 'vitest';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { logger } from 'storybook/internal/client-logger';
import type { StoryContextForEnhancers } from 'storybook/internal/types';
import { argTypesEnhancers } from './inferControls';
const getStor... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/sortStories.ts | code/core/src/preview-api/modules/store/sortStories.ts | import type {
Addon_Comparator,
Addon_StorySortParameter,
Addon_StorySortParameterV7,
IndexEntry,
IndexEntryLegacy,
StoryIndexEntry,
} from 'storybook/internal/types';
import type { Parameters, Path, Renderer } from 'storybook/internal/types';
import type { PreparedStory } from 'storybook/internal/types';
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/index.ts | code/core/src/preview-api/modules/store/index.ts | export { StoryStore } from './StoryStore';
export { combineParameters } from './parameters';
export { filterArgTypes } from './filterArgTypes';
export type { PropDescriptor } from './filterArgTypes';
export { inferControls } from './inferControls';
export * from './csf';
export * from './hooks';
export * from './decor... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/hooks.test.ts | code/core/src/preview-api/modules/store/hooks.test.ts | import { beforeEach, describe, expect, it, vi } from 'vitest';
import {
FORCE_RE_RENDER,
RESET_STORY_ARGS,
STORY_RENDERED,
UPDATE_GLOBALS,
UPDATE_STORY_ARGS,
} from 'storybook/internal/core-events';
import type { DecoratorFunction, StoryContext } from 'storybook/internal/types';
import {
HooksContext,
a... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/reporter-api.ts | code/core/src/preview-api/modules/store/reporter-api.ts | export interface Report<T = unknown> {
type: string;
version?: number;
result: T;
status: 'failed' | 'passed' | 'warning';
}
export class ReporterAPI {
reports: Report[] = [];
async addReport(report: Report) {
this.reports.push(report);
}
}
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/StoryStore.test.ts | code/core/src/preview-api/modules/store/StoryStore.test.ts | import { describe, expect, it, vi } from 'vitest';
import type { ProjectAnnotations, Renderer, StoryIndex } from 'storybook/internal/types';
import { StoryStore } from './StoryStore';
import { composeConfigs } from './csf/composeConfigs';
import { prepareStory } from './csf/prepareStory';
import { processCSFFile } fr... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/hooks.ts | code/core/src/preview-api/modules/store/hooks.ts | import {
HooksContext,
applyHooks,
useArgs,
useCallback,
useChannel,
useEffect,
useGlobals,
useMemo,
useParameter,
useReducer,
useRef,
useState,
useStoryContext,
} from '../addons';
export {
HooksContext,
applyHooks,
useMemo,
useCallback,
useRef,
useState,
useReducer,
useEffec... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/csf/beforeAll.test.ts | code/core/src/preview-api/modules/store/csf/beforeAll.test.ts | import { beforeEach, describe, expect, it } from 'vitest';
import { composeBeforeAllHooks } from './beforeAll';
const calls: string[] = [];
beforeEach(() => {
calls.length = 0;
});
const basicHook = (label: string) => () => {
calls.push(label);
};
const asyncHook = (label: string, delay: number) => async () => ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/csf/processCSFFile.ts | code/core/src/preview-api/modules/store/csf/processCSFFile.ts | import { logger } from 'storybook/internal/client-logger';
import type { Story } from 'storybook/internal/csf';
import { getStoryChildren, isExportStory, isStory, toTestId } from 'storybook/internal/csf';
import type { ComponentTitle, Parameters, Path, Renderer } from 'storybook/internal/types';
import type {
CSFFile... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/csf/normalizeArrays.ts | code/core/src/preview-api/modules/store/csf/normalizeArrays.ts | export const normalizeArrays = <T>(array: T[] | T | undefined): T[] => {
if (Array.isArray(array)) {
return array;
}
return array ? [array] : [];
};
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/csf/normalizeStory.test.ts | code/core/src/preview-api/modules/store/csf/normalizeStory.test.ts | import { describe, expect, it, vi } from 'vitest';
import type { Renderer, StoryAnnotationsOrFn } from 'storybook/internal/types';
import { normalizeStory } from './normalizeStory';
vi.mock('storybook/internal/client-logger');
describe('normalizeStory', () => {
describe('id generation', () => {
it('respects c... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/csf/stepRunners.ts | code/core/src/preview-api/modules/store/csf/stepRunners.ts | import type { Renderer, StepRunner } from 'storybook/internal/types';
/**
* Compose step runners to create a single step runner that applies each step runner in order.
*
* A step runner is a function that takes a defined step:
*
* @example
*
* ```ts
* step('label', () => {});
* ```
*
* ...and runs it. The p... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/csf/getValuesFromArgTypes.ts | code/core/src/preview-api/modules/store/csf/getValuesFromArgTypes.ts | import type { ArgTypes } from 'storybook/internal/types';
export const getValuesFromArgTypes = (argTypes: ArgTypes = {}) =>
Object.entries(argTypes).reduce((acc, [arg, { defaultValue }]) => {
if (typeof defaultValue !== 'undefined') {
acc[arg] = defaultValue;
}
return acc;
}, {} as ArgTypes);
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/csf/portable-stories.test.ts | code/core/src/preview-api/modules/store/csf/portable-stories.test.ts | // @vitest-environment node
import { describe, expect, it, vi } from 'vitest';
import type { ProjectAnnotations } from 'storybook/internal/csf';
import type {
ComponentAnnotations as Meta,
Store_CSFExports,
StoryAnnotationsOrFn as Story,
} from 'storybook/internal/types';
import * as defaultExportAnnotations fr... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/csf/normalizeProjectAnnotations.ts | code/core/src/preview-api/modules/store/csf/normalizeProjectAnnotations.ts | import type {
ArgTypes,
NormalizedProjectAnnotations,
ProjectAnnotations,
Renderer,
} from 'storybook/internal/types';
import { inferArgTypes } from '../inferArgTypes';
import { inferControls } from '../inferControls';
import { normalizeArrays } from './normalizeArrays';
import { normalizeInputTypes } from './... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/csf/stepRunners.test.ts | code/core/src/preview-api/modules/store/csf/stepRunners.test.ts | import { describe, expect, it, vi } from 'vitest';
import type { StepRunner, StoryContext } from 'storybook/internal/types';
import { composeStepRunners } from './stepRunners';
describe('stepRunners', () => {
it('composes each step runner', async () => {
const order: string[] = [];
const firstStepRunner: ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/csf/normalizeProjectAnnotations.test.ts | code/core/src/preview-api/modules/store/csf/normalizeProjectAnnotations.test.ts | import { describe, expect, it } from 'vitest';
import { normalizeProjectAnnotations } from './normalizeProjectAnnotations';
describe('normalizeProjectAnnotations', () => {
it('passes through initialGlobals', () => {
expect(
normalizeProjectAnnotations({
initialGlobals: { a: 'b' },
})
).t... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/csf/beforeAll.ts | code/core/src/preview-api/modules/store/csf/beforeAll.ts | import { type BeforeAll, type CleanupCallback } from 'storybook/internal/csf';
// Execute all the hooks in sequence, and return a function that will execute cleanups in reverse order
export const composeBeforeAllHooks = (hooks: BeforeAll[]): BeforeAll => {
return async () => {
const cleanups: CleanupCallback[] =... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/csf/prepareStory.ts | code/core/src/preview-api/modules/store/csf/prepareStory.ts | import { type CleanupCallback, combineTags, includeConditionalArg } from 'storybook/internal/csf';
import { NoRenderFunctionError } from 'storybook/internal/preview-errors';
import type {
Args,
ArgsStoryFn,
Globals,
ModuleExport,
NormalizedComponentAnnotations,
NormalizedProjectAnnotations,
NormalizedStor... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/csf/processCSFFile.test.ts | code/core/src/preview-api/modules/store/csf/processCSFFile.test.ts | import { describe, expect, it } from 'vitest';
import { processCSFFile } from './processCSFFile';
it('returns a CSFFile object with meta and stories', () => {
const { meta, stories } = processCSFFile(
{
default: { title: 'Component' },
storyOne: { args: { a: 1 } },
storyTwo: { args: { a: 2 } }... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/csf/normalizeStory.ts | code/core/src/preview-api/modules/store/csf/normalizeStory.ts | import { deprecate, logger } from 'storybook/internal/client-logger';
import { storyNameFromExport, toId } from 'storybook/internal/csf';
import type {
ArgTypes,
ArgsStoryFn,
NormalizedComponentAnnotations,
NormalizedStoryAnnotations,
Renderer,
StoryAnnotationsOrFn,
StoryId,
} from 'storybook/internal/typ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/csf/csf-factory-utils.ts | code/core/src/preview-api/modules/store/csf/csf-factory-utils.ts | import { type Meta, type Story, isMeta, isStory } from 'storybook/internal/csf';
import type {
Args,
ComponentAnnotations,
LegacyStoryAnnotationsOrFn,
ProjectAnnotations,
Renderer,
} from 'storybook/internal/types';
export function getCsfFactoryAnnotations<
TRenderer extends Renderer = Renderer,
TArgs ex... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/csf/normalizeComponentAnnotations.ts | code/core/src/preview-api/modules/store/csf/normalizeComponentAnnotations.ts | import { sanitize } from 'storybook/internal/csf';
import type { ModuleExports, NormalizedComponentAnnotations } from 'storybook/internal/types';
import type { Renderer } from 'storybook/internal/types';
import { normalizeInputTypes } from './normalizeInputTypes';
export function normalizeComponentAnnotations<TRender... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/csf/normalizeInputTypes.test.ts | code/core/src/preview-api/modules/store/csf/normalizeInputTypes.test.ts | import { describe, expect, it } from 'vitest';
import { normalizeInputType, normalizeInputTypes } from './normalizeInputTypes';
describe('normalizeInputType', () => {
it('does nothing to strict types', () => {
expect(
normalizeInputType(
{
name: 'name',
type: { name: 'string' }... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/csf/composeConfigs.ts | code/core/src/preview-api/modules/store/csf/composeConfigs.ts | import type { ModuleExports, NormalizedProjectAnnotations } from 'storybook/internal/types';
import type { Renderer } from 'storybook/internal/types';
import { global } from '@storybook/global';
import { combineParameters } from '../parameters';
import { composeBeforeAllHooks } from './beforeAll';
import { normalizeA... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/csf/prepareStory.test.ts | code/core/src/preview-api/modules/store/csf/prepareStory.test.ts | import { beforeEach, describe, expect, it, vi } from 'vitest';
import type {
ArgsEnhancer,
NormalizedComponentAnnotations,
NormalizedStoryAnnotations,
PreparedStory,
ProjectAnnotations,
Renderer,
SBScalarType,
StoryContext,
} from 'storybook/internal/types';
import { global } from '@storybook/global';... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/csf/portable-stories.ts | code/core/src/preview-api/modules/store/csf/portable-stories.ts | import { type CleanupCallback, isExportStory } from 'storybook/internal/csf';
import { getCoreAnnotations } from 'storybook/internal/csf';
import { MountMustBeDestructuredError } from 'storybook/internal/preview-errors';
import type {
Args,
Canvas,
ComponentAnnotations,
ComposeStoryFn,
ComposedStoryFn,
Lega... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/csf/index.ts | code/core/src/preview-api/modules/store/csf/index.ts | export * from './normalizeInputTypes';
export * from './normalizeStory';
export * from './processCSFFile';
export * from './prepareStory';
export * from './normalizeComponentAnnotations';
export * from './normalizeProjectAnnotations';
export * from './normalizeArrays';
export * from './getValuesFromArgTypes';
export * ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/csf/normalizeInputTypes.ts | code/core/src/preview-api/modules/store/csf/normalizeInputTypes.ts | import type {
ArgTypes,
GlobalTypes,
InputType,
StrictArgTypes,
StrictGlobalTypes,
StrictInputType,
} from 'storybook/internal/types';
import { mapValues } from 'es-toolkit/object';
const normalizeType = (type: InputType['type']): StrictInputType['type'] => {
return typeof type === 'string' ? { name: ty... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/csf/composeConfigs.test.ts | code/core/src/preview-api/modules/store/csf/composeConfigs.test.ts | import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { global } from '@storybook/global';
import { composeConfigs } from './composeConfigs';
vi.mock('@storybook/global', () => ({
global: {
FEATURES: {},
},
}));
describe('composeConfigs', () => {
it('sets default (empty) values ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/csf/__mocks__/defaultExportAnnotations.mockfile.ts | code/core/src/preview-api/modules/store/csf/__mocks__/defaultExportAnnotations.mockfile.ts | export default {
parameters: {
fromAnnotations: {
asDefaultImport: true,
},
},
};
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/store/csf/__mocks__/namedExportAnnotations.mockfile.ts | code/core/src/preview-api/modules/store/csf/__mocks__/namedExportAnnotations.mockfile.ts | export const parameters = {
fromAnnotations: {
asObjectImport: true,
},
};
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/addons/make-decorator.ts | code/core/src/preview-api/modules/addons/make-decorator.ts | import type {
Addon_LegacyStoryFn,
Addon_StoryContext,
Addon_StoryWrapper,
} from 'storybook/internal/types';
export type MakeDecoratorResult = (...args: any) => any;
export interface MakeDecoratorOptions {
name: string;
parameterName: string;
skipIfNoParametersOrOptions?: boolean;
wrapper: Addon_StoryW... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/addons/make-decorator.test.ts | code/core/src/preview-api/modules/addons/make-decorator.test.ts | import { describe, expect, it, vi } from 'vitest';
import type { Addon_StoryContext } from 'storybook/internal/types';
import { makeDecorator } from './make-decorator';
// Copy & paste from internal api: client-api/src/client_api
type DecoratorFn = (fn: any, context: Addon_StoryContext) => any;
const defaultDecorat... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/addons/main.ts | code/core/src/preview-api/modules/addons/main.ts | import type { Channel } from 'storybook/internal/channels';
import { global } from '@storybook/global';
import { mockChannel } from './storybook-channel-mock';
export class AddonStore {
constructor() {
this.promise = new Promise((res) => {
this.resolve = () => res(this.getChannel());
}) as Promise<Ch... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/addons/storybook-channel-mock.ts | code/core/src/preview-api/modules/addons/storybook-channel-mock.ts | import { Channel } from 'storybook/internal/channels';
export function mockChannel() {
const transport = {
setHandler: () => {},
send: () => {},
};
return new Channel({ transport });
}
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/addons/index.ts | code/core/src/preview-api/modules/addons/index.ts | export * from './main';
export * from './hooks';
export * from './make-decorator';
export * from './storybook-channel-mock';
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/preview-api/modules/addons/hooks.ts | code/core/src/preview-api/modules/addons/hooks.ts | import { logger } from 'storybook/internal/client-logger';
import {
FORCE_RE_RENDER,
RESET_STORY_ARGS,
STORY_RENDERED,
UPDATE_GLOBALS,
UPDATE_STORY_ARGS,
} from 'storybook/internal/core-events';
import type {
Args,
DecoratorApplicator,
DecoratorFunction,
LegacyStoryFn,
Renderer,
StoryContext,
St... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/highlight/StoryContent.tsx | code/core/src/highlight/StoryContent.tsx | import React from 'react';
export const StoryContent = ({
dynamic,
withPopover,
}: {
dynamic: boolean;
withPopover: boolean;
}) => {
const [extra, setExtra] = React.useState(false);
React.useEffect(() => {
if (!dynamic) {
return;
}
const interval = setInterval(() => setExtra((v) => !v), 1... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/highlight/typings.d.ts | code/core/src/highlight/typings.d.ts | declare var __STORYBOOK_HIGHLIGHT_INITIALIZED: boolean;
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/highlight/preview.ts | code/core/src/highlight/preview.ts | /* eslint-env browser */
import { definePreviewAddon } from 'storybook/internal/csf';
import { addons } from 'storybook/preview-api';
import type { HighlightTypes } from './types';
import { useHighlights } from './useHighlights';
if (globalThis?.FEATURES?.highlight && addons?.ready) {
addons.ready().then(useHighli... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/highlight/utils.ts | code/core/src/highlight/utils.ts | /* eslint-env browser */
import { MIN_TOUCH_AREA_SIZE } from './constants';
import { type IconName, iconPaths } from './icons';
import type {
Box,
ClickEventDetails,
Highlight,
HighlightOptions,
RawHighlightOptions,
} from './types';
const svgElements = 'svg,path,rect,circle,line,polyline,polygon,ellipse,tex... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/highlight/icons.ts | code/core/src/highlight/icons.ts | export const iconPaths = {
chevronLeft: [
'M9.10355 10.1464C9.29882 10.3417 9.29882 10.6583 9.10355 10.8536C8.90829 11.0488 8.59171 11.0488 8.39645 10.8536L4.89645 7.35355C4.70118 7.15829 4.70118 6.84171 4.89645 6.64645L8.39645 3.14645C8.59171 2.95118 8.90829 2.95118 9.10355 3.14645C9.29882 3.34171 9.29882 3.6582... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/highlight/useHighlights.ts | code/core/src/highlight/useHighlights.ts | /// <reference path="./typings.d.ts" />
/* eslint-env browser */
import type { Channel } from 'storybook/internal/channels';
import { STORY_RENDER_PHASE_CHANGED } from 'storybook/internal/core-events';
import {
HIGHLIGHT,
MAX_Z_INDEX,
MIN_TOUCH_AREA_SIZE,
REMOVE_HIGHLIGHT,
RESET_HIGHLIGHT,
SCROLL_INTO_VIEW... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/highlight/useHighlights.stories.tsx | code/core/src/highlight/useHighlights.stories.tsx | import React from 'react';
import { useChannel } from 'storybook/preview-api';
import { fn, userEvent, within } from 'storybook/test';
import preview from '../../../.storybook/preview';
import { StoryContent } from './StoryContent';
import { HIGHLIGHT, REMOVE_HIGHLIGHT, SCROLL_INTO_VIEW } from './constants';
const h... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/highlight/utils.test.ts | code/core/src/highlight/utils.test.ts | import { describe, expect, it, vi } from 'vitest';
import { useStore } from './utils';
describe('useStore', () => {
it('should return the initial value', () => {
const { get } = useStore(1);
expect(get()).toBe(1);
});
it('should update the value', () => {
const { get, set } = useStore(1);
set(2... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/highlight/constants.ts | code/core/src/highlight/constants.ts | export const ADDON_ID = 'storybook/highlight';
export const HIGHLIGHT = `${ADDON_ID}/add`;
export const REMOVE_HIGHLIGHT = `${ADDON_ID}/remove`;
export const RESET_HIGHLIGHT = `${ADDON_ID}/reset`;
export const SCROLL_INTO_VIEW = `${ADDON_ID}/scroll-into-view`;
export const MAX_Z_INDEX = 2147483647;
export const MIN_T... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/highlight/types.ts | code/core/src/highlight/types.ts | import type { IconName } from './icons';
export interface HighlightTypes {
parameters: HighlightParameters;
}
export interface HighlightParameters {
/**
* Highlight configuration
*
* @see https://storybook.js.org/docs/essentials/highlight#parameters
*/
highlight?: {
/**
* Removes the tool a... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/highlight/index.ts | code/core/src/highlight/index.ts | export { HIGHLIGHT, REMOVE_HIGHLIGHT, RESET_HIGHLIGHT, SCROLL_INTO_VIEW } from './constants';
export type { ClickEventDetails, HighlightMenuItem, HighlightOptions } from './types';
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/shared/universal-store/instances.ts | code/core/src/shared/universal-store/instances.ts | // this module just contains a map of all the instances of the UniversalStore
// it's a separate module so it can be mocked in tests
import type { UniversalStore } from '.';
export const instances: Map<string, UniversalStore<any, any>> = new Map();
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/shared/universal-store/index.test-d.ts | code/core/src/shared/universal-store/index.test-d.ts | import { describe, expectTypeOf, it } from 'vitest';
import { UniversalStore } from '.';
import type { EventInfo, InternalEvent } from './types';
import { useUniversalStore as useUniversalStoreManager } from './use-universal-store-manager';
import { useUniversalStore as useUniversalStorePreview } from './use-universal... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/shared/universal-store/index.test.ts | code/core/src/shared/universal-store/index.test.ts | import { beforeEach, describe, expect, it, vi } from 'vitest';
import { dedent } from 'ts-dedent';
import { UniversalStore } from '.';
import { instances as mockedInstances } from './__mocks__/instances';
import { MockUniversalStore } from './mock';
import type { ChannelEvent } from './types';
vi.mock('./instances')... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | true |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/shared/universal-store/use-universal-store-manager.ts | code/core/src/shared/universal-store/use-universal-store-manager.ts | import * as React from 'react';
import { isEqual } from 'es-toolkit/predicate';
import type { UniversalStore } from './index';
/**
* A hook to use a UniversalStore in the manager UI (eg. in an addon panel). This hook will react to
* changes in the store state and re-render when the store changes.
*
* @param univ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/shared/universal-store/use-universal-store-manager.test.ts | code/core/src/shared/universal-store/use-universal-store-manager.test.ts | // @vitest-environment happy-dom
import { act, renderHook } from '@testing-library/react';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { UniversalStore } from '.';
import { instances as mockedInstances } from './__mocks__/instances';
import type { ChannelEvent } from './types';
import { useUn... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/shared/universal-store/types.ts | code/core/src/shared/universal-store/types.ts | import type { Channel } from 'storybook/internal/channels';
import type { UniversalStore } from '.';
export type EnvironmentType =
(typeof UniversalStore.Environment)[keyof typeof UniversalStore.Environment];
export type StatusType = (typeof UniversalStore.Status)[keyof typeof UniversalStore.Status];
export type ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/shared/universal-store/mock.ts | code/core/src/shared/universal-store/mock.ts | import { Channel } from 'storybook/internal/channels';
import { dedent } from 'ts-dedent';
import { UniversalStore } from '.';
import type { StoreOptions } from './types';
/**
* A mock universal store that can be used when testing code that relies on a universal store. It
* functions exactly like a normal universa... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/shared/universal-store/index.ts | code/core/src/shared/universal-store/index.ts | import { dedent } from 'ts-dedent';
import { instances } from './instances';
import type {
Actor,
ChannelEvent,
ChannelLike,
EnvironmentOverrides,
EnvironmentType,
Event,
EventInfo,
ExistingStateResponseEvent,
Listener,
SetStateEvent,
StateUpdater,
StatusType,
StoreOptions,
} from './types';
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/shared/universal-store/use-universal-store-preview.ts | code/core/src/shared/universal-store/use-universal-store-preview.ts | import { isEqual } from 'es-toolkit/predicate';
import { useEffect, useState } from 'storybook/preview-api';
import type { UniversalStore } from './index';
/**
* A hook to use a UniversalStore in a rendered preview. This hook will react to changes in the
* store state and re-render when the store changes.
*
* @pa... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/shared/universal-store/__mocks__/instances.ts | code/core/src/shared/universal-store/__mocks__/instances.ts | /**
* Mock implementation of a universal store instances manager for testing purposes.
*
* This class provides a two-level map structure to manage store instances:
*
* - First level: environments (identified by environment key)
* - Second level: store instances within each environment (identified by instance key)... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/shared/utils/module.ts | code/core/src/shared/utils/module.ts | import { statSync } from 'node:fs';
import { createRequire, register } from 'node:module';
import { win32 } from 'node:path/win32';
import { fileURLToPath, pathToFileURL } from 'node:url';
import { resolveModulePath } from 'exsolve';
import { dirname, join } from 'pathe';
/**
* This is just an alias for import.meta.... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/shared/test-provider-store/index.test-d.ts | code/core/src/shared/test-provider-store/index.test-d.ts | import { describe, expectTypeOf, it } from 'vitest';
import {
type TestProviderState,
type TestProviderStateByProviderId,
UNIVERSAL_TEST_PROVIDER_STORE_OPTIONS,
createTestProviderStore,
} from '.';
import { MockUniversalStore } from '../universal-store/mock';
import { useUniversalStore } from '../universal-sto... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/shared/test-provider-store/index.test.ts | code/core/src/shared/test-provider-store/index.test.ts | // @vitest-environment happy-dom
import { act, renderHook } from '@testing-library/react';
import { afterEach, describe, expect, it, vi } from 'vitest';
import { MockUniversalStore } from '../universal-store/mock';
import { useUniversalStore } from '../universal-store/use-universal-store-manager';
import {
type Test... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/shared/test-provider-store/index.ts | code/core/src/shared/test-provider-store/index.ts | import type { UniversalStore } from '../universal-store';
import type { BaseEvent, StoreOptions } from '../universal-store/types';
import type { useUniversalStore as managerUseUniversalStore } from '../universal-store/use-universal-store-manager';
export const UNIVERSAL_TEST_PROVIDER_STORE_OPTIONS: StoreOptions<TestPr... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/shared/status-store/index.test-d.ts | code/core/src/shared/status-store/index.test-d.ts | import { describe, expectTypeOf, it } from 'vitest';
import {
type Status,
type StatusesByStoryIdAndTypeId,
UNIVERSAL_STATUS_STORE_OPTIONS,
createStatusStore,
} from '.';
import type { StoryId } from '../../types';
import { MockUniversalStore } from '../universal-store/mock';
import { useUniversalStore } from ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/shared/status-store/index.test.ts | code/core/src/shared/status-store/index.test.ts | // @vitest-environment happy-dom
import { act, renderHook } from '@testing-library/react';
import { afterEach, describe, expect, it, vi } from 'vitest';
import { MockUniversalStore } from '../universal-store/mock';
import { useUniversalStore } from '../universal-store/use-universal-store-manager';
import {
type Stat... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/shared/status-store/index.ts | code/core/src/shared/status-store/index.ts | import { StatusTypeIdMismatchError as ManagerStatusTypeIdMismatchError } from '../../manager-errors';
import { StatusTypeIdMismatchError as PreviewStatusTypeIdMismatchError } from '../../preview-errors';
import { StatusTypeIdMismatchError as ServerStatusTypeIdMismatchError } from '../../server-errors';
import type { St... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/shared/checklist-store/checklistData.state.ts | code/core/src/shared/checklist-store/checklistData.state.ts | import type { StoreState } from '.';
export const initialState = {
items: {
accessibilityTests: { status: 'open' },
autodocs: { status: 'open' },
ciTests: { status: 'open' },
controls: { status: 'open' },
coverage: { status: 'open' },
guidedTour: { status: 'open' },
installA11y: { status:... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/shared/checklist-store/index.ts | code/core/src/shared/checklist-store/index.ts | import type { globalSettings } from '../../cli/globalSettings';
import type { UniversalStore } from '../universal-store';
import type { StoreOptions } from '../universal-store/types';
import { initialState } from './checklistData.state';
/** ChecklistState is the persisted state, which may be incomplete */
export type... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/shared/checklist-store/checklistData.tsx | code/core/src/shared/checklist-store/checklistData.tsx | import type { ComponentProps } from 'react';
import React from 'react';
import { Link, SyntaxHighlighter } from 'storybook/internal/components';
import {
PREVIEW_INITIALIZED,
STORY_ARGS_UPDATED,
STORY_FINISHED,
STORY_INDEX_INVALIDATED,
UPDATE_GLOBALS,
} from 'storybook/internal/core-events';
import {
type ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | true |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/shared/constants/environments-support.ts | code/core/src/shared/constants/environments-support.ts | import type { BuildOptions } from 'esbuild';
// https://esbuild.github.io/api/#target
export const BROWSER_TARGETS: BuildOptions['target'] = [
'chrome131',
'edge134',
'firefox136',
'safari18.3',
'ios18.3',
'opera117',
];
// https://esbuild.github.io/api/#target
export const NODE_TARGET: BuildOptions['targ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/backgrounds/typings.d.ts | code/core/src/backgrounds/typings.d.ts | declare var FEATURES: import('storybook/internal/types').StorybookConfigRaw['features'];
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/backgrounds/defaults.ts | code/core/src/backgrounds/defaults.ts | import type { BackgroundMap } from './types';
export const DEFAULT_BACKGROUNDS: BackgroundMap = {
light: { name: 'light', value: '#F8F8F8' },
dark: { name: 'dark', value: '#333' },
};
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/backgrounds/preview.ts | code/core/src/backgrounds/preview.ts | import { definePreviewAddon } from 'storybook/internal/csf';
import { PARAM_KEY } from './constants';
import { withBackgroundAndGrid } from './decorator';
import type {
BackgroundTypes,
BackgroundsGlobals,
BackgroundsParameters,
GlobalState,
} from './types';
const decorators = globalThis.FEATURES?.background... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/backgrounds/manager.tsx | code/core/src/backgrounds/manager.tsx | import React from 'react';
import { addons, types } from 'storybook/manager-api';
import { BackgroundTool } from './components/Tool';
import { ADDON_ID } from './constants';
export default addons.register(ADDON_ID, () => {
if (globalThis?.FEATURES?.backgrounds) {
addons.add(ADDON_ID, {
title: 'Background... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/backgrounds/utils.ts | code/core/src/backgrounds/utils.ts | const { document } = globalThis;
export const isReduceMotionEnabled = () => {
if (!globalThis?.matchMedia) {
return false;
}
const prefersReduceMotion = globalThis.matchMedia('(prefers-reduced-motion: reduce)');
return !!prefersReduceMotion?.matches;
};
export const clearStyles = (selector: string | strin... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/backgrounds/constants.ts | code/core/src/backgrounds/constants.ts | export const ADDON_ID = 'storybook/background';
export const PARAM_KEY = 'backgrounds';
export const GRID_PARAM_KEY = 'grid';
export const EVENTS = {
UPDATE: `${ADDON_ID}/update`,
};
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/backgrounds/decorator.ts | code/core/src/backgrounds/decorator.ts | import type { DecoratorFunction } from 'storybook/internal/types';
import { useEffect } from 'storybook/preview-api';
import { PARAM_KEY } from './constants';
import { DEFAULT_BACKGROUNDS } from './defaults';
import type { BackgroundsParameters, GridConfig } from './types';
import { addBackgroundStyle, addGridStyle, ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/backgrounds/types.ts | code/core/src/backgrounds/types.ts | import type { PARAM_KEY } from './constants';
export interface Background {
name: string;
value: string;
}
export type BackgroundMap = Record<string, Background>;
export interface GridConfig {
cellAmount: number;
cellSize: number;
opacity: number;
offsetX?: number;
offsetY?: number;
}
export type Glob... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/backgrounds/components/Tool.tsx | code/core/src/backgrounds/components/Tool.tsx | import React, { Fragment, memo, useCallback } from 'react';
import { Select, ToggleButton } from 'storybook/internal/components';
import { CircleIcon, GridIcon, PhotoIcon } from '@storybook/icons';
import { useGlobals, useParameter } from 'storybook/manager-api';
import { PARAM_KEY as KEY } from '../constants';
imp... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/event-cache.ts | code/core/src/telemetry/event-cache.ts | import { cache } from 'storybook/internal/common';
import type { EventType, TelemetryEvent } from './types';
interface UpgradeSummary {
timestamp: number;
eventType?: EventType;
eventId?: string;
sessionId?: string;
}
export interface CacheEntry {
timestamp: number;
body: TelemetryEvent;
}
let processin... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/event-cache.test.ts | code/core/src/telemetry/event-cache.test.ts | import type { MockInstance } from 'vitest';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { cache } from 'storybook/internal/common';
import type { CacheEntry } from './event-cache';
import { getLastEvents, getPrecedingUpgrade, set } from './event-cache';
import type { TelemetryEvent } from '.... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/notify.ts | code/core/src/telemetry/notify.ts | import { cache } from 'storybook/internal/common';
import { logger } from 'storybook/internal/node-logger';
import { dedent } from 'ts-dedent';
const TELEMETRY_KEY_NOTIFY_DATE = 'telemetry-notification-date';
let called = false;
/**
* The end-user has already been notified about our telemetry integration. We don't... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/get-portable-stories-usage.ts | code/core/src/telemetry/get-portable-stories-usage.ts | import { execCommandCountLines } from './exec-command-count-lines';
import { runTelemetryOperation } from './run-telemetry-operation';
export const getPortableStoriesFileCountUncached = async (path?: string) => {
try {
return await execCommandCountLines('git', [
'grep',
'-l',
'composeStor',
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/get-has-router-package.test.ts | code/core/src/telemetry/get-has-router-package.test.ts | import { expect, it } from 'vitest';
import { getHasRouterPackage } from './get-has-router-package';
it('returns true if there is a routing package in package.json', () => {
expect(
getHasRouterPackage({
dependencies: {
react: '^18',
'react-dom': '^18',
'react-router': '^6',
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/get-application-file-count.test.ts | code/core/src/telemetry/get-application-file-count.test.ts | import { join } from 'node:path';
import { describe, expect, it } from 'vitest';
import { getApplicationFilesCountUncached } from './get-application-file-count';
const mocksDir = join(__dirname, '..', '__mocks__');
describe('getApplicationFilesCount', () => {
it('should find files with correct names', async () =>... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/telemetry.ts | code/core/src/telemetry/telemetry.ts | /// <reference types="node" />
import { readFileSync } from 'node:fs';
import * as os from 'node:os';
import { join } from 'node:path';
import { isCI } from 'storybook/internal/common';
import retry from 'fetch-retry';
import { nanoid } from 'nanoid';
import { version } from '../../package.json';
import { resolvePac... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/get-package-manager-info.ts | code/core/src/telemetry/get-package-manager-info.ts | // eslint-disable-next-line depend/ban-dependencies
import { execaCommand } from 'execa';
import { detect } from 'package-manager-detector';
import { getProjectRoot } from '../common';
export const getPackageManagerInfo = async () => {
const packageManagerType = await detect({ cwd: getProjectRoot() });
if (!pack... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/one-way-hash.ts | code/core/src/telemetry/one-way-hash.ts | import type { BinaryLike } from 'crypto';
import { createHash } from 'crypto';
export const oneWayHash = (payload: BinaryLike): string => {
const hash = createHash('sha256');
// Always prepend the payload value with salt. This ensures the hash is truly
// one-way.
hash.update('storybook-telemetry-salt');
/... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.