@storybook/addon-docs 6.3.3 → 6.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,5 +7,19 @@ exports.DocsContext = void 0;
7
7
 
8
8
  var _react = require("react");
9
9
 
10
- var DocsContext = /*#__PURE__*/(0, _react.createContext)({});
10
+ var _global = require("global");
11
+
12
+ // We add DocsContext to window. The reason is that in case DocsContext.ts is
13
+ // imported multiple times (maybe once directly, and another time from a minified bundle)
14
+ // we will have multiple DocsContext definitions - leading to lost context in
15
+ // the React component tree.
16
+ // This was specifically a problem with the Vite builder.
17
+
18
+ /* eslint-disable no-underscore-dangle */
19
+ if (_global.window.__DOCS_CONTEXT__ === undefined) {
20
+ _global.window.__DOCS_CONTEXT__ = /*#__PURE__*/(0, _react.createContext)({});
21
+ _global.window.__DOCS_CONTEXT__.displayName = 'DocsContext';
22
+ }
23
+
24
+ var DocsContext = _global.window.__DOCS_CONTEXT__;
11
25
  exports.DocsContext = DocsContext;
@@ -1,2 +1,16 @@
1
1
  import { createContext } from 'react';
2
- export var DocsContext = /*#__PURE__*/createContext({});
2
+ import { window as globalWindow } from 'global';
3
+
4
+ // We add DocsContext to window. The reason is that in case DocsContext.ts is
5
+ // imported multiple times (maybe once directly, and another time from a minified bundle)
6
+ // we will have multiple DocsContext definitions - leading to lost context in
7
+ // the React component tree.
8
+ // This was specifically a problem with the Vite builder.
9
+
10
+ /* eslint-disable no-underscore-dangle */
11
+ if (globalWindow.__DOCS_CONTEXT__ === undefined) {
12
+ globalWindow.__DOCS_CONTEXT__ = /*#__PURE__*/createContext({});
13
+ globalWindow.__DOCS_CONTEXT__.displayName = 'DocsContext';
14
+ }
15
+
16
+ export var DocsContext = globalWindow.__DOCS_CONTEXT__;
@@ -1,2 +1,16 @@
1
1
  import { createContext } from 'react';
2
- export const DocsContext = /*#__PURE__*/createContext({});
2
+ import { window as globalWindow } from 'global';
3
+
4
+ // We add DocsContext to window. The reason is that in case DocsContext.ts is
5
+ // imported multiple times (maybe once directly, and another time from a minified bundle)
6
+ // we will have multiple DocsContext definitions - leading to lost context in
7
+ // the React component tree.
8
+ // This was specifically a problem with the Vite builder.
9
+
10
+ /* eslint-disable no-underscore-dangle */
11
+ if (globalWindow.__DOCS_CONTEXT__ === undefined) {
12
+ globalWindow.__DOCS_CONTEXT__ = /*#__PURE__*/createContext({});
13
+ globalWindow.__DOCS_CONTEXT__.displayName = 'DocsContext';
14
+ }
15
+
16
+ export const DocsContext = globalWindow.__DOCS_CONTEXT__;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/addon-docs",
3
- "version": "6.3.3",
3
+ "version": "6.3.7",
4
4
  "description": "Document component usage and properties in Markdown",
5
5
  "keywords": [
6
6
  "addon",
@@ -63,20 +63,20 @@
63
63
  "@mdx-js/loader": "^1.6.22",
64
64
  "@mdx-js/mdx": "^1.6.22",
65
65
  "@mdx-js/react": "^1.6.22",
66
- "@storybook/addons": "6.3.3",
67
- "@storybook/api": "6.3.3",
68
- "@storybook/builder-webpack4": "6.3.3",
69
- "@storybook/client-api": "6.3.3",
70
- "@storybook/client-logger": "6.3.3",
71
- "@storybook/components": "6.3.3",
72
- "@storybook/core": "6.3.3",
73
- "@storybook/core-events": "6.3.3",
66
+ "@storybook/addons": "6.3.7",
67
+ "@storybook/api": "6.3.7",
68
+ "@storybook/builder-webpack4": "6.3.7",
69
+ "@storybook/client-api": "6.3.7",
70
+ "@storybook/client-logger": "6.3.7",
71
+ "@storybook/components": "6.3.7",
72
+ "@storybook/core": "6.3.7",
73
+ "@storybook/core-events": "6.3.7",
74
74
  "@storybook/csf": "0.0.1",
75
- "@storybook/csf-tools": "6.3.3",
76
- "@storybook/node-logger": "6.3.3",
77
- "@storybook/postinstall": "6.3.3",
78
- "@storybook/source-loader": "6.3.3",
79
- "@storybook/theming": "6.3.3",
75
+ "@storybook/csf-tools": "6.3.7",
76
+ "@storybook/node-logger": "6.3.7",
77
+ "@storybook/postinstall": "6.3.7",
78
+ "@storybook/source-loader": "6.3.7",
79
+ "@storybook/theming": "6.3.7",
80
80
  "acorn": "^7.4.1",
81
81
  "acorn-jsx": "^5.3.1",
82
82
  "acorn-walk": "^7.2.0",
@@ -104,10 +104,10 @@
104
104
  "@babel/core": "^7.12.10",
105
105
  "@emotion/core": "^10.1.1",
106
106
  "@emotion/styled": "^10.0.27",
107
- "@storybook/angular": "6.3.3",
108
- "@storybook/react": "6.3.3",
109
- "@storybook/vue": "6.3.3",
110
- "@storybook/web-components": "6.3.3",
107
+ "@storybook/angular": "6.3.7",
108
+ "@storybook/react": "6.3.7",
109
+ "@storybook/vue": "6.3.7",
110
+ "@storybook/web-components": "6.3.7",
111
111
  "@types/cross-spawn": "^6.0.2",
112
112
  "@types/doctrine": "^0.0.3",
113
113
  "@types/enzyme": "^3.10.8",
@@ -137,10 +137,10 @@
137
137
  "zone.js": "^0.11.3"
138
138
  },
139
139
  "peerDependencies": {
140
- "@storybook/angular": "6.3.3",
141
- "@storybook/vue": "6.3.3",
142
- "@storybook/vue3": "6.3.3",
143
- "@storybook/web-components": "6.3.3",
140
+ "@storybook/angular": "6.3.7",
141
+ "@storybook/vue": "6.3.7",
142
+ "@storybook/vue3": "6.3.7",
143
+ "@storybook/web-components": "6.3.7",
144
144
  "lit": "^2.0.0-rc.1",
145
145
  "lit-html": "^1.4.1 || ^2.0.0-rc.3",
146
146
  "react": "^16.8.0 || ^17.0.0",
@@ -191,7 +191,7 @@
191
191
  "publishConfig": {
192
192
  "access": "public"
193
193
  },
194
- "gitHead": "8735bf5c0e6b39c0d6a2af1041861ff3bf05b1b4",
194
+ "gitHead": "57695ddcfdc6f2b5c6534579d84066ec4e855679",
195
195
  "sbmodern": "dist/modern/index.js",
196
196
  "storybook": {
197
197
  "displayName": "Docs",