@storybook/manager 7.0.0-alpha.44 → 7.0.0-alpha.46

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.
package/dist/runtime.mjs CHANGED
@@ -1 +1 @@
1
- import{a as ne,b as $,c as x,d,e as g,f as u,g as y,h as D,i as K,j as b,k as B,l as w,m as H,n as P,p as Y}from"./chunk-7OQJDLEV.mjs";import{a as S}from"./chunk-QV6IVTJA.mjs";import"./chunk-NISR2N5K.mjs";import{a as re}from"./chunk-722JULI4.mjs";import"./chunk-MY4F7ORE.mjs";import{a as k,b as f,d as C,e as L,s as I}from"./chunk-T6P6F2SI.mjs";import{b as oe}from"./chunk-Z7LX2X6E.mjs";import"./chunk-AIPH5HO4.mjs";import"./chunk-6XCSLWLC.mjs";import{e as h,g as l}from"./chunk-L2PAVIFR.mjs";l();var E=h(k());l();var O=h(k(),1);var U=h(ne(),1),{window:n,document:p,location:A}=O.default,_="storybook-channel",se={allowFunction:!0,maxDepth:25},ae=class{constructor(t){if(this.config=t,this.buffer=[],this.handler=null,n&&n.addEventListener("message",this.handleEvent.bind(this),!1),t.page!=="manager"&&t.page!=="preview")throw new Error(`postmsg-channel: "config.page" cannot be "${t.page}"`)}setHandler(t){this.handler=(...e)=>{t.apply(this,e),!this.connected&&this.getLocalFrame().length&&(this.flush(),this.connected=!0)}}send(t,e){let{target:o,allowRegExp:r,allowFunction:s,allowSymbol:i,allowDate:a,allowUndefined:c,allowClass:V,maxDepth:z,space:J,lazyEval:Q}=e||{},X=Object.fromEntries(Object.entries({allowRegExp:r,allowFunction:s,allowSymbol:i,allowDate:a,allowUndefined:c,allowClass:V,maxDepth:z,space:J,lazyEval:Q}).filter(([m,v])=>typeof v<"u")),Z={...se,...O.default.CHANNEL_OPTIONS||{},...X},F=this.getFrames(o),ee=U.default.parse(A.search,{ignoreQueryPrefix:!0}),te=u({key:_,event:t,refId:ee.refId},Z);return F.length?(this.buffer.length&&this.flush(),F.forEach(m=>{try{m.postMessage(te,"*")}catch{console.error("sending over postmessage fail")}}),Promise.resolve(null)):new Promise((m,v)=>{this.buffer.push({event:t,resolve:m,reject:v})})}flush(){let{buffer:t}=this;this.buffer=[],t.forEach(e=>{this.send(e.event).then(e.resolve).catch(e.reject)})}getFrames(t){if(this.config.page==="manager"){let e=[...p.querySelectorAll("iframe[data-is-storybook][data-is-loaded]")].filter(o=>{try{return!!o.contentWindow&&o.dataset.isStorybook!==void 0&&o.id===t}catch{return!1}}).map(o=>o.contentWindow);return e.length?e:this.getCurrentFrames()}return n&&n.parent&&n.parent!==n?[n.parent]:[]}getCurrentFrames(){return this.config.page==="manager"?[...p.querySelectorAll('[data-is-storybook="true"]')].map(t=>t.contentWindow):n&&n.parent?[n.parent]:[]}getLocalFrame(){return this.config.page==="manager"?[...p.querySelectorAll("#storybook-preview-iframe")].map(t=>t.contentWindow):n&&n.parent?[n.parent]:[]}handleEvent(t){try{let{data:e}=t,{key:o,event:r,refId:s}=typeof e=="string"&&g(e)?y(e,O.default.CHANNEL_OPTIONS||{}):e;if(o===_){let i=this.config.page==="manager"?'<span style="color: #37D5D3; background: black"> manager </span>':'<span style="color: #1EA7FD; background: black"> preview </span>',a=Object.values(d).includes(r.type)?`<span style="color: #FF4785">${r.type}</span>`:`<span style="color: #FFAE00">${r.type}</span>`;if(s&&(r.refId=s),r.source=this.config.page==="preview"?t.origin:ie(t),!r.source){C.error(`${i} received ${a} but was unable to determine the source of the event`);return}let c=`${i} received ${a} (${e.length})`;C.debug(A.origin!==r.source?c:`${c} <span style="color: gray">(on ${A.origin} from ${r.source})</span>`,...r.args),this.handler(r)}}catch(e){f.error(e)}}},ie=t=>{let e=[...p.querySelectorAll("iframe[data-is-storybook]")],[o,...r]=e.filter(s=>{try{return s.contentWindow===t.source}catch{}let i=s.getAttribute("src"),a;try{({origin:a}=new URL(i,p.location))}catch{return!1}return a===t.origin});if(o&&r.length===0){let s=o.getAttribute("src"),{protocol:i,host:a,pathname:c}=new URL(s,p.location);return`${i}//${a}${c}`}return r.length>0&&f.error("found multiple candidates for event source"),null};function j({page:t}){let e=new ae({page:t});return new b({transport:e})}l();var q=h(k());var{WebSocket:ce}=q.default,N=class{constructor({url:e,onError:o}){this.socket=void 0,this.handler=void 0,this.buffer=[],this.isReady=!1,this.connect(e,o)}setHandler(e){this.handler=e}send(e){this.isReady?this.sendNow(e):this.sendLater(e)}sendLater(e){this.buffer.push(e)}sendNow(e){let o=u(e,{maxDepth:15,allowFunction:!0});this.socket.send(o)}flush(){let{buffer:e}=this;this.buffer=[],e.forEach(o=>this.send(o))}connect(e,o){this.socket=new ce(e),this.socket.onopen=()=>{this.isReady=!0,this.flush()},this.socket.onmessage=({data:r})=>{let s=typeof r=="string"&&g(r)?y(r):r;this.handler(s)},this.socket.onerror=r=>{o&&o(r)}}};function M({url:t,async:e=!1,onError:o=r=>f.warn(r)}){let r=new N({url:t,onError:o});return new b({transport:r,async:e})}l();var pe=h(oe()),fe=h(re());var W={react:pe,"react-dom":fe,"@storybook/components":K,"@storybook/channels":B,"@storybook/core-events":d,"@storybook/router":$,"@storybook/theming":I,"@storybook/api":D,"@storybook/addons":H,"@storybook/client-logger":L};var{FEATURES:me,SERVER_CHANNEL_URL:G}=E.default,T=class extends P{constructor(){super();let o=j({page:"manager"});if(w.setChannel(o),o.emit(x),this.addons=w,this.channel=o,me?.storyStoreV7&&G){let r=M({url:G});this.serverChannel=r,w.setServerChannel(this.serverChannel)}}getElements(o){return this.addons.getElements(o)}getConfig(){return this.addons.getConfig()}handleAPI(o){this.addons.loadAddons(o)}},{document:de}=E.default,ge=de.getElementById("root");Y(ge,new T);Object.keys(S).forEach(t=>{E.default[S[t]]=W[t]});
1
+ import{a as ne,b as $,c as x,d,e as g,f as u,g as y,h as D,i as K,j as b,k as B,l as w,m as H,n as P,p as Y}from"./chunk-7RLKY42A.mjs";import{a as S}from"./chunk-QV6IVTJA.mjs";import"./chunk-OTP7WBFR.mjs";import{a as re}from"./chunk-722JULI4.mjs";import"./chunk-MY4F7ORE.mjs";import{a as k,b as f,d as C,e as L,s as I}from"./chunk-T6P6F2SI.mjs";import{b as oe}from"./chunk-Z7LX2X6E.mjs";import"./chunk-AIPH5HO4.mjs";import"./chunk-6XCSLWLC.mjs";import{e as p,g as l}from"./chunk-L2PAVIFR.mjs";l();var E=p(k());l();var O=p(k(),1);var U=p(ne(),1),{window:n,document:h,location:A}=O.default,_="storybook-channel",se={allowFunction:!0,maxDepth:25},ae=class{constructor(t){if(this.config=t,this.buffer=[],this.handler=null,n&&n.addEventListener("message",this.handleEvent.bind(this),!1),t.page!=="manager"&&t.page!=="preview")throw new Error(`postmsg-channel: "config.page" cannot be "${t.page}"`)}setHandler(t){this.handler=(...e)=>{t.apply(this,e),!this.connected&&this.getLocalFrame().length&&(this.flush(),this.connected=!0)}}send(t,e){let{target:o,allowRegExp:r,allowFunction:s,allowSymbol:i,allowDate:a,allowUndefined:c,allowClass:V,maxDepth:z,space:J,lazyEval:Q}=e||{},X=Object.fromEntries(Object.entries({allowRegExp:r,allowFunction:s,allowSymbol:i,allowDate:a,allowUndefined:c,allowClass:V,maxDepth:z,space:J,lazyEval:Q}).filter(([m,v])=>typeof v<"u")),Z={...se,...O.default.CHANNEL_OPTIONS||{},...X},F=this.getFrames(o),ee=U.default.parse(A.search,{ignoreQueryPrefix:!0}),te=u({key:_,event:t,refId:ee.refId},Z);return F.length?(this.buffer.length&&this.flush(),F.forEach(m=>{try{m.postMessage(te,"*")}catch{console.error("sending over postmessage fail")}}),Promise.resolve(null)):new Promise((m,v)=>{this.buffer.push({event:t,resolve:m,reject:v})})}flush(){let{buffer:t}=this;this.buffer=[],t.forEach(e=>{this.send(e.event).then(e.resolve).catch(e.reject)})}getFrames(t){if(this.config.page==="manager"){let e=[...h.querySelectorAll("iframe[data-is-storybook][data-is-loaded]")].filter(o=>{try{return!!o.contentWindow&&o.dataset.isStorybook!==void 0&&o.id===t}catch{return!1}}).map(o=>o.contentWindow);return e.length?e:this.getCurrentFrames()}return n&&n.parent&&n.parent!==n?[n.parent]:[]}getCurrentFrames(){return this.config.page==="manager"?[...h.querySelectorAll('[data-is-storybook="true"]')].map(t=>t.contentWindow):n&&n.parent?[n.parent]:[]}getLocalFrame(){return this.config.page==="manager"?[...h.querySelectorAll("#storybook-preview-iframe")].map(t=>t.contentWindow):n&&n.parent?[n.parent]:[]}handleEvent(t){try{let{data:e}=t,{key:o,event:r,refId:s}=typeof e=="string"&&g(e)?y(e,O.default.CHANNEL_OPTIONS||{}):e;if(o===_){let i=this.config.page==="manager"?'<span style="color: #37D5D3; background: black"> manager </span>':'<span style="color: #1EA7FD; background: black"> preview </span>',a=Object.values(d).includes(r.type)?`<span style="color: #FF4785">${r.type}</span>`:`<span style="color: #FFAE00">${r.type}</span>`;if(s&&(r.refId=s),r.source=this.config.page==="preview"?t.origin:ie(t),!r.source){C.error(`${i} received ${a} but was unable to determine the source of the event`);return}let c=`${i} received ${a} (${e.length})`;C.debug(A.origin!==r.source?c:`${c} <span style="color: gray">(on ${A.origin} from ${r.source})</span>`,...r.args),this.handler(r)}}catch(e){f.error(e)}}},ie=t=>{let e=[...h.querySelectorAll("iframe[data-is-storybook]")],[o,...r]=e.filter(s=>{try{return s.contentWindow===t.source}catch{}let i=s.getAttribute("src"),a;try{({origin:a}=new URL(i,h.location))}catch{return!1}return a===t.origin});if(o&&r.length===0){let s=o.getAttribute("src"),{protocol:i,host:a,pathname:c}=new URL(s,h.location);return`${i}//${a}${c}`}return r.length>0&&f.error("found multiple candidates for event source"),null};function j({page:t}){let e=new ae({page:t});return new b({transport:e})}l();var q=p(k());var{WebSocket:ce}=q.default,N=class{constructor({url:e,onError:o}){this.socket=void 0,this.handler=void 0,this.buffer=[],this.isReady=!1,this.connect(e,o)}setHandler(e){this.handler=e}send(e){this.isReady?this.sendNow(e):this.sendLater(e)}sendLater(e){this.buffer.push(e)}sendNow(e){let o=u(e,{maxDepth:15,allowFunction:!0});this.socket.send(o)}flush(){let{buffer:e}=this;this.buffer=[],e.forEach(o=>this.send(o))}connect(e,o){this.socket=new ce(e),this.socket.onopen=()=>{this.isReady=!0,this.flush()},this.socket.onmessage=({data:r})=>{let s=typeof r=="string"&&g(r)?y(r):r;this.handler(s)},this.socket.onerror=r=>{o&&o(r)}}};function M({url:t,async:e=!1,onError:o=r=>f.warn(r)}){let r=new N({url:t,onError:o});return new b({transport:r,async:e})}l();var he=p(oe()),fe=p(re());var W={react:he,"react-dom":fe,"@storybook/components":K,"@storybook/channels":B,"@storybook/core-events":d,"@storybook/router":$,"@storybook/theming":I,"@storybook/api":D,"@storybook/addons":H,"@storybook/client-logger":L};var{FEATURES:me,SERVER_CHANNEL_URL:G}=E.default,T=class extends P{constructor(){super();let o=j({page:"manager"});if(w.setChannel(o),o.emit(x),this.addons=w,this.channel=o,me?.storyStoreV7&&G){let r=M({url:G});this.serverChannel=r,w.setServerChannel(this.serverChannel)}}getElements(o){return this.addons.getElements(o)}getConfig(){return this.addons.getConfig()}handleAPI(o){this.addons.loadAddons(o)}},{document:de}=E.default,ge=de.getElementById("root");Y(ge,new T);Object.keys(S).forEach(t=>{E.default[S[t]]=W[t]});
@@ -1 +1 @@
1
- import{c as t,d as r,e as i}from"./chunk-NISR2N5K.mjs";import"./chunk-MY4F7ORE.mjs";import"./chunk-T6P6F2SI.mjs";import"./chunk-Z7LX2X6E.mjs";import"./chunk-AIPH5HO4.mjs";import"./chunk-6XCSLWLC.mjs";import{g as o}from"./chunk-L2PAVIFR.mjs";o();export{r as SyntaxHighlighter,t as createCopyToClipboardFunction,i as default};
1
+ import{c as t,d as r,e as i}from"./chunk-OTP7WBFR.mjs";import"./chunk-MY4F7ORE.mjs";import"./chunk-T6P6F2SI.mjs";import"./chunk-Z7LX2X6E.mjs";import"./chunk-AIPH5HO4.mjs";import"./chunk-6XCSLWLC.mjs";import{g as o}from"./chunk-L2PAVIFR.mjs";o();export{r as SyntaxHighlighter,t as createCopyToClipboardFunction,i as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/manager",
3
- "version": "7.0.0-alpha.44",
3
+ "version": "7.0.0-alpha.46",
4
4
  "description": "Core Storybook UI",
5
5
  "keywords": [
6
6
  "storybook"
@@ -53,17 +53,17 @@
53
53
  },
54
54
  "devDependencies": {
55
55
  "@fal-works/esbuild-plugin-global-externals": "^2.1.2",
56
- "@storybook/addons": "7.0.0-alpha.44",
57
- "@storybook/api": "7.0.0-alpha.44",
58
- "@storybook/channel-postmessage": "7.0.0-alpha.44",
59
- "@storybook/channel-websocket": "7.0.0-alpha.44",
60
- "@storybook/channels": "7.0.0-alpha.44",
61
- "@storybook/client-logger": "7.0.0-alpha.44",
62
- "@storybook/components": "7.0.0-alpha.44",
63
- "@storybook/core-events": "7.0.0-alpha.44",
64
- "@storybook/router": "7.0.0-alpha.44",
65
- "@storybook/theming": "7.0.0-alpha.44",
66
- "@storybook/types": "7.0.0-alpha.44",
56
+ "@storybook/addons": "7.0.0-alpha.46",
57
+ "@storybook/api": "7.0.0-alpha.46",
58
+ "@storybook/channel-postmessage": "7.0.0-alpha.46",
59
+ "@storybook/channel-websocket": "7.0.0-alpha.46",
60
+ "@storybook/channels": "7.0.0-alpha.46",
61
+ "@storybook/client-logger": "7.0.0-alpha.46",
62
+ "@storybook/components": "7.0.0-alpha.46",
63
+ "@storybook/core-events": "7.0.0-alpha.46",
64
+ "@storybook/router": "7.0.0-alpha.46",
65
+ "@storybook/theming": "7.0.0-alpha.46",
66
+ "@storybook/types": "7.0.0-alpha.46",
67
67
  "@testing-library/react": "^11.2.2",
68
68
  "@types/semver": "^7.3.4",
69
69
  "copy-to-clipboard": "^3.3.1",
@@ -100,5 +100,5 @@
100
100
  "./src/runtime.ts"
101
101
  ]
102
102
  },
103
- "gitHead": "d4965bd328d8f83c279560c7bc8428e490b275f3"
103
+ "gitHead": "c64b5be851ed2affac56e1daaac3f453fbe6f230"
104
104
  }