storybook-addon-remix-react-router
Advanced tools
Comparing version 3.0.2 to 3.0.3--canary.73a4e68.0
@@ -343,2 +343,12 @@ import * as React from 'react'; | ||
/** | ||
* Future flags to toggle new feature behavior | ||
*/ | ||
interface FutureConfig$1 { | ||
v7_fetcherPersist: boolean; | ||
v7_normalizeFormMethod: boolean; | ||
v7_partialHydration: boolean; | ||
v7_prependBasename: boolean; | ||
v7_relativeSplatPath: boolean; | ||
} | ||
/** | ||
* Potential states for state.navigation | ||
@@ -476,2 +486,7 @@ */ | ||
interface FutureConfig { | ||
v7_relativeSplatPath: boolean; | ||
v7_startTransition: boolean; | ||
} | ||
/** | ||
@@ -529,2 +544,4 @@ * SetDifference (same as Exclude) | ||
routing?: string | RouterRoute | [RouterRoute, ...RouterRoute[]]; | ||
future?: Partial<FutureConfig$1 & FutureConfig>; | ||
fallback?: React__default.JSX.Element; | ||
}; | ||
@@ -531,0 +548,0 @@ type LocationParameters<PathParams extends Record<string, string | number> = Record<string, string | number>> = { |
import { makeDecorator, addons } from '@storybook/preview-api'; | ||
import P, { useState, useMemo, useCallback, useRef } from 'react'; | ||
import T, { useState, useMemo, useCallback, useRef } from 'react'; | ||
import { createMemoryRouter, RouterProvider, UNSAFE_RouteContext, useLocation, useParams, useSearchParams, useNavigationType } from 'react-router-dom'; | ||
var p="storybook/react-router-v6",z="reactRouter",l={CLEAR:`${p}/clear`,NAVIGATION:`${p}/navigation`,STORY_LOADED:`${p}/story-loaded`,ROUTE_MATCHES:`${p}/route-matches`,ACTION_INVOKED:`${p}/action_invoked`,ACTION_SETTLED:`${p}/action_settled`,LOADER_INVOKED:`${p}/loader_invoked`,LOADER_SETTLED:`${p}/loader_settled`};var D=P.createContext([]);var b=P.createContext(void 0);function k(){let[e,t]=useState([]),n=UNSAFE_RouteContext;return n.Provider._context=new Proxy(n.Provider._context??{},{set(r,o,i){return o==="_currentValue"&&i!==void 0&&t(a=>i.matches.length>a.length?i.matches:a),Reflect.set(r,o,i)}}),e}function V(e){let t={};return e.forEach((n,r)=>{if(n instanceof File){t[r]={filename:n.name,filesize:n.size,filetype:n.type};return}t[r]=n;}),t}async function T(e){let t=e.clone(),n=t.headers.get("content-type")||"",r;switch(!0){case n.startsWith("text"):r=await t.text();break;case n.startsWith("application/json"):r=await t.json();break;case n.startsWith("multipart/form-data"):case n.startsWith("application/x-www-form-urlencoded"):{r=V(await t.formData());break}}return r}var w=()=>{let e=useRef(0);return useCallback(async(t,n)=>{e.current++;let r=`${t}_${e.current}`;switch(t){case l.ACTION_INVOKED:{let{request:o,params:i,context:a}=n,c={url:o.url,method:o.method,body:await T(o)};return {key:r,type:t,data:{params:i,request:c,context:a}}}case l.ACTION_SETTLED:return {key:r,type:t,data:n};case l.LOADER_INVOKED:{let{request:o,params:i,context:a}=n,c={url:o.url,method:o.method,body:await T(o)};return {key:r,type:t,data:{params:i,request:c,context:a}}}case l.LOADER_SETTLED:return {key:r,type:t,data:n}}},[])};function B(){let e=addons.getChannel(),t=w();return useCallback(n=>async function(r){if(n===void 0)return;e.emit(l.ACTION_INVOKED,await t(l.ACTION_INVOKED,r));let o=await n(r);return e.emit(l.ACTION_SETTLED,await t(l.ACTION_SETTLED,o)),o},[e,t])}function K(){let e=addons.getChannel(),t=w();return useCallback(n=>async function(r){if(n===void 0)return;e.emit(l.LOADER_INVOKED,await t(l.LOADER_INVOKED,r));let o=await n(r);return e.emit(l.LOADER_SETTLED,await t(l.LOADER_SETTLED,o)),o},[e,t])}function $(){let e=B(),t=K(),n=useCallback(r=>r.map(o=>{let{action:i,loader:a,children:c,lazy:d}=o,h={...o};return d&&(h.lazy=async function(){let s=await d(),f={...s};return s.action&&(f.action=e(s.action)),s.loader&&(f.loader=t(s.loader)),f}),i&&(h.action=e(i)),a&&(h.loader=t(a)),c&&(h.children=n(c)),h}),[e,t]);return n}var x=()=>{let e=P.useContext(b);if(e===void 0)throw new Error("useStory should be used inside <StoryContext>");return e};function L(e,t){return e.length===1&&(e[0].children===void 0||e[0].children.length===0)?[{...e[0],element:t}]:e.findIndex(r=>r.useStoryElement)!==-1?e.map(r=>r.useStoryElement?{...r,element:t}:r):e.map(r=>r.children?{...r,children:L(r.children,t)}:r)}var W;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE";})(W||(W={}));function xe(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Se(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}var Y;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error";})(Y||(Y={}));function N(e,t){t===void 0&&(t={});let n=e;n.endsWith("*")&&n!=="*"&&!n.endsWith("/*")&&(Se(!1,'Route path "'+n+'" will be treated as if it were '+('"'+n.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+n.replace(/\*$/,"/*")+'".')),n=n.replace(/\*$/,"/*"));let r=n.startsWith("/")?"/":"",o=a=>a==null?"":typeof a=="string"?a:String(a),i=n.split(/\/+/).map((a,c,d)=>{if(c===d.length-1&&a==="*")return o(t["*"]);let s=a.match(/^:([\w-]+)(\??)$/);if(s){let[,f,_]=s,R=t[f];return xe(_==="?"||R!=null,'Missing ":'+f+'" param'),o(R)}return a.replace(/\?$/g,"")}).filter(a=>!!a);return r+i.join("/")}var G=["post","put","patch","delete"];new Set(G);var Ee=["get",...G];new Set(Ee);function J({navigationHistory:e,location:t,routes:n}){if(e!==void 0){let R=[],A,F=Object.values(e);for(let v=0;v<F.length;v++){let{path:O,pathParams:U,searchParams:ie,hash:le,state:se,isInitialLocation:ue}=F[v];ue&&(A=v);let H=M(n),ce=(typeof O=="function"?O(H,U??{}):O)??H;R.push({pathname:N(ce??"/",U),search:new URLSearchParams(ie).toString(),hash:le,state:se});}return A??=R.length-1,{initialEntries:R,initialIndex:A}}let{path:r,pathParams:o,searchParams:i,hash:a,state:c}=t??{},d=M(n),s=(typeof r=="function"?r(d,o??{}):r)??d;return {initialEntries:[{pathname:N(s,o),search:new URLSearchParams(i).toString(),hash:a,state:c}],initialIndex:0}}function M(e=[],t="/"){if(e.length!==1)return t;let n=e[0],r=Pe(t,n.path);return n.children===void 0||n.children.length===0?r:M(n.children,r)}function Pe(e,t=""){let n=["","/"],r=e.split("/").filter(a=>!n.includes(a)),o=t.split("/").filter(a=>!n.includes(a));return "/"+[...r,...o].join("/")}function u(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function y(e,t){if(e===!1||e===null||typeof e>"u")throw console.warn("Test invariant failed:",t),new Error(t)}function S(e){return arguments.length===0?[]:Array.isArray(e)?e:[e]}function q(e){return e===void 0?[{path:"/"}]:typeof e=="string"?[{path:e}]:(e=S(e),e.length===1&&(e[0].path??="/"),e)}var E=()=>P.useContext(D);function X(e){let t={};return e.forEach((n,r)=>{let o=t[r];if(typeof o=="string"){t[r]=[o,n];return}if(Array.isArray(o)){t[r]=[...o,n];return}t[r]=n;}),t}var Q=()=>{let e=useLocation(),t=e.pathname;return e.search.length>0&&(t+=`?${e.search}`),e.hash.length>0&&(t+=`#${e.hash}`),t};var Z=()=>{let e=useRef(0),t=useLocation(),n=useParams(),[r]=useSearchParams(),o=useNavigationType(),i=E(),a=X(r),c=Q(),d=i.map(s=>{let f={path:s.route.path};return Object.keys(s.params).length>0&&(f.params=s.params),f}),h={url:c,path:t.pathname,routeParams:n,searchParams:a,hash:t.hash,routeState:t.state,routeMatches:d};return s=>{e.current++;let f=`${s}_${e.current}`;switch(s){case l.STORY_LOADED:return {key:f,type:s,data:h};case l.NAVIGATION:return {key:f,type:s,data:{...h,navigationType:o}};case l.ROUTE_MATCHES:return {key:f,type:s,data:{matches:d}}}}};function C(){let{renderStory:e,storyContext:t}=x(),n=addons.getChannel(),r=useLocation(),o=E(),i=Z(),a=useRef(),c=useRef(),d=useRef(),h=a.current!==void 0,s=h&&r.key!==a.current;return s&&c.current!==r.key&&(n.emit(l.NAVIGATION,i(l.NAVIGATION)),c.current=r.key),s&&o.length>0&&o!==d.current&&n.emit(l.ROUTE_MATCHES,i(l.ROUTE_MATCHES)),!h&&o.length>0&&(n.emit(l.STORY_LOADED,i(l.STORY_LOADED)),a.current=r.key,d.current=o),d.current=o,P.createElement(P.Fragment,null,e(t))}C.displayName="RouterLogger";function te(){let{addonParameters:e={}}=x(),{hydrationData:t,routing:n,navigationHistory:r,location:o}=e,i=$(),a=useMemo(()=>{let c=q(n),d=i(c),h=L(d,P.createElement(C,null)),{initialEntries:s,initialIndex:f}=J({navigationHistory:r,location:o,routes:h});return createMemoryRouter(h,{initialEntries:s,initialIndex:f,hydrationData:t})},[i,t,o,r,n]);return P.createElement(RouterProvider,{router:a,fallbackElement:P.createElement(He,null)})}function He(){return P.createElement("p",null,"Performing initial data load")}var re=({renderStory:e,storyContext:t,addonParameters:n})=>{let r=k();return P.createElement(b.Provider,{value:{renderStory:e,storyContext:t,addonParameters:n}},P.createElement(D.Provider,{value:r},P.createElement(te,null)))};function oe(e){if(P.isValidElement(e))return !0;switch(!0){case P.isValidElement(e):case typeof e=="string":case typeof e=="number":case typeof e=="boolean":case e===null:case e===void 0:case(e instanceof Object&&u(e,Symbol.iterator)):return !0}return !1}function m(e){return oe(e)?{element:e}:e}function ae(e={}){let t=["location","navigationHistory","routing"];if(Object.keys(e??{}).some(o=>t.includes(o)))return e;let r={routing:{},location:{},hydrationData:void 0};if(u(e,"routePath")&&(r.location.path=e.routePath,r.routing.path=e.routePath),u(e,"routeParams")&&(r.location.pathParams=e.routeParams),u(e,"routeState")&&(r.location.state=e.routeState),u(e,"routeHandle")&&(r.routing.handle=e.routeHandle),u(e,"searchParams")&&(r.location.searchParams=e.searchParams),u(e,"browserPath")&&(r.location.path=e.browserPath),u(e,"loader")&&(r.routing.loader=e.loader),u(e,"action")&&(r.routing.action=e.action),u(e,"errorElement")&&(r.routing.errorElement=e.errorElement),u(e,"hydrationData")&&(r.hydrationData=e.hydrationData),u(e,"shouldRevalidate")&&(r.routing.shouldRevalidate=e.shouldRevalidate),u(e,"routeId")&&(r.routing.id=e.routeId),u(e,"outlet")){let o=m(e.outlet);o.path??="",r.routing.children=[o];}return r.routing.useStoryElement=!0,r}var Ve=makeDecorator({name:"withRouter",parameterName:z,wrapper:(e,t,{parameters:n})=>{let r=ae(n);return P.createElement(re,{renderStory:e,storyContext:t,addonParameters:r})}});function Be(e){return e}function g(e){let t={},n=[];return e.length===1&&(t={},n=e[0]),e.length===2&&(t=typeof e[0]=="string"?{path:e[0]}:m(e[0]),n=e[1]),[t,n]}function Ke(...e){let[t,n]=g(e);y(!u(t,"element"),"The story definition cannot contain the `element` property because the story element will be used");let r=m(n);return r.index=!0,[{...t,useStoryElement:!0,children:[r]}]}function $e(...e){let[t,n]=g(e);return y(!u(t,"element"),"The story definition cannot contain the `element` property because the story element will be used"),[{...t,useStoryElement:!0,children:n}]}function We(...e){let[t,n]=g(e);y(!u(t,"element"),"The story definition cannot contain the `element` property because the story element will be used");let r={},o=r;return n.forEach(i=>{let a=m(i);a.path??="",o.children=[a],o=a;},r),[{...t,useStoryElement:!0,children:[r]}]}function Ye(...e){let t=e.length===1?{}:e[0],n=S(e.length===1?e[0]:e[1]);y(!u(t,"element"),"The story definition cannot contain the `element` property because the story element will be used");let r={path:"/"},o=r;for(let i=0;i<n.length;i++){let a=n[i],c=m(a);c.path??="",o.children=[c],o=c;}return o.children=[{...t,index:!0,useStoryElement:!0}],[r]}/*! Bundled license information: | ||
var y="storybook/react-router-v6",z="reactRouter",s={CLEAR:`${y}/clear`,NAVIGATION:`${y}/navigation`,STORY_LOADED:`${y}/story-loaded`,ROUTE_MATCHES:`${y}/route-matches`,ACTION_INVOKED:`${y}/action_invoked`,ACTION_SETTLED:`${y}/action_settled`,LOADER_INVOKED:`${y}/loader_invoked`,LOADER_SETTLED:`${y}/loader_settled`};var x=T.createContext([]);var S=T.createContext(void 0);function k(){let[e,t]=useState([]),n=UNSAFE_RouteContext;return n.Provider._context=new Proxy(n.Provider._context??{},{set(r,o,i){return o==="_currentValue"&&i!==void 0&&t(a=>i.matches.length>a.length?i.matches:a),Reflect.set(r,o,i)}}),e}function V(e){let t={};return e.forEach((n,r)=>{if(n instanceof File){t[r]={filename:n.name,filesize:n.size,filetype:n.type};return}t[r]=n;}),t}async function N(e){let t=e.clone(),n=t.headers.get("content-type")||"",r;switch(!0){case n.startsWith("text"):r=await t.text();break;case n.startsWith("application/json"):r=await t.json();break;case n.startsWith("multipart/form-data"):case n.startsWith("application/x-www-form-urlencoded"):{r=V(await t.formData());break}}return r}var E=()=>{let e=useRef(0);return useCallback(async(t,n)=>{e.current++;let r=`${t}_${e.current}`;switch(t){case s.ACTION_INVOKED:{let{request:o,params:i,context:a}=n,c={url:o.url,method:o.method,body:await N(o)};return {key:r,type:t,data:{params:i,request:c,context:a}}}case s.ACTION_SETTLED:return {key:r,type:t,data:n};case s.LOADER_INVOKED:{let{request:o,params:i,context:a}=n,c={url:o.url,method:o.method,body:await N(o)};return {key:r,type:t,data:{params:i,request:c,context:a}}}case s.LOADER_SETTLED:return {key:r,type:t,data:n}}},[])};function B(){let e=addons.getChannel(),t=E();return useCallback(n=>async function(r){if(n===void 0)return;e.emit(s.ACTION_INVOKED,await t(s.ACTION_INVOKED,r));let o=await n(r);return e.emit(s.ACTION_SETTLED,await t(s.ACTION_SETTLED,o)),o},[e,t])}function K(){let e=addons.getChannel(),t=E();return useCallback(n=>async function(r){if(n===void 0)return;e.emit(s.LOADER_INVOKED,await t(s.LOADER_INVOKED,r));let o=await n(r);return e.emit(s.LOADER_SETTLED,await t(s.LOADER_SETTLED,o)),o},[e,t])}function $(){let e=B(),t=K(),n=useCallback(r=>r.map(o=>{let{action:i,loader:a,children:c,lazy:d}=o,f={...o};return d&&(f.lazy=async function(){let l=await d(),h={...l};return l.action&&(h.action=e(l.action)),l.loader&&(h.loader=t(l.loader)),h}),i&&(f.action=e(i)),a&&(f.loader=t(a)),c&&(f.children=n(c)),f}),[e,t]);return n}var P=()=>{let e=T.useContext(S);if(e===void 0)throw new Error("useStory should be used inside <StoryContext>");return e};function M(e,t){return e.length===1&&(e[0].children===void 0||e[0].children.length===0)?[{...e[0],element:t}]:e.findIndex(r=>r.useStoryElement)!==-1?e.map(r=>r.useStoryElement?{...r,element:t}:r):e.map(r=>r.children?{...r,children:M(r.children,t)}:r)}var W;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE";})(W||(W={}));function xe(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Se(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}var Y;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error";})(Y||(Y={}));function j(e,t){t===void 0&&(t={});let n=e;n.endsWith("*")&&n!=="*"&&!n.endsWith("/*")&&(Se(!1,'Route path "'+n+'" will be treated as if it were '+('"'+n.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+n.replace(/\*$/,"/*")+'".')),n=n.replace(/\*$/,"/*"));let r=n.startsWith("/")?"/":"",o=a=>a==null?"":typeof a=="string"?a:String(a),i=n.split(/\/+/).map((a,c,d)=>{if(c===d.length-1&&a==="*")return o(t["*"]);let l=a.match(/^:([\w-]+)(\??)$/);if(l){let[,h,b]=l,p=t[h];return xe(b==="?"||p!=null,'Missing ":'+h+'" param'),o(p)}return a.replace(/\?$/g,"")}).filter(a=>!!a);return r+i.join("/")}var G=["post","put","patch","delete"];new Set(G);var Ee=["get",...G];new Set(Ee);function J({navigationHistory:e,location:t,routes:n}){if(e!==void 0){let p=[],D,w=Object.values(e);for(let g=0;g<w.length;g++){let{path:L,pathParams:U,searchParams:ie,hash:le,state:se,isInitialLocation:ue}=w[g];ue&&(D=g);let H=C(n),ce=(typeof L=="function"?L(H,U??{}):L)??H;p.push({pathname:j(ce??"/",U),search:new URLSearchParams(ie).toString(),hash:le,state:se});}return D??=p.length-1,{initialEntries:p,initialIndex:D}}let{path:r,pathParams:o,searchParams:i,hash:a,state:c}=t??{},d=C(n),l=(typeof r=="function"?r(d,o??{}):r)??d;return {initialEntries:[{pathname:j(l,o),search:new URLSearchParams(i).toString(),hash:a,state:c}],initialIndex:0}}function C(e=[],t="/"){if(e.length!==1)return t;let n=e[0],r=Pe(t,n.path);return n.children===void 0||n.children.length===0?r:C(n.children,r)}function Pe(e,t=""){let n=["","/"],r=e.split("/").filter(a=>!n.includes(a)),o=t.split("/").filter(a=>!n.includes(a));return "/"+[...r,...o].join("/")}function u(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function R(e,t){if(e===!1||e===null||typeof e>"u")throw console.warn("Test invariant failed:",t),new Error(t)}function A(e){return arguments.length===0?[]:Array.isArray(e)?e:[e]}function q(e){return e===void 0?[{path:"/"}]:typeof e=="string"?[{path:e}]:(e=A(e),e.length===1&&(e[0].path??="/"),e)}var O=()=>T.useContext(x);function X(e){let t={};return e.forEach((n,r)=>{let o=t[r];if(typeof o=="string"){t[r]=[o,n];return}if(Array.isArray(o)){t[r]=[...o,n];return}t[r]=n;}),t}var Q=()=>{let e=useLocation(),t=e.pathname;return e.search.length>0&&(t+=`?${e.search}`),e.hash.length>0&&(t+=`#${e.hash}`),t};var Z=()=>{let e=useRef(0),t=useLocation(),n=useParams(),[r]=useSearchParams(),o=useNavigationType(),i=O(),a=X(r),c=Q(),d=i.map(l=>{let h={path:l.route.path};return Object.keys(l.params).length>0&&(h.params=l.params),h}),f={url:c,path:t.pathname,routeParams:n,searchParams:a,hash:t.hash,routeState:t.state,routeMatches:d};return l=>{e.current++;let h=`${l}_${e.current}`;switch(l){case s.STORY_LOADED:return {key:h,type:l,data:f};case s.NAVIGATION:return {key:h,type:l,data:{...f,navigationType:o}};case s.ROUTE_MATCHES:return {key:h,type:l,data:{matches:d}}}}};function I(){let{renderStory:e,storyContext:t}=P(),n=addons.getChannel(),r=useLocation(),o=O(),i=Z(),a=useRef(),c=useRef(),d=useRef(),f=a.current!==void 0,l=f&&r.key!==a.current;return l&&c.current!==r.key&&(n.emit(s.NAVIGATION,i(s.NAVIGATION)),c.current=r.key),l&&o.length>0&&o!==d.current&&n.emit(s.ROUTE_MATCHES,i(s.ROUTE_MATCHES)),!f&&o.length>0&&(n.emit(s.STORY_LOADED,i(s.STORY_LOADED)),a.current=r.key,d.current=o),d.current=o,T.createElement(T.Fragment,null,e(t))}I.displayName="RouterLogger";function te(){let{addonParameters:e={}}=P(),{hydrationData:t,routing:n,navigationHistory:r,location:o,future:i,fallback:a}=e,c=$(),d=useMemo(()=>{let h=q(n),b=c(h),p=M(b,T.createElement(I,null)),{initialEntries:D,initialIndex:w}=J({navigationHistory:r,location:o,routes:p}),g={initialEntries:D,initialIndex:w,hydrationData:t};return i&&(g.future=i),createMemoryRouter(p,g)},[c,t,o,r,n,i]),f={},l=a??T.createElement(He,null);return i&&(f.future=i),i?.v7_partialHydration===!0&&(f.HydrateFallback=l),i?.v7_partialHydration===!1&&(f.fallbackElement=l),T.createElement(RouterProvider,{router:d,...f})}function He(){return T.createElement("p",null,"Performing initial data load")}var re=({renderStory:e,storyContext:t,addonParameters:n})=>{let r=k();return T.createElement(S.Provider,{value:{renderStory:e,storyContext:t,addonParameters:n}},T.createElement(x.Provider,{value:r},T.createElement(te,null)))};function oe(e){if(T.isValidElement(e))return !0;switch(!0){case T.isValidElement(e):case typeof e=="string":case typeof e=="number":case typeof e=="boolean":case e===null:case e===void 0:case(e instanceof Object&&u(e,Symbol.iterator)):return !0}return !1}function m(e){return oe(e)?{element:e}:e}function ae(e={}){let t=["location","navigationHistory","routing","future"];if(Object.keys(e??{}).some(o=>t.includes(o)))return e;let r={routing:{},location:{},hydrationData:void 0};if(u(e,"routePath")&&(r.location.path=e.routePath,r.routing.path=e.routePath),u(e,"routeParams")&&(r.location.pathParams=e.routeParams),u(e,"routeState")&&(r.location.state=e.routeState),u(e,"routeHandle")&&(r.routing.handle=e.routeHandle),u(e,"searchParams")&&(r.location.searchParams=e.searchParams),u(e,"browserPath")&&(r.location.path=e.browserPath),u(e,"loader")&&(r.routing.loader=e.loader),u(e,"action")&&(r.routing.action=e.action),u(e,"errorElement")&&(r.routing.errorElement=e.errorElement),u(e,"hydrationData")&&(r.hydrationData=e.hydrationData),u(e,"shouldRevalidate")&&(r.routing.shouldRevalidate=e.shouldRevalidate),u(e,"routeId")&&(r.routing.id=e.routeId),u(e,"outlet")){let o=m(e.outlet);o.path??="",r.routing.children=[o];}return r.routing.useStoryElement=!0,r}var Ve=makeDecorator({name:"withRouter",parameterName:z,wrapper:(e,t,{parameters:n})=>{let r=ae(n);return T.createElement(re,{renderStory:e,storyContext:t,addonParameters:r})}});function Be(e){return e}function v(e){let t={},n=[];return e.length===1&&(t={},n=e[0]),e.length===2&&(t=typeof e[0]=="string"?{path:e[0]}:m(e[0]),n=e[1]),[t,n]}function Ke(...e){let[t,n]=v(e);R(!u(t,"element"),"The story definition cannot contain the `element` property because the story element will be used");let r=m(n);return r.index=!0,[{...t,useStoryElement:!0,children:[r]}]}function $e(...e){let[t,n]=v(e);return R(!u(t,"element"),"The story definition cannot contain the `element` property because the story element will be used"),[{...t,useStoryElement:!0,children:n}]}function We(...e){let[t,n]=v(e);R(!u(t,"element"),"The story definition cannot contain the `element` property because the story element will be used");let r={},o=r;return n.forEach(i=>{let a=m(i);a.path??="",o.children=[a],o=a;},r),[{...t,useStoryElement:!0,children:[r]}]}function Ye(...e){let t=e.length===1?{}:e[0],n=A(e.length===1?e[0]:e[1]);R(!u(t,"element"),"The story definition cannot contain the `element` property because the story element will be used");let r={path:"/"},o=r;for(let i=0;i<n.length;i++){let a=n[i],c=m(a);c.path??="",o.children=[c],o=c;}return o.children=[{...t,index:!0,useStoryElement:!0}],[r]}/*! Bundled license information: | ||
@@ -7,0 +7,0 @@ @remix-run/router/dist/router.js: |
{ | ||
"name": "storybook-addon-remix-react-router", | ||
"version": "3.0.2", | ||
"version": "3.0.3--canary.73a4e68.0", | ||
"description": "Use Remix React Router in your stories. (Formerly storybook-addon-react-router-v6)", | ||
@@ -16,3 +16,3 @@ "keywords": [ | ||
"type": "git", | ||
"url": "git+https://github.com/JesusTheHun/storybook-addon-remix-react-router.git" | ||
"url": "https://github.com/JesusTheHun/storybook-addon-remix-react-router.git" | ||
}, | ||
@@ -101,3 +101,3 @@ "author": "Jonathan MASSUCHETTI <jonathan.massuchetti@dappit.fr>", | ||
"@vitejs/plugin-react": "^3.1.0", | ||
"auto": "^11.2.1", | ||
"auto": "^11.3.0", | ||
"boxen": "^5.0.1", | ||
@@ -104,0 +104,0 @@ "chromatic": "^6.17.4", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
687681
798
3