@storybook/components 6.1.12 → 6.1.17

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.
@@ -34,6 +34,8 @@ require("core-js/modules/es.object.keys");
34
34
 
35
35
  require("core-js/modules/es.object.to-string");
36
36
 
37
+ require("core-js/modules/es.promise");
38
+
37
39
  require("core-js/modules/es.regexp.to-string");
38
40
 
39
41
  require("core-js/modules/es.string.iterator");
@@ -55,6 +57,8 @@ Object.defineProperty(exports, "createSyntaxHighlighterElement", {
55
57
  });
56
58
  exports.SyntaxHighlighter = void 0;
57
59
 
60
+ require("regenerator-runtime/runtime");
61
+
58
62
  var _react = _interopRequireWildcard(require("react"));
59
63
 
60
64
  var _clientLogger = require("@storybook/client-logger");
@@ -109,6 +113,10 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
109
113
 
110
114
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
111
115
 
116
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
117
+
118
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
119
+
112
120
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
113
121
 
114
122
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
@@ -154,17 +162,58 @@ var themedSyntax = (0, _memoizerific["default"])(2)(function (theme) {
154
162
  return Object.assign({}, acc, _defineProperty({}, "* .".concat(key), val));
155
163
  }, {});
156
164
  });
165
+ var copyToClipboard;
157
166
 
158
- var Wrapper = _theming.styled.div(function (_ref3) {
159
- var theme = _ref3.theme;
167
+ if (_global.navigator.clipboard) {
168
+ copyToClipboard = function copyToClipboard(text) {
169
+ return _global.navigator.clipboard.writeText(text);
170
+ };
171
+ } else {
172
+ copyToClipboard = /*#__PURE__*/function () {
173
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(text) {
174
+ var tmp, focus;
175
+ return regeneratorRuntime.wrap(function _callee$(_context) {
176
+ while (1) {
177
+ switch (_context.prev = _context.next) {
178
+ case 0:
179
+ tmp = _global.document.createElement('TEXTAREA');
180
+ focus = _global.document.activeElement;
181
+ tmp.value = text;
182
+
183
+ _global.document.body.appendChild(tmp);
184
+
185
+ tmp.select();
186
+
187
+ _global.document.execCommand('copy');
188
+
189
+ _global.document.body.removeChild(tmp);
190
+
191
+ focus.focus();
192
+
193
+ case 8:
194
+ case "end":
195
+ return _context.stop();
196
+ }
197
+ }
198
+ }, _callee);
199
+ }));
200
+
201
+ return function copyToClipboard(_x) {
202
+ return _ref3.apply(this, arguments);
203
+ };
204
+ }();
205
+ }
206
+
207
+ var Wrapper = _theming.styled.div(function (_ref4) {
208
+ var theme = _ref4.theme;
160
209
  return {
161
210
  position: 'relative',
162
211
  overflow: 'hidden',
163
212
  color: theme.color.defaultText
164
213
  };
165
- }, function (_ref4) {
166
- var theme = _ref4.theme,
167
- bordered = _ref4.bordered;
214
+ }, function (_ref5) {
215
+ var theme = _ref5.theme,
216
+ bordered = _ref5.bordered;
168
217
  return bordered ? {
169
218
  border: "1px solid ".concat(theme.appBorderColor),
170
219
  borderRadius: theme.borderRadius,
@@ -172,9 +221,9 @@ var Wrapper = _theming.styled.div(function (_ref3) {
172
221
  } : {};
173
222
  });
174
223
 
175
- var Scroller = (0, _theming.styled)(function (_ref5) {
176
- var children = _ref5.children,
177
- className = _ref5.className;
224
+ var Scroller = (0, _theming.styled)(function (_ref6) {
225
+ var children = _ref6.children,
226
+ className = _ref6.className;
178
227
  return /*#__PURE__*/_react["default"].createElement(_ScrollArea.ScrollArea, {
179
228
  horizontal: true,
180
229
  vertical: true,
@@ -182,21 +231,21 @@ var Scroller = (0, _theming.styled)(function (_ref5) {
182
231
  }, children);
183
232
  })({
184
233
  position: 'relative'
185
- }, function (_ref6) {
186
- var theme = _ref6.theme;
234
+ }, function (_ref7) {
235
+ var theme = _ref7.theme;
187
236
  return {
188
237
  '& code': {
189
238
  paddingRight: theme.layoutMargin
190
239
  }
191
240
  };
192
- }, function (_ref7) {
193
- var theme = _ref7.theme;
241
+ }, function (_ref8) {
242
+ var theme = _ref8.theme;
194
243
  return themedSyntax(theme);
195
244
  });
196
245
 
197
- var Pre = _theming.styled.pre(function (_ref8) {
198
- var theme = _ref8.theme,
199
- padded = _ref8.padded;
246
+ var Pre = _theming.styled.pre(function (_ref9) {
247
+ var theme = _ref9.theme,
248
+ padded = _ref9.padded;
200
249
  return {
201
250
  display: 'flex',
202
251
  justifyContent: 'flex-start',
@@ -211,23 +260,23 @@ var Code = _theming.styled.code({
211
260
  opacity: 1
212
261
  });
213
262
 
214
- var SyntaxHighlighter = function SyntaxHighlighter(_ref9) {
215
- var children = _ref9.children,
216
- _ref9$language = _ref9.language,
217
- language = _ref9$language === void 0 ? 'jsx' : _ref9$language,
218
- _ref9$copyable = _ref9.copyable,
219
- copyable = _ref9$copyable === void 0 ? false : _ref9$copyable,
220
- _ref9$bordered = _ref9.bordered,
221
- bordered = _ref9$bordered === void 0 ? false : _ref9$bordered,
222
- _ref9$padded = _ref9.padded,
223
- padded = _ref9$padded === void 0 ? false : _ref9$padded,
224
- _ref9$format = _ref9.format,
225
- format = _ref9$format === void 0 ? true : _ref9$format,
226
- _ref9$className = _ref9.className,
227
- className = _ref9$className === void 0 ? null : _ref9$className,
228
- _ref9$showLineNumbers = _ref9.showLineNumbers,
229
- showLineNumbers = _ref9$showLineNumbers === void 0 ? false : _ref9$showLineNumbers,
230
- rest = _objectWithoutProperties(_ref9, ["children", "language", "copyable", "bordered", "padded", "format", "className", "showLineNumbers"]);
263
+ var SyntaxHighlighter = function SyntaxHighlighter(_ref10) {
264
+ var children = _ref10.children,
265
+ _ref10$language = _ref10.language,
266
+ language = _ref10$language === void 0 ? 'jsx' : _ref10$language,
267
+ _ref10$copyable = _ref10.copyable,
268
+ copyable = _ref10$copyable === void 0 ? false : _ref10$copyable,
269
+ _ref10$bordered = _ref10.bordered,
270
+ bordered = _ref10$bordered === void 0 ? false : _ref10$bordered,
271
+ _ref10$padded = _ref10.padded,
272
+ padded = _ref10$padded === void 0 ? false : _ref10$padded,
273
+ _ref10$format = _ref10.format,
274
+ format = _ref10$format === void 0 ? true : _ref10$format,
275
+ _ref10$className = _ref10.className,
276
+ className = _ref10$className === void 0 ? null : _ref10$className,
277
+ _ref10$showLineNumber = _ref10.showLineNumbers,
278
+ showLineNumbers = _ref10$showLineNumber === void 0 ? false : _ref10$showLineNumber,
279
+ rest = _objectWithoutProperties(_ref10, ["children", "language", "copyable", "bordered", "padded", "format", "className", "showLineNumbers"]);
231
280
 
232
281
  if (typeof children !== 'string' || !children.trim()) {
233
282
  return null;
@@ -242,8 +291,7 @@ var SyntaxHighlighter = function SyntaxHighlighter(_ref9) {
242
291
 
243
292
  var onClick = function onClick(e) {
244
293
  e.preventDefault();
245
-
246
- _global.navigator.clipboard.writeText(highlightableCode).then(function () {
294
+ copyToClipboard(highlightableCode).then(function () {
247
295
  setCopied(true);
248
296
 
249
297
  _global.window.setTimeout(function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/components",
3
- "version": "6.1.12",
3
+ "version": "6.1.17",
4
4
  "description": "Core Storybook Components",
5
5
  "keywords": [
6
6
  "storybook"
@@ -29,9 +29,9 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@popperjs/core": "^2.5.4",
32
- "@storybook/client-logger": "6.1.12",
32
+ "@storybook/client-logger": "6.1.17",
33
33
  "@storybook/csf": "0.0.1",
34
- "@storybook/theming": "6.1.12",
34
+ "@storybook/theming": "6.1.17",
35
35
  "@types/overlayscrollbars": "^1.9.0",
36
36
  "@types/react-color": "^3.0.1",
37
37
  "@types/react-syntax-highlighter": "11.0.4",
@@ -60,7 +60,7 @@
60
60
  "publishConfig": {
61
61
  "access": "public"
62
62
  },
63
- "gitHead": "9c114af32618d516ae9e6f73700fbb79273c95e2",
63
+ "gitHead": "c5f036719ab7098cc8e2bbccf3430b3c9c494a8f",
64
64
  "typesVersions": {
65
65
  "<3.8": {
66
66
  "*": [