Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

storybook-addon-apollo-client

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

storybook-addon-apollo-client - npm Package Compare versions

Comparing version 7.0.0--canary.112.04472e9.0 to 7.0.0--canary.112.15cfed9.0

2

dist/manager.js

@@ -8,4 +8,4 @@ import { addons, types, useAddonState, useChannel, useParameter } from '@storybook/manager-api';

var a="storybook/apollo-client",f=`${a}/panel`,g="apolloClient",m={RESULT:`${a}/result`,REQUEST:`${a}/request`,CLEAR:`${a}/clear`};styled(Button)({marginTop:"1rem"});function c({children:e,fallback:t,language:i}){return e?jsx(SyntaxHighlighter,{bordered:!0,copyable:!0,language:i,padded:!0,children:i==="json"?JSON.stringify(e,null,2):e}):jsx(Placeholder,{children:t})}var b=({mock:e,query:t})=>e?jsxs(TabsState,{initial:"query",backgroundColor:convert(themes.normal).background.hoverable,children:[jsx("div",{color:convert(themes.normal).color.primary,id:"query",title:"Query",children:jsx(c,{fallback:"Could not parse query",language:"graphql",children:t})}),jsx("div",{color:convert(themes.normal).color.warning,id:"variables",title:"Variables",children:jsx(c,{fallback:"No variables in request",language:"json",children:e.request.variables})}),jsx("div",{color:convert(themes.normal).color.defaultText,id:"extensions",title:"Extensions",children:jsx(c,{fallback:"No extensions in request",language:"json",children:e.request.extensions})}),jsx("div",{color:convert(themes.normal).color.defaultText,id:"context",title:"Context",children:jsx(c,{fallback:"No context in request",language:"json",children:e.request.context})}),jsx("div",{color:convert(themes.normal).color.positive,id:"result",title:"Result",children:jsx(c,{fallback:"No result in mock",language:"json",children:e.result})}),jsx("div",{color:convert(themes.normal).color.negative,id:"error",title:"Error",children:jsx(c,{fallback:"No error in mock",language:"json",children:e.error})})]},t):jsx(Placeholder,{children:"No mock selected"});var L=e=>{if(e.request.operationName)return e.request.operationName;let t=e.request.query.definitions.find(i=>i.kind==="OperationDefinition");return t&&t.name?t.name.value:"Unnamed"},A=({active:e=!1})=>{let[t,i]=useState(-1),[p,C]=useAddonState(a,{mocks:[],queries:[]}),u=useChannel({[m.RESULT]:r=>{C(r),i(n=>n===-1?r.mocks.length?0:-1:r.mocks[n]?n:r.mocks.length?0:-1);},[STORY_RENDERED]:()=>{u(m.REQUEST);},[STORY_CHANGED]:()=>{u(m.REQUEST);}});useEffect(()=>{u(m.REQUEST);},[]);let N=p.mocks[t],P=p.queries[t];return jsxs(AddonPanel,{active:e,children:[jsx(Form.Field,{label:"Mocks",children:jsxs(Form.Select,{size:"flex",value:t,disabled:!p.mocks.length,onChange:r=>{let{value:n}=r.currentTarget;i(Number(n));},children:[jsx("option",{value:"",children:"Select a mock"}),p.mocks.map((r,n)=>jsx("option",{value:n,children:L(r)},n))]})}),jsx(b,{mock:N,query:P})]})};function T(){let{mocks:e=[]}=useParameter(g,{mocks:[]});return e.length?`Apollo Client (${e.length})`:"Apollo Client"}addons.register(a,()=>{addons.add(f,{type:types.PANEL,title:T,match:({viewMode:e})=>e==="story",render:A});});
var a="storybook/apollo-client",f=`${a}/panel`,g="apolloClient",m={RESULT:`${a}/result`,REQUEST:`${a}/request`,CLEAR:`${a}/clear`};styled(Button)({marginTop:"1rem"});function c({children:e,fallback:t,language:i}){return e?jsx(SyntaxHighlighter,{bordered:!0,copyable:!0,language:i,padded:!0,children:i==="json"?JSON.stringify(e,null,2):e}):jsx(Placeholder,{children:t})}var b=({mock:e,query:t})=>e?jsxs(TabsState,{initial:"query",backgroundColor:convert(themes.normal).background.hoverable,children:[jsx("div",{color:convert(themes.normal).color.primary,id:"query",title:"Query",children:jsx(c,{fallback:"Could not parse query",language:"graphql",children:t})}),jsx("div",{color:convert(themes.normal).color.warning,id:"variables",title:"Variables",children:jsx(c,{fallback:"No variables in request",language:"json",children:e.request.variables})}),jsx("div",{color:convert(themes.normal).color.defaultText,id:"extensions",title:"Extensions",children:jsx(c,{fallback:"No extensions in request",language:"json",children:e.request.extensions})}),jsx("div",{color:convert(themes.normal).color.defaultText,id:"context",title:"Context",children:jsx(c,{fallback:"No context in request",language:"json",children:e.request.context})}),jsx("div",{color:convert(themes.normal).color.positive,id:"result",title:"Result",children:jsx(c,{fallback:"No result in mock",language:"json",children:e.result})}),jsx("div",{color:convert(themes.normal).color.negative,id:"error",title:"Error",children:jsx(c,{fallback:"No error in mock",language:"json",children:e.error})})]},t):jsx(Placeholder,{children:"No mock selected"});var L=e=>{if(e.request.operationName)return e.request.operationName;let t=e.request.query.definitions.find(i=>i.kind==="OperationDefinition");return t&&t.name?t.name.value:"Unnamed"},A=({active:e=!1})=>{let[t,i]=useState(-1),[p,C]=useAddonState(a,{mocks:[],queries:[]}),u=useChannel({[m.RESULT]:r=>{C(r),i(n=>n===-1?r.mocks.length?0:-1:r.mocks[n]?n:r.mocks.length?0:-1);},[STORY_RENDERED]:()=>{u(m.REQUEST);},[STORY_CHANGED]:()=>{u(m.REQUEST);}});useEffect(()=>{u(m.REQUEST);},[]);let N=p.mocks[t],P=p.queries[t];return jsxs(AddonPanel,{active:e,children:[jsx(Form.Field,{label:"Mock",children:jsxs(Form.Select,{size:"flex",value:t,disabled:!p.mocks.length,onChange:r=>{let{value:n}=r.currentTarget;i(Number(n));},children:[jsx("option",{value:"",children:"Select a mock"}),p.mocks.map((r,n)=>jsx("option",{value:n,children:L(r)},n))]})}),jsx(b,{mock:N,query:P})]})};function T(){let{mocks:e=[]}=useParameter(g,{mocks:[]});return e.length?`Apollo Client (${e.length})`:"Apollo Client"}addons.register(a,()=>{addons.add(f,{type:types.PANEL,title:T,match:({viewMode:e})=>e==="story",render:A});});
//# sourceMappingURL=out.js.map
//# sourceMappingURL=manager.js.map
{
"name": "storybook-addon-apollo-client",
"version": "7.0.0--canary.112.04472e9.0",
"version": "7.0.0--canary.112.15cfed9.0",
"description": "Use Apollo Client in your Storybook stories.",

@@ -5,0 +5,0 @@ "keywords": [

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