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/telemetry/run-telemetry-operation.ts | code/core/src/telemetry/run-telemetry-operation.ts | import { createFileSystemCache, resolvePathInStorybookCache } from '../common';
const cache = createFileSystemCache({
basePath: resolvePathInStorybookCache('telemetry'),
ns: 'storybook',
ttl: 24 * 60 * 60 * 1000, // 24h
});
/**
* Run an (expensive) operation, caching the result in a FS cache for 24 hours.
*
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/get-framework-info.ts | code/core/src/telemetry/get-framework-info.ts | import { getStorybookInfo } from 'storybook/internal/common';
import type { StorybookConfig } from 'storybook/internal/types';
import { cleanPaths } from './sanitize';
const cleanAndSanitizePath = (path: string) => {
return cleanPaths(path).replace(/.*node_modules[\\/]/, '');
};
export async function getFrameworkI... | 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.ts | code/core/src/telemetry/get-has-router-package.ts | import type { PackageJson } from '../types';
const routerPackages = new Set([
'react-router',
'react-router-dom',
'remix',
'@tanstack/react-router',
'expo-router',
'@reach/router',
'react-easy-router',
'@remix-run/router',
'wouter',
'wouter-preact',
'preact-router',
'vue-router',
'unplugin-vu... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/storybook-metadata.test.ts | code/core/src/telemetry/storybook-metadata.test.ts | import path from 'node:path';
import type { MockInstance } from 'vitest';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { getStorybookInfo, isCI } from 'storybook/internal/common';
import {
type PackageJson,
type StorybookConfig,
SupportedBuilder,
SupportedFramework,
Suppo... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/session-id.ts | code/core/src/telemetry/session-id.ts | import { cache } from 'storybook/internal/common';
import { nanoid } from 'nanoid';
export const SESSION_TIMEOUT = 1000 * 60 * 60 * 2; // 2h
interface Session {
id: string;
lastUsed: number;
}
let sessionId: string | undefined;
export const resetSessionIdForTest = (val: string | undefined = undefined) => {
s... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/error-collector.test.ts | code/core/src/telemetry/error-collector.test.ts | import { describe, expect, it } from 'vitest';
import { ErrorCollector } from './error-collector';
describe('ErrorCollector', () => {
it('should collect errors', () => {
const error = new Error('Test error');
ErrorCollector.addError(error);
expect(ErrorCollector.getErrors()).toEqual([error]);
});
});... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/fetch.ts | code/core/src/telemetry/fetch.ts | export const fetch = global.fetch;
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/telemetry.test.ts | code/core/src/telemetry/telemetry.test.ts | import { beforeEach, expect, it, vi } from 'vitest';
import { fetch } from './fetch';
import { sendTelemetry } from './telemetry';
vi.mock('./fetch');
vi.mock('./event-cache', () => {
return { set: vi.fn() };
});
vi.mock('./session-id', () => {
return {
getSessionId: async () => {
return 'session-id';
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/get-monorepo-type.ts | code/core/src/telemetry/get-monorepo-type.ts | import { existsSync, readFileSync } from 'node:fs';
import { join } from 'node:path';
import { getProjectRoot } from 'storybook/internal/common';
import type { PackageJson } from 'storybook/internal/types';
export const monorepoConfigs = {
Nx: 'nx.json',
Turborepo: 'turbo.json',
Lerna: 'lerna.json',
Rush: 'ru... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/anonymous-id.ts | code/core/src/telemetry/anonymous-id.ts | import { relative } from 'node:path';
import { getProjectRoot } from 'storybook/internal/common';
import { execSync } from 'child_process';
// eslint-disable-next-line depend/ban-dependencies
import slash from 'slash';
import { oneWayHash } from './one-way-hash';
export function normalizeGitUrl(rawUrl: string) {
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/get-chromatic-version.ts | code/core/src/telemetry/get-chromatic-version.ts | import type { PackageJson } from 'storybook/internal/types';
export function getChromaticVersionSpecifier(packageJson: PackageJson) {
const dependency =
packageJson.dependencies?.chromatic ||
packageJson.devDependencies?.chromatic ||
packageJson.peerDependencies?.chromatic;
if (dependency) {
retur... | 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.test.ts | code/core/src/telemetry/get-portable-stories-usage.test.ts | import { join } from 'node:path';
import { describe, expect, it } from 'vitest';
import { getPortableStoriesFileCountUncached } from './get-portable-stories-usage';
const mocksDir = join(__dirname, '..', '__mocks__');
describe('getPortableStoriesFileCountUncached', () => {
it('should ignores node_modules, non-sou... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/get-chromatic-version.test.ts | code/core/src/telemetry/get-chromatic-version.test.ts | import { expect, it } from 'vitest';
import { getChromaticVersionSpecifier } from './get-chromatic-version';
it('works for dependencies', () => {
expect(getChromaticVersionSpecifier({ dependencies: { chromatic: '^6.11.4' } })).toBe('^6.11.4');
});
it('works for scripts', () => {
expect(getChromaticVersionSpecifi... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/sanitize.ts | code/core/src/telemetry/sanitize.ts | import path from 'node:path';
export interface IErrorWithStdErrAndStdOut {
stderr?: Buffer | string;
stdout?: Buffer | string;
[key: string]: unknown;
}
// Removes all user paths
function regexpEscape(str: string): string {
return str.replace(/[-[/{}()*+?.\\^$|]/g, `\\$&`);
}
export function removeAnsiEscape... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/sanitize.test.ts | code/core/src/telemetry/sanitize.test.ts | import { describe, expect, it, vi } from 'vitest';
import { cleanPaths, sanitizeError } from './sanitize';
describe(`Errors Helpers`, () => {
describe(`sanitizeError`, () => {
it(`Sanitizes ansi codes in error`, () => {
const errorMessage = `\u001B[4mStorybook\u001B[0m`;
let e: any;
try {
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/get-framework-info.test.ts | code/core/src/telemetry/get-framework-info.test.ts | import { beforeEach, describe, expect, it, vi } from 'vitest';
import type { StorybookConfig } from 'storybook/internal/types';
import { getFrameworkInfo } from './get-framework-info';
vi.mock('storybook/internal/common', () => ({
getStorybookInfo: vi.fn(),
}));
describe('getFrameworkInfo', () => {
const defaul... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/get-monorepo-type.test.ts | code/core/src/telemetry/get-monorepo-type.test.ts | import * as fs from 'node:fs';
import { join } from 'node:path';
import { describe, expect, it, vi } from 'vitest';
import { getMonorepoType, monorepoConfigs } from './get-monorepo-type';
vi.mock('node:fs', async () => import('../../../__mocks__/fs'));
vi.mock('storybook/internal/common', async (importOriginal) => ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/anonymous-id.test.ts | code/core/src/telemetry/anonymous-id.test.ts | import { describe, expect, it } from 'vitest';
import { normalizeGitUrl, unhashedProjectId } from './anonymous-id';
describe('normalizeGitUrl', () => {
it('trims off https://', () => {
expect(normalizeGitUrl('https://github.com/storybookjs/storybook.git')).toEqual(
'github.com/storybookjs/storybook.git'
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/types.ts | code/core/src/telemetry/types.ts | import type { StorybookConfig, TypescriptOptions } from 'storybook/internal/types';
import type { DetectResult } from 'package-manager-detector';
import type { MonorepoType } from './get-monorepo-type';
export type EventType =
| 'boot'
| 'add'
| 'dev'
| 'build'
| 'index'
| 'upgrade'
| 'multi-upgrade'
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/exec-command-count-lines.test.ts | code/core/src/telemetry/exec-command-count-lines.test.ts | import type { Transform } from 'node:stream';
import { PassThrough } from 'node:stream';
import { beforeEach, describe, expect, it, vi } from 'vitest';
// eslint-disable-next-line depend/ban-dependencies
import { execa as rawExeca } from 'execa';
import { execCommandCountLines } from './exec-command-count-lines';
v... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/session-id.test.ts | code/core/src/telemetry/session-id.test.ts | import type { MockInstance } from 'vitest';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { cache } from 'storybook/internal/common';
import { nanoid } from 'nanoid';
import { SESSION_TIMEOUT, getSessionId, resetSessionIdForTest } from './session-id';
vi.mock('storybook/internal/common', asy... | 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.test.ts | code/core/src/telemetry/get-package-manager-info.test.ts | import { beforeEach, describe, expect, it, vi } from 'vitest';
// eslint-disable-next-line depend/ban-dependencies
import { execaCommand as rawExecaCommand } from 'execa';
import { detect as rawDetect } from 'package-manager-detector';
import { getPackageManagerInfo } from './get-package-manager-info';
vi.mock('exec... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/index.ts | code/core/src/telemetry/index.ts | import { logger } from 'storybook/internal/node-logger';
import { notify } from './notify';
import { sanitizeError } from './sanitize';
import { getStorybookMetadata } from './storybook-metadata';
import { sendTelemetry } from './telemetry';
import type { EventType, Options, Payload, TelemetryData } from './types';
e... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/storybook-metadata.ts | code/core/src/telemetry/storybook-metadata.ts | import { createHash } from 'node:crypto';
import { existsSync } from 'node:fs';
import { readFile } from 'node:fs/promises';
import { dirname, resolve } from 'node:path';
import {
getStorybookConfiguration,
getStorybookInfo,
isCI,
loadMainConfig,
versions,
} from 'storybook/internal/common';
import { getInte... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/exec-command-count-lines.ts | code/core/src/telemetry/exec-command-count-lines.ts | import { createInterface } from 'node:readline';
// eslint-disable-next-line depend/ban-dependencies
import { execa } from 'execa';
/**
* Execute a command in the local terminal and count the lines in the result
*
* @param command The command to execute.
* @param options Execa options
* @returns The number of li... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/error-collector.ts | code/core/src/telemetry/error-collector.ts | /**
* Service for collecting errors during Storybook initialization.
*
* This singleton class exists to accumulate non-fatal errors that occur during the Storybook's
* processes. Instead of immediately reporting errors to telemetry (which could interrupt the
* process), errors are collected here and then batch-rep... | 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.ts | code/core/src/telemetry/get-application-file-count.ts | import { sep } from 'node:path';
import { execCommandCountLines } from './exec-command-count-lines';
import { runTelemetryOperation } from './run-telemetry-operation';
// We are looking for files with the word "page" or "screen" somewhere in them with these exts
const nameMatches = ['page', 'screen'];
const extension... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/telemetry/package-json.ts | code/core/src/telemetry/package-json.ts | import { fileURLToPath, pathToFileURL } from 'node:url';
import * as pkg from 'empathic/package';
import type { PackageJson } from 'type-fest';
import type { Dependency } from './types';
export const getActualPackageVersions = async (packages: Record<string, Partial<Dependency>>) => {
const packageNames = Object.k... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/outline/outlineCSS.ts | code/core/src/outline/outlineCSS.ts | import { dedent } from 'ts-dedent';
/*
From pesticide v1.3.0 . @mrmrs . MIT
*/
export default function outlineCSS(selector: string) {
return dedent /* css */ `
${selector} body {
outline: 1px solid #2980b9 !important;
}
${selector} article {
outline: 1px solid #3498db !important;
}
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/outline/preview.ts | code/core/src/outline/preview.ts | import { definePreviewAddon } from 'storybook/internal/csf';
import { PARAM_KEY } from './constants';
import type { OutlineTypes } from './types';
import { withOutline } from './withOutline';
export const decorators = globalThis.FEATURES?.outline ? [withOutline] : [];
export const initialGlobals = {
[PARAM_KEY]: f... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/outline/manager.tsx | code/core/src/outline/manager.tsx | import React from 'react';
import { addons, types } from 'storybook/manager-api';
import { OutlineSelector } from './OutlineSelector';
import { ADDON_ID } from './constants';
export default addons.register(ADDON_ID, () => {
if (globalThis?.FEATURES?.outline) {
addons.add(ADDON_ID, {
title: 'Outline',
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/outline/helpers.ts | code/core/src/outline/helpers.ts | import { global } from '@storybook/global';
export const clearStyles = (selector: string | string[]) => {
const selectors = Array.isArray(selector) ? selector : [selector];
selectors.forEach(clearStyle);
};
const clearStyle = (input: string | string[]) => {
const selector = typeof input === 'string' ? input : i... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/outline/constants.ts | code/core/src/outline/constants.ts | export const ADDON_ID = 'storybook/outline';
export const PARAM_KEY = 'outline';
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/outline/withOutline.ts | code/core/src/outline/withOutline.ts | import type { DecoratorFunction } from 'storybook/internal/types';
import { useEffect, useMemo } from 'storybook/preview-api';
import { PARAM_KEY } from './constants';
import { addOutlineStyles, clearStyles } from './helpers';
import outlineCSS from './outlineCSS';
export const withOutline: DecoratorFunction = (Stor... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/outline/types.ts | code/core/src/outline/types.ts | export interface OutlineParameters {
/**
* Outline configuration
*
* @see https://storybook.js.org/docs/essentials/measure-and-outline#parameters
*/
outline?: {
/**
* Removes the tool and disables the feature's behavior. If you wish to turn off this feature
* for the entire Storybook, you ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/outline/OutlineSelector.tsx | code/core/src/outline/OutlineSelector.tsx | import React, { memo, useCallback, useEffect } from 'react';
import { ToggleButton } from 'storybook/internal/components';
import { OutlineIcon } from '@storybook/icons';
import { useGlobals, useStorybookApi } from 'storybook/manager-api';
import { ADDON_ID, PARAM_KEY } from './constants';
export const OutlineSele... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/channels/index.test.ts | code/core/src/channels/index.test.ts | import { beforeEach, describe, expect, it, vi } from 'vitest';
import type { ChannelTransport, Listener } from '.';
import { Channel, WebsocketTransport } from '.';
const MockedWebsocket = vi.hoisted(() => {
const ref = { current: undefined as unknown as InstanceType<typeof MyMockedWebsocket> };
class MyMockedWeb... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/channels/main.ts | code/core/src/channels/main.ts | import type {
ChannelArgs,
ChannelArgsMulti,
ChannelArgsSingle,
ChannelEvent,
ChannelTransport,
EventsKeyValue,
Listener,
} from './types';
const isMulti = (args: ChannelArgs): args is ChannelArgsMulti => {
// @ts-expect-error (we guard against this right here)
return args.transports !== undefined;
}... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/channels/types.ts | code/core/src/channels/types.ts | export interface Config {
page: 'manager' | 'preview';
}
export interface BufferedEvent {
event: ChannelEvent;
resolve: (value?: any) => void;
reject: (reason?: any) => void;
}
export type ChannelHandler = (event: ChannelEvent) => void;
export interface ChannelTransport {
send(event: ChannelEvent, options?... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/channels/index.ts | code/core/src/channels/index.ts | /// <reference path="../typings.d.ts" />
import { global } from '@storybook/global';
import { UniversalStore } from '../shared/universal-store';
import { Channel } from './main';
import { PostMessageTransport } from './postmessage';
import type { ChannelTransport, Config } from './types';
import { WebsocketTransport }... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/channels/postmessage/index.ts | code/core/src/channels/postmessage/index.ts | /// <reference path="../../typings.d.ts" />
import { logger, pretty } from 'storybook/internal/client-logger';
import * as EVENTS from 'storybook/internal/core-events';
import { global } from '@storybook/global';
import { isJSON, parse, stringify } from 'telejson';
import invariant from 'tiny-invariant';
import type... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/channels/postmessage/getEventSourceUrl.ts | code/core/src/channels/postmessage/getEventSourceUrl.ts | import { logger } from 'storybook/internal/client-logger';
export const getEventSourceUrl = (event: MessageEvent) => {
const frames: HTMLIFrameElement[] = Array.from(
document.querySelectorAll('iframe[data-is-storybook]')
);
// try to find the originating iframe by matching it's contentWindow
// This might... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/channels/websocket/index.ts | code/core/src/channels/websocket/index.ts | /// <reference path="../../typings.d.ts" />
import * as EVENTS from 'storybook/internal/core-events';
import { global } from '@storybook/global';
import { isJSON, parse, stringify } from 'telejson';
import invariant from 'tiny-invariant';
import type { ChannelHandler, ChannelTransport, Config } from '../types';
con... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/__mocks__/page.ts | code/core/src/__mocks__/page.ts | // empty file only matched on path
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/typings.d.ts | code/core/src/manager-api/typings.d.ts | declare var __STORYBOOK_ADDONS_MANAGER: any;
declare var CONFIG_TYPE: string;
declare var FEATURES: import('storybook/internal/types').StorybookConfigRaw['features'];
declare var TAGS_OPTIONS: import('storybook/internal/types').StorybookConfigRaw['tags'];
declare var REFS: any;
declare var VERSIONCHECK: any;
declare v... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/index.mock.ts | code/core/src/manager-api/index.mock.ts | import { fn } from 'storybook/test';
export * from './root';
export const openInEditor = fn();
export { UniversalStore as experimental_UniversalStore } from '../shared/universal-store';
export { useUniversalStore as experimental_useUniversalStore } from '../shared/universal-store/use-universal-store-manager';
export... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/root.tsx | code/core/src/manager-api/root.tsx | import type { FC, ReactElement, ReactNode } from 'react';
import React, {
Component,
Fragment,
useCallback,
useContext,
useEffect,
useMemo,
useRef,
useState,
} from 'react';
import type { Listener } from 'storybook/internal/channels';
import {
DOCS_PREPARED,
SET_STORIES,
SHARED_STATE_CHANGED,
S... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/store.ts | code/core/src/manager-api/store.ts | import type { StoreAPI } from 'store2';
import store from 'store2';
import storeSetup from './lib/store-setup';
import type { State } from './root';
// setting up the store, overriding set and get to use telejson
storeSetup(store._);
export const STORAGE_KEY = '@storybook/manager/store';
function get(storage: Store... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/version.ts | code/core/src/manager-api/version.ts | export const version = '10.2.0-alpha.10';
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/context.ts | code/core/src/manager-api/context.ts | import { createContext as ReactCreateContext } from 'react';
import type { Combo } from './root';
export const createContext = ({ api, state }: Combo) => ReactCreateContext({ api, state });
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/initial-state.ts | code/core/src/manager-api/initial-state.ts | import merge from './lib/merge';
import type { State } from './root';
interface Addition {
[key: string]: any;
}
type Additions = Addition[];
// Returns the initialState of the app
const main = (...additions: Additions): State =>
additions.reduce((acc: State, item) => merge<State>(acc, item), {} as any);
export ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/index.ts | code/core/src/manager-api/index.ts | export * from './root';
export { UniversalStore as experimental_UniversalStore } from '../shared/universal-store';
export { useUniversalStore as experimental_useUniversalStore } from '../shared/universal-store/use-universal-store-manager';
export { MockUniversalStore as experimental_MockUniversalStore } from '../share... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/tests/stories.test.ts | code/core/src/manager-api/tests/stories.test.ts | import type { Mocked } from 'vitest';
import { describe, expect, it, vi } from 'vitest';
import {
CONFIG_ERROR,
CURRENT_STORY_WAS_SET,
DOCS_PREPARED,
RESET_STORY_ARGS,
SET_INDEX,
SET_STORIES,
STORY_ARGS_UPDATED,
STORY_INDEX_INVALIDATED,
STORY_MISSING,
STORY_PREPARED,
STORY_SPECIFIED,
UPDATE_STO... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | true |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/tests/events.test.ts | code/core/src/manager-api/tests/events.test.ts | import { describe, expect, it, vi } from 'vitest';
import { getEventMetadata } from '../lib/events';
import type { API } from '../root';
vi.mock('@storybook/global', () => ({
global: {
location: { origin: 'http://localhost:6006', pathname: '/' },
},
}));
describe('getEventMetadata', () => {
const fullAPIMo... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/tests/mockStoriesEntries.ts | code/core/src/manager-api/tests/mockStoriesEntries.ts | import type { API_PreparedStoryIndex, StoryIndex } from 'storybook/internal/types';
export const mockEntries: StoryIndex['entries'] = {
'component-a--docs': {
type: 'docs',
id: 'component-a--docs',
title: 'Component A',
name: 'Docs',
importPath: './path/to/component-a.ts',
storiesImports: [],... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/tests/globals.test.ts | code/core/src/manager-api/tests/globals.test.ts | import { beforeEach, describe, expect, it, vi } from 'vitest';
import { logger as _logger } from 'storybook/internal/client-logger';
import {
GLOBALS_UPDATED,
SET_GLOBALS,
SET_STORIES,
UPDATE_GLOBALS,
} from 'storybook/internal/core-events';
import type { GlobalsUpdatedPayload, SetGlobalsPayload } from 'storyb... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/tests/refs.test.ts | code/core/src/manager-api/tests/refs.test.ts | import { describe, expect, it, vi } from 'vitest';
import type { StoryIndex } from 'storybook/internal/types';
import { global } from '@storybook/global';
import { transformStoryIndexToStoriesHash } from '../lib/stories';
import { getSourceType, init as initRefs } from '../modules/refs';
import type { State } from '... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | true |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/tests/intersect.test.ts | code/core/src/manager-api/tests/intersect.test.ts | import { describe, expect, it } from 'vitest';
import intersect from '../lib/intersect';
describe('Manager API utilities - intersect', () => {
it('returns identity when intersecting identity', () => {
const a = ['foo', 'bar'];
expect(intersect(a, a)).toEqual(a);
});
it('returns a when b is a superset o... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/tests/layout.test.ts | code/core/src/manager-api/tests/layout.test.ts | import type { Mock } from 'vitest';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import type { API_Provider } from 'storybook/internal/types';
import EventEmitter from 'events';
import { themes } from 'storybook/theming';
import type { ModuleArgs } from '../lib/types';
import type { SubState as Add... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/stores/checklist.ts | code/core/src/manager-api/stores/checklist.ts | import {
type StoreEvent,
type StoreState,
createChecklistStore,
} from '../../shared/checklist-store';
import { UNIVERSAL_CHECKLIST_STORE_OPTIONS } from '../../shared/checklist-store';
import { UniversalStore } from '../../shared/universal-store';
export const universalChecklistStore = UniversalStore.create<Sto... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/stores/test-provider.ts | code/core/src/manager-api/stores/test-provider.ts | import { createTestProviderStore } from '../../shared/test-provider-store';
import { UNIVERSAL_TEST_PROVIDER_STORE_OPTIONS } from '../../shared/test-provider-store';
import { UniversalStore } from '../../shared/universal-store';
import { useUniversalStore } from '../../shared/universal-store/use-universal-store-manager... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/stores/status.ts | code/core/src/manager-api/stores/status.ts | import { createStatusStore } from '../../shared/status-store';
import { UNIVERSAL_STATUS_STORE_OPTIONS } from '../../shared/status-store';
import { UniversalStore } from '../../shared/universal-store';
import { useUniversalStore } from '../../shared/universal-store/use-universal-store-manager';
const statusStore = cre... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/stores/__mocks__/checklist.ts | code/core/src/manager-api/stores/__mocks__/checklist.ts | import {
type StoreEvent,
type StoreState,
createChecklistStore,
} from '../../../shared/checklist-store';
import { UNIVERSAL_CHECKLIST_STORE_OPTIONS } from '../../../shared/checklist-store';
import { UniversalStore } from '../../../shared/universal-store';
export const mockUniversalChecklistStore = UniversalSto... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/stores/__mocks__/test-provider.ts | code/core/src/manager-api/stores/__mocks__/test-provider.ts | import { createTestProviderStore } from '../../../shared/test-provider-store';
import { UNIVERSAL_TEST_PROVIDER_STORE_OPTIONS } from '../../../shared/test-provider-store';
import { useUniversalStore } from '../../../shared/universal-store/use-universal-store-manager';
import { experimental_MockUniversalStore } from '..... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/stores/__mocks__/status.ts | code/core/src/manager-api/stores/__mocks__/status.ts | import { createStatusStore } from '../../../shared/status-store';
import { UNIVERSAL_STATUS_STORE_OPTIONS } from '../../../shared/status-store';
import { useUniversalStore } from '../../../shared/universal-store/use-universal-store-manager';
import { experimental_MockUniversalStore } from '../../index.mock';
const moc... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/modules/versions.ts | code/core/src/manager-api/modules/versions.ts | import type { API_UnknownEntries, API_Version, API_Versions } from 'storybook/internal/types';
import { global } from '@storybook/global';
import memoize from 'memoizerific';
import semver from 'semver';
import type { ModuleFn } from '../lib/types';
import { version as currentVersion } from '../version';
const { VE... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/modules/open-in-editor.tsx | code/core/src/manager-api/modules/open-in-editor.tsx | import React from 'react';
import {
OPEN_IN_EDITOR_REQUEST,
OPEN_IN_EDITOR_RESPONSE,
type OpenInEditorResponsePayload,
} from 'storybook/internal/core-events';
import type { API_Notification } from 'storybook/internal/types';
import { FailedIcon } from '@storybook/icons';
import type { ModuleFn } from '../lib/... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/modules/addons.ts | code/core/src/manager-api/modules/addons.ts | import { Addon_TypesEnum } from 'storybook/internal/types';
import type {
API_StateMerger,
Addon_BaseType,
Addon_Collection,
Addon_Types,
Addon_TypesMapping,
} from 'storybook/internal/types';
import type { ModuleFn } from '../lib/types';
import type { Options } from '../store';
export interface SubState {
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/modules/stories.ts | code/core/src/manager-api/modules/stories.ts | import { logger } from 'storybook/internal/client-logger';
import {
CONFIG_ERROR,
CURRENT_STORY_WAS_SET,
DOCS_PREPARED,
PRELOAD_ENTRIES,
RESET_STORY_ARGS,
SELECT_STORY,
SET_CONFIG,
SET_CURRENT_STORY,
SET_FILTER,
SET_INDEX,
SET_STORIES,
STORY_ARGS_UPDATED,
STORY_CHANGED,
STORY_INDEX_INVALIDAT... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/modules/provider.ts | code/core/src/manager-api/modules/provider.ts | import type { API_IframeRenderer } from 'storybook/internal/types';
import type { ModuleFn } from '../lib/types';
export interface SubAPI {
renderPreview?: API_IframeRenderer;
}
export const init: ModuleFn<SubAPI, {}> = ({ provider, fullAPI }) => {
return {
api: provider.renderPreview ? { renderPreview: prov... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/modules/channel.ts | code/core/src/manager-api/modules/channel.ts | import type { Listener } from 'storybook/internal/channels';
import type { API_Provider } from 'storybook/internal/types';
import type { ModuleFn } from '../lib/types';
import type { API } from '../root';
export interface SubAPI {
/**
* Returns the channel object.
*
* @protected Please do not use, it's for... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/modules/url.ts | code/core/src/manager-api/modules/url.ts | import {
GLOBALS_UPDATED,
NAVIGATE_URL,
SET_CURRENT_STORY,
STORY_ARGS_UPDATED,
UPDATE_QUERY_PARAMS,
} from 'storybook/internal/core-events';
import { buildArgsParam, queryFromLocation } from 'storybook/internal/router';
import type { NavigateOptions } from 'storybook/internal/router';
import type { API_Layout... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/modules/notifications.ts | code/core/src/manager-api/modules/notifications.ts | import type { API_Notification } from 'storybook/internal/types';
import { partition } from 'es-toolkit/array';
import type { ModuleFn } from '../lib/types';
export interface SubState {
notifications: API_Notification[];
}
/** The API for managing notifications. */
export interface SubAPI {
/**
* Adds a new ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/modules/layout.ts | code/core/src/manager-api/modules/layout.ts | import { SET_CONFIG } from 'storybook/internal/core-events';
import type {
API_Layout,
API_LayoutCustomisations,
API_PanelPositions,
API_UI,
} from 'storybook/internal/types';
import { global } from '@storybook/global';
import { pick, toMerged } from 'es-toolkit/object';
import { isEqual as deepEqual } from '... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/modules/refs.ts | code/core/src/manager-api/modules/refs.ts | import type {
API_ComposedRef,
API_ComposedRefUpdate,
API_IndexHash,
API_Refs,
API_SetRefData,
API_StoryMapper,
SetStoriesStoryData,
StoryIndex,
} from 'storybook/internal/types';
import { global } from '@storybook/global';
import { dedent } from 'ts-dedent';
import {
transformSetStoriesStoryDataTo... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/modules/settings.ts | code/core/src/manager-api/modules/settings.ts | import type { API_Settings, StoryId } from 'storybook/internal/types';
import type { ModuleFn } from '../lib/types';
export interface SubAPI {
storeSelection: () => void;
retrieveSelection: () => StoryId;
/**
* Changes the active settings tab.
*
* @example
*
* ```ts
* changeSettingsTab(`about`... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/modules/globals.ts | code/core/src/manager-api/modules/globals.ts | import { logger } from 'storybook/internal/client-logger';
import { GLOBALS_UPDATED, SET_GLOBALS, UPDATE_GLOBALS } from 'storybook/internal/core-events';
import type {
GlobalTypes,
Globals,
GlobalsUpdatedPayload,
SetGlobalsPayload,
} from 'storybook/internal/types';
import { dequal as deepEqual } from 'dequal'... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/modules/whatsnew.tsx | code/core/src/manager-api/modules/whatsnew.tsx | import React from 'react';
import {
REQUEST_WHATS_NEW_DATA,
RESULT_WHATS_NEW_DATA,
SET_WHATS_NEW_CACHE,
TOGGLE_WHATS_NEW_NOTIFICATIONS,
} from 'storybook/internal/core-events';
import type { WhatsNewCache, WhatsNewData } from 'storybook/internal/core-events';
import { global } from '@storybook/global';
impor... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/modules/shortcuts.ts | code/core/src/manager-api/modules/shortcuts.ts | import {
FORCE_REMOUNT,
PREVIEW_KEYDOWN,
STORIES_COLLAPSE_ALL,
STORIES_EXPAND_ALL,
} from 'storybook/internal/core-events';
import { global } from '@storybook/global';
import copy from 'copy-to-clipboard';
import type { KeyboardEventLike } from '../lib/shortcut';
import { eventToShortcut, shortcutMatchesShor... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/lib/stories.test.ts | code/core/src/manager-api/lib/stories.test.ts | import { describe, expect, it } from 'vitest';
import {
type API_PreparedStoryIndex,
type StatusesByStoryIdAndTypeId,
type StoryIndexV2,
type StoryIndexV3,
} from 'storybook/internal/types';
import type { State } from '../root';
import { mockEntries } from '../tests/mockStoriesEntries';
import {
transformSt... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/lib/platform.ts | code/core/src/manager-api/lib/platform.ts | import { global } from '@storybook/global';
const { navigator } = global;
export const isMacLike = () =>
navigator && navigator.platform ? !!navigator.platform.match(/(Mac|iPhone|iPod|iPad)/i) : false;
| typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/lib/addons.ts | code/core/src/manager-api/lib/addons.ts | import type { Channel } from 'storybook/internal/channels';
import { logger } from 'storybook/internal/client-logger';
import { SET_CONFIG } from 'storybook/internal/core-events';
import type {
Addon_BaseType,
Addon_Collection,
Addon_Config,
Addon_Elements,
Addon_Loaders,
Addon_PageType,
Addon_TestProvide... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/lib/stories.ts | code/core/src/manager-api/lib/stories.ts | import { sanitize } from 'storybook/internal/csf';
import type {
API_ComponentEntry,
API_DocsEntry,
API_GroupEntry,
API_HashEntry,
API_IndexHash,
API_PreparedIndexEntry,
API_PreparedStoryIndex,
API_Provider,
API_RootEntry,
API_StoryEntry,
DocsOptions,
IndexEntry,
Parameters,
SetStoriesPayloa... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/lib/merge.ts | code/core/src/manager-api/lib/merge.ts | import { logger } from 'storybook/internal/client-logger';
import { mergeWith } from 'es-toolkit/object';
import { isEqual } from 'es-toolkit/predicate';
export default <TObj = any>(a: TObj, ...b: Partial<TObj>[]): TObj => {
// start with empty object
let target = {};
// merge object a unto target
target = m... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/lib/store-setup.ts | code/core/src/manager-api/lib/store-setup.ts | import { parse, stringify } from 'telejson';
// setting up the store, overriding set and get to use telejson
export default (_: any) => {
_.fn('set', function (key: string, data: object) {
return _.set(
// @ts-expect-error('this' implicitly has type 'any')
this._area,
// @ts-expect-error('this'... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/lib/shortcut.test.ts | code/core/src/manager-api/lib/shortcut.test.ts | import { beforeEach, describe, expect, it, vi } from 'vitest';
import { isMacLike } from './platform';
import type { KeyboardEventLike } from './shortcut';
import {
controlOrMetaKey,
controlOrMetaSymbol,
eventMatchesShortcut,
eventToShortcut,
isShortcutTaken,
keyToSymbol,
optionOrAltSymbol,
shortcutMat... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/lib/intersect.ts | code/core/src/manager-api/lib/intersect.ts | export default <T>(a: T[], b: T[]): T[] => {
// no point in intersecting if one of the input is ill-defined
if (!Array.isArray(a) || !Array.isArray(b) || !a.length || !b.length) {
return [];
}
return a.reduce((acc: T[], aValue) => {
if (b.includes(aValue)) {
acc.push(aValue);
}
return ac... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/lib/shortcut.ts | code/core/src/manager-api/lib/shortcut.ts | import type { API_KeyCollection } from '../modules/shortcuts';
import { isMacLike } from './platform';
export type { API_KeyCollection } from '../modules/shortcuts';
export const controlOrMetaSymbol = () => (isMacLike() ? '⌘' : 'ctrl');
export const controlOrMetaKey = () => (isMacLike() ? 'meta' : 'control');
export ... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/lib/types.tsx | code/core/src/manager-api/lib/types.tsx | import type { RouterData } from 'storybook/internal/router';
import type { API_ProviderData } from 'storybook/internal/types';
import type { API, State } from '../root';
import type Store from '../store';
export type ModuleFn<APIType = unknown, StateType = unknown> = (
m: ModuleArgs,
options?: any
) => {
init?:... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/lib/storybook-channel-mock.ts | code/core/src/manager-api/lib/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/manager-api/lib/request-response.ts | code/core/src/manager-api/lib/request-response.ts | import type { Channel } from 'storybook/internal/channels';
import type { RequestData, ResponseData } from 'storybook/internal/core-events';
export class RequestResponseError<Payload extends Record<string, any> | void> extends Error {
payload: Payload | undefined = undefined;
constructor(message: string, payload?... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/manager-api/lib/events.ts | code/core/src/manager-api/lib/events.ts | import { logger } from 'storybook/internal/client-logger';
import type { API_ComposedRef } from 'storybook/internal/types';
import { getSourceType } from '../modules/refs';
import type { API } from '../root';
interface Meta {
ref?: API_ComposedRef;
source?: string;
sourceType?: 'local' | 'external';
sourceLoc... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/babel/babelParse.ts | code/core/src/babel/babelParse.ts | import * as parser from '@babel/parser';
import type { ParserOptions } from '@babel/parser';
import type * as t from '@babel/types';
import * as recast from 'recast';
function parseWithFlowOrTypescript(source: string, parserOptions: parser.ParserOptions) {
const flowCommentPattern = /^\s*\/\/\s*@flow/;
const useFl... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/src/babel/index.ts | code/core/src/babel/index.ts | /**
* This entry is to ensure we use a single version of Babel across the codebase. This is to prevent
* issues with multiple versions of Babel being used in the same project. It also prevents us from
* bundling babel multiple times in the final bundles.
*/
import { transformSync } from '@babel/core';
import * as c... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/loader-enhancements.stories.ts | code/core/template/stories/loader-enhancements.stories.ts | /* eslint-disable storybook/prefer-pascal-case */
import { expect, within } from 'storybook/test';
const meta = {
component: globalThis.__TEMPLATE_COMPONENTS__.Button,
parameters: { chromatic: { disableSnapshot: true } },
args: { label: 'Button' },
};
export default meta;
export const canvas_is_equal_to_within... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/globals.stories.ts | code/core/template/stories/globals.stories.ts | import type { PartialStoryFn, PlayFunctionContext, StoryContext } from 'storybook/internal/types';
import { global as globalThis } from '@storybook/global';
import { expect, within } from 'storybook/test';
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Pre,
tags: ['autodocs'],
globals: {
ba... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/names.stories.ts | code/core/template/stories/names.stories.ts | import type { PlayFunctionContext } from 'storybook/internal/types';
import { global as globalThis } from '@storybook/global';
import { expect } from 'storybook/test';
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Pre,
args: { text: 'No content' },
};
// Very simple stories to show what happens... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/rendering.stories.ts | code/core/template/stories/rendering.stories.ts | import {
FORCE_REMOUNT,
RESET_STORY_ARGS,
STORY_ARGS_UPDATED,
UPDATE_STORY_ARGS,
} from 'storybook/internal/core-events';
import type { PlayFunctionContext } from 'storybook/internal/types';
import { global as globalThis } from '@storybook/global';
import { expect, waitFor, within } from 'storybook/test';
ex... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/mount-in-play.stories.ts | code/core/template/stories/mount-in-play.stories.ts | import { expect, fn } from 'storybook/test';
const meta = { component: globalThis.__TEMPLATE_COMPONENTS__.Button };
export default meta;
export const MountShouldBeDestructured = {
parameters: { chromatic: { disableSnapshot: true } },
args: {
label: 'Button',
onClick: fn(),
},
async play(context) {
... | typescript | MIT | 7f193d38eec36246a211339c1f352cca246de779 | 2026-01-04T15:25:31.846427Z | false |
storybookjs/storybook | https://github.com/storybookjs/storybook/blob/7f193d38eec36246a211339c1f352cca246de779/code/core/template/stories/layout.stories.ts | code/core/template/stories/layout.stories.ts | import { global as globalThis } from '@storybook/global';
const style = {
display: 'block',
border: '2px solid #FF4785',
padding: 10,
};
export default {
component: globalThis.__TEMPLATE_COMPONENTS__.Pre,
args: {
style,
},
parameters: {
layout: 'centered',
},
};
export const PaddedBlock = {
... | 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.