storybook 10.1.0-beta.1 → 10.1.0-beta.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.
Files changed (64) hide show
  1. package/dist/_browser-chunks/{chunk-L4RMQ7D7.js → chunk-BRX2HXH7.js} +75 -5
  2. package/dist/_node-chunks/{builder-manager-FTVC2JL7.js → builder-manager-OAF6SRKJ.js} +14 -579
  3. package/dist/_node-chunks/{camelcase-3SMT5WKC.js → camelcase-UG5ZJHCD.js} +7 -7
  4. package/dist/_node-chunks/{chunk-6L7FFBOW.js → chunk-473LXK7O.js} +6 -6
  5. package/dist/_node-chunks/chunk-5N3H43LE.js +23 -0
  6. package/dist/_node-chunks/{chunk-6DEMT5VX.js → chunk-6YYH64IJ.js} +13 -13
  7. package/dist/_node-chunks/{chunk-2OVULPK3.js → chunk-745GFLCZ.js} +6 -6
  8. package/dist/_node-chunks/{chunk-SQSFX47N.js → chunk-7WOMK33B.js} +7 -7
  9. package/dist/_node-chunks/{chunk-RURZIE3W.js → chunk-A5VW7257.js} +8 -8
  10. package/dist/_node-chunks/{chunk-Y4UYN72K.js → chunk-CRJ7M6EO.js} +22 -21
  11. package/dist/_node-chunks/chunk-DRN5YXX5.js +18 -0
  12. package/dist/_node-chunks/{chunk-AREL5IXS.js → chunk-H6HVK5J2.js} +7 -7
  13. package/dist/_node-chunks/{chunk-VRICJPXY.js → chunk-JOOO54RB.js} +6 -6
  14. package/dist/_node-chunks/chunk-LJRIVT23.js +61 -0
  15. package/dist/_node-chunks/{chunk-K673CX4Q.js → chunk-LZ2HPFRB.js} +7 -7
  16. package/dist/_node-chunks/{chunk-TURUTKVH.js → chunk-N5IE6WWR.js} +7 -7
  17. package/dist/_node-chunks/{chunk-IUYZQKSX.js → chunk-NKT3R6IH.js} +6 -6
  18. package/dist/_node-chunks/{chunk-N3BJOOY5.js → chunk-NOTIBODG.js} +6 -6
  19. package/dist/_node-chunks/{chunk-ZMCJS2GU.js → chunk-Q65ED3UK.js} +6 -6
  20. package/dist/_node-chunks/{chunk-3JJPSDXI.js → chunk-RABBUYPA.js} +9 -9
  21. package/dist/_node-chunks/{chunk-RVII4SK6.js → chunk-SKFAHEPX.js} +14 -14
  22. package/dist/_node-chunks/{chunk-O5FMCQHP.js → chunk-STYUJSG3.js} +10 -10
  23. package/dist/_node-chunks/{chunk-54NMJ4II.js → chunk-SUILKNPA.js} +8 -8
  24. package/dist/_node-chunks/{chunk-XGNRK7QB.js → chunk-TUQOGYET.js} +7 -7
  25. package/dist/_node-chunks/{chunk-5V4A6MSI.js → chunk-U24W5IIW.js} +7 -7
  26. package/dist/_node-chunks/{chunk-WIWWMCEU.js → chunk-UWK6Z4VL.js} +6 -6
  27. package/dist/_node-chunks/{chunk-S3PBHOVC.js → chunk-WBULWRM7.js} +34 -24
  28. package/dist/_node-chunks/{chunk-RIKQZHV3.js → chunk-WSIZMTN2.js} +6 -6
  29. package/dist/_node-chunks/{chunk-6ULDIDXV.js → chunk-WYLXFNIP.js} +9 -9
  30. package/dist/_node-chunks/{chunk-Y2FOTPAE.js → chunk-XS5QCZP7.js} +7 -7
  31. package/dist/_node-chunks/{chunk-FNYKBULZ.js → chunk-Y7VDA7NY.js} +7 -7
  32. package/dist/_node-chunks/{dist-TZLZ3T6L.js → dist-N33YQ3NH.js} +9 -9
  33. package/dist/_node-chunks/{globby-22GFCZQD.js → globby-5IBS67N3.js} +9 -9
  34. package/dist/_node-chunks/{lib-37NQ4ZIJ.js → lib-2XH6KQ2B.js} +7 -7
  35. package/dist/_node-chunks/{mdx-N42X6CFJ-2TRB7OEH.js → mdx-N42X6CFJ-3GGSRLVV.js} +8 -8
  36. package/dist/_node-chunks/{p-limit-UD7TYFDW.js → p-limit-Z3A7N5MY.js} +7 -7
  37. package/dist/babel/index.js +10 -10
  38. package/dist/bin/core.js +12 -12
  39. package/dist/bin/dispatcher.js +11 -11
  40. package/dist/bin/loader.js +9 -9
  41. package/dist/cli/index.d.ts +5 -4
  42. package/dist/cli/index.js +18 -18
  43. package/dist/common/index.js +19 -19
  44. package/dist/components/index.js +35 -29
  45. package/dist/core-server/index.js +33 -33
  46. package/dist/core-server/presets/common-manager.js +74 -108
  47. package/dist/core-server/presets/common-override-preset.js +9 -9
  48. package/dist/core-server/presets/common-preset.js +25 -25
  49. package/dist/csf-tools/index.js +9 -9
  50. package/dist/manager/globals-runtime.js +148 -74
  51. package/dist/manager/runtime.js +70 -20
  52. package/dist/manager-api/index.js +7 -10
  53. package/dist/mocking-utils/index.js +8 -8
  54. package/dist/node-logger/index.js +9 -9
  55. package/dist/server-errors.js +11 -11
  56. package/dist/telemetry/index.js +23 -23
  57. package/dist/theming/create.d.ts +1 -1
  58. package/dist/theming/create.js +1 -1
  59. package/dist/theming/index.d.ts +65 -2
  60. package/dist/theming/index.js +6 -3
  61. package/package.json +1 -2
  62. package/dist/_node-chunks/chunk-DWA53E73.js +0 -23
  63. package/dist/_node-chunks/chunk-KJAFCNZ3.js +0 -61
  64. package/dist/_node-chunks/chunk-Z4BMBA5L.js +0 -18
@@ -293,9 +293,9 @@ var require_memoizerific = __commonJS({
293
293
  module3.exports = function(limit) {
294
294
  var cache = new MapOrSimilar(!1), lru = [];
295
295
  return function(fn) {
296
- var memoizerific2 = function() {
296
+ var memoizerific3 = function() {
297
297
  var currentCache = cache, newMap, fnResult, argsLengthMinusOne = arguments.length - 1, lruPath = Array(argsLengthMinusOne + 1), isMemoized = !0, i2;
298
- if ((memoizerific2.numArgs || memoizerific2.numArgs === 0) && memoizerific2.numArgs !== argsLengthMinusOne + 1)
298
+ if ((memoizerific3.numArgs || memoizerific3.numArgs === 0) && memoizerific3.numArgs !== argsLengthMinusOne + 1)
299
299
  throw new Error("Memoizerific functions should always be called with the same number of arguments");
300
300
  for (i2 = 0; i2 < argsLengthMinusOne; i2++) {
301
301
  if (lruPath[i2] = {
@@ -310,9 +310,9 @@ var require_memoizerific = __commonJS({
310
310
  return isMemoized && (currentCache.has(arguments[argsLengthMinusOne]) ? fnResult = currentCache.get(arguments[argsLengthMinusOne]) : isMemoized = !1), isMemoized || (fnResult = fn.apply(null, arguments), currentCache.set(arguments[argsLengthMinusOne], fnResult)), limit > 0 && (lruPath[argsLengthMinusOne] = {
311
311
  cacheItem: currentCache,
312
312
  arg: arguments[argsLengthMinusOne]
313
- }, isMemoized ? moveToMostRecentLru(lru, lruPath) : lru.push(lruPath), lru.length > limit && removeCachedResult(lru.shift())), memoizerific2.wasMemoized = isMemoized, memoizerific2.numArgs = argsLengthMinusOne + 1, fnResult;
313
+ }, isMemoized ? moveToMostRecentLru(lru, lruPath) : lru.push(lruPath), lru.length > limit && removeCachedResult(lru.shift())), memoizerific3.wasMemoized = isMemoized, memoizerific3.numArgs = argsLengthMinusOne + 1, fnResult;
314
314
  };
315
- return memoizerific2.limit = limit, memoizerific2.wasMemoized = !1, memoizerific2.cache = cache, memoizerific2.lru = lru, memoizerific2;
315
+ return memoizerific3.limit = limit, memoizerific3.wasMemoized = !1, memoizerific3.cache = cache, memoizerific3.lru = lru, memoizerific3;
316
316
  };
317
317
  };
318
318
  function moveToMostRecentLru(lru, lruPath) {
@@ -2259,7 +2259,7 @@ var icons_default = __STORYBOOK_ICONS__, { AccessibilityAltIcon, AccessibilityIc
2259
2259
  var manager_api_default = __STORYBOOK_API__, { ActiveTabs, Consumer, ManagerContext, Provider, RequestResponseError, addons, combineParameters, controlOrMetaKey, controlOrMetaSymbol, eventMatchesShortcut, eventToShortcut, experimental_MockUniversalStore, experimental_UniversalStore, experimental_getStatusStore, experimental_getTestProviderStore, experimental_requestResponse, experimental_useStatusStore, experimental_useTestProviderStore, experimental_useUniversalStore, internal_checklistStore, internal_fullStatusStore, internal_fullTestProviderStore, internal_universalChecklistStore, internal_universalStatusStore, internal_universalTestProviderStore, isMacLike, isShortcutTaken, keyToSymbol, merge, mockChannel, optionOrAltSymbol, shortcutMatchesShortcut, shortcutToAriaKeyshortcuts, shortcutToHumanString, types, useAddonState, useArgTypes, useArgs, useChannel, useGlobalTypes, useGlobals, useParameter, useSharedState, useStoryPrepared, useStorybookApi, useStorybookState } = __STORYBOOK_API__;
2260
2260
 
2261
2261
  // global-externals:storybook/theming
2262
- var theming_default = __STORYBOOK_THEMING__, { CacheProvider, ClassNames, Global, ThemeProvider, background, color, convert, create, createCache, createGlobal, createReset, css, darken, ensure, getPreferredColorScheme, ignoreSsrWarning, isPropValid, jsx, keyframes, lighten, styled, themes, typography, useTheme, withTheme } = __STORYBOOK_THEMING__;
2262
+ var theming_default = __STORYBOOK_THEMING__, { CacheProvider, ClassNames, Global, ThemeProvider, background, color, convert, create, createCache, createGlobal, createReset, css, darken, ensure, getPreferredColorScheme, ignoreSsrWarning, isPropValid, jsx, keyframes, lighten, styled, themes, tokens, typography, useTheme, withTheme } = __STORYBOOK_THEMING__;
2263
2263
 
2264
2264
  // global-externals:storybook/internal/components
2265
2265
  var components_default = __STORYBOOK_COMPONENTS__, { A, AbstractToolbar, ActionBar, AddonPanel, Badge, Bar, Blockquote, Button, Card, ClipboardCode, Code, Collapsible, DL, Div, DocumentWrapper, EmptyTabContent, ErrorFormatter, FlexBar, Form, H1, H2, H3, H4, H5, H6, HR, IconButton, Img, LI, Link, ListItem, Listbox, Loader, Modal, ModalDecorator, OL, P, Placeholder, Popover, PopoverProvider, Pre, ProgressSpinner, ResetWrapper, ScrollArea, Select, Separator, Spaced, Span, StatelessTab, StatelessTabList, StatelessTabPanel, StatelessTabsView, StorybookIcon: StorybookIcon2, StorybookLogo, SyntaxHighlighter, TT, TabBar, TabButton, TabList, TabPanel, TabWrapper, Table, Tabs, TabsState, TabsView, ToggleButton, Toolbar, Tooltip, TooltipLinkList, TooltipMessage, TooltipNote, TooltipProvider, UL, WithTooltip, WithTooltipPure, Zoom, codeCommon, components, convertToReactAriaPlacement, createCopyToClipboardFunction, getStoryHref, interleaveSeparators, nameSpaceClassNames, resetComponents, useTabsState, withReset } = __STORYBOOK_COMPONENTS__;
@@ -13919,6 +13919,9 @@ var { document: document4, window: globalWindow3 } = scope, IndicatorPlacement =
13919
13919
  return react_default.createElement(Message, { href: "https://storybook.js.org/docs/sharing/storybook-composition?ref=ui" }, react_default.createElement(LightningIcon, { color: theme.color.gold }), react_default.createElement("div", null, react_default.createElement(MessageTitle, null, "Reduce lag"), react_default.createElement("div", null, "Learn how to speed up Composition performance.")));
13920
13920
  };
13921
13921
 
13922
+ // src/manager/utils/status.tsx
13923
+ var import_memoizerific3 = __toESM(require_memoizerific(), 1);
13924
+
13922
13925
  // src/manager/components/sidebar/IconSymbols.tsx
13923
13926
  var Svg2 = styled.svg`
13924
13927
  position: absolute;
@@ -14015,7 +14018,7 @@ var SmallIcons = styled(CircleIcon)({
14015
14018
  "status-value:success",
14016
14019
  "status-value:warning",
14017
14020
  "status-value:error"
14018
- ], statusMapping = {
14021
+ ], getStatus = (0, import_memoizerific3.default)(5)((theme, status) => ({
14019
14022
  "status-value:unknown": [null, null],
14020
14023
  "status-value:pending": [react_default.createElement(LoadingIcons, { key: "icon" }), "currentColor"],
14021
14024
  "status-value:success": [
@@ -14024,13 +14027,13 @@ var SmallIcons = styled(CircleIcon)({
14024
14027
  ],
14025
14028
  "status-value:warning": [
14026
14029
  react_default.createElement("svg", { key: "icon", viewBox: "0 0 14 14", width: "14", height: "14" }, react_default.createElement(UseSymbol, { type: "warning" })),
14027
- "#A15C20"
14030
+ theme.fgColor.warning
14028
14031
  ],
14029
14032
  "status-value:error": [
14030
14033
  react_default.createElement("svg", { key: "icon", viewBox: "0 0 14 14", width: "14", height: "14" }, react_default.createElement(UseSymbol, { type: "error" })),
14031
- "#D43900"
14034
+ theme.fgColor.negative
14032
14035
  ]
14033
- }, getMostCriticalStatusValue = (statusValues) => statusPriority.reduce(
14036
+ })[status]), getMostCriticalStatusValue = (statusValues) => statusPriority.reduce(
14034
14037
  (acc, value) => statusValues.includes(value) ? value : acc,
14035
14038
  "status-value:unknown"
14036
14039
  );
@@ -14575,7 +14578,7 @@ var statusOrder = [
14575
14578
  setExpanded,
14576
14579
  onSelectStoryId,
14577
14580
  api
14578
- } = props, { isDesktop, isMobile: isMobile2, setMobileMenuOpen } = useLayout(), { counts, statusesByValue } = useStatusSummary(item);
14581
+ } = props, theme = useTheme(), { isDesktop, isMobile: isMobile2, setMobileMenuOpen } = useLayout(), { counts, statusesByValue } = useStatusSummary(item);
14579
14582
  if (!isDisplayed)
14580
14583
  return null;
14581
14584
  let statusLinks = useMemo(() => {
@@ -14617,6 +14620,52 @@ var statusOrder = [
14617
14620
  return [];
14618
14621
  }, [counts, item.id, item.type, onSelectStoryId, statuses, statusesByValue]), id = createId(item.id, refId), contextMenu = refId === "storybook_internal" ? useContextMenu(item, statusLinks, api) : { node: null, onMouseEnter: () => {
14619
14622
  } };
14623
+ if (item.type === "story" && !("children" in item && item.children) && (!("subtype" in item) || item.subtype !== "test") || item.type === "docs") {
14624
+ let LeafNode3 = item.type === "docs" ? DocumentNode : StoryNode, statusValue = getMostCriticalStatusValue(
14625
+ Object.values(statuses || {}).map((s2) => s2.value)
14626
+ ), [icon, textColor] = getStatus(theme, statusValue);
14627
+ return react_default.createElement(
14628
+ LeafNodeStyleWrapper,
14629
+ {
14630
+ key: id,
14631
+ className: "sidebar-item",
14632
+ "data-selected": isSelected,
14633
+ "data-ref-id": refId,
14634
+ "data-item-id": item.id,
14635
+ "data-parent-id": item.parent,
14636
+ "data-nodetype": item.type === "docs" ? "document" : "story",
14637
+ "data-highlightable": isDisplayed,
14638
+ onMouseEnter: contextMenu.onMouseEnter
14639
+ },
14640
+ react_default.createElement(
14641
+ LeafNode3,
14642
+ {
14643
+ style: isSelected ? {} : { color: textColor },
14644
+ href: getLink(item, refId),
14645
+ id,
14646
+ depth: isOrphan ? item.depth : item.depth - 1,
14647
+ onClick: (event) => {
14648
+ event.preventDefault(), onSelectStoryId(item.id), isMobile2 && setMobileMenuOpen(!1);
14649
+ },
14650
+ ...item.type === "docs" && { docsMode }
14651
+ },
14652
+ item.renderLabel?.(item, api) || item.name
14653
+ ),
14654
+ isSelected && react_default.createElement(SkipToContentLink, { asChild: !0, ariaLabel: !1 }, react_default.createElement("a", { href: "#storybook-preview-wrapper" }, "Skip to canvas")),
14655
+ contextMenu.node,
14656
+ icon ? react_default.createElement(
14657
+ StatusButton,
14658
+ {
14659
+ ariaLabel: `Test status: ${statusValue.replace("status-value:", "")}`,
14660
+ "data-testid": "tree-status-button",
14661
+ type: "button",
14662
+ status: statusValue,
14663
+ selectedItem: isSelected
14664
+ },
14665
+ icon
14666
+ ) : null
14667
+ );
14668
+ }
14620
14669
  if (item.type === "root")
14621
14670
  return react_default.createElement(
14622
14671
  RootNode,
@@ -14658,7 +14707,7 @@ var statusOrder = [
14658
14707
  isFullyExpanded ? react_default.createElement(CollapseIcon, null) : react_default.createElement(ExpandAltIcon, null)
14659
14708
  )
14660
14709
  );
14661
- let itemStatus = getMostCriticalStatusValue(Object.values(statuses || {}).map((s2) => s2.value)), [itemIcon, itemColor] = statusMapping[itemStatus], itemStatusButton = itemIcon ? react_default.createElement(
14710
+ let itemStatus = getMostCriticalStatusValue(Object.values(statuses || {}).map((s2) => s2.value)), [itemIcon, itemColor] = getStatus(theme, itemStatus), itemStatusButton = itemIcon ? react_default.createElement(
14662
14711
  StatusButton,
14663
14712
  {
14664
14713
  ariaLabel: `Test status: ${itemStatus.replace("status-value:", "")}`,
@@ -14671,7 +14720,7 @@ var statusOrder = [
14671
14720
  itemIcon
14672
14721
  ) : null;
14673
14722
  if (item.type === "component" || item.type === "group" || item.type === "story" && "children" in item && item.children) {
14674
- let { children = [] } = item, BranchNode2 = { component: ComponentNode, group: GroupNode, story: StoryNode }[item.type], status = getMostCriticalStatusValue([itemStatus, groupStatus?.[item.id]]), color2 = status ? statusMapping[status][1] : null, showBranchStatus = status === "status-value:error" || status === "status-value:warning";
14723
+ let { children = [] } = item, BranchNode2 = { component: ComponentNode, group: GroupNode, story: StoryNode }[item.type], status = getMostCriticalStatusValue([itemStatus, groupStatus?.[item.id]]), color2 = status ? getStatus(theme, status)[1] : null, showBranchStatus = status === "status-value:error" || status === "status-value:warning";
14675
14724
  return react_default.createElement(
14676
14725
  LeafNodeStyleWrapper,
14677
14726
  {
@@ -14745,8 +14794,7 @@ var statusOrder = [
14745
14794
  depth: isOrphan ? item.depth : item.depth - 1,
14746
14795
  onClick: (event) => {
14747
14796
  event.preventDefault(), onSelectStoryId(item.id), isMobile2 && setMobileMenuOpen(!1);
14748
- },
14749
- ...item.type === "docs" && { docsMode }
14797
+ }
14750
14798
  },
14751
14799
  item.renderLabel?.(item, api) || item.name
14752
14800
  ),
@@ -17581,13 +17629,13 @@ var { document: document7 } = scope, DEFAULT_MAX_SEARCH_RESULTS = 50, options =
17581
17629
  openMenu,
17582
17630
  closeMenu,
17583
17631
  inputValue,
17584
- clearSelection,
17585
17632
  getInputProps,
17586
17633
  getItemProps,
17587
17634
  getLabelProps,
17588
17635
  getMenuProps,
17589
17636
  getRootProps,
17590
- highlightedIndex
17637
+ highlightedIndex,
17638
+ reset
17591
17639
  }) => {
17592
17640
  let input = inputValue ? inputValue.trim() : "", results = input ? getResults(input) : [], lastViewed = !input && getLastViewed();
17593
17641
  lastViewed && lastViewed.length && (results = lastViewed.reduce((acc, { storyId, refId }) => {
@@ -17630,7 +17678,9 @@ var { document: document7 } = scope, DEFAULT_MAX_SEARCH_RESULTS = 50, options =
17630
17678
  padding: "small",
17631
17679
  variant: "ghost",
17632
17680
  ariaLabel: "Clear search",
17633
- onClick: () => clearSelection()
17681
+ onClick: () => {
17682
+ reset({ inputValue: "" }), closeMenu();
17683
+ }
17634
17684
  },
17635
17685
  react_default.createElement(CloseIcon, null)
17636
17686
  ), searchFieldContent)
@@ -17745,7 +17795,7 @@ var { document: document8 } = scope, ResultsList = styled.ol({
17745
17795
  }
17746
17796
  }
17747
17797
  })), Result = react_default.memo(function({ item, matches, onClick, ...props }) {
17748
- let click = useCallback(
17798
+ let theme = useTheme(), click = useCallback(
17749
17799
  (event) => {
17750
17800
  event.preventDefault(), onClick?.(event);
17751
17801
  },
@@ -17753,8 +17803,8 @@ var { document: document8 } = scope, ResultsList = styled.ol({
17753
17803
  ), api = useStorybookApi();
17754
17804
  useEffect(() => {
17755
17805
  api && props.isHighlighted && item.type === "component" && api.emit(PRELOAD_ENTRIES, { ids: [item.children[0]] }, { options: { target: item.refId } });
17756
- }, [props.isHighlighted, item]);
17757
- let nameMatch = matches.find((match) => match.key === "name"), pathMatches = matches.filter((match) => match.key === "path"), [icon] = item.status ? statusMapping[item.status] : [];
17806
+ }, [api, props.isHighlighted, item]);
17807
+ let nameMatch = matches.find((match) => match.key === "name"), pathMatches = matches.filter((match) => match.key === "path"), [icon] = item.status ? getStatus(theme, item.status) : [];
17758
17808
  return react_default.createElement(ResultRow, { ...props, onClick: click }, react_default.createElement(IconWrapper2, null, item.type === "component" && react_default.createElement(TypeIcon2, { viewBox: "0 0 14 14", width: "14", height: "14", type: "component" }, react_default.createElement(UseSymbol, { type: "component" })), item.type === "story" && react_default.createElement(TypeIcon2, { viewBox: "0 0 14 14", width: "14", height: "14", type: item.subtype }, react_default.createElement(UseSymbol, { type: item.subtype })), !(item.type === "component" || item.type === "story") && react_default.createElement(TypeIcon2, { viewBox: "0 0 14 14", width: "14", height: "14", type: "document" }, react_default.createElement(UseSymbol, { type: "document" }))), react_default.createElement(ResultRowContent, { className: "search-result-item--label" }, react_default.createElement(Title, null, react_default.createElement(Highlight, { match: nameMatch }, item.name)), react_default.createElement(Path, null, item.path.map((group, index) => react_default.createElement("span", { key: index }, react_default.createElement(Highlight, { match: pathMatches.find((match) => match.arrayIndex === index) }, group))))), item.status ? react_default.createElement(StatusLabel, { status: item.status }, icon) : null);
17759
17809
  }), SearchResults = react_default.memo(function({
17760
17810
  query,
@@ -2329,7 +2329,7 @@ import { global as global8 } from "@storybook/global";
2329
2329
  import semver from "semver";
2330
2330
 
2331
2331
  // src/manager-api/version.ts
2332
- var version = "10.1.0-beta.1";
2332
+ var version = "10.1.0-beta.3";
2333
2333
 
2334
2334
  // src/manager-api/modules/versions.ts
2335
2335
  var { VERSIONCHECK } = global8, getVersionCheckData = (0, import_memoizerific2.default)(1)(() => {
@@ -2362,15 +2362,12 @@ var { VERSIONCHECK } = global8, getVersionCheckData = (0, import_memoizerific2.d
2362
2362
  },
2363
2363
  // TODO: Move this to it's own "info" module later
2364
2364
  getDocsUrl: ({ asset, subpath = asset, versioned, renderer, ref = "ui" }) => {
2365
- let {
2366
- versions: { latest, current }
2367
- } = store2.getState(), url = `https://storybook.js.org/${asset ? "docs-assets" : "docs"}/`;
2368
- if (asset && current?.version)
2369
- url += `${semver.major(current.version)}.${semver.minor(current.version)}/`;
2370
- else if (versioned && current?.version && latest?.version) {
2371
- let versionDiff = semver.diff(latest.version, current.version);
2372
- versionDiff === "patch" || versionDiff === null || // assume latest version when current version is a 0.0.0 canary
2373
- semver.satisfies(current.version, "0.0.0", { includePrerelease: !0 }) || (url += `${semver.major(current.version)}.${semver.minor(current.version)}/`);
2365
+ let { versions } = store2.getState(), latestVersion = versions.latest?.version, currentVersion = versions.current?.version, activeVersion = currentVersion?.startsWith("0.0.0") && latestVersion || currentVersion, url = `https://storybook.js.org/${asset ? "docs-assets" : "docs"}/`;
2366
+ if (asset && activeVersion)
2367
+ url += `${semver.major(activeVersion)}.${semver.minor(activeVersion)}/`;
2368
+ else if (versioned && activeVersion && latestVersion) {
2369
+ let versionDiff = semver.diff(latestVersion, activeVersion);
2370
+ versionDiff === "patch" || versionDiff === null || (url += `${semver.major(activeVersion)}.${semver.minor(activeVersion)}/`);
2374
2371
  }
2375
2372
  let [cleanedSubpath, hash] = subpath?.split("#") || [];
2376
2373
  if (cleanedSubpath && (url += asset ? cleanedSubpath : `${cleanedSubpath}/`), renderer && typeof global8.STORYBOOK_RENDERER < "u") {
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_jdojl2z4eei from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_jdojl2z4eei from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_jdojl2z4eei from "node:module";
1
+ import CJS_COMPAT_NODE_URL_d4nrjz93tmm from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_d4nrjz93tmm from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_d4nrjz93tmm from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_jdojl2z4eei.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_jdojl2z4eei.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_jdojl2z4eei.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_d4nrjz93tmm.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_d4nrjz93tmm.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_d4nrjz93tmm.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -16,8 +16,8 @@ import {
16
16
  join,
17
17
  normalize,
18
18
  resolve
19
- } from "../_node-chunks/chunk-WIWWMCEU.js";
20
- import "../_node-chunks/chunk-2OVULPK3.js";
19
+ } from "../_node-chunks/chunk-UWK6Z4VL.js";
20
+ import "../_node-chunks/chunk-745GFLCZ.js";
21
21
 
22
22
  // ../node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
23
23
  var comma = 44, semicolon = 59, chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", intToChar = new Uint8Array(64), charToInt = new Uint8Array(128);
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_jdojl2z4eei from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_jdojl2z4eei from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_jdojl2z4eei from "node:module";
1
+ import CJS_COMPAT_NODE_URL_d4nrjz93tmm from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_d4nrjz93tmm from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_d4nrjz93tmm from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_jdojl2z4eei.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_jdojl2z4eei.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_jdojl2z4eei.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_d4nrjz93tmm.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_d4nrjz93tmm.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_d4nrjz93tmm.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -22,9 +22,9 @@ import {
22
22
  once,
23
23
  prompt,
24
24
  protectUrls
25
- } from "../_node-chunks/chunk-RURZIE3W.js";
26
- import "../_node-chunks/chunk-XGNRK7QB.js";
27
- import "../_node-chunks/chunk-2OVULPK3.js";
25
+ } from "../_node-chunks/chunk-A5VW7257.js";
26
+ import "../_node-chunks/chunk-TUQOGYET.js";
27
+ import "../_node-chunks/chunk-745GFLCZ.js";
28
28
  var export_instance = import_npmlog.default;
29
29
  export {
30
30
  CLI_COLORS,
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_jdojl2z4eei from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_jdojl2z4eei from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_jdojl2z4eei from "node:module";
1
+ import CJS_COMPAT_NODE_URL_d4nrjz93tmm from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_d4nrjz93tmm from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_d4nrjz93tmm from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_jdojl2z4eei.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_jdojl2z4eei.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_jdojl2z4eei.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_d4nrjz93tmm.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_d4nrjz93tmm.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_d4nrjz93tmm.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -42,11 +42,11 @@ import {
42
42
  WebpackCompilationError,
43
43
  WebpackInvocationError,
44
44
  WebpackMissingStatsError
45
- } from "./_node-chunks/chunk-O5FMCQHP.js";
46
- import "./_node-chunks/chunk-N3BJOOY5.js";
47
- import "./_node-chunks/chunk-SQSFX47N.js";
48
- import "./_node-chunks/chunk-XGNRK7QB.js";
49
- import "./_node-chunks/chunk-2OVULPK3.js";
45
+ } from "./_node-chunks/chunk-STYUJSG3.js";
46
+ import "./_node-chunks/chunk-NOTIBODG.js";
47
+ import "./_node-chunks/chunk-7WOMK33B.js";
48
+ import "./_node-chunks/chunk-TUQOGYET.js";
49
+ import "./_node-chunks/chunk-745GFLCZ.js";
50
50
  export {
51
51
  AddonVitestPostinstallError,
52
52
  AddonVitestPostinstallPrerequisiteCheckError,
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_jdojl2z4eei from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_jdojl2z4eei from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_jdojl2z4eei from "node:module";
1
+ import CJS_COMPAT_NODE_URL_d4nrjz93tmm from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_d4nrjz93tmm from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_d4nrjz93tmm from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_jdojl2z4eei.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_jdojl2z4eei.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_jdojl2z4eei.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_d4nrjz93tmm.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_d4nrjz93tmm.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_d4nrjz93tmm.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -22,25 +22,25 @@ import {
22
22
  sanitizeAddonName,
23
23
  sanitizeError,
24
24
  telemetry
25
- } from "../_node-chunks/chunk-RVII4SK6.js";
26
- import "../_node-chunks/chunk-Z4BMBA5L.js";
27
- import "../_node-chunks/chunk-Y4UYN72K.js";
28
- import "../_node-chunks/chunk-KJAFCNZ3.js";
29
- import "../_node-chunks/chunk-5V4A6MSI.js";
30
- import "../_node-chunks/chunk-RURZIE3W.js";
25
+ } from "../_node-chunks/chunk-SKFAHEPX.js";
26
+ import "../_node-chunks/chunk-DRN5YXX5.js";
27
+ import "../_node-chunks/chunk-CRJ7M6EO.js";
28
+ import "../_node-chunks/chunk-LJRIVT23.js";
29
+ import "../_node-chunks/chunk-U24W5IIW.js";
30
+ import "../_node-chunks/chunk-A5VW7257.js";
31
31
  import {
32
32
  getPrecedingUpgrade
33
- } from "../_node-chunks/chunk-VRICJPXY.js";
34
- import "../_node-chunks/chunk-3JJPSDXI.js";
35
- import "../_node-chunks/chunk-IUYZQKSX.js";
36
- import "../_node-chunks/chunk-FNYKBULZ.js";
37
- import "../_node-chunks/chunk-RIKQZHV3.js";
38
- import "../_node-chunks/chunk-WIWWMCEU.js";
39
- import "../_node-chunks/chunk-Y2FOTPAE.js";
40
- import "../_node-chunks/chunk-ZMCJS2GU.js";
41
- import "../_node-chunks/chunk-SQSFX47N.js";
42
- import "../_node-chunks/chunk-XGNRK7QB.js";
43
- import "../_node-chunks/chunk-2OVULPK3.js";
33
+ } from "../_node-chunks/chunk-JOOO54RB.js";
34
+ import "../_node-chunks/chunk-RABBUYPA.js";
35
+ import "../_node-chunks/chunk-NKT3R6IH.js";
36
+ import "../_node-chunks/chunk-Y7VDA7NY.js";
37
+ import "../_node-chunks/chunk-WSIZMTN2.js";
38
+ import "../_node-chunks/chunk-UWK6Z4VL.js";
39
+ import "../_node-chunks/chunk-XS5QCZP7.js";
40
+ import "../_node-chunks/chunk-Q65ED3UK.js";
41
+ import "../_node-chunks/chunk-7WOMK33B.js";
42
+ import "../_node-chunks/chunk-TUQOGYET.js";
43
+ import "../_node-chunks/chunk-745GFLCZ.js";
44
44
  export {
45
45
  ErrorCollector,
46
46
  addToGlobalContext,
@@ -45,7 +45,7 @@ interface Themes {
45
45
  }
46
46
  declare const themes: Themes;
47
47
  interface Rest {
48
- [key: string]: any;
48
+ [key: string]: unknown;
49
49
  }
50
50
  declare const create: (vars?: ThemeVarsPartial, rest?: Rest) => ThemeVars;
51
51
 
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  create,
3
3
  themes
4
- } from "../_browser-chunks/chunk-L4RMQ7D7.js";
4
+ } from "../_browser-chunks/chunk-BRX2HXH7.js";
5
5
  import "../_browser-chunks/chunk-AXG2BOBL.js";
6
6
  import "../_browser-chunks/chunk-CHUV5WSW.js";
7
7
  import "../_browser-chunks/chunk-A242L54C.js";
@@ -12486,6 +12486,66 @@ declare const typography: {
12486
12486
  code: number;
12487
12487
  };
12488
12488
  };
12489
+ declare const tokens: {
12490
+ light: {
12491
+ fgColor: {
12492
+ default: string;
12493
+ muted: string;
12494
+ accent: string;
12495
+ inverse: string;
12496
+ positive: string;
12497
+ warning: string;
12498
+ negative: string;
12499
+ critical: string;
12500
+ };
12501
+ bgColor: {
12502
+ default: string;
12503
+ muted: string;
12504
+ positive: string;
12505
+ warning: string;
12506
+ negative: string;
12507
+ critical: string;
12508
+ };
12509
+ borderColor: {
12510
+ default: string;
12511
+ muted: string;
12512
+ inverse: string;
12513
+ positive: string;
12514
+ warning: string;
12515
+ negative: string;
12516
+ critical: string;
12517
+ };
12518
+ };
12519
+ dark: {
12520
+ fgColor: {
12521
+ default: string;
12522
+ muted: string;
12523
+ accent: string;
12524
+ inverse: string;
12525
+ positive: string;
12526
+ warning: string;
12527
+ negative: string;
12528
+ critical: string;
12529
+ };
12530
+ bgColor: {
12531
+ default: string;
12532
+ muted: string;
12533
+ positive: string;
12534
+ warning: string;
12535
+ negative: string;
12536
+ critical: string;
12537
+ };
12538
+ borderColor: {
12539
+ default: string;
12540
+ muted: string;
12541
+ inverse: string;
12542
+ positive: string;
12543
+ warning: string;
12544
+ negative: string;
12545
+ critical: string;
12546
+ };
12547
+ };
12548
+ };
12489
12549
 
12490
12550
  interface ThemeVars extends ThemeVarsBase, ThemeVarsColors {
12491
12551
  }
@@ -12540,6 +12600,9 @@ interface Brand {
12540
12600
  }
12541
12601
  interface StorybookTheme {
12542
12602
  color: Color;
12603
+ fgColor: typeof tokens.light.fgColor;
12604
+ bgColor: typeof tokens.light.bgColor;
12605
+ borderColor: typeof tokens.light.borderColor;
12543
12606
  background: Background;
12544
12607
  typography: Typography;
12545
12608
  animation: Animation;
@@ -12681,7 +12744,7 @@ interface Themes {
12681
12744
  }
12682
12745
  declare const themes: Themes;
12683
12746
  interface Rest {
12684
- [key: string]: any;
12747
+ [key: string]: unknown;
12685
12748
  }
12686
12749
  declare const create: (vars?: ThemeVarsPartial, rest?: Rest) => ThemeVars;
12687
12750
 
@@ -12702,7 +12765,7 @@ type InterpolationEnhanced<T = {}> = Interpolation<T & {
12702
12765
 
12703
12766
  declare const ignoreSsrWarning = "/* emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason */";
12704
12767
 
12705
- export { type Animation, type Background, type Brand, type CSSObject, CacheProvider, ClassNames, type Color, type Easing, type FunctionInterpolationEnhanced as FunctionInterpolation, Global, type InterpolationEnhanced as Interpolation, type Keyframes$1 as Keyframes, type StorybookTheme, type StyledComponent, type TextSize, ThemeProvider, type ThemeVars, type ThemeVarsColors, type ThemeVarsPartial, type Typography, background, color, convert, create, createCache, createGlobal, createReset, css, darkenColor as darken, ensure, getPreferredColorScheme, ignoreSsrWarning, isPropValid, jsx, keyframes, lightenColor as lighten, styled, themes, typography, useTheme, withTheme };
12768
+ export { type Animation, type Background, type Brand, type CSSObject, CacheProvider, ClassNames, type Color, type Easing, type FunctionInterpolationEnhanced as FunctionInterpolation, Global, type InterpolationEnhanced as Interpolation, type Keyframes$1 as Keyframes, type StorybookTheme, type StyledComponent, type TextSize, ThemeProvider, type ThemeVars, type ThemeVarsColors, type ThemeVarsPartial, type Typography, background, color, convert, create, createCache, createGlobal, createReset, css, darkenColor as darken, ensure, getPreferredColorScheme, ignoreSsrWarning, isPropValid, jsx, keyframes, lightenColor as lighten, styled, themes, tokens, typography, useTheme, withTheme };
12706
12769
 
12707
12770
 
12708
12771
  interface Theme extends StorybookTheme {}
@@ -8,8 +8,9 @@ import {
8
8
  lightenColor,
9
9
  mkColor,
10
10
  themes,
11
+ tokens,
11
12
  typography
12
- } from "../_browser-chunks/chunk-L4RMQ7D7.js";
13
+ } from "../_browser-chunks/chunk-BRX2HXH7.js";
13
14
  import {
14
15
  curriedOpacify$1
15
16
  } from "../_browser-chunks/chunk-AXG2BOBL.js";
@@ -1984,6 +1985,7 @@ var lightSyntaxColors = {
1984
1985
  return {
1985
1986
  ...rest,
1986
1987
  base,
1988
+ ...base === "dark" ? tokens.dark : tokens.light,
1987
1989
  color: createColors(inherit),
1988
1990
  background: {
1989
1991
  app: appBg,
@@ -2038,13 +2040,13 @@ var lightSyntaxColors = {
2038
2040
  target: brandTarget
2039
2041
  },
2040
2042
  code: create2({
2041
- colors: base === "light" ? lightSyntaxColors : darkSyntaxColors,
2043
+ colors: base === "dark" ? darkSyntaxColors : lightSyntaxColors,
2042
2044
  mono: fontCode
2043
2045
  }),
2044
2046
  // Addon actions theme
2045
2047
  // API example https://github.com/storybookjs/react-inspector/blob/master/src/styles/themes/chromeLight.tsx
2046
2048
  addonActionsTheme: {
2047
- ...base === "light" ? chromeLight : chromeDark,
2049
+ ...base === "dark" ? chromeDark : chromeLight,
2048
2050
  BASE_FONT_FAMILY: fontCode,
2049
2051
  BASE_FONT_SIZE: typography.size.s2 - 1,
2050
2052
  BASE_LINE_HEIGHT: "18px",
@@ -2117,6 +2119,7 @@ export {
2117
2119
  lightenColor as lighten,
2118
2120
  styled,
2119
2121
  themes,
2122
+ tokens,
2120
2123
  typography,
2121
2124
  useTheme,
2122
2125
  withTheme
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "storybook",
3
- "version": "10.1.0-beta.1",
3
+ "version": "10.1.0-beta.3",
4
4
  "description": "Storybook: Develop, document, and test UI components in isolation",
5
5
  "keywords": [
6
6
  "storybook",
@@ -261,7 +261,6 @@
261
261
  "@types/semver": "^7.5.8",
262
262
  "@types/ws": "^8",
263
263
  "@vitest/utils": "^3.2.4",
264
- "@yarnpkg/esbuild-plugin-pnp": "^3.0.0-rc.10",
265
264
  "@yarnpkg/fslib": "2.10.3",
266
265
  "@yarnpkg/libzip": "2.3.0",
267
266
  "ansi-to-html": "^0.7.2",
@@ -1,23 +0,0 @@
1
- import CJS_COMPAT_NODE_URL_jdojl2z4eei from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_jdojl2z4eei from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_jdojl2z4eei from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_jdojl2z4eei.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_jdojl2z4eei.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_jdojl2z4eei.createRequire(import.meta.url);
8
-
9
- // ------------------------------------------------------------
10
- // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
- // ------------------------------------------------------------
12
- import {
13
- any
14
- } from "./chunk-IUYZQKSX.js";
15
-
16
- // src/cli/detect.ts
17
- async function detectPnp() {
18
- return !!any([".pnp.js", ".pnp.cjs"]);
19
- }
20
-
21
- export {
22
- detectPnp
23
- };