Socket
Socket
Sign inDemoInstall

@sanity/state-router

Package Overview
Dependencies
Maintainers
6
Versions
702
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sanity/state-router - npm Package Compare versions

Comparing version 0.99.6 to 0.99.9

2

lib/components/IntentLink.js

@@ -34,3 +34,3 @@ 'use strict';

intent: string,
params: Object
params?: Object
}*/

@@ -37,0 +37,0 @@

@@ -38,9 +38,2 @@ 'use strict';

/*:: type Props = {
replace: boolean,
onClick: (event : SyntheticMouseEvent) => void,
href: string,
target: string
}*/
var Link = function (_React$Component) {

@@ -47,0 +40,0 @@ _inherits(Link, _React$Component);

@@ -23,8 +23,2 @@ 'use strict';

/*:: import type {RouterProviderContext, NavigateOptions} from './types'*/
/*:: type Props = {
onNavigate: () => void,
router: Router,
state: Object,
children: Element<*>
}*/

@@ -31,0 +25,0 @@ var RouterProvider = function (_React$Component) {

@@ -30,6 +30,2 @@ 'use strict';

/*:: import type {RouterProviderContext, NavigateOptions, InternalRouter, ContextRouter} from './types'*/
/*:: type Props = {
scope: string,
children: Element<*>
}*/

@@ -36,0 +32,0 @@

@@ -36,7 +36,2 @@ 'use strict';

/*:: type Props = {
state: string,
toIndex: boolean
}*/
var StateLink = function (_React$Component) {

@@ -43,0 +38,0 @@ _inherits(StateLink, _React$Component);

@@ -8,3 +8,3 @@ "use strict";

resolvePathFromState: (nextState : Object) => string,
resolveIntentLink: (intent : string, params : Object) => string,
resolveIntentLink: (intent : string, params? : Object) => string,
navigateUrl: (url : string, options? : NavigateOptions) => void

@@ -11,0 +11,0 @@ }*/

@@ -138,8 +138,8 @@ 'use strict';

isRoot: isRoot,
getBasePath: function getBasePath() /*: boolean*/ {
return this.encode(EMPTY_STATE);
},
isNotFound: function isNotFound(pathname /*: string*/) /*: boolean*/ {
return this.decode(pathname) === null;
},
getBasePath: function getBasePath() /*: string*/ {
return this.encode(EMPTY_STATE);
},
getRedirectBase: function getRedirectBase(pathname /*: string*/) /*: ?string*/ {

@@ -146,0 +146,0 @@ if (isRoot(pathname)) {

@@ -27,3 +27,7 @@ 'use strict';

encode: (state : Object) => string,
decode: (path : string) => ?Object
decode: (path : string) => ?Object,
isNotFound: (path : string) => boolean,
getBasePath: () => string,
getRedirectBase: (pathname : string) => ?string,
isRoot: (path : string) => boolean
}*/

@@ -30,0 +34,0 @@ /*:: export type MatchResult = {

{
"name": "@sanity/state-router",
"version": "0.99.6",
"version": "0.99.9",
"description": "A path pattern => state object bidirectional mapper",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -9,3 +9,3 @@ // @flow

intent: string,
params: Object
params?: Object
}

@@ -12,0 +12,0 @@

@@ -14,11 +14,10 @@ // @flow

type Props = {
replace: boolean,
onClick: (event : SyntheticMouseEvent) => void,
href: string,
target: string
}
export default class Link extends React.Component {
props: {
replace?: boolean,
onClick?: (event : SyntheticMouseEvent) => void,
href: string,
target?: string
}
export default class Link extends React.Component {
props: Props
context: RouterProviderContext

@@ -25,0 +24,0 @@

@@ -6,11 +6,9 @@ // @flow

type Props = {
onNavigate: () => void,
router: Router,
state: Object,
children: Element<*>
}
export default class RouterProvider extends React.Component {
props: Props
props: {
onNavigate: (nextPath: string) => void,
router: Router,
state: Object,
children?: Element<*>
}

@@ -35,3 +33,3 @@ static childContextTypes = {

resolveIntentLink = (intent : string, params : Object) : string => {
resolveIntentLink = (intent : string, params? : Object) : string => {
return this.props.router.encode({intent, params})

@@ -38,0 +36,0 @@ }

@@ -7,7 +7,2 @@ // @flow

type Props = {
scope: string,
children: Element<*>
}
function addScope(routerState : Object, scope : string, scopedState : Object) {

@@ -20,3 +15,6 @@ return scopedState && {

export default class RouteScope extends React.Component {
props: Props
props: {
scope: string,
children: Element<*>
}
context: RouterProviderContext

@@ -23,0 +21,0 @@

@@ -9,8 +9,7 @@ // @flow

type Props = {
state: string,
toIndex: boolean
}
export default class StateLink extends React.Component {
props: Props
props: {
state?: Object,
toIndex?: boolean
}
context: RouterProviderContext

@@ -17,0 +16,0 @@

@@ -9,3 +9,3 @@ // @flow

resolvePathFromState: (nextState : Object) => string,
resolveIntentLink: (intent : string, params : Object) => string,
resolveIntentLink: (intent : string, params? : Object) => string,
navigateUrl: (url : string, options? : NavigateOptions) => void

@@ -12,0 +12,0 @@ }

@@ -111,8 +111,8 @@ // @flow

isRoot: isRoot,
getBasePath(): boolean {
return this.encode(EMPTY_STATE)
},
isNotFound(pathname: string): boolean {
return this.decode(pathname) === null
},
getBasePath(): string {
return this.encode(EMPTY_STATE)
},
getRedirectBase(pathname : string) : ?string {

@@ -119,0 +119,0 @@ if (isRoot(pathname)) {

@@ -30,3 +30,7 @@ // @flow

encode: (state : Object) => string,
decode: (path : string) => ?Object
decode: (path : string) => ?Object,
isNotFound: (path : string) => boolean,
getBasePath: () => string,
getRedirectBase: (pathname : string) => ?string,
isRoot: (path : string) => boolean
}

@@ -33,0 +37,0 @@ export type MatchResult = {

@@ -5,9 +5,7 @@ // @flow

function mock(obj, method, mockFn) {
const original = obj[method]
// $FlowIgnore
obj[method] = mockFn
function mock(obj : Object, methodName : string, mockFn : Function) {
const original = obj[methodName]
obj[methodName] = mockFn
return function restore() {
// $FlowIgnore
obj[method] = original
obj[methodName] = original
}

@@ -14,0 +12,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc