@storybook/router
Advanced tools
Comparing version 5.1.0-alpha.9 to 5.1.0-alpha.10
import React from 'react'; | ||
import { Location, LocationProvider } from '@reach/router'; | ||
interface Location { | ||
search: string; | ||
href: string; | ||
origin: string; | ||
protocol: 'http:' | 'https:'; | ||
host: string; | ||
hostname: string; | ||
port: string; | ||
pathname: string; | ||
hash: string; | ||
state: { | ||
key: string; | ||
}; | ||
key: string; | ||
reload: () => void; | ||
replace: (url: string) => void; | ||
assign: (url: string) => void; | ||
toString: () => string; | ||
} | ||
interface RenderData { | ||
path: string; | ||
location: Location; | ||
navigate: (to: string) => void; | ||
import { LocationProvider, RouteComponentProps } from '@reach/router'; | ||
interface Other { | ||
viewMode?: string; | ||
storyId?: string; | ||
} | ||
export declare type RenderData = RouteComponentProps & Other; | ||
interface MatchingData { | ||
@@ -30,0 +9,0 @@ match: null | { |
@@ -7,8 +7,11 @@ interface StoryData { | ||
export declare const toId: (kind: string, name: string) => string; | ||
export declare const storyDataFromString: (path: string) => StoryData; | ||
export declare const queryFromString: (s: any) => any; | ||
export declare const storyDataFromString: (path?: string) => StoryData; | ||
interface Query { | ||
[key: string]: any; | ||
} | ||
export declare const queryFromString: (s: string) => Query; | ||
export declare const queryFromLocation: (location: { | ||
search: string; | ||
}) => any; | ||
export declare const stringifyQuery: (query: object) => any; | ||
}) => Query; | ||
export declare const stringifyQuery: (query: Query) => any; | ||
export declare const getMatch: (current: string, target: string, startsWith?: boolean) => { | ||
@@ -15,0 +18,0 @@ path: string; |
{ | ||
"name": "@storybook/router", | ||
"version": "5.1.0-alpha.9", | ||
"version": "5.1.0-alpha.10", | ||
"description": "Core Storybook Router", | ||
@@ -19,2 +19,3 @@ "keywords": [ | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
@@ -25,3 +26,3 @@ "prepare": "node ../../scripts/prepare.js" | ||
"@reach/router": "^1.2.1", | ||
"@storybook/theming": "5.1.0-alpha.9", | ||
"@storybook/theming": "5.1.0-alpha.10", | ||
"core-js": "^2.6.5", | ||
@@ -39,3 +40,6 @@ "global": "^4.3.2", | ||
}, | ||
"gitHead": "b51a247295aca9ae33eb98b41cd52abc6f77d844" | ||
"devDependencies": { | ||
"@types/reach__router": "^1.2.3" | ||
}, | ||
"gitHead": "5cff559d907931e817e715d0a00821993b6bb00c" | ||
} |
// todo the following packages need definition files or a TS migration | ||
declare module 'global'; | ||
declare module 'qs'; | ||
declare module 'global'; | ||
declare module '@reach/router'; |
@@ -33,3 +33,3 @@ import qs from 'qs'; | ||
export const storyDataFromString: (path: string) => StoryData = memoize(1000)( | ||
export const storyDataFromString: (path?: string) => StoryData = memoize(1000)( | ||
(path: string | undefined | null) => { | ||
@@ -54,5 +54,11 @@ const result: StoryData = { | ||
export const queryFromString = memoize(1000)(s => qs.parse(s, { ignoreQueryPrefix: true })); | ||
interface Query { | ||
[key: string]: any; | ||
} | ||
export const queryFromString = memoize(1000)( | ||
(s: string): Query => qs.parse(s, { ignoreQueryPrefix: true }) | ||
); | ||
export const queryFromLocation = (location: { search: string }) => queryFromString(location.search); | ||
export const stringifyQuery = (query: object) => | ||
export const stringifyQuery = (query: Query) => | ||
qs.stringify(query, { addQueryPrefix: true, encode: false }); | ||
@@ -59,0 +65,0 @@ |
@@ -11,4 +11,6 @@ { | ||
"exclude": [ | ||
"dist", | ||
"src/tests/**/*", | ||
"src/__tests__/**/*" | ||
] | ||
} |
Sorry, the diff of this file is not supported yet
19005
1
19
448
+ Added@storybook/client-logger@5.1.0-alpha.10(transitive)
+ Added@storybook/theming@5.1.0-alpha.10(transitive)
- Removed@storybook/client-logger@5.1.0-alpha.9(transitive)
- Removed@storybook/theming@5.1.0-alpha.9(transitive)