@storybook/addon-links 11.0.0-alpha.1 → 11.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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  withLinks
3
- } from "./chunk-43SYPRXW.js";
3
+ } from "./chunk-72HWH2ZD.js";
4
4
  import {
5
5
  __export
6
6
  } from "./chunk-FX5LXYO2.js";
@@ -17,7 +17,7 @@ function parseQuery(queryString) {
17
17
  return query;
18
18
  }
19
19
  var navigate = (params) => addons.getChannel().emit(SELECT_STORY, params), generateStoryUrl = (title, name) => {
20
- let { location } = document, existingId = parseQuery(location.search).id, titleToLink = title || existingId.split("--", 2)[0], path = `/story/${toId(titleToLink, name)}`, sbPath = location.pathname.replace(/iframe\.html$/, "");
20
+ let { location } = document, query = parseQuery(location.search), existingId = query.id ?? query.path?.match(/^\/story\/(.+)$/)?.[1], titleToLink = title || existingId?.split("--", 2)[0] || "", path = `/story/${toId(titleToLink, name)}`, sbPath = location.pathname.replace(/iframe\.html$/, "");
21
21
  return `${location.origin + sbPath}?${Object.entries({ path }).map((item) => `${item[0]}=${item[1]}`).join("&")}`;
22
22
  }, hrefTo = (title, name) => new Promise((resolve) => {
23
23
  resolve(generateStoryUrl(title, name));
package/dist/index.d.ts CHANGED
@@ -11,8 +11,8 @@ interface ParamsCombo {
11
11
  name?: StoryName;
12
12
  }
13
13
  declare const navigate: (params: ParamsId | ParamsCombo) => void;
14
- declare const hrefTo: (title: ComponentTitle, name: StoryName) => Promise<string>;
15
- declare const hrefToSync: (title: ComponentTitle, name: StoryName) => string;
14
+ declare const hrefTo: (title: ComponentTitle | undefined, name: StoryName) => Promise<string>;
15
+ declare const hrefToSync: (title: ComponentTitle | undefined, name: StoryName) => string;
16
16
  declare const linkTo: (idOrTitle: string | ((...args: any[]) => string), nameInput?: string | ((...args: any[]) => string)) => (...args: any[]) => void;
17
17
  declare const withLinks: (...args: any) => any;
18
18
  //#endregion
package/dist/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  index_default
3
- } from "./_browser-chunks/chunk-CBP7D7GU.js";
3
+ } from "./_browser-chunks/chunk-2NZOTHER.js";
4
4
  import {
5
5
  hrefTo,
6
6
  hrefToSync,
7
7
  linkTo,
8
8
  navigate,
9
9
  withLinks
10
- } from "./_browser-chunks/chunk-43SYPRXW.js";
10
+ } from "./_browser-chunks/chunk-72HWH2ZD.js";
11
11
  import "./_browser-chunks/chunk-FX5LXYO2.js";
12
12
  export {
13
13
  index_default as default,
package/dist/preview.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  decorators
3
- } from "./_browser-chunks/chunk-CBP7D7GU.js";
4
- import "./_browser-chunks/chunk-43SYPRXW.js";
3
+ } from "./_browser-chunks/chunk-2NZOTHER.js";
4
+ import "./_browser-chunks/chunk-72HWH2ZD.js";
5
5
  import "./_browser-chunks/chunk-FX5LXYO2.js";
6
6
  export {
7
7
  decorators
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  hrefTo,
3
3
  navigate
4
- } from "../_browser-chunks/chunk-43SYPRXW.js";
4
+ } from "../_browser-chunks/chunk-72HWH2ZD.js";
5
5
  import "../_browser-chunks/chunk-FX5LXYO2.js";
6
6
 
7
7
  // src/react/components/link.tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/addon-links",
3
- "version": "11.0.0-alpha.1",
3
+ "version": "11.0.0-alpha.3",
4
4
  "description": "Storybook Links: Link stories together to build demos and prototypes with your UI components",
5
5
  "keywords": [
6
6
  "storybook",
@@ -59,9 +59,9 @@
59
59
  "typescript": "^6.0.3"
60
60
  },
61
61
  "peerDependencies": {
62
- "@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
63
- "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
64
- "storybook": "^11.0.0-alpha.1"
62
+ "@types/react": "^18.0.0 || ^19.0.0",
63
+ "react": "^18.0.0 || ^19.0.0",
64
+ "storybook": "^11.0.0-alpha.3"
65
65
  },
66
66
  "peerDependenciesMeta": {
67
67
  "@types/react": {