Skip to content

Commit

Permalink
Merge branch 'main' of github.com:storybookjs/addon-knobs into next
Browse files Browse the repository at this point in the history
  • Loading branch information
JReinhold committed Apr 27, 2023
2 parents f0dc860 + 11d65f9 commit 703e5fa
Show file tree
Hide file tree
Showing 21 changed files with 5,684 additions and 7,503 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/release.yml
Expand Up @@ -10,12 +10,15 @@ jobs:
- uses: actions/checkout@v2

- name: Prepare repository
run: git fetch --unshallow --tags
run: |
git fetch --unshallow --tags
git config user.name "GitHub Actions Bot"
git config user.email "bot@github.com"
- name: Use Node.js 14.x
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 14.x
node-version: 16.x

- name: Install dependencies
uses: bahmutov/npm-install@v1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests-unit.yml
Expand Up @@ -10,11 +10,11 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "14.x"
node-version: "16.x"
cache: yarn
- name: install
run: |
yarn install --immutable
- name: test
run: |
yarn test --runInBand --ci
yarn test --runInBand --ci
9 changes: 5 additions & 4 deletions .storybook/main.js
@@ -1,7 +1,8 @@
module.exports = {
stories: [
"../stories/**/*.stories.mdx",
"../stories/**/*.stories.@(js|jsx|ts|tsx)",
],
stories: ["../stories/**/*.stories.mdx", "../stories/**/*.stories.@(js|jsx|ts|tsx)"],
addons: ["../preset"],
framework: {
name: "@storybook/react-webpack5",
options: {}
}
};
103 changes: 103 additions & 0 deletions CHANGELOG.md
@@ -0,0 +1,103 @@
# v7.0.1 (Thu Apr 27 2023)

#### 🐛 Bug Fix

- build: make storybook peer dependency less strict [#51](https://github.com/storybookjs/addon-knobs/pull/51) ([@literalpie](https://github.com/literalpie))

#### Authors: 1

- Benjamin Kindle ([@literalpie](https://github.com/literalpie))

---

# v7.0.0 (Sat Apr 01 2023)

#### 💥 Breaking Change

- Support Storybook 7.0.0 [#48](https://github.com/storybookjs/addon-knobs/pull/48) ([@literalpie](https://github.com/literalpie))

#### ⚠️ Pushed to `main`

- Add Git user info to release workflow ([@JReinhold](https://github.com/JReinhold))

#### 🏠 Internal

- Remove unnecessary `check-metadata.js` [#50](https://github.com/storybookjs/addon-knobs/pull/50) ([@JReinhold](https://github.com/JReinhold))
- Upgrade Node in CI [#49](https://github.com/storybookjs/addon-knobs/pull/49) ([@jonniebigodes](https://github.com/jonniebigodes) [@JReinhold](https://github.com/JReinhold))

#### 📝 Documentation

- Chore: (Docs) Updates link for support table [#44](https://github.com/storybookjs/addon-knobs/pull/44) ([@jonniebigodes](https://github.com/jonniebigodes))

#### Authors: 3

- [@jonniebigodes](https://github.com/jonniebigodes)
- Benjamin Kindle ([@literalpie](https://github.com/literalpie))
- Jeppe Reinhold ([@JReinhold](https://github.com/JReinhold))

---

# v6.4.0 (Sat Nov 27 2021)

#### 🚀 Enhancement

- 6.4.0 [#41](https://github.com/storybookjs/addon-knobs/pull/41) ([@shilman](https://github.com/shilman))

#### 🐛 Bug Fix

- fix gh secret [#40](https://github.com/storybookjs/addon-knobs/pull/40) ([@shilman](https://github.com/shilman))

#### ⚠️ Pushed to `main`

- Merge branch 'next' ([@shilman](https://github.com/shilman))

#### Authors: 1

- Michael Shilman ([@shilman](https://github.com/shilman))

---

# v6.3.1 (Sat Sep 04 2021)

#### 🐛 Bug Fix


#### ⚠️ Pushed to `main`

- Merge branch 'next' into main ([@shilman](https://github.com/shilman))

#### 🔩 Dependency Updates

- build: make copy-to-clipboard an explicit dependency [#36](https://github.com/storybookjs/addon-knobs/pull/36) ([@hydrosquall](https://github.com/hydrosquall))

#### Authors: 3

- Cameron Yick ([@hydrosquall](https://github.com/hydrosquall))
- Jordan ([@Silic0nS0ldier](https://github.com/Silic0nS0ldier))
- Michael Shilman ([@shilman](https://github.com/shilman))

---

# v6.3.0 (Wed Jun 23 2021)

#### 🚀 Enhancement

- Update package version [#31](https://github.com/storybookjs/addon-knobs/pull/31) ([@shilman](https://github.com/shilman))

#### 🐛 Bug Fix

- Upgrade to Storybook 6.3 [#34](https://github.com/storybookjs/addon-knobs/pull/34) ([@shilman](https://github.com/shilman))

#### ⚠️ Pushed to `main`

- Add deprecation warning ([@shilman](https://github.com/shilman))
- Fix index ([@shilman](https://github.com/shilman))
- Update version ([@shilman](https://github.com/shilman))
- Update package metadata ([@shilman](https://github.com/shilman))
- Fix typescript errors ([@shilman](https://github.com/shilman))
- Extract addon-knobs from monorepo ([@shilman](https://github.com/shilman))
- Initial commit ([@shilman](https://github.com/shilman))

#### Authors: 1

- Michael Shilman ([@shilman](https://github.com/shilman))
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -23,6 +23,8 @@ First of all, you need to install Knobs into your project as a dev dependency.
yarn add @storybook/addon-knobs --dev
```

The latest version of this addon supports Storybook v7. If you're using a previous version of Storybook you need to install the matching version of this addon, eg `@storybook/addon-knobs@6.4.0`.

within `.storybook/main.js`:

```js
Expand Down
23 changes: 0 additions & 23 deletions check-metadata.js

This file was deleted.

4 changes: 3 additions & 1 deletion jest.config.js
Expand Up @@ -15,8 +15,10 @@ module.exports = {
coverageDirectory: 'coverage',
setupFilesAfterEnv: ['./scripts/jest.init.js'],
coverageReporters: ['lcov'],
testEnvironmentOptions: {
url: 'http://localhost',
},
testEnvironment: 'jest-environment-jsdom',
setupFiles: [],
testURL: 'http://localhost',
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx', 'json', 'node'],
};
83 changes: 43 additions & 40 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "@storybook/addon-knobs",
"version": "6.3.0-next.0",
"version": "7.0.1",
"description": "Storybook addon for editing props",
"keywords": [
"storybook-addons",
Expand All @@ -23,59 +23,62 @@
"buildTsc": "tsc --declaration --emitDeclarationOnly --outDir ./dist",
"build": "concurrently \"npm run buildBabel\" \"npm run buildTsc\"",
"test": "jest",
"storybook": "start-storybook -p 6006",
"storybook": "storybook dev -p 6006",
"start": "concurrently \"npm run storybook -- --no-manager-cache --quiet\" \"npm run build -- --watch\"",
"build-storybook": "build-storybook",
"prerelease": "node check-metadata.js",
"build-storybook": "storybook build",
"release": "npm run build && auto shipit"
},
"dependencies": {
"copy-to-clipboard": "^3.3.1",
"core-js": "^3.8.2",
"copy-to-clipboard": "^3.3.3",
"core-js": "^3.29.0",
"escape-html": "^1.0.3",
"fast-deep-equal": "^3.1.3",
"global": "^4.4.0",
"lodash": "^4.17.20",
"prop-types": "^15.7.2",
"qs": "^6.10.0",
"react-colorful": "^5.1.2",
"lodash": "^4.17.21",
"prop-types": "^15.8.1",
"qs": "^6.11.1",
"react-colorful": "^5.6.1",
"react-lifecycles-compat": "^3.0.4",
"react-select": "^3.2.0"
"react-select": "^5.7.0"
},
"devDependencies": {
"@babel/cli": "^7.12.1",
"@babel/core": "^7.12.3",
"@babel/preset-env": "^7.12.1",
"@babel/preset-react": "^7.12.5",
"@babel/preset-typescript": "^7.13.0",
"@emotion/jest": "^11.3.0",
"@storybook/react": "^6.4.0",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^12.0.0",
"@testing-library/user-event": "^13.2.1",
"@types/escape-html": "^1.0.1",
"@types/lodash": "^4.14.168",
"@babel/cli": "^7.21.0",
"@babel/core": "^7.21.0",
"@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.21.0",
"@emotion/jest": "^11.10.5",
"@storybook/react": "^7.0.0",
"@storybook/react-webpack5": "^7.0.0",
"@testing-library/dom": "^9.2.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.4.3",
"@types/escape-html": "^1.0.2",
"@types/lodash": "^4.14.191",
"@types/node": "^18.15.11",
"@types/react-lifecycles-compat": "^3.0.1",
"@types/react-select": "^3.1.2",
"@types/webpack-env": "^1.16.0",
"auto": "^10.3.0",
"babel-loader": "^8.1.0",
"chalk": "^2.4.2",
"concurrently": "^5.3.0",
"jest": "^27.0.6",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"rimraf": "^3.0.2",
"typescript": "^3.9.7"
"@types/webpack-env": "^1.18.0",
"auto": "^10.43.0",
"chalk": "^5.2.0",
"concurrently": "^7.6.0",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rimraf": "^4.4.0",
"storybook": "^7.0.0",
"typescript": "^4.9.5"
},
"peerDependencies": {
"@storybook/addons": "^6.4.0",
"@storybook/api": "^6.4.0",
"@storybook/components": "^6.4.0",
"@storybook/core-events": "^6.4.0",
"@storybook/theming": "^6.4.0",
"react": "^16.8.0 || ^17.0.0",
"react-dom": "^16.8.0 || ^17.0.0"
"@storybook/addons": "^7.0.0",
"@storybook/api": "^7.0.0",
"@storybook/components": "^7.0.0",
"@storybook/core-events": "^7.0.0",
"@storybook/theming": "^7.0.0",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
},
"peerDependenciesMeta": {
"react": {
Expand Down
4 changes: 4 additions & 0 deletions scripts/jest.init.js
Expand Up @@ -6,6 +6,10 @@ import '@testing-library/jest-dom';
*/
const consoleError = global.console.error;
global.console.error = (...args) => {
const reactDomError = (args[0].toString()).includes('ReactDOM.render');
if (reactDomError) {
return;
}
consoleError(...args);
throw new Error(JSON.stringify(args));
}
Expand Down
7 changes: 5 additions & 2 deletions src/KnobManager.ts
@@ -1,8 +1,9 @@
/* eslint no-underscore-dangle: 0 */

import { navigator } from 'global';
// navigator exists in Jest but not the browser. global exists in the browser but not Jest
import { navigator as gNavigator, global } from 'global';
import escape from 'escape-html';
import { getQueryParams } from '@storybook/client-api';
import { getQueryParams } from '@storybook/preview-api';
import { Channel } from '@storybook/channels';

import KnobStore, { KnobStoreKnob } from './KnobStore';
Expand All @@ -11,6 +12,8 @@ import { SET } from './shared';

import { deserializers } from './converters';

const navigator: Navigator = gNavigator || global.navigator;

const knobValuesFromUrl: Record<string, string> = Object.entries(getQueryParams()).reduce(
(acc, [k, v]) => {
if (k.includes('knob-')) {
Expand Down
2 changes: 1 addition & 1 deletion src/KnobStore.ts
Expand Up @@ -36,7 +36,7 @@ export default class KnobStore {
if (this.timer) {
clearTimeout(this.timer);
}
this.timer = setTimeout(callAll, 50, this.callbacks) as number;
this.timer = setTimeout(callAll, 50, this.callbacks) as unknown as number;
}

update(key: string, options: Partial<KnobStoreKnob>) {
Expand Down

0 comments on commit 703e5fa

Please sign in to comment.