@storybook/addon-docs 7.0.0-alpha.0 → 7.0.0-alpha.3
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.
- package/dist/cjs/blocks/Anchor.js +7 -10
- package/dist/cjs/blocks/ArgsTable.js +134 -205
- package/dist/cjs/blocks/Canvas.js +38 -73
- package/dist/cjs/blocks/Description.js +41 -68
- package/dist/cjs/blocks/DocsContainer.js +40 -68
- package/dist/cjs/blocks/DocsContext.js +1 -1
- package/dist/cjs/blocks/DocsPage.js +3 -5
- package/dist/cjs/blocks/DocsStory.js +18 -28
- package/dist/cjs/blocks/Heading.js +5 -9
- package/dist/cjs/blocks/Meta.js +11 -33
- package/dist/cjs/blocks/Preview.js +4 -10
- package/dist/cjs/blocks/Primary.js +11 -39
- package/dist/cjs/blocks/Props.js +4 -10
- package/dist/cjs/blocks/Source.js +62 -80
- package/dist/cjs/blocks/SourceContainer.js +19 -68
- package/dist/cjs/blocks/Stories.js +16 -47
- package/dist/cjs/blocks/Story.js +60 -180
- package/dist/cjs/blocks/Subheading.js +5 -9
- package/dist/cjs/blocks/Subtitle.js +15 -35
- package/dist/cjs/blocks/Title.js +12 -36
- package/dist/cjs/blocks/Wrapper.js +7 -8
- package/dist/cjs/blocks/enhanceSource.js +30 -67
- package/dist/cjs/blocks/index.js +28 -34
- package/dist/cjs/blocks/mdx.js +85 -96
- package/dist/cjs/blocks/types.js +2 -2
- package/dist/cjs/blocks/useStory.js +16 -101
- package/dist/cjs/blocks/utils.js +4 -25
- package/dist/cjs/index.js +1 -7
- package/dist/cjs/manager.js +9 -15
- package/dist/cjs/preset.js +120 -288
- package/dist/cjs/preview.js +5 -103
- package/dist/cjs/shared.js +5 -5
- package/dist/esm/blocks/Story.js +21 -73
- package/dist/types/blocks/Story.d.ts +2 -2
- package/package.json +15 -14
package/dist/cjs/blocks/types.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.PRIMARY_STORY = exports.CURRENT_SELECTION = void 0;
|
|
7
|
-
|
|
7
|
+
const CURRENT_SELECTION = '.';
|
|
8
8
|
exports.CURRENT_SELECTION = CURRENT_SELECTION;
|
|
9
|
-
|
|
9
|
+
const PRIMARY_STORY = '^';
|
|
10
10
|
exports.PRIMARY_STORY = PRIMARY_STORY;
|
|
@@ -1,122 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
|
-
require("core-js/modules/es.symbol.js");
|
|
6
|
-
|
|
7
|
-
require("core-js/modules/es.symbol.description.js");
|
|
8
|
-
|
|
9
|
-
require("core-js/modules/es.symbol.iterator.js");
|
|
10
|
-
|
|
11
|
-
require("core-js/modules/es.array.slice.js");
|
|
12
|
-
|
|
13
|
-
require("core-js/modules/es.function.name.js");
|
|
14
|
-
|
|
15
|
-
require("core-js/modules/es.array.from.js");
|
|
16
|
-
|
|
17
|
-
require("core-js/modules/es.regexp.exec.js");
|
|
18
|
-
|
|
19
|
-
require("core-js/modules/es.symbol.async-iterator.js");
|
|
20
|
-
|
|
21
|
-
require("core-js/modules/es.symbol.to-string-tag.js");
|
|
22
|
-
|
|
23
|
-
require("core-js/modules/es.json.to-string-tag.js");
|
|
24
|
-
|
|
25
|
-
require("core-js/modules/es.math.to-string-tag.js");
|
|
26
|
-
|
|
27
|
-
require("core-js/modules/es.object.get-prototype-of.js");
|
|
28
|
-
|
|
29
|
-
require("core-js/modules/web.dom-collections.for-each.js");
|
|
30
|
-
|
|
31
3
|
Object.defineProperty(exports, "__esModule", {
|
|
32
4
|
value: true
|
|
33
5
|
});
|
|
34
6
|
exports.useStories = useStories;
|
|
35
7
|
exports.useStory = useStory;
|
|
36
8
|
|
|
37
|
-
require("core-js/modules/es.object.to-string.js");
|
|
38
|
-
|
|
39
|
-
require("core-js/modules/es.array.iterator.js");
|
|
40
|
-
|
|
41
|
-
require("core-js/modules/es.promise.js");
|
|
42
|
-
|
|
43
|
-
require("core-js/modules/es.string.iterator.js");
|
|
44
|
-
|
|
45
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
46
|
-
|
|
47
|
-
require("core-js/modules/es.array.map.js");
|
|
48
|
-
|
|
49
|
-
require("core-js/modules/es.object.assign.js");
|
|
50
|
-
|
|
51
9
|
var _react = require("react");
|
|
52
10
|
|
|
53
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
54
|
-
|
|
55
|
-
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; }
|
|
56
|
-
|
|
57
|
-
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); } }
|
|
58
|
-
|
|
59
|
-
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); }); }; }
|
|
60
|
-
|
|
61
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
62
|
-
|
|
63
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
64
|
-
|
|
65
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
66
|
-
|
|
67
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
68
|
-
|
|
69
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
70
|
-
|
|
71
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
72
|
-
|
|
73
11
|
function useStory(storyId, context) {
|
|
74
|
-
|
|
12
|
+
const stories = useStories([storyId], context);
|
|
75
13
|
return stories && stories[0];
|
|
76
14
|
}
|
|
77
15
|
|
|
78
16
|
function useStories(storyIds, context) {
|
|
79
|
-
|
|
17
|
+
const initialStoriesById = context.componentStories().reduce((acc, story) => {
|
|
80
18
|
acc[story.id] = story;
|
|
81
19
|
return acc;
|
|
82
20
|
}, {});
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
switch (_context.prev = _context.next) {
|
|
96
|
-
case 0:
|
|
97
|
-
_context.next = 2;
|
|
98
|
-
return context.loadStory(storyId);
|
|
99
|
-
|
|
100
|
-
case 2:
|
|
101
|
-
story = _context.sent;
|
|
102
|
-
setStories(function (current) {
|
|
103
|
-
return current[storyId] === story ? current : Object.assign({}, current, _defineProperty({}, storyId, story));
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
case 4:
|
|
107
|
-
case "end":
|
|
108
|
-
return _context.stop();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}, _callee);
|
|
21
|
+
const [storiesById, setStories] = (0, _react.useState)(initialStoriesById);
|
|
22
|
+
(0, _react.useEffect)(() => {
|
|
23
|
+
Promise.all(storyIds.map(async storyId => {
|
|
24
|
+
// loadStory will be called every single time useStory is called
|
|
25
|
+
// because useEffect does not use storyIds as an input. This is because
|
|
26
|
+
// HMR can change the story even when the storyId hasn't changed. However, it
|
|
27
|
+
// will be a no-op once the story has loaded. Furthermore, the `story` will
|
|
28
|
+
// have an exact equality when the story hasn't changed, so it won't trigger
|
|
29
|
+
// any unnecessary re-renders
|
|
30
|
+
const story = await context.loadStory(storyId);
|
|
31
|
+
setStories(current => current[storyId] === story ? current : Object.assign({}, current, {
|
|
32
|
+
[storyId]: story
|
|
112
33
|
}));
|
|
113
|
-
|
|
114
|
-
return function (_x) {
|
|
115
|
-
return _ref.apply(this, arguments);
|
|
116
|
-
};
|
|
117
|
-
}()));
|
|
118
|
-
});
|
|
119
|
-
return storyIds.map(function (storyId) {
|
|
120
|
-
return storiesById[storyId];
|
|
34
|
+
}));
|
|
121
35
|
});
|
|
36
|
+
return storyIds.map(storyId => storiesById[storyId]);
|
|
122
37
|
}
|
package/dist/cjs/blocks/utils.js
CHANGED
|
@@ -6,30 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getComponentName = void 0;
|
|
7
7
|
exports.scrollToElement = scrollToElement;
|
|
8
8
|
|
|
9
|
-
require("core-js/modules/es.array.join.js");
|
|
10
|
-
|
|
11
|
-
require("core-js/modules/es.array.map.js");
|
|
12
|
-
|
|
13
|
-
require("core-js/modules/es.regexp.exec.js");
|
|
14
|
-
|
|
15
|
-
require("core-js/modules/es.string.split.js");
|
|
16
|
-
|
|
17
|
-
require("core-js/modules/es.array.slice.js");
|
|
18
|
-
|
|
19
|
-
require("core-js/modules/es.array.includes.js");
|
|
20
|
-
|
|
21
|
-
require("core-js/modules/es.string.includes.js");
|
|
22
|
-
|
|
23
|
-
require("core-js/modules/es.function.name.js");
|
|
24
|
-
|
|
25
9
|
/* eslint-disable no-underscore-dangle */
|
|
26
|
-
|
|
27
|
-
return str.split('-').map(function (part) {
|
|
28
|
-
return part.charAt(0).toUpperCase() + part.slice(1);
|
|
29
|
-
}).join('');
|
|
30
|
-
};
|
|
10
|
+
const titleCase = str => str.split('-').map(part => part.charAt(0).toUpperCase() + part.slice(1)).join('');
|
|
31
11
|
|
|
32
|
-
|
|
12
|
+
const getComponentName = component => {
|
|
33
13
|
if (!component) {
|
|
34
14
|
return undefined;
|
|
35
15
|
}
|
|
@@ -51,11 +31,10 @@ var getComponentName = function getComponentName(component) {
|
|
|
51
31
|
|
|
52
32
|
exports.getComponentName = getComponentName;
|
|
53
33
|
|
|
54
|
-
function scrollToElement(element) {
|
|
55
|
-
var block = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'start';
|
|
34
|
+
function scrollToElement(element, block = 'start') {
|
|
56
35
|
element.scrollIntoView({
|
|
57
36
|
behavior: 'smooth',
|
|
58
|
-
block
|
|
37
|
+
block,
|
|
59
38
|
inline: 'nearest'
|
|
60
39
|
});
|
|
61
40
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.object.to-string.js");
|
|
4
|
-
|
|
5
|
-
require("core-js/modules/web.dom-collections.for-each.js");
|
|
6
|
-
|
|
7
|
-
require("core-js/modules/es.object.keys.js");
|
|
8
|
-
|
|
9
3
|
Object.defineProperty(exports, "__esModule", {
|
|
10
4
|
value: true
|
|
11
5
|
});
|
|
@@ -17,7 +11,7 @@ Object.keys(_blocks).forEach(function (key) {
|
|
|
17
11
|
if (key in exports && exports[key] === _blocks[key]) return;
|
|
18
12
|
Object.defineProperty(exports, key, {
|
|
19
13
|
enumerable: true,
|
|
20
|
-
get: function
|
|
14
|
+
get: function () {
|
|
21
15
|
return _blocks[key];
|
|
22
16
|
}
|
|
23
17
|
});
|
package/dist/cjs/manager.js
CHANGED
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.array.concat.js");
|
|
4
|
-
|
|
5
3
|
var _addons = require("@storybook/addons");
|
|
6
4
|
|
|
7
5
|
var _shared = require("./shared");
|
|
8
6
|
|
|
9
|
-
_addons.addons.register(_shared.ADDON_ID,
|
|
7
|
+
_addons.addons.register(_shared.ADDON_ID, () => {
|
|
10
8
|
_addons.addons.add(_shared.PANEL_ID, {
|
|
11
9
|
type: _addons.types.TAB,
|
|
12
10
|
title: 'Docs',
|
|
13
|
-
route:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
render: function render() {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
11
|
+
route: ({
|
|
12
|
+
storyId,
|
|
13
|
+
refId
|
|
14
|
+
}) => refId ? `/docs/${refId}_${storyId}` : `/docs/${storyId}`,
|
|
15
|
+
match: ({
|
|
16
|
+
viewMode
|
|
17
|
+
}) => viewMode === 'docs',
|
|
18
|
+
render: () => null
|
|
25
19
|
});
|
|
26
20
|
});
|