diff --git a/CHANGELOG.prerelease.md b/CHANGELOG.prerelease.md index f6df38746483..a001a53b6fe2 100644 --- a/CHANGELOG.prerelease.md +++ b/CHANGELOG.prerelease.md @@ -1,3 +1,11 @@ +## 10.3.0-alpha.12 + +- Builder-Vite: Prevent config duplication - [#33883](https://github.com/storybookjs/storybook/pull/33883), thanks @copilot-swe-agent! +- CLI: Fix React native web A11y issues - [#33937](https://github.com/storybookjs/storybook/pull/33937), thanks @jonniebigodes! +- Core: Ensure telemetry is never triggered on initial load of checklist data - [#33918](https://github.com/storybookjs/storybook/pull/33918), thanks @ghengeveld! +- Eslint: Fix ESLint 10 compatibility in eslint-plugin-storybook rules - [#33884](https://github.com/storybookjs/storybook/pull/33884), thanks @copilot-swe-agent! +- Test: Update @testing-library/jest-dom - [#33928](https://github.com/storybookjs/storybook/pull/33928), thanks @valentinpalkovic! + ## 10.3.0-alpha.11 - Addon Pseudo-states: Process all nested css rules - [#33605](https://github.com/storybookjs/storybook/pull/33605), thanks @hpohlmeyer! diff --git a/code/builders/builder-vite/src/build.ts b/code/builders/builder-vite/src/build.ts index 1f419e038f09..46f1a22e1fb8 100644 --- a/code/builders/builder-vite/src/build.ts +++ b/code/builders/builder-vite/src/build.ts @@ -46,8 +46,7 @@ export async function build(options: Options) { finalConfig.plugins?.push({ name: 'storybook:enforce-output-dir', enforce: 'post', - config: (config) => ({ - ...config, + config: () => ({ build: { outDir: options.outputDir, }, diff --git a/code/core/package.json b/code/core/package.json index 6506626961a8..fcd1abb8f40d 100644 --- a/code/core/package.json +++ b/code/core/package.json @@ -230,7 +230,7 @@ "dependencies": { "@storybook/global": "^5.0.0", "@storybook/icons": "^2.0.1", - "@testing-library/jest-dom": "^6.6.3", + "@testing-library/jest-dom": "^6.9.1", "@testing-library/user-event": "^14.6.1", "@vitest/expect": "3.2.4", "@vitest/spy": "3.2.4", diff --git a/code/core/src/core-server/utils/checklist.ts b/code/core/src/core-server/utils/checklist.ts index 44049e9d6cc2..af125d3a46ed 100644 --- a/code/core/src/core-server/utils/checklist.ts +++ b/code/core/src/core-server/utils/checklist.ts @@ -3,7 +3,6 @@ import { experimental_UniversalStore } from 'storybook/internal/core-server'; import { logger } from 'storybook/internal/node-logger'; import { telemetry } from 'storybook/internal/telemetry'; -import { dequal as deepEqual } from 'dequal'; import { throttle } from 'es-toolkit/function'; import { toMerged } from 'es-toolkit/object'; @@ -85,6 +84,11 @@ export async function initializeChecklist() { saveProjectState({ items: projectValues as StoreState['items'] }); saveUserState({ items: userValues, widget: state.widget }); + // Skip telemetry when loading from persistence (first transition to loaded: true) + if (!previousState.loaded) { + return; + } + // Gather items that have changed state const { mutedItems, statusItems } = entries.reduce( (acc, [item, { mutedAt, status }]) => { diff --git a/code/frameworks/react-native-web-vite/template/cli/js/Button.jsx b/code/frameworks/react-native-web-vite/template/cli/js/Button.jsx index 4d87b6e2c4ea..ad2b64e95927 100644 --- a/code/frameworks/react-native-web-vite/template/cli/js/Button.jsx +++ b/code/frameworks/react-native-web-vite/template/cli/js/Button.jsx @@ -44,7 +44,7 @@ const styles = StyleSheet.create({ lineHeight: 1, }, primary: { - backgroundColor: '#1ea7fd', + backgroundColor: '#555ab9', }, primaryText: { color: 'white', @@ -52,6 +52,7 @@ const styles = StyleSheet.create({ secondary: { backgroundColor: 'transparent', borderColor: 'rgba(0, 0, 0, 0.15)', + color: '#333', borderWidth: 1, }, secondaryText: { diff --git a/code/frameworks/react-native-web-vite/template/cli/js/Page.jsx b/code/frameworks/react-native-web-vite/template/cli/js/Page.jsx index 19c4b4cc90ac..7e7b436acdcc 100644 --- a/code/frameworks/react-native-web-vite/template/cli/js/Page.jsx +++ b/code/frameworks/react-native-web-vite/template/cli/js/Page.jsx @@ -116,7 +116,8 @@ const styles = StyleSheet.create({ }, a: { - color: '#1ea7fd', + color: '#1a237e', + textDecorationLine: 'underline', }, ul: { @@ -141,7 +142,7 @@ const styles = StyleSheet.create({ fontSize: 11, lineHeight: 12, fontWeight: '700', - color: '#66bf3c', + color: '#1a237e', }, tipWrapper: { diff --git a/code/frameworks/react-native-web-vite/template/cli/ts/Button.tsx b/code/frameworks/react-native-web-vite/template/cli/ts/Button.tsx index ed17e64a3d20..444eec25985e 100644 --- a/code/frameworks/react-native-web-vite/template/cli/ts/Button.tsx +++ b/code/frameworks/react-native-web-vite/template/cli/ts/Button.tsx @@ -58,7 +58,7 @@ const styles = StyleSheet.create({ lineHeight: 1, }, primary: { - backgroundColor: '#1ea7fd', + backgroundColor: '#555ab9', }, primaryText: { color: 'white', @@ -66,6 +66,7 @@ const styles = StyleSheet.create({ secondary: { backgroundColor: 'transparent', borderColor: 'rgba(0, 0, 0, 0.15)', + color: '#333', borderWidth: 1, }, secondaryText: { diff --git a/code/frameworks/react-native-web-vite/template/cli/ts/Page.tsx b/code/frameworks/react-native-web-vite/template/cli/ts/Page.tsx index 1c9a7191c148..2303b97554ca 100644 --- a/code/frameworks/react-native-web-vite/template/cli/ts/Page.tsx +++ b/code/frameworks/react-native-web-vite/template/cli/ts/Page.tsx @@ -108,7 +108,8 @@ const styles = StyleSheet.create({ }, a: { - color: '#1ea7fd', + color: '#1a237e', + textDecorationLine: 'underline', }, ul: { @@ -133,7 +134,7 @@ const styles = StyleSheet.create({ fontSize: 11, lineHeight: 12, fontWeight: '700', - color: '#66bf3c', + color: '#1a237e', }, tipWrapper: { diff --git a/code/lib/eslint-plugin/src/rules/default-exports.ts b/code/lib/eslint-plugin/src/rules/default-exports.ts index c119a01cd0e2..c4dfbf78f908 100644 --- a/code/lib/eslint-plugin/src/rules/default-exports.ts +++ b/code/lib/eslint-plugin/src/rules/default-exports.ts @@ -99,7 +99,7 @@ export default createStorybookRule({ }, 'Program:exit': function (program: TSESTree.Program) { if (!isCsf4Style && !hasDefaultExport && !hasStoriesOfImport) { - const componentName = getComponentName(program, context.getFilename()); + const componentName = getComponentName(program, context.filename); const firstNonImportStatement = program.body.find((n) => !isImportDeclaration(n)); const node = firstNonImportStatement || program.body[0] || program; diff --git a/code/lib/eslint-plugin/src/rules/meta-satisfies-type.ts b/code/lib/eslint-plugin/src/rules/meta-satisfies-type.ts index 4755458c1965..848b21659020 100644 --- a/code/lib/eslint-plugin/src/rules/meta-satisfies-type.ts +++ b/code/lib/eslint-plugin/src/rules/meta-satisfies-type.ts @@ -33,7 +33,7 @@ export default createStorybookRule({ create(context) { // variables should be defined here - const sourceCode = context.getSourceCode(); + const sourceCode = context.sourceCode; //---------------------------------------------------------------------- // Helpers diff --git a/code/lib/eslint-plugin/src/rules/no-title-property-in-meta.ts b/code/lib/eslint-plugin/src/rules/no-title-property-in-meta.ts index 3d4b06b80290..496b3f609c6e 100644 --- a/code/lib/eslint-plugin/src/rules/no-title-property-in-meta.ts +++ b/code/lib/eslint-plugin/src/rules/no-title-property-in-meta.ts @@ -51,7 +51,7 @@ export default createStorybookRule({ { messageId: 'removeTitleInMeta', fix(fixer) { - const fullText = context.getSourceCode().text; + const fullText = context.sourceCode.text; const propertyTextWithExtraCharacter = fullText.slice( titleNode.range[0], titleNode.range[1] + 1 diff --git a/code/lib/eslint-plugin/src/rules/prefer-pascal-case.ts b/code/lib/eslint-plugin/src/rules/prefer-pascal-case.ts index 244bb51d3c9f..1e0d1cf638c7 100644 --- a/code/lib/eslint-plugin/src/rules/prefer-pascal-case.ts +++ b/code/lib/eslint-plugin/src/rules/prefer-pascal-case.ts @@ -91,7 +91,7 @@ export default createStorybookRule({ { messageId: 'convertToPascalCase', *fix(fixer) { - const fullText = context.getSourceCode().text; + const fullText = context.sourceCode.text; const fullName = fullText.slice(id.range[0], id.range[1]); const suffix = fullName.substring(name.length); const pascal = toPascalCase(name); diff --git a/code/lib/eslint-plugin/src/rules/use-storybook-testing-library.ts b/code/lib/eslint-plugin/src/rules/use-storybook-testing-library.ts index 8c3f132ef049..32085266f452 100644 --- a/code/lib/eslint-plugin/src/rules/use-storybook-testing-library.ts +++ b/code/lib/eslint-plugin/src/rules/use-storybook-testing-library.ts @@ -68,7 +68,7 @@ export default createStorybookRule({ // // import foo, { bar } from 'baz'; // ^ ^ end - const fullText = context.getSourceCode().text; + const fullText = context.sourceCode.text; const importEnd = node.range[1]; const closingBrace = fullText.indexOf('}', end - 1); if (closingBrace > -1 && closingBrace <= importEnd) { diff --git a/code/package.json b/code/package.json index d64a4a0614e3..5048f5972936 100644 --- a/code/package.json +++ b/code/package.json @@ -110,7 +110,7 @@ "@storybook/web-components": "workspace:*", "@storybook/web-components-vite": "workspace:*", "@testing-library/dom": "^10.4.0", - "@testing-library/jest-dom": "^6.6.3", + "@testing-library/jest-dom": "^6.9.1", "@testing-library/react": "^16.2.0", "@testing-library/user-event": "patch:@testing-library/user-event@npm%3A14.6.1#~/.yarn/patches/@testing-library-user-event-npm-14.6.1-5da7e1d4e2.patch", "@types/lodash-es": "^4.17.12", @@ -220,5 +220,6 @@ "Dependency Upgrades" ] ] - } + }, + "deferredNextVersion": "10.3.0-alpha.12" } diff --git a/docs/versions/next.json b/docs/versions/next.json index 2d686769827a..cab8049afe6e 100644 --- a/docs/versions/next.json +++ b/docs/versions/next.json @@ -1 +1 @@ -{"version":"10.3.0-alpha.11","info":{"plain":"- Addon Pseudo-states: Process all nested css rules - [#33605](https://github.com/storybookjs/storybook/pull/33605), thanks @hpohlmeyer!\n- Core: Avoid hanging when inferring args for recursive calls on DOM elemens - [#33922](https://github.com/storybookjs/storybook/pull/33922), thanks @valentinpalkovic!\n- Core: Sanitize inputs for save from controls - [#33868](https://github.com/storybookjs/storybook/pull/33868), thanks @valentinpalkovic!\n- Telemetry: Add project age - [#33910](https://github.com/storybookjs/storybook/pull/33910), thanks @shilman!\n- Viewport: Prioritize story viewport globals and avoid user-global pollution - [#33849](https://github.com/storybookjs/storybook/pull/33849), thanks @ia319!"}} \ No newline at end of file +{"version":"10.3.0-alpha.12","info":{"plain":"- Builder-Vite: Prevent config duplication - [#33883](https://github.com/storybookjs/storybook/pull/33883), thanks @copilot-swe-agent!\n- CLI: Fix React native web A11y issues - [#33937](https://github.com/storybookjs/storybook/pull/33937), thanks @jonniebigodes!\n- Core: Ensure telemetry is never triggered on initial load of checklist data - [#33918](https://github.com/storybookjs/storybook/pull/33918), thanks @ghengeveld!\n- Eslint: Fix ESLint 10 compatibility in eslint-plugin-storybook rules - [#33884](https://github.com/storybookjs/storybook/pull/33884), thanks @copilot-swe-agent!\n- Test: Update @testing-library/jest-dom - [#33928](https://github.com/storybookjs/storybook/pull/33928), thanks @valentinpalkovic!"}} \ No newline at end of file diff --git a/scripts/package.json b/scripts/package.json index 46065ad6d5ef..146c7b85e203 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -63,7 +63,7 @@ "@octokit/request": "^8.4.1", "@polka/parse": "^1.0.0-next.28", "@testing-library/dom": "^10.4.0", - "@testing-library/jest-dom": "^6.6.3", + "@testing-library/jest-dom": "^6.9.1", "@testing-library/react": "^16.0.0", "@testing-library/user-event": "^14.5.2", "@trivago/prettier-plugin-sort-imports": "^6.0.0", diff --git a/scripts/tasks/dev.ts b/scripts/tasks/dev.ts index 71c0bc8f6a0c..268e8d1862ec 100644 --- a/scripts/tasks/dev.ts +++ b/scripts/tasks/dev.ts @@ -1,4 +1,3 @@ -import detectFreePort from 'detect-port'; import waitOn from 'wait-on'; import type { AllTemplatesKey } from '../../code/lib/cli-storybook/src/sandbox-templates'; @@ -21,7 +20,12 @@ export const dev: Task = { dependsOn: ['sandbox'], async ready({ key }) { const port = getDevPort(key); - return (await detectFreePort(port)) !== port; + try { + await fetch(`http://localhost:${port}/iframe.html`, { signal: AbortSignal.timeout(1000) }); + return true; + } catch { + return false; + } }, async run({ sandboxDir, key, selectedTask }, { dryRun, debug }) { const controller = new AbortController(); diff --git a/scripts/tasks/serve.ts b/scripts/tasks/serve.ts index 05e80006d620..6a5ee9513ceb 100644 --- a/scripts/tasks/serve.ts +++ b/scripts/tasks/serve.ts @@ -1,4 +1,3 @@ -import detectFreePort from 'detect-port'; import waitOn from 'wait-on'; import type { AllTemplatesKey } from '../../code/lib/cli-storybook/src/sandbox-templates'; @@ -21,7 +20,12 @@ export const serve: Task = { dependsOn: ['build'], async ready({ key }) { const port = getServePort(key); - return (await detectFreePort(port)) !== port; + try { + await fetch(`http://localhost:${port}/iframe.html`, { signal: AbortSignal.timeout(1000) }); + return true; + } catch { + return false; + } }, async run({ builtSandboxDir, key }, { debug, dryRun }) { const port = getServePort(key); diff --git a/yarn.lock b/yarn.lock index 73518103a089..487cbea3d2ff 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7950,7 +7950,7 @@ __metadata: "@storybook/web-components": "workspace:*" "@storybook/web-components-vite": "workspace:*" "@testing-library/dom": "npm:^10.4.0" - "@testing-library/jest-dom": "npm:^6.6.3" + "@testing-library/jest-dom": "npm:^6.9.1" "@testing-library/react": "npm:^16.2.0" "@testing-library/user-event": "patch:@testing-library/user-event@npm%3A14.6.1#~/.yarn/patches/@testing-library-user-event-npm-14.6.1-5da7e1d4e2.patch" "@types/lodash-es": "npm:^4.17.12" @@ -8475,7 +8475,7 @@ __metadata: "@octokit/request": "npm:^8.4.1" "@polka/parse": "npm:^1.0.0-next.28" "@testing-library/dom": "npm:^10.4.0" - "@testing-library/jest-dom": "npm:^6.6.3" + "@testing-library/jest-dom": "npm:^6.9.1" "@testing-library/react": "npm:^16.0.0" "@testing-library/user-event": "npm:^14.5.2" "@trivago/prettier-plugin-sort-imports": "npm:^6.0.0" @@ -8875,18 +8875,17 @@ __metadata: languageName: node linkType: hard -"@testing-library/jest-dom@npm:^6.6.3": - version: 6.6.3 - resolution: "@testing-library/jest-dom@npm:6.6.3" +"@testing-library/jest-dom@npm:^6.9.1": + version: 6.9.1 + resolution: "@testing-library/jest-dom@npm:6.9.1" dependencies: "@adobe/css-tools": "npm:^4.4.0" aria-query: "npm:^5.0.0" - chalk: "npm:^3.0.0" css.escape: "npm:^1.5.1" dom-accessibility-api: "npm:^0.6.3" - lodash: "npm:^4.17.21" + picocolors: "npm:^1.1.1" redent: "npm:^3.0.0" - checksum: 10c0/5566b6c0b7b0709bc244aec3aa3dc9e5f4663e8fb2b99d8cd456fc07279e59db6076cbf798f9d3099a98fca7ef4cd50e4e1f4c4dec5a60a8fad8d24a638a5bf6 + checksum: 10c0/4291ebd2f0f38d14cefac142c56c337941775a5807e2a3d6f1a14c2fbd6be76a18e498ed189e95bedc97d9e8cf1738049bc76c85b5bc5e23fae7c9e10f7b3a12 languageName: node linkType: hard @@ -13272,16 +13271,6 @@ __metadata: languageName: node linkType: hard -"chalk@npm:^3.0.0": - version: 3.0.0 - resolution: "chalk@npm:3.0.0" - dependencies: - ansi-styles: "npm:^4.1.0" - supports-color: "npm:^7.1.0" - checksum: 10c0/ee650b0a065b3d7a6fda258e75d3a86fc8e4effa55871da730a9e42ccb035bf5fd203525e5a1ef45ec2582ecc4f65b47eb11357c526b84dd29a14fb162c414d2 - languageName: node - linkType: hard - "chalk@npm:^4.0.0, chalk@npm:^4.0.2, chalk@npm:^4.1.0, chalk@npm:^4.1.2": version: 4.1.2 resolution: "chalk@npm:4.1.2" @@ -28413,7 +28402,7 @@ __metadata: "@storybook/icons": "npm:^2.0.1" "@tanstack/react-virtual": "npm:^3.3.0" "@testing-library/dom": "npm:^10.4.1" - "@testing-library/jest-dom": "npm:^6.6.3" + "@testing-library/jest-dom": "npm:^6.9.1" "@testing-library/react": "npm:^14.0.0" "@testing-library/user-event": "npm:^14.6.1" "@types/cross-spawn": "npm:^6.0.6"