@teambit/scope 1.0.122 → 1.0.123

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.
@@ -51,5 +51,5 @@
51
51
  transform-origin: center center;
52
52
  }
53
53
 
54
- .image_fullWidth__ZH91W{width:100%}
55
- .image_center__Hfsuj{margin-left:auto;margin-right:auto}
54
+ .image_fullWidth__M5NBA{width:100%}
55
+ .image_center__hG6ii{margin-left:auto;margin-right:auto}
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see teambit_scope_scope-preview.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.scope/scope-preview"]=t():e["teambit.scope/scope-preview"]=t()}(self,(()=>(()=>{var e={5576:(e,t)=>{var n;!function(){"use strict";var o={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var i=typeof n;if("string"===i||"number"===i)e.push(n);else if(Array.isArray(n)&&n.length){var a=r.apply(null,n);a&&e.push(a)}else if("object"===i)for(var s in n)o.call(n,s)&&n[s]&&e.push(s)}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(n=function(){return r}.apply(t,[]))||(e.exports=n)}()},61844:()=>{!function(){if("undefined"!=typeof window&&"undefined"!=typeof document&&"undefined"!=typeof HTMLElement){var e=!1;try{var t=document.createElement("div");t.addEventListener("focus",(function(e){e.preventDefault(),e.stopPropagation()}),!0),t.focus(Object.defineProperty({},"preventScroll",{get:function(){e=!0}}))}catch(e){}void 0!==HTMLElement.prototype.nativeFocus||e||(HTMLElement.prototype.nativeFocus=HTMLElement.prototype.focus,HTMLElement.prototype.focus=function(e){var t=window.scrollY||window.pageYOffset;this.nativeFocus(),e&&e.preventScroll&&setTimeout((function(){window.scroll(window.scrollX||window.pageXOffset,t)}),0)})}}()},42263:(e,t)=>{var n;!function(){"use strict";var o={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var i=typeof n;if("string"===i||"number"===i)e.push(n);else if(Array.isArray(n)){if(n.length){var a=r.apply(null,n);a&&e.push(a)}}else if("object"===i)if(n.toString===Object.prototype.toString)for(var s in n)o.call(n,s)&&n[s]&&e.push(s);else e.push(n.toString())}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(n=function(){return r}.apply(t,[]))||(e.exports=n)}()},75902:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isNavigator=t.isBrowser=t.off=t.on=t.noop=void 0,t.noop=function(){},t.on=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];e&&e.addEventListener&&e.addEventListener.apply(e,t)},t.off=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];e&&e.removeEventListener&&e.removeEventListener.apply(e,t)},t.isBrowser="undefined"!=typeof window,t.isNavigator="undefined"!=typeof navigator},17352:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(87363);t.default=function(e){o.useEffect(e,[])}},29918:(e,t,n)=>{"use strict";var o=n(87363),r=n(75902),i=r.isBrowser?window:null,a=function(e){return!!e.addEventListener},s=function(e){return!!e.on};t.Z=function(e,t,n,c){void 0===n&&(n=i),o.useEffect((function(){if(t&&n)return a(n)?r.on(n,e,t,c):s(n)&&n.on(e,t,c),function(){a(n)?r.off(n,e,t,c):s(n)&&n.off(e,t,c)}}),[e,t,n,JSON.stringify(c)])}},52135:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(78655),r=n(87363),i=o.__importDefault(n(40042));t.default=function(e){var t=r.useRef(0),n=r.useState(e),o=n[0],a=n[1],s=r.useCallback((function(e){cancelAnimationFrame(t.current),t.current=requestAnimationFrame((function(){a(e)}))}),[]);return i.default((function(){cancelAnimationFrame(t.current)})),[o,s]}},40042:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(78655),r=n(87363),i=o.__importDefault(n(17352));t.default=function(e){var t=r.useRef(e);t.current=e,i.default((function(){return function(){return t.current()}}))}},76175:(e,t,n)=>{"use strict";var o=n(78655),r=n(87363),i=o.__importDefault(n(52135)),a=n(75902);t.Z=function(e,t){void 0===e&&(e=1/0),void 0===t&&(t=1/0);var n=i.default({width:a.isBrowser?window.innerWidth:e,height:a.isBrowser?window.innerHeight:t}),o=n[0],s=n[1];return r.useEffect((function(){if(a.isBrowser){var e=function(){s({width:window.innerWidth,height:window.innerHeight})};return a.on(window,"resize",e),function(){a.off(window,"resize",e)}}}),[]),o}},58500:(e,t,n)=>{"use strict";var o={id:"teambit.scope/scope@1.0.122",homepage:"https://bit.cloud/teambit/scope/scope",exported:!0};function r(){const e=i(n(87363));return r=function(){return e},e}function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,r.__bit_component=o,i.__bit_component=o;const a=()=>r().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},r().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/scope.svg"}));a.__bit_component=o,t.Logo=a},54548:function(e,t,n){"use strict";var o=this&&this.__rest||function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.BaseImage=void 0;const i=r(n(87363)),a=r(n(5576)),s=r(n(23302));function c(e){var{alt:t,className:n,fullWidth:r}=e,c=o(e,["alt","className","fullWidth"]);return i.default.createElement("img",Object.assign({"data-bit-id":"teambit.base-ui/elements/image",alt:t},c,{className:a.default(s.default.image,r&&s.default.fullWidth,n)}))}c.__bit_component={id:"teambit.base-ui/elements/image@1.0.0",homepage:"https://bit.dev/teambit/base-ui/elements/image",exported:!0},t.BaseImage=c},37706:function(e,t,n){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,n,o){void 0===o&&(o=n),Object.defineProperty(e,o,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||o(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),r(n(54548),t)},55113:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Image:()=>y});var o=n(87363),r=n.n(o),i=n(42263),a=n.n(i);n(61844);const s=ReactDom;var c=n(29918),l=n(76175),u=n(78655),p=function(e){return e+"ms"},f={getBoundingClientRect:function(){return{height:0,left:0,top:0,width:0}},style:{transform:null}},d=(0,o.memo)((function(e){var t=e.children,n=e.closeText,i=void 0===n?"Unzoom Image":n,a=e.onUnload,d=e.onLoad,m=e.overlayBgColorEnd,h=void 0===m?"rgba(255, 255, 255, 0.95)":m,y=e.overlayBgColorStart,v=void 0===y?"rgba(255, 255, 255, 0)":y,b=e.parentRef,g=e.portalEl,_=void 0===g?document.body:g,w=e.scrollableEl,x=void 0===w?window:w,O=e.transitionDuration,j=void 0===O?300:O,S=e.zoomMargin,P=void 0===S?0:S,E=e.zoomZindex,T=void 0===E?2147483647:E,k=(0,o.useRef)(null),M=(0,o.useState)(0)[1],D=(0,o.useState)(!1),C=D[0],I=D[1],B=(0,o.useState)(!1),z=B[0],N=B[1],A=(0,l.Z)(),R=A.width,L=A.height,W=(0,o.useCallback)((function(e){e.preventDefault(),N(!0)}),[]),F=(0,o.useCallback)((function(e){"Escape"!==e.key&&27!==e.keyCode||(e.stopPropagation(),N(!0))}),[]),H=(0,o.useCallback)((function(){M((function(e){return e+1})),z||N(!0)}),[z]);(0,c.Z)("keydown",F,document),(0,c.Z)("scroll",H,x),(0,o.useEffect)((function(){I(!0),d(),k.current&&k.current.focus({preventScroll:!0})}),[d]),(0,o.useEffect)((function(){var e=z?setTimeout(a,j):null;return function(){e&&clearTimeout(e)}}),[z,a,j]);var Z=b.current||f,X=Z.getBoundingClientRect(),U=X.height,G=X.left,$=X.top,J=X.width,V=function(e){var t=e.isLoaded,n=e.isUnloading,o=e.overlayBgColorEnd,r=e.zoomZindex,i={backgroundColor:e.overlayBgColorStart,transitionDuration:p(e.transitionDuration),zIndex:r};return t&&!n&&(i.backgroundColor=o),i}({isLoaded:C,isUnloading:z,overlayBgColorEnd:h,overlayBgColorStart:v,transitionDuration:j,zoomZindex:T}),Y=function(e){var t=e.height,n=e.innerHeight,o=e.innerWidth,r=e.isLoaded,i=e.isUnloading,a=e.left,s=e.originalTransform,c=e.top,l=e.transitionDuration,f=e.width,d=e.zoomMargin,m=p(l);if(!r||i){var h=(0,u.__spreadArrays)(["scale(1)","translate(0, 0)"],s?[s]:[]).join(" ");return{height:t,left:a,top:c,transform:h,WebkitTransform:h,transitionDuration:m,width:f}}var y=function(e){var t=e.zoomMargin,n=e.innerWidth/(e.width+t),o=e.innerHeight/(e.height+t);return Math.min(n,o)}({height:t,innerWidth:o,innerHeight:n,width:f,zoomMargin:d}),v=(o/2-(a+f/2))/y,b=(n/2-(c+t/2))/y,g=(0,u.__spreadArrays)(["scale("+y+")","translate("+v+"px, "+b+"px)"],s?[s]:[]).join(" ");return{height:t,left:a,top:c,transform:g,WebkitTransform:g,transitionDuration:m,width:f}}({height:U,isLoaded:C,innerHeight:L,innerWidth:R,isUnloading:z,left:G,originalTransform:Z.style.transform,top:$,transitionDuration:j,width:J,zoomMargin:P});return(0,s.createPortal)(r().createElement("div",{"aria-modal":!0,"data-rmiz-overlay":!0,role:"dialog",style:V},r().createElement("div",{"data-rmiz-modal-content":!0,style:Y},t),r().createElement("button",{"aria-label":i,"data-rmiz-btn-close":!0,onClick:W,ref:k})),_)}));const m=(0,o.memo)((function(e){var t=e.children,n=e.closeText,i=void 0===n?"Unzoom image":n,a=e.overlayBgColorEnd,s=void 0===a?"rgba(255, 255, 255, 0.95)":a,c=e.overlayBgColorStart,l=void 0===c?"rgba(255, 255, 255, 0)":c,u=e.portalEl,p=e.openText,f=void 0===p?"Zoom image":p,m=e.scrollableEl,h=e.transitionDuration,y=void 0===h?300:h,v=e.wrapElement,b=void 0===v?"div":v,g=e.wrapStyle,_=e.zoomMargin,w=void 0===_?0:_,x=e.zoomZindex,O=void 0===x?2147483647:x,j=(0,o.useState)(!1),S=j[0],P=j[1],E=(0,o.useState)(!1),T=E[0],k=E[1],M=(0,o.useRef)(null),D=(0,o.useRef)(null),C=(0,o.useCallback)((function(e){S||(e.preventDefault(),P(!0))}),[S]),I=(0,o.useCallback)((function(){k(!0)}),[]),B=(0,o.useCallback)((function(){P(!1),k(!1),D.current&&D.current.focus({preventScroll:!0})}),[]),z=S&&T?"hidden":"visible";return r().createElement(o.StrictMode,null,r().createElement(b,{"data-rmiz-wrap":z,ref:M,style:g},t,r().createElement("button",{"aria-label":f,"data-rmiz-btn-open":!0,onClick:C,ref:D}),"undefined"!=typeof window&&S&&r().createElement(d,{closeText:i,onLoad:I,onUnload:B,overlayBgColorEnd:s,overlayBgColorStart:l,parentRef:M,portalEl:u,scrollableEl:m,transitionDuration:y,zoomMargin:w,zoomZindex:O},t)))}));var h=n(37706);const y=e=>{var{center:t=!0,width:n,alt:o,src:i,className:s}=e,c=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}(e,["center","width","alt","src","className"]);return r().createElement("div",{style:{width:n||"100%"},className:a()(t&&"image_center__Hfsuj",s)},r().createElement(m,null,r().createElement(h.BaseImage,Object.assign({fullWidth:!0,alt:o,src:i},c))))};y.__bit_component={id:"teambit.docs/ui/zoomable-image@1.95.0",homepage:"https://bit.dev/teambit/docs/ui/zoomable-image",exported:!0}},43077:(e,t,n)=>{"use strict";Object.defineProperty(t,"ZP",{enumerable:!0,get:function(){return o.default}});var o=r(n(16015));function r(e){return e&&e.__esModule?e:{default:e}}r.__bit_component={id:"teambit.scope/content/scope-overview@1.95.0",homepage:"https://bit.dev/teambit/scope/content/scope-overview",exported:!0}},16015:(e,t,n)=>{"use strict";var o={id:"teambit.scope/content/scope-overview@1.95.0",homepage:"https://bit.dev/teambit/scope/content/scope-overview",exported:!0};Object.defineProperty(t,"__esModule",{value:!0}),t.default=v,p(n(87363));var r=n(40040),i=n(70500),a=p(n(24783)),s=p(n(35574)),c=p(n(34599)),l=n(55113),u=["components"];function p(e){return e&&e.__esModule?e:{default:e}}function f(){return f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},f.apply(this,arguments)}function d(e,t){if(null==e)return{};var n,o,r=m(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function m(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}p.__bit_component=o,f.__bit_component=o,d.__bit_component=o,m.__bit_component=o;var h={},y="wrapper";function v(e){var t=e.components,n=d(e,u);return(0,r.mdx)(y,f({},h,n,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)(i.MDXScopeProvider,{components:{scopeImage:a.default,scopeGraph:s.default,componentTypes:c.default,Image:l.Image},mdxType:"MDXScopeProvider"},(0,r.mdx)("h1",null,"Scope Overview"),(0,r.mdx)("p",null,"Scope is a server for hosting components. Scopes help teams to share and use each other's components as by preserving team autonomy through versioning, forking, storing dependencies, and collaborate on changes of independent components.\nScopes defines ownership on components, as a single team owns the components exported to scope."),(0,r.mdx)(l.Image,{width:"70%",src:a.default,mdxType:"Image"}),(0,r.mdx)("h2",null,"Full stack of functionality"),(0,r.mdx)("p",null,"Scopes host components of any kind, from React, Angular and Node modules, all the way to a frontend apps or microservices. For a scope they are all Bit Components.",(0,r.mdx)("br",{parentName:"p"}),"\n","For example, the ",(0,r.mdx)("a",{parentName:"p",href:"https://bit.dev/teambit/mdx"},"MDX scope"),' contains all components relevant to handling MDX functionality in Bit. It exposes various types of components (or "APIs") to achieve this: Webpack loader, Node modules, React components and even a ',(0,r.mdx)("a",{parentName:"p",href:"/"},"Bit Aspect"),". This makes it easy for other teams to take leverage of MDX, not just as a feature but also as an API for their features."),(0,r.mdx)("p",null,"Scopes support various methods for using components, from adding as dependencies to runtime integrations, allowing the consumer to decide how whats the best solution for their use case."),(0,r.mdx)(l.Image,{width:"70%",src:c.default,mdxType:"Image"}),(0,r.mdx)("h2",null,"Team collaboration using components"),(0,r.mdx)("p",null,"Scopes provides visibility to components built by other teams, this is the first step towards better collaboration. Developers can find, use and depend on components by other teams. Instead of reinventing the wheel and rebuilding the same functionality, component visibility drives for collaboration. It is similar to how teams build with microservices and build team communication and collaboration by using each-other's APIs.",(0,r.mdx)("br",{parentName:"p"}),"\n","Moreover, developers can use ",(0,r.mdx)("inlineCode",{parentName:"p"},"bit import")," and access to any component's source code and contribute change to collaborate on components."),(0,r.mdx)("p",null,"Bit keeps track on all these dependencies and flows, making team collaboration visible, easy to extend and optimize."),(0,r.mdx)(l.Image,{width:"70%",src:s.default,mdxType:"Image"}),(0,r.mdx)("h2",null,"Distributed and autonomous"),(0,r.mdx)("p",null,"Hosted scopes form a distributed network, where each scope is connected to the other scopes according to component dependencies. Each scope stores not only the components it hosts, but also the dependencies of those components.",(0,r.mdx)("br",{parentName:"p"}),"\n","When you export a component, the scope then does network calls to fetch the dependencies of the component from their respective scopes. This means that each scope becomes autonomous, as it contains all the dependencies needed to its components to run. In turn this makes teams more autonomous, as they can now build and use their components without having to worry about the dependencies."),(0,r.mdx)("p",null,"Scopes use standard HTTP for inner-scope communication, however, when building a network of scopes, you need to ensure scopes are able to connect to one another to fetch dependencies."),(0,r.mdx)("h2",null,"Source of truth"),(0,r.mdx)("p",null,"Scopes become the source of truth for components. Allowing different stakeholders to collaborate and work together from the same, or from different Workspaces.\nComponents can be maintained from multiple Workspaces in parallel, while Scopes are keeping them in sync, merging changes for all ends."),(0,r.mdx)("p",null,(0,r.mdx)("inlineCode",{parentName:"p"},"bit import")," can be used to fetch component updates. Using ",(0,r.mdx)("inlineCode",{parentName:"p"},"bit import")," is similar to using ",(0,r.mdx)("inlineCode",{parentName:"p"},"git fetch")," where new objects are being fetched but not checked out in your workspace. "),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-bash"},"$ bit import\n⡃⢐ fetching 143 components from 18 remotes. delta-only: 143, all-history: 0.\n- up to date teambit.community/ui/hero \n- up to date teambit.community/ui/homepage/sections/distribution \n- updated teambit.design/ui/layouts/sections/left-right \n- updated teambit.design/ui/layouts/sections/section-group \n- updated teambit.design/ui/layouts/sections/top-down \n")),(0,r.mdx)("p",null,(0,r.mdx)("inlineCode",{parentName:"p"},"bit export")," is used to share component changes with others. It pushes new objects from a local Workspace to a remote Scope, allowing others to keep in sync with the latest\ncomponent changes."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-bash"},"$ bit export\nexported 8 components successfully to remote scope `community`\n"))))}v.__bit_component=o,v.isMDXComponent=!0},23302:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>o});const o={fullWidth:"image_fullWidth__ZH91W"}},34599:(e,t,n)=>{"use strict";e.exports=n.p+"static/images/3a1072c009accd203fa8.png"},35574:(e,t,n)=>{"use strict";e.exports=n.p+"static/images/ccf5ea377e3a1a72829d.png"},24783:(e,t,n)=>{"use strict";e.exports=n.p+"static/images/aef2176d16de53259dad.png"},40040:e=>{"use strict";e.exports=MdxJsReact},87363:e=>{"use strict";e.exports=React},70500:e=>{"use strict";e.exports=TeambitMdxUiMdxScopeContext},78655:(e,t,n)=>{"use strict";n.r(t),n.d(t,{__addDisposableResource:()=>B,__assign:()=>i,__asyncDelegator:()=>S,__asyncGenerator:()=>j,__asyncValues:()=>P,__await:()=>O,__awaiter:()=>m,__classPrivateFieldGet:()=>D,__classPrivateFieldIn:()=>I,__classPrivateFieldSet:()=>C,__createBinding:()=>y,__decorate:()=>s,__disposeResources:()=>N,__esDecorate:()=>l,__exportStar:()=>v,__extends:()=>r,__generator:()=>h,__importDefault:()=>M,__importStar:()=>k,__makeTemplateObject:()=>E,__metadata:()=>d,__param:()=>c,__propKey:()=>p,__read:()=>g,__rest:()=>a,__runInitializers:()=>u,__setFunctionName:()=>f,__spread:()=>_,__spreadArray:()=>x,__spreadArrays:()=>w,__values:()=>b,default:()=>A});var o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},o(e,t)};function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var i=function(){return i=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},i.apply(this,arguments)};function a(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}function s(e,t,n,o){var r,i=arguments.length,a=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,o);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(i<3?r(a):i>3?r(t,n,a):r(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function c(e,t){return function(n,o){t(n,o,e)}}function l(e,t,n,o,r,i){function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,c=o.kind,l="getter"===c?"get":"setter"===c?"set":"value",u=!t&&e?o.static?e:e.prototype:null,p=t||(u?Object.getOwnPropertyDescriptor(u,o.name):{}),f=!1,d=n.length-1;d>=0;d--){var m={};for(var h in o)m[h]="access"===h?{}:o[h];for(var h in o.access)m.access[h]=o.access[h];m.addInitializer=function(e){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(e||null))};var y=(0,n[d])("accessor"===c?{get:p.get,set:p.set}:p[l],m);if("accessor"===c){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw new TypeError("Object expected");(s=a(y.get))&&(p.get=s),(s=a(y.set))&&(p.set=s),(s=a(y.init))&&r.unshift(s)}else(s=a(y))&&("field"===c?r.unshift(s):p[l]=s)}u&&Object.defineProperty(u,o.name,p),f=!0}function u(e,t,n){for(var o=arguments.length>2,r=0;r<t.length;r++)n=o?t[r].call(e,n):t[r].call(e);return o?n:void 0}function p(e){return"symbol"==typeof e?e:"".concat(e)}function f(e,t,n){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})}function d(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function m(e,t,n,o){return new(n||(n=Promise))((function(r,i){function a(e){try{c(o.next(e))}catch(e){i(e)}}function s(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((o=o.apply(e,t||[])).next())}))}function h(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],o=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}var y=Object.create?function(e,t,n,o){void 0===o&&(o=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,o,r)}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]};function v(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||y(t,e,n)}function b(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function g(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(o=i.next()).done;)a.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return a}function _(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(g(arguments[t]));return e}function w(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),r=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,r++)o[r]=i[a];return o}function x(e,t,n){if(n||2===arguments.length)for(var o,r=0,i=t.length;r<i;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}function O(e){return this instanceof O?(this.v=e,this):new O(e)}function j(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(e,t||[]),i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(e){r[e]&&(o[e]=function(t){return new Promise((function(n,o){i.push([e,t,n,o])>1||s(e,t)}))})}function s(e,t){try{(n=r[e](t)).value instanceof O?Promise.resolve(n.value.v).then(c,l):u(i[0][2],n)}catch(e){u(i[0][3],e)}var n}function c(e){s("next",e)}function l(e){s("throw",e)}function u(e,t){e(t),i.shift(),i.length&&s(i[0][0],i[0][1])}}function S(e){var t,n;return t={},o("next"),o("throw",(function(e){throw e})),o("return"),t[Symbol.iterator]=function(){return this},t;function o(o,r){t[o]=e[o]?function(t){return(n=!n)?{value:O(e[o](t)),done:!1}:r?r(t):t}:r}}function P(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=b(e),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(n){t[n]=e[n]&&function(t){return new Promise((function(o,r){!function(e,t,n,o){Promise.resolve(o).then((function(t){e({value:t,done:n})}),t)}(o,r,(t=e[n](t)).done,t.value)}))}}}function E(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var T=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function k(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&y(t,e,n);return T(t,e),t}function M(e){return e&&e.__esModule?e:{default:e}}function D(e,t,n,o){if("a"===n&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?o:"a"===n?o.call(e):o?o.value:t.get(e)}function C(e,t,n,o,r){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?r.call(e,n):r?r.value=n:t.set(e,n),n}function I(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function B(e,t,n){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var o;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");o=t[Symbol.asyncDispose]}if(void 0===o){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");o=t[Symbol.dispose]}if("function"!=typeof o)throw new TypeError("Object not disposable.");e.stack.push({value:t,dispose:o,async:n})}else n&&e.stack.push({async:!0});return t}var z="function"==typeof SuppressedError?SuppressedError:function(e,t,n){var o=new Error(n);return o.name="SuppressedError",o.error=e,o.suppressed=t,o};function N(e){function t(t){e.error=e.hasError?new z(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function n(){for(;e.stack.length;){var o=e.stack.pop();try{var r=o.dispose&&o.dispose.call(o.value);if(o.async)return Promise.resolve(r).then(n,(function(e){return t(e),n()}))}catch(e){t(e)}}if(e.hasError)throw e.error}()}const A={__extends:r,__assign:i,__rest:a,__decorate:s,__param:c,__metadata:d,__awaiter:m,__generator:h,__createBinding:y,__exportStar:v,__values:b,__read:g,__spread:_,__spreadArrays:w,__spreadArray:x,__await:O,__asyncGenerator:j,__asyncDelegator:S,__asyncValues:P,__makeTemplateObject:E,__importStar:k,__importDefault:M,__classPrivateFieldGet:D,__classPrivateFieldSet:C,__classPrivateFieldIn:I,__addDisposableResource:B,__disposeResources:N}}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var i=t[o]={exports:{}};return e[o].call(i.exports,i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var o=t.getElementsByTagName("script");if(o.length)for(var r=o.length-1;r>-1&&!e;)e=o[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})();var o={};return(()=>{"use strict";n.r(o),n.d(o,{compositions:()=>f,compositions_metadata:()=>m,overview:()=>d});var e={};n.r(e),n.d(e,{default:()=>p});var t=n(58500),r=(n(87363),n(40040)),i=n(70500),a=n(43077),s=["components"];function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},c.apply(this,arguments)}var l={},u="wrapper";function p(e){var t=e.components,n=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,s);return(0,r.mdx)(u,c({},l,n,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)(i.MDXScopeProvider,{components:{ScopeOverview:a.ZP},mdxType:"MDXScopeProvider"},(0,r.mdx)(a.ZP,{mdxType:"ScopeOverview"})))}p.isMDXComponent=!0;const f=[t],d=[e],m={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),o})()));
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.scope/scope-preview"]=t():e["teambit.scope/scope-preview"]=t()}(self,(()=>(()=>{var e={5576:(e,t)=>{var n;!function(){"use strict";var o={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var i=typeof n;if("string"===i||"number"===i)e.push(n);else if(Array.isArray(n)&&n.length){var a=r.apply(null,n);a&&e.push(a)}else if("object"===i)for(var s in n)o.call(n,s)&&n[s]&&e.push(s)}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(n=function(){return r}.apply(t,[]))||(e.exports=n)}()},61844:()=>{!function(){if("undefined"!=typeof window&&"undefined"!=typeof document&&"undefined"!=typeof HTMLElement){var e=!1;try{var t=document.createElement("div");t.addEventListener("focus",(function(e){e.preventDefault(),e.stopPropagation()}),!0),t.focus(Object.defineProperty({},"preventScroll",{get:function(){e=!0}}))}catch(e){}void 0!==HTMLElement.prototype.nativeFocus||e||(HTMLElement.prototype.nativeFocus=HTMLElement.prototype.focus,HTMLElement.prototype.focus=function(e){var t=window.scrollY||window.pageYOffset;this.nativeFocus(),e&&e.preventScroll&&setTimeout((function(){window.scroll(window.scrollX||window.pageXOffset,t)}),0)})}}()},65461:(e,t)=>{var n;!function(){"use strict";var o={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var i=typeof n;if("string"===i||"number"===i)e.push(n);else if(Array.isArray(n)){if(n.length){var a=r.apply(null,n);a&&e.push(a)}}else if("object"===i)if(n.toString===Object.prototype.toString)for(var s in n)o.call(n,s)&&n[s]&&e.push(s);else e.push(n.toString())}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(n=function(){return r}.apply(t,[]))||(e.exports=n)}()},13442:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isNavigator=t.isBrowser=t.off=t.on=t.noop=void 0,t.noop=function(){},t.on=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];e&&e.addEventListener&&e.addEventListener.apply(e,t)},t.off=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];e&&e.removeEventListener&&e.removeEventListener.apply(e,t)},t.isBrowser="undefined"!=typeof window,t.isNavigator="undefined"!=typeof navigator},39039:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(87363);t.default=function(e){o.useEffect(e,[])}},31277:(e,t,n)=>{"use strict";var o=n(87363),r=n(13442),i=r.isBrowser?window:null,a=function(e){return!!e.addEventListener},s=function(e){return!!e.on};t.Z=function(e,t,n,c){void 0===n&&(n=i),o.useEffect((function(){if(t&&n)return a(n)?r.on(n,e,t,c):s(n)&&n.on(e,t,c),function(){a(n)?r.off(n,e,t,c):s(n)&&n.off(e,t,c)}}),[e,t,n,JSON.stringify(c)])}},18312:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(78655),r=n(87363),i=o.__importDefault(n(55070));t.default=function(e){var t=r.useRef(0),n=r.useState(e),o=n[0],a=n[1],s=r.useCallback((function(e){cancelAnimationFrame(t.current),t.current=requestAnimationFrame((function(){a(e)}))}),[]);return i.default((function(){cancelAnimationFrame(t.current)})),[o,s]}},55070:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(78655),r=n(87363),i=o.__importDefault(n(39039));t.default=function(e){var t=r.useRef(e);t.current=e,i.default((function(){return function(){return t.current()}}))}},65634:(e,t,n)=>{"use strict";var o=n(78655),r=n(87363),i=o.__importDefault(n(18312)),a=n(13442);t.Z=function(e,t){void 0===e&&(e=1/0),void 0===t&&(t=1/0);var n=i.default({width:a.isBrowser?window.innerWidth:e,height:a.isBrowser?window.innerHeight:t}),o=n[0],s=n[1];return r.useEffect((function(){if(a.isBrowser){var e=function(){s({width:window.innerWidth,height:window.innerHeight})};return a.on(window,"resize",e),function(){a.off(window,"resize",e)}}}),[]),o}},94952:(e,t,n)=>{"use strict";var o={id:"teambit.scope/scope@1.0.123",homepage:"https://bit.cloud/teambit/scope/scope",exported:!0};function r(){const e=i(n(87363));return r=function(){return e},e}function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,r.__bit_component=o,i.__bit_component=o;const a=()=>r().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},r().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/scope.svg"}));a.__bit_component=o,t.Logo=a},30475:function(e,t,n){"use strict";var o=this&&this.__rest||function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.BaseImage=void 0;const i=r(n(87363)),a=r(n(5576)),s=r(n(18564));function c(e){var{alt:t,className:n,fullWidth:r}=e,c=o(e,["alt","className","fullWidth"]);return i.default.createElement("img",Object.assign({"data-bit-id":"teambit.base-ui/elements/image",alt:t},c,{className:a.default(s.default.image,r&&s.default.fullWidth,n)}))}c.__bit_component={id:"teambit.base-ui/elements/image@1.0.0",homepage:"https://bit.dev/teambit/base-ui/elements/image",exported:!0},t.BaseImage=c},42366:function(e,t,n){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,n,o){void 0===o&&(o=n),Object.defineProperty(e,o,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||o(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),r(n(30475),t)},78968:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Image:()=>y});var o=n(87363),r=n.n(o),i=n(65461),a=n.n(i);n(61844);const s=ReactDom;var c=n(31277),l=n(65634),u=n(78655),p=function(e){return e+"ms"},f={getBoundingClientRect:function(){return{height:0,left:0,top:0,width:0}},style:{transform:null}},d=(0,o.memo)((function(e){var t=e.children,n=e.closeText,i=void 0===n?"Unzoom Image":n,a=e.onUnload,d=e.onLoad,m=e.overlayBgColorEnd,h=void 0===m?"rgba(255, 255, 255, 0.95)":m,y=e.overlayBgColorStart,v=void 0===y?"rgba(255, 255, 255, 0)":y,b=e.parentRef,g=e.portalEl,_=void 0===g?document.body:g,w=e.scrollableEl,x=void 0===w?window:w,O=e.transitionDuration,j=void 0===O?300:O,S=e.zoomMargin,P=void 0===S?0:S,E=e.zoomZindex,T=void 0===E?2147483647:E,k=(0,o.useRef)(null),M=(0,o.useState)(0)[1],D=(0,o.useState)(!1),C=D[0],I=D[1],B=(0,o.useState)(!1),N=B[0],z=B[1],A=(0,l.Z)(),R=A.width,L=A.height,W=(0,o.useCallback)((function(e){e.preventDefault(),z(!0)}),[]),F=(0,o.useCallback)((function(e){"Escape"!==e.key&&27!==e.keyCode||(e.stopPropagation(),z(!0))}),[]),Z=(0,o.useCallback)((function(){M((function(e){return e+1})),N||z(!0)}),[N]);(0,c.Z)("keydown",F,document),(0,c.Z)("scroll",Z,x),(0,o.useEffect)((function(){I(!0),d(),k.current&&k.current.focus({preventScroll:!0})}),[d]),(0,o.useEffect)((function(){var e=N?setTimeout(a,j):null;return function(){e&&clearTimeout(e)}}),[N,a,j]);var H=b.current||f,X=H.getBoundingClientRect(),U=X.height,G=X.left,$=X.top,J=X.width,V=function(e){var t=e.isLoaded,n=e.isUnloading,o=e.overlayBgColorEnd,r=e.zoomZindex,i={backgroundColor:e.overlayBgColorStart,transitionDuration:p(e.transitionDuration),zIndex:r};return t&&!n&&(i.backgroundColor=o),i}({isLoaded:C,isUnloading:N,overlayBgColorEnd:h,overlayBgColorStart:v,transitionDuration:j,zoomZindex:T}),Y=function(e){var t=e.height,n=e.innerHeight,o=e.innerWidth,r=e.isLoaded,i=e.isUnloading,a=e.left,s=e.originalTransform,c=e.top,l=e.transitionDuration,f=e.width,d=e.zoomMargin,m=p(l);if(!r||i){var h=(0,u.__spreadArrays)(["scale(1)","translate(0, 0)"],s?[s]:[]).join(" ");return{height:t,left:a,top:c,transform:h,WebkitTransform:h,transitionDuration:m,width:f}}var y=function(e){var t=e.zoomMargin,n=e.innerWidth/(e.width+t),o=e.innerHeight/(e.height+t);return Math.min(n,o)}({height:t,innerWidth:o,innerHeight:n,width:f,zoomMargin:d}),v=(o/2-(a+f/2))/y,b=(n/2-(c+t/2))/y,g=(0,u.__spreadArrays)(["scale("+y+")","translate("+v+"px, "+b+"px)"],s?[s]:[]).join(" ");return{height:t,left:a,top:c,transform:g,WebkitTransform:g,transitionDuration:m,width:f}}({height:U,isLoaded:C,innerHeight:L,innerWidth:R,isUnloading:N,left:G,originalTransform:H.style.transform,top:$,transitionDuration:j,width:J,zoomMargin:P});return(0,s.createPortal)(r().createElement("div",{"aria-modal":!0,"data-rmiz-overlay":!0,role:"dialog",style:V},r().createElement("div",{"data-rmiz-modal-content":!0,style:Y},t),r().createElement("button",{"aria-label":i,"data-rmiz-btn-close":!0,onClick:W,ref:k})),_)}));const m=(0,o.memo)((function(e){var t=e.children,n=e.closeText,i=void 0===n?"Unzoom image":n,a=e.overlayBgColorEnd,s=void 0===a?"rgba(255, 255, 255, 0.95)":a,c=e.overlayBgColorStart,l=void 0===c?"rgba(255, 255, 255, 0)":c,u=e.portalEl,p=e.openText,f=void 0===p?"Zoom image":p,m=e.scrollableEl,h=e.transitionDuration,y=void 0===h?300:h,v=e.wrapElement,b=void 0===v?"div":v,g=e.wrapStyle,_=e.zoomMargin,w=void 0===_?0:_,x=e.zoomZindex,O=void 0===x?2147483647:x,j=(0,o.useState)(!1),S=j[0],P=j[1],E=(0,o.useState)(!1),T=E[0],k=E[1],M=(0,o.useRef)(null),D=(0,o.useRef)(null),C=(0,o.useCallback)((function(e){S||(e.preventDefault(),P(!0))}),[S]),I=(0,o.useCallback)((function(){k(!0)}),[]),B=(0,o.useCallback)((function(){P(!1),k(!1),D.current&&D.current.focus({preventScroll:!0})}),[]),N=S&&T?"hidden":"visible";return r().createElement(o.StrictMode,null,r().createElement(b,{"data-rmiz-wrap":N,ref:M,style:g},t,r().createElement("button",{"aria-label":f,"data-rmiz-btn-open":!0,onClick:C,ref:D}),"undefined"!=typeof window&&S&&r().createElement(d,{closeText:i,onLoad:I,onUnload:B,overlayBgColorEnd:s,overlayBgColorStart:l,parentRef:M,portalEl:u,scrollableEl:m,transitionDuration:y,zoomMargin:w,zoomZindex:O},t)))}));var h=n(42366);const y=e=>{var{center:t=!0,width:n,alt:o,src:i,className:s}=e,c=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}(e,["center","width","alt","src","className"]);return r().createElement("div",{style:{width:n||"100%"},className:a()(t&&"image_center__hG6ii",s)},r().createElement(m,null,r().createElement(h.BaseImage,Object.assign({fullWidth:!0,alt:o,src:i},c))))};y.__bit_component={id:"teambit.docs/ui/zoomable-image@1.95.0",homepage:"https://bit.dev/teambit/docs/ui/zoomable-image",exported:!0}},490:(e,t,n)=>{"use strict";Object.defineProperty(t,"ZP",{enumerable:!0,get:function(){return o.default}});var o=r(n(73864));function r(e){return e&&e.__esModule?e:{default:e}}r.__bit_component={id:"teambit.scope/content/scope-overview@1.95.0",homepage:"https://bit.dev/teambit/scope/content/scope-overview",exported:!0}},73864:(e,t,n)=>{"use strict";var o={id:"teambit.scope/content/scope-overview@1.95.0",homepage:"https://bit.dev/teambit/scope/content/scope-overview",exported:!0};Object.defineProperty(t,"__esModule",{value:!0}),t.default=v,p(n(87363));var r=n(40040),i=n(70500),a=p(n(30819)),s=p(n(58111)),c=p(n(71058)),l=n(78968),u=["components"];function p(e){return e&&e.__esModule?e:{default:e}}function f(){return f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},f.apply(this,arguments)}function d(e,t){if(null==e)return{};var n,o,r=m(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function m(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}p.__bit_component=o,f.__bit_component=o,d.__bit_component=o,m.__bit_component=o;var h={},y="wrapper";function v(e){var t=e.components,n=d(e,u);return(0,r.mdx)(y,f({},h,n,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)(i.MDXScopeProvider,{components:{scopeImage:a.default,scopeGraph:s.default,componentTypes:c.default,Image:l.Image},mdxType:"MDXScopeProvider"},(0,r.mdx)("h1",null,"Scope Overview"),(0,r.mdx)("p",null,"Scope is a server for hosting components. Scopes help teams to share and use each other's components as by preserving team autonomy through versioning, forking, storing dependencies, and collaborate on changes of independent components.\nScopes defines ownership on components, as a single team owns the components exported to scope."),(0,r.mdx)(l.Image,{width:"70%",src:a.default,mdxType:"Image"}),(0,r.mdx)("h2",null,"Full stack of functionality"),(0,r.mdx)("p",null,"Scopes host components of any kind, from React, Angular and Node modules, all the way to a frontend apps or microservices. For a scope they are all Bit Components.",(0,r.mdx)("br",{parentName:"p"}),"\n","For example, the ",(0,r.mdx)("a",{parentName:"p",href:"https://bit.dev/teambit/mdx"},"MDX scope"),' contains all components relevant to handling MDX functionality in Bit. It exposes various types of components (or "APIs") to achieve this: Webpack loader, Node modules, React components and even a ',(0,r.mdx)("a",{parentName:"p",href:"/"},"Bit Aspect"),". This makes it easy for other teams to take leverage of MDX, not just as a feature but also as an API for their features."),(0,r.mdx)("p",null,"Scopes support various methods for using components, from adding as dependencies to runtime integrations, allowing the consumer to decide how whats the best solution for their use case."),(0,r.mdx)(l.Image,{width:"70%",src:c.default,mdxType:"Image"}),(0,r.mdx)("h2",null,"Team collaboration using components"),(0,r.mdx)("p",null,"Scopes provides visibility to components built by other teams, this is the first step towards better collaboration. Developers can find, use and depend on components by other teams. Instead of reinventing the wheel and rebuilding the same functionality, component visibility drives for collaboration. It is similar to how teams build with microservices and build team communication and collaboration by using each-other's APIs.",(0,r.mdx)("br",{parentName:"p"}),"\n","Moreover, developers can use ",(0,r.mdx)("inlineCode",{parentName:"p"},"bit import")," and access to any component's source code and contribute change to collaborate on components."),(0,r.mdx)("p",null,"Bit keeps track on all these dependencies and flows, making team collaboration visible, easy to extend and optimize."),(0,r.mdx)(l.Image,{width:"70%",src:s.default,mdxType:"Image"}),(0,r.mdx)("h2",null,"Distributed and autonomous"),(0,r.mdx)("p",null,"Hosted scopes form a distributed network, where each scope is connected to the other scopes according to component dependencies. Each scope stores not only the components it hosts, but also the dependencies of those components.",(0,r.mdx)("br",{parentName:"p"}),"\n","When you export a component, the scope then does network calls to fetch the dependencies of the component from their respective scopes. This means that each scope becomes autonomous, as it contains all the dependencies needed to its components to run. In turn this makes teams more autonomous, as they can now build and use their components without having to worry about the dependencies."),(0,r.mdx)("p",null,"Scopes use standard HTTP for inner-scope communication, however, when building a network of scopes, you need to ensure scopes are able to connect to one another to fetch dependencies."),(0,r.mdx)("h2",null,"Source of truth"),(0,r.mdx)("p",null,"Scopes become the source of truth for components. Allowing different stakeholders to collaborate and work together from the same, or from different Workspaces.\nComponents can be maintained from multiple Workspaces in parallel, while Scopes are keeping them in sync, merging changes for all ends."),(0,r.mdx)("p",null,(0,r.mdx)("inlineCode",{parentName:"p"},"bit import")," can be used to fetch component updates. Using ",(0,r.mdx)("inlineCode",{parentName:"p"},"bit import")," is similar to using ",(0,r.mdx)("inlineCode",{parentName:"p"},"git fetch")," where new objects are being fetched but not checked out in your workspace. "),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-bash"},"$ bit import\n⡃⢐ fetching 143 components from 18 remotes. delta-only: 143, all-history: 0.\n- up to date teambit.community/ui/hero \n- up to date teambit.community/ui/homepage/sections/distribution \n- updated teambit.design/ui/layouts/sections/left-right \n- updated teambit.design/ui/layouts/sections/section-group \n- updated teambit.design/ui/layouts/sections/top-down \n")),(0,r.mdx)("p",null,(0,r.mdx)("inlineCode",{parentName:"p"},"bit export")," is used to share component changes with others. It pushes new objects from a local Workspace to a remote Scope, allowing others to keep in sync with the latest\ncomponent changes."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-bash"},"$ bit export\nexported 8 components successfully to remote scope `community`\n"))))}v.__bit_component=o,v.isMDXComponent=!0},18564:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>o});const o={fullWidth:"image_fullWidth__M5NBA"}},71058:(e,t,n)=>{"use strict";e.exports=n.p+"static/images/3a1072c009accd203fa8.png"},58111:(e,t,n)=>{"use strict";e.exports=n.p+"static/images/ccf5ea377e3a1a72829d.png"},30819:(e,t,n)=>{"use strict";e.exports=n.p+"static/images/aef2176d16de53259dad.png"},40040:e=>{"use strict";e.exports=MdxJsReact},87363:e=>{"use strict";e.exports=React},70500:e=>{"use strict";e.exports=TeambitMdxUiMdxScopeContext},78655:(e,t,n)=>{"use strict";n.r(t),n.d(t,{__addDisposableResource:()=>B,__assign:()=>i,__asyncDelegator:()=>S,__asyncGenerator:()=>j,__asyncValues:()=>P,__await:()=>O,__awaiter:()=>m,__classPrivateFieldGet:()=>D,__classPrivateFieldIn:()=>I,__classPrivateFieldSet:()=>C,__createBinding:()=>y,__decorate:()=>s,__disposeResources:()=>z,__esDecorate:()=>l,__exportStar:()=>v,__extends:()=>r,__generator:()=>h,__importDefault:()=>M,__importStar:()=>k,__makeTemplateObject:()=>E,__metadata:()=>d,__param:()=>c,__propKey:()=>p,__read:()=>g,__rest:()=>a,__runInitializers:()=>u,__setFunctionName:()=>f,__spread:()=>_,__spreadArray:()=>x,__spreadArrays:()=>w,__values:()=>b,default:()=>A});var o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},o(e,t)};function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var i=function(){return i=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},i.apply(this,arguments)};function a(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}function s(e,t,n,o){var r,i=arguments.length,a=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,o);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(i<3?r(a):i>3?r(t,n,a):r(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function c(e,t){return function(n,o){t(n,o,e)}}function l(e,t,n,o,r,i){function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,c=o.kind,l="getter"===c?"get":"setter"===c?"set":"value",u=!t&&e?o.static?e:e.prototype:null,p=t||(u?Object.getOwnPropertyDescriptor(u,o.name):{}),f=!1,d=n.length-1;d>=0;d--){var m={};for(var h in o)m[h]="access"===h?{}:o[h];for(var h in o.access)m.access[h]=o.access[h];m.addInitializer=function(e){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(e||null))};var y=(0,n[d])("accessor"===c?{get:p.get,set:p.set}:p[l],m);if("accessor"===c){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw new TypeError("Object expected");(s=a(y.get))&&(p.get=s),(s=a(y.set))&&(p.set=s),(s=a(y.init))&&r.unshift(s)}else(s=a(y))&&("field"===c?r.unshift(s):p[l]=s)}u&&Object.defineProperty(u,o.name,p),f=!0}function u(e,t,n){for(var o=arguments.length>2,r=0;r<t.length;r++)n=o?t[r].call(e,n):t[r].call(e);return o?n:void 0}function p(e){return"symbol"==typeof e?e:"".concat(e)}function f(e,t,n){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})}function d(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function m(e,t,n,o){return new(n||(n=Promise))((function(r,i){function a(e){try{c(o.next(e))}catch(e){i(e)}}function s(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((o=o.apply(e,t||[])).next())}))}function h(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],o=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}var y=Object.create?function(e,t,n,o){void 0===o&&(o=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,o,r)}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]};function v(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||y(t,e,n)}function b(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function g(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(o=i.next()).done;)a.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return a}function _(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(g(arguments[t]));return e}function w(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),r=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,r++)o[r]=i[a];return o}function x(e,t,n){if(n||2===arguments.length)for(var o,r=0,i=t.length;r<i;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}function O(e){return this instanceof O?(this.v=e,this):new O(e)}function j(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(e,t||[]),i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(e){r[e]&&(o[e]=function(t){return new Promise((function(n,o){i.push([e,t,n,o])>1||s(e,t)}))})}function s(e,t){try{(n=r[e](t)).value instanceof O?Promise.resolve(n.value.v).then(c,l):u(i[0][2],n)}catch(e){u(i[0][3],e)}var n}function c(e){s("next",e)}function l(e){s("throw",e)}function u(e,t){e(t),i.shift(),i.length&&s(i[0][0],i[0][1])}}function S(e){var t,n;return t={},o("next"),o("throw",(function(e){throw e})),o("return"),t[Symbol.iterator]=function(){return this},t;function o(o,r){t[o]=e[o]?function(t){return(n=!n)?{value:O(e[o](t)),done:!1}:r?r(t):t}:r}}function P(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=b(e),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(n){t[n]=e[n]&&function(t){return new Promise((function(o,r){!function(e,t,n,o){Promise.resolve(o).then((function(t){e({value:t,done:n})}),t)}(o,r,(t=e[n](t)).done,t.value)}))}}}function E(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var T=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function k(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&y(t,e,n);return T(t,e),t}function M(e){return e&&e.__esModule?e:{default:e}}function D(e,t,n,o){if("a"===n&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?o:"a"===n?o.call(e):o?o.value:t.get(e)}function C(e,t,n,o,r){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?r.call(e,n):r?r.value=n:t.set(e,n),n}function I(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function B(e,t,n){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var o;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");o=t[Symbol.asyncDispose]}if(void 0===o){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");o=t[Symbol.dispose]}if("function"!=typeof o)throw new TypeError("Object not disposable.");e.stack.push({value:t,dispose:o,async:n})}else n&&e.stack.push({async:!0});return t}var N="function"==typeof SuppressedError?SuppressedError:function(e,t,n){var o=new Error(n);return o.name="SuppressedError",o.error=e,o.suppressed=t,o};function z(e){function t(t){e.error=e.hasError?new N(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function n(){for(;e.stack.length;){var o=e.stack.pop();try{var r=o.dispose&&o.dispose.call(o.value);if(o.async)return Promise.resolve(r).then(n,(function(e){return t(e),n()}))}catch(e){t(e)}}if(e.hasError)throw e.error}()}const A={__extends:r,__assign:i,__rest:a,__decorate:s,__param:c,__metadata:d,__awaiter:m,__generator:h,__createBinding:y,__exportStar:v,__values:b,__read:g,__spread:_,__spreadArrays:w,__spreadArray:x,__await:O,__asyncGenerator:j,__asyncDelegator:S,__asyncValues:P,__makeTemplateObject:E,__importStar:k,__importDefault:M,__classPrivateFieldGet:D,__classPrivateFieldSet:C,__classPrivateFieldIn:I,__addDisposableResource:B,__disposeResources:z}}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var i=t[o]={exports:{}};return e[o].call(i.exports,i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var o=t.getElementsByTagName("script");if(o.length)for(var r=o.length-1;r>-1&&!e;)e=o[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})();var o={};return(()=>{"use strict";n.r(o),n.d(o,{compositions:()=>f,compositions_metadata:()=>m,overview:()=>d});var e={};n.r(e),n.d(e,{default:()=>p});var t=n(94952),r=(n(87363),n(40040)),i=n(70500),a=n(490),s=["components"];function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},c.apply(this,arguments)}var l={},u="wrapper";function p(e){var t=e.components,n=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,s);return(0,r.mdx)(u,c({},l,n,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)(i.MDXScopeProvider,{components:{ScopeOverview:a.ZP},mdxType:"MDXScopeProvider"},(0,r.mdx)(a.ZP,{mdxType:"ScopeOverview"})))}p.isMDXComponent=!0;const f=[t],d=[e],m={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),o})()));
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.scope_scope@1.0.122/dist/scope.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.scope_scope@1.0.122/dist/scope.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.scope_scope@1.0.123/dist/scope.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.scope_scope@1.0.123/dist/scope.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -1,15 +1,31 @@
1
1
  import { ComponentType } from 'react';
2
+ import { ScopeID } from '@teambit/scopes.scope-id';
3
+ import { ComponentCardPluginType, PluginProps } from '@teambit/explorer.ui.component-card';
2
4
  import { ComponentModel } from '@teambit/component';
5
+ import { ComponentDescriptor } from '@teambit/component-descriptor';
3
6
  import type { ScopeBadgeSlot, OverviewLineSlot } from '../../scope.ui.runtime';
4
7
  export type ScopeOverviewProps = {
5
8
  badgeSlot: ScopeBadgeSlot;
6
9
  overviewSlot: OverviewLineSlot;
7
10
  TargetOverview?: ComponentType;
8
11
  };
12
+ export declare class LinkPlugin {
13
+ link(id: any): any;
14
+ }
9
15
  export declare function ScopeOverview({ badgeSlot, overviewSlot, TargetOverview }: ScopeOverviewProps): JSX.Element;
10
16
  type ScopeComponentCardProps = {
11
- component: ComponentModel;
17
+ component?: ComponentModel;
18
+ componentDescriptor?: ComponentDescriptor;
19
+ plugins?: ComponentCardPluginType<PluginProps>[];
20
+ scope?: {
21
+ icon?: string;
22
+ backgroundIconColor?: string;
23
+ id: ScopeID;
24
+ };
12
25
  componentUrl?: string;
13
26
  };
14
- export declare function ScopeComponentCard({ component, componentUrl }: ScopeComponentCardProps): JSX.Element;
27
+ export declare function ScopeComponentCard({ componentDescriptor, plugins }: ScopeComponentCardProps): JSX.Element;
28
+ export declare function useCardPlugins({ compModelsById, }: {
29
+ compModelsById: Map<string, ComponentModel>;
30
+ }): ComponentCardPluginType<PluginProps>[];
15
31
  export {};
@@ -3,8 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.LinkPlugin = void 0;
6
7
  exports.ScopeComponentCard = ScopeComponentCard;
7
8
  exports.ScopeOverview = ScopeOverview;
9
+ exports.useCardPlugins = useCardPlugins;
8
10
  function _react() {
9
11
  const data = _interopRequireWildcard(require("react"));
10
12
  _react = function () {
@@ -13,15 +15,8 @@ function _react() {
13
15
  return data;
14
16
  }
15
17
  function _explorerUiGallery() {
16
- const data = require("@teambit/explorer.ui.gallery.component-card");
17
- _explorerUiGallery = function () {
18
- return data;
19
- };
20
- return data;
21
- }
22
- function _explorerUiGallery2() {
23
18
  const data = require("@teambit/explorer.ui.gallery.component-grid");
24
- _explorerUiGallery2 = function () {
19
+ _explorerUiGallery = function () {
25
20
  return data;
26
21
  };
27
22
  return data;
@@ -47,6 +42,27 @@ function _scopeUi2() {
47
42
  };
48
43
  return data;
49
44
  }
45
+ function _designUi() {
46
+ const data = require("@teambit/design.ui.tooltip");
47
+ _designUi = function () {
48
+ return data;
49
+ };
50
+ return data;
51
+ }
52
+ function _componentId() {
53
+ const data = require("@teambit/component-id");
54
+ _componentId = function () {
55
+ return data;
56
+ };
57
+ return data;
58
+ }
59
+ function _explorerUi() {
60
+ const data = require("@teambit/explorer.ui.component-card");
61
+ _explorerUi = function () {
62
+ return data;
63
+ };
64
+ return data;
65
+ }
50
66
  function _scopeUiHooks() {
51
67
  const data = require("@teambit/scope.ui.hooks.scope-context");
52
68
  _scopeUiHooks = function () {
@@ -64,6 +80,12 @@ function _scopeOverviewModule() {
64
80
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
65
81
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
66
82
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
83
+ class LinkPlugin {
84
+ link(id) {
85
+ return id.fullName;
86
+ }
87
+ }
88
+ exports.LinkPlugin = LinkPlugin;
67
89
  function ScopeOverview({
68
90
  badgeSlot,
69
91
  overviewSlot,
@@ -71,12 +93,18 @@ function ScopeOverview({
71
93
  }) {
72
94
  const scope = (0, _react().useContext)(_scopeUiHooks().ScopeContext);
73
95
  const {
74
- components
96
+ components,
97
+ componentDescriptors
75
98
  } = scope;
76
99
  if (TargetOverview) return /*#__PURE__*/_react().default.createElement(TargetOverview, null);
77
100
  if (!components || components.length === 0) return /*#__PURE__*/_react().default.createElement(_scopeUi2().EmptyScope, {
78
101
  name: scope.name
79
102
  });
103
+ const compDescriptorById = new Map(componentDescriptors.map(comp => [comp.id.toString(), comp]));
104
+ const compModelsById = new Map(components.map(comp => [comp.id.toString(), comp]));
105
+ const plugins = useCardPlugins({
106
+ compModelsById
107
+ });
80
108
  return /*#__PURE__*/_react().default.createElement("div", {
81
109
  className: _scopeOverviewModule().default.container
82
110
  }, /*#__PURE__*/_react().default.createElement(_scopeUi().ScopeDetails, {
@@ -87,31 +115,64 @@ function ScopeOverview({
87
115
  overviewSlot: overviewSlot,
88
116
  description: scope.description,
89
117
  componentCount: scope.components.length
90
- }), /*#__PURE__*/_react().default.createElement(_explorerUiGallery2().ComponentGrid, null, components.map((component, index) => {
118
+ }), /*#__PURE__*/_react().default.createElement(_explorerUiGallery().ComponentGrid, {
119
+ className: _scopeOverviewModule().default.cardGrid
120
+ }, components.map(component => {
91
121
  if (component.deprecation?.isDeprecate) return null;
92
122
  return /*#__PURE__*/_react().default.createElement("div", {
93
- key: index
123
+ key: component.id.toString()
94
124
  }, /*#__PURE__*/_react().default.createElement(ScopeComponentCard, {
95
- component: component
125
+ component: component,
126
+ plugins: plugins,
127
+ componentDescriptor: compDescriptorById.get(component.id.toString())
96
128
  }));
97
129
  })));
98
130
  }
99
131
  function ScopeComponentCard({
100
- component,
101
- componentUrl
132
+ componentDescriptor,
133
+ plugins
102
134
  }) {
103
- const shouldShowPreview = component.compositions.length > 0;
104
- return /*#__PURE__*/_react().default.createElement(_explorerUiGallery().ComponentCard, {
105
- id: component.id.fullName,
106
- envIcon: component.environment?.icon,
107
- description: component.description,
108
- version: component.version,
109
- href: componentUrl,
110
- preview: /*#__PURE__*/_react().default.createElement(_previewUi().PreviewPlaceholder, {
111
- component: component,
112
- shouldShowPreview: shouldShowPreview
113
- })
135
+ if (!componentDescriptor) return null;
136
+ return /*#__PURE__*/_react().default.createElement(_explorerUi().ComponentCard, {
137
+ plugins: plugins,
138
+ component: componentDescriptor
114
139
  });
115
140
  }
141
+ function useCardPlugins({
142
+ compModelsById
143
+ }) {
144
+ const plugins = _react().default.useMemo(() => [{
145
+ preview: function Preview({
146
+ component
147
+ }) {
148
+ const compModel = compModelsById.get(component.id.toString());
149
+ if (!compModel) return null;
150
+ return /*#__PURE__*/_react().default.createElement(_previewUi().PreviewPlaceholder, {
151
+ componentDescriptor: component,
152
+ component: compModel,
153
+ shouldShowPreview: compModel.compositions.length > 0
154
+ });
155
+ }
156
+ }, {
157
+ previewBottomRight: function PreviewBottomRight({
158
+ component
159
+ }) {
160
+ const env = component.get('teambit.envs/envs');
161
+ const envComponentId = env?.id ? _componentId().ComponentID.fromString(env?.id) : undefined;
162
+ return /*#__PURE__*/_react().default.createElement("div", {
163
+ className: _scopeOverviewModule().default.rightPreviewPlugins
164
+ }, /*#__PURE__*/_react().default.createElement("div", {
165
+ className: _scopeOverviewModule().default.badge
166
+ }, /*#__PURE__*/_react().default.createElement(_designUi().Tooltip, {
167
+ delay: 300,
168
+ content: envComponentId?.name
169
+ }, /*#__PURE__*/_react().default.createElement("img", {
170
+ src: env?.icon,
171
+ className: _scopeOverviewModule().default.envIcon
172
+ }))));
173
+ }
174
+ }, new LinkPlugin()], [compModelsById.size]);
175
+ return plugins;
176
+ }
116
177
 
117
178
  //# sourceMappingURL=scope-overview.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","data","_interopRequireWildcard","require","_explorerUiGallery","_explorerUiGallery2","_scopeUi","_previewUi","_scopeUi2","_scopeUiHooks","_scopeOverviewModule","_interopRequireDefault","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","ScopeOverview","badgeSlot","overviewSlot","TargetOverview","scope","useContext","ScopeContext","components","createElement","length","EmptyScope","name","className","styles","container","ScopeDetails","scopeName","icon","backgroundIconColor","description","componentCount","ComponentGrid","map","component","index","deprecation","isDeprecate","key","ScopeComponentCard","componentUrl","shouldShowPreview","compositions","ComponentCard","id","fullName","envIcon","environment","version","href","preview","PreviewPlaceholder"],"sources":["scope-overview.tsx"],"sourcesContent":["import React, { useContext, ComponentType } from 'react';\nimport { ComponentCard } from '@teambit/explorer.ui.gallery.component-card';\nimport { ComponentGrid } from '@teambit/explorer.ui.gallery.component-grid';\nimport { ScopeDetails } from '@teambit/scope.ui.scope-details';\nimport { PreviewPlaceholder } from '@teambit/preview.ui.preview-placeholder';\nimport { EmptyScope } from '@teambit/scope.ui.empty-scope';\nimport { ComponentModel } from '@teambit/component';\nimport { ScopeContext } from '@teambit/scope.ui.hooks.scope-context';\nimport styles from './scope-overview.module.scss';\nimport type { ScopeBadgeSlot, OverviewLineSlot } from '../../scope.ui.runtime';\n\nexport type ScopeOverviewProps = {\n badgeSlot: ScopeBadgeSlot;\n overviewSlot: OverviewLineSlot;\n TargetOverview?: ComponentType;\n};\n\nexport function ScopeOverview({ badgeSlot, overviewSlot, TargetOverview }: ScopeOverviewProps) {\n const scope = useContext(ScopeContext);\n const { components } = scope;\n if (TargetOverview) return <TargetOverview />;\n if (!components || components.length === 0) return <EmptyScope name={scope.name} />;\n\n return (\n <div className={styles.container}>\n <ScopeDetails\n scopeName={scope.name}\n icon={scope.icon}\n backgroundIconColor={scope.backgroundIconColor}\n badgeSlot={badgeSlot}\n overviewSlot={overviewSlot}\n description={scope.description}\n componentCount={scope.components.length}\n />\n <ComponentGrid>\n {components.map((component, index) => {\n if (component.deprecation?.isDeprecate) return null;\n return (\n <div key={index}>\n <ScopeComponentCard component={component} />\n </div>\n );\n })}\n </ComponentGrid>\n </div>\n );\n}\n\ntype ScopeComponentCardProps = {\n component: ComponentModel;\n componentUrl?: string;\n};\n\nexport function ScopeComponentCard({ component, componentUrl }: ScopeComponentCardProps) {\n const shouldShowPreview = component.compositions.length > 0;\n return (\n <ComponentCard\n id={component.id.fullName}\n envIcon={component.environment?.icon}\n description={component.description}\n version={component.version}\n href={componentUrl}\n preview={<PreviewPlaceholder component={component} shouldShowPreview={shouldShowPreview} />}\n />\n );\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,mBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,kBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,oBAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,mBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,SAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,QAAA,YAAAA,CAAA;IAAA,OAAAL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+ {"version":3,"names":["_react","data","_interopRequireWildcard","require","_explorerUiGallery","_scopeUi","_previewUi","_scopeUi2","_designUi","_componentId","_explorerUi","_scopeUiHooks","_scopeOverviewModule","_interopRequireDefault","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","LinkPlugin","link","id","fullName","exports","ScopeOverview","badgeSlot","overviewSlot","TargetOverview","scope","useContext","ScopeContext","components","componentDescriptors","createElement","length","EmptyScope","name","compDescriptorById","Map","map","comp","toString","compModelsById","plugins","useCardPlugins","className","styles","container","ScopeDetails","scopeName","icon","backgroundIconColor","description","componentCount","ComponentGrid","cardGrid","component","deprecation","isDeprecate","key","ScopeComponentCard","componentDescriptor","ComponentCard","React","useMemo","preview","Preview","compModel","PreviewPlaceholder","shouldShowPreview","compositions","previewBottomRight","PreviewBottomRight","env","envComponentId","ComponentID","fromString","undefined","rightPreviewPlugins","badge","Tooltip","delay","content","src","envIcon","size"],"sources":["scope-overview.tsx"],"sourcesContent":["import React, { useContext, ComponentType } from 'react';\nimport { ScopeID } from '@teambit/scopes.scope-id';\nimport { ComponentGrid } from '@teambit/explorer.ui.gallery.component-grid';\nimport { ScopeDetails } from '@teambit/scope.ui.scope-details';\nimport { PreviewPlaceholder } from '@teambit/preview.ui.preview-placeholder';\nimport { EmptyScope } from '@teambit/scope.ui.empty-scope';\nimport { Tooltip } from '@teambit/design.ui.tooltip';\nimport { ComponentID } from '@teambit/component-id';\nimport { ComponentCard, ComponentCardPluginType, PluginProps } from '@teambit/explorer.ui.component-card';\nimport { ComponentModel } from '@teambit/component';\nimport { ScopeContext } from '@teambit/scope.ui.hooks.scope-context';\nimport { ComponentDescriptor } from '@teambit/component-descriptor';\nimport styles from './scope-overview.module.scss';\nimport type { ScopeBadgeSlot, OverviewLineSlot } from '../../scope.ui.runtime';\n\nexport type ScopeOverviewProps = {\n badgeSlot: ScopeBadgeSlot;\n overviewSlot: OverviewLineSlot;\n TargetOverview?: ComponentType;\n};\n\nexport class LinkPlugin {\n link(id) {\n return id.fullName;\n }\n}\n\nexport function ScopeOverview({ badgeSlot, overviewSlot, TargetOverview }: ScopeOverviewProps) {\n const scope = useContext(ScopeContext);\n const { components, componentDescriptors } = scope;\n if (TargetOverview) return <TargetOverview />;\n if (!components || components.length === 0) return <EmptyScope name={scope.name} />;\n const compDescriptorById = new Map(componentDescriptors.map((comp) => [comp.id.toString(), comp]));\n const compModelsById = new Map(components.map((comp) => [comp.id.toString(), comp]));\n const plugins = useCardPlugins({ compModelsById });\n\n return (\n <div className={styles.container}>\n <ScopeDetails\n scopeName={scope.name}\n icon={scope.icon}\n backgroundIconColor={scope.backgroundIconColor}\n badgeSlot={badgeSlot}\n overviewSlot={overviewSlot}\n description={scope.description}\n componentCount={scope.components.length}\n />\n <ComponentGrid className={styles.cardGrid}>\n {components.map((component) => {\n if (component.deprecation?.isDeprecate) return null;\n return (\n <div key={component.id.toString()}>\n <ScopeComponentCard\n component={component}\n plugins={plugins}\n componentDescriptor={compDescriptorById.get(component.id.toString())}\n />\n </div>\n );\n })}\n </ComponentGrid>\n </div>\n );\n}\n\ntype ScopeComponentCardProps = {\n component?: ComponentModel;\n componentDescriptor?: ComponentDescriptor;\n plugins?: ComponentCardPluginType<PluginProps>[];\n scope?: {\n icon?: string;\n backgroundIconColor?: string;\n id: ScopeID;\n };\n componentUrl?: string;\n};\n\nexport function ScopeComponentCard({ componentDescriptor, plugins }: ScopeComponentCardProps) {\n if (!componentDescriptor) return null;\n\n return <ComponentCard plugins={plugins} component={componentDescriptor} />;\n}\n\nexport function useCardPlugins({\n compModelsById,\n}: {\n compModelsById: Map<string, ComponentModel>;\n}): ComponentCardPluginType<PluginProps>[] {\n const plugins = React.useMemo(\n () => [\n {\n preview: function Preview({ component }) {\n const compModel = compModelsById.get(component.id.toString());\n if (!compModel) return null;\n return (\n <PreviewPlaceholder\n componentDescriptor={component}\n component={compModel}\n shouldShowPreview={compModel.compositions.length > 0}\n />\n );\n },\n },\n {\n previewBottomRight: function PreviewBottomRight({ component }) {\n const env = component.get('teambit.envs/envs');\n const envComponentId = env?.id ? ComponentID.fromString(env?.id) : undefined;\n\n return (\n <div className={styles.rightPreviewPlugins}>\n <div className={styles.badge}>\n <Tooltip delay={300} content={envComponentId?.name}>\n <img src={env?.icon} className={styles.envIcon} />\n </Tooltip>\n </div>\n </div>\n );\n },\n },\n new LinkPlugin(),\n ],\n [compModelsById.size]\n );\n\n return plugins;\n}\n"],"mappings":";;;;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,mBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,kBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,WAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,UAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,SAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,UAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,SAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,aAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAAM,YAAA,YAAAA,CAAA;IAAA,OAAAR,IAA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B,gBACzC/F,MAAA,GAAAgB,OAAA,CAAAkC,aAAA;QAAKY,SAAS,EAAEC,8BAAM,CAACiC;MAAM,gBAC3BhG,MAAA,GAAAgB,OAAA,CAAAkC,aAAA,CAAC1C,SAAA,GAAAyF,OAAO;QAACC,KAAK,EAAE,GAAI;QAACC,OAAO,EAAER,cAAc,EAAEtC;MAAK,gBACjDrD,MAAA,GAAAgB,OAAA,CAAAkC,aAAA;QAAKkD,GAAG,EAAEV,GAAG,EAAEvB,IAAK;QAACL,SAAS,EAAEC,8BAAM,CAACsC;MAAQ,CAAE,CAC1C,CACN,CACF,CAAC;IAEV;EACF,CAAC,EACD,IAAIjE,UAAU,CAAC,CAAC,CACjB,EACD,CAACuB,cAAc,CAAC2C,IAAI,CACtB,CAAC;EAED,OAAO1C,OAAO;AAChB"}
@@ -4,3 +4,14 @@
4
4
  height: 100%;
5
5
  box-sizing: border-box;
6
6
  }
7
+
8
+ .cardGrid {
9
+ grid-column-gap: 10px;
10
+ grid-gap: 32px 24px;
11
+ -moz-column-gap: 10px;
12
+ column-gap: 10px;
13
+ display: grid;
14
+ gap: 32px 24px;
15
+ grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
16
+ max-width: 1280px;
17
+ }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/scope",
3
- "version": "1.0.122",
3
+ "version": "1.0.123",
4
4
  "homepage": "https://bit.cloud/teambit/scope/scope",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.scope",
8
8
  "name": "scope",
9
- "version": "1.0.122"
9
+ "version": "1.0.123"
10
10
  },
11
11
  "dependencies": {
12
12
  "fs-extra": "10.0.0",
@@ -27,7 +27,6 @@
27
27
  "@teambit/legacy-bit-id": "1.1.0",
28
28
  "@teambit/legacy-component-log": "0.0.402",
29
29
  "@teambit/design.ui.tree": "0.0.15",
30
- "@teambit/lanes.hooks.use-lane-components": "0.0.253",
31
30
  "@teambit/lanes.hooks.use-lanes": "0.0.254",
32
31
  "@teambit/lanes.ui.models.lanes-model": "0.0.207",
33
32
  "@teambit/ui-foundation.ui.side-bar": "0.0.871",
@@ -52,34 +51,38 @@
52
51
  "@teambit/ui-foundation.ui.top-bar": "0.0.514",
53
52
  "@teambit/ui-foundation.ui.use-box.dropdown": "0.0.141",
54
53
  "@teambit/ui-foundation.ui.use-box.scope-menu": "0.0.145",
55
- "@teambit/explorer.ui.gallery.component-card": "0.0.513",
54
+ "@teambit/scopes.scope-id": "0.0.7",
55
+ "@teambit/design.ui.tooltip": "0.0.361",
56
+ "@teambit/explorer.ui.component-card": "0.0.30",
56
57
  "@teambit/explorer.ui.gallery.component-grid": "0.0.496",
57
58
  "@teambit/scope.ui.empty-scope": "0.0.509",
58
59
  "@teambit/scope.ui.scope-details": "0.0.526",
59
60
  "@teambit/component.modules.component-url": "0.0.167",
60
61
  "@teambit/scope.ui.hooks.scope-context": "0.0.495",
61
62
  "@teambit/scope.models.scope-model": "0.0.501",
62
- "@teambit/aspect-loader": "1.0.122",
63
- "@teambit/cli": "0.0.844",
64
- "@teambit/compiler": "1.0.122",
65
- "@teambit/component": "1.0.122",
66
- "@teambit/dependency-resolver": "1.0.122",
67
- "@teambit/envs": "1.0.122",
68
- "@teambit/global-config": "0.0.847",
63
+ "@teambit/aspect-loader": "1.0.123",
64
+ "@teambit/cli": "0.0.845",
65
+ "@teambit/compiler": "1.0.123",
66
+ "@teambit/component": "1.0.123",
67
+ "@teambit/dependency-resolver": "1.0.123",
68
+ "@teambit/envs": "1.0.123",
69
+ "@teambit/global-config": "0.0.848",
69
70
  "@teambit/harmony.modules.requireable-component": "0.0.497",
70
- "@teambit/isolator": "1.0.122",
71
- "@teambit/logger": "0.0.937",
72
- "@teambit/builder": "1.0.122",
73
- "@teambit/express": "0.0.943",
74
- "@teambit/graph": "1.0.122",
75
- "@teambit/graphql": "1.0.122",
76
- "@teambit/ui": "1.0.122",
71
+ "@teambit/isolator": "1.0.123",
72
+ "@teambit/logger": "0.0.938",
73
+ "@teambit/builder": "1.0.123",
74
+ "@teambit/express": "0.0.944",
75
+ "@teambit/graph": "1.0.123",
76
+ "@teambit/graphql": "1.0.123",
77
+ "@teambit/ui": "1.0.123",
77
78
  "@teambit/workspace.modules.match-pattern": "0.0.504",
78
79
  "@teambit/component.ui.component-drawer": "0.0.385",
79
- "@teambit/command-bar": "1.0.122",
80
- "@teambit/component-tree": "1.0.122",
81
- "@teambit/sidebar": "1.0.122",
82
- "@teambit/preview.ui.preview-placeholder": "0.0.507"
80
+ "@teambit/lanes.hooks.use-lane-components": "0.0.255",
81
+ "@teambit/command-bar": "1.0.123",
82
+ "@teambit/component-tree": "1.0.123",
83
+ "@teambit/sidebar": "1.0.123",
84
+ "@teambit/preview.ui.preview-placeholder": "0.0.508",
85
+ "@teambit/component-descriptor": "0.0.412"
83
86
  },
84
87
  "devDependencies": {
85
88
  "@types/fs-extra": "9.0.7",
@@ -4,3 +4,14 @@
4
4
  height: 100%;
5
5
  box-sizing: border-box;
6
6
  }
7
+
8
+ .cardGrid {
9
+ grid-column-gap: 10px;
10
+ grid-gap: 32px 24px;
11
+ -moz-column-gap: 10px;
12
+ column-gap: 10px;
13
+ display: grid;
14
+ gap: 32px 24px;
15
+ grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
16
+ max-width: 1280px;
17
+ }
@@ -1,11 +1,15 @@
1
1
  import React, { useContext, ComponentType } from 'react';
2
- import { ComponentCard } from '@teambit/explorer.ui.gallery.component-card';
2
+ import { ScopeID } from '@teambit/scopes.scope-id';
3
3
  import { ComponentGrid } from '@teambit/explorer.ui.gallery.component-grid';
4
4
  import { ScopeDetails } from '@teambit/scope.ui.scope-details';
5
5
  import { PreviewPlaceholder } from '@teambit/preview.ui.preview-placeholder';
6
6
  import { EmptyScope } from '@teambit/scope.ui.empty-scope';
7
+ import { Tooltip } from '@teambit/design.ui.tooltip';
8
+ import { ComponentID } from '@teambit/component-id';
9
+ import { ComponentCard, ComponentCardPluginType, PluginProps } from '@teambit/explorer.ui.component-card';
7
10
  import { ComponentModel } from '@teambit/component';
8
11
  import { ScopeContext } from '@teambit/scope.ui.hooks.scope-context';
12
+ import { ComponentDescriptor } from '@teambit/component-descriptor';
9
13
  import styles from './scope-overview.module.scss';
10
14
  import type { ScopeBadgeSlot, OverviewLineSlot } from '../../scope.ui.runtime';
11
15
 
@@ -15,11 +19,20 @@ export type ScopeOverviewProps = {
15
19
  TargetOverview?: ComponentType;
16
20
  };
17
21
 
22
+ export class LinkPlugin {
23
+ link(id) {
24
+ return id.fullName;
25
+ }
26
+ }
27
+
18
28
  export function ScopeOverview({ badgeSlot, overviewSlot, TargetOverview }: ScopeOverviewProps) {
19
29
  const scope = useContext(ScopeContext);
20
- const { components } = scope;
30
+ const { components, componentDescriptors } = scope;
21
31
  if (TargetOverview) return <TargetOverview />;
22
32
  if (!components || components.length === 0) return <EmptyScope name={scope.name} />;
33
+ const compDescriptorById = new Map(componentDescriptors.map((comp) => [comp.id.toString(), comp]));
34
+ const compModelsById = new Map(components.map((comp) => [comp.id.toString(), comp]));
35
+ const plugins = useCardPlugins({ compModelsById });
23
36
 
24
37
  return (
25
38
  <div className={styles.container}>
@@ -32,12 +45,16 @@ export function ScopeOverview({ badgeSlot, overviewSlot, TargetOverview }: Scope
32
45
  description={scope.description}
33
46
  componentCount={scope.components.length}
34
47
  />
35
- <ComponentGrid>
36
- {components.map((component, index) => {
48
+ <ComponentGrid className={styles.cardGrid}>
49
+ {components.map((component) => {
37
50
  if (component.deprecation?.isDeprecate) return null;
38
51
  return (
39
- <div key={index}>
40
- <ScopeComponentCard component={component} />
52
+ <div key={component.id.toString()}>
53
+ <ScopeComponentCard
54
+ component={component}
55
+ plugins={plugins}
56
+ componentDescriptor={compDescriptorById.get(component.id.toString())}
57
+ />
41
58
  </div>
42
59
  );
43
60
  })}
@@ -47,20 +64,63 @@ export function ScopeOverview({ badgeSlot, overviewSlot, TargetOverview }: Scope
47
64
  }
48
65
 
49
66
  type ScopeComponentCardProps = {
50
- component: ComponentModel;
67
+ component?: ComponentModel;
68
+ componentDescriptor?: ComponentDescriptor;
69
+ plugins?: ComponentCardPluginType<PluginProps>[];
70
+ scope?: {
71
+ icon?: string;
72
+ backgroundIconColor?: string;
73
+ id: ScopeID;
74
+ };
51
75
  componentUrl?: string;
52
76
  };
53
77
 
54
- export function ScopeComponentCard({ component, componentUrl }: ScopeComponentCardProps) {
55
- const shouldShowPreview = component.compositions.length > 0;
56
- return (
57
- <ComponentCard
58
- id={component.id.fullName}
59
- envIcon={component.environment?.icon}
60
- description={component.description}
61
- version={component.version}
62
- href={componentUrl}
63
- preview={<PreviewPlaceholder component={component} shouldShowPreview={shouldShowPreview} />}
64
- />
78
+ export function ScopeComponentCard({ componentDescriptor, plugins }: ScopeComponentCardProps) {
79
+ if (!componentDescriptor) return null;
80
+
81
+ return <ComponentCard plugins={plugins} component={componentDescriptor} />;
82
+ }
83
+
84
+ export function useCardPlugins({
85
+ compModelsById,
86
+ }: {
87
+ compModelsById: Map<string, ComponentModel>;
88
+ }): ComponentCardPluginType<PluginProps>[] {
89
+ const plugins = React.useMemo(
90
+ () => [
91
+ {
92
+ preview: function Preview({ component }) {
93
+ const compModel = compModelsById.get(component.id.toString());
94
+ if (!compModel) return null;
95
+ return (
96
+ <PreviewPlaceholder
97
+ componentDescriptor={component}
98
+ component={compModel}
99
+ shouldShowPreview={compModel.compositions.length > 0}
100
+ />
101
+ );
102
+ },
103
+ },
104
+ {
105
+ previewBottomRight: function PreviewBottomRight({ component }) {
106
+ const env = component.get('teambit.envs/envs');
107
+ const envComponentId = env?.id ? ComponentID.fromString(env?.id) : undefined;
108
+
109
+ return (
110
+ <div className={styles.rightPreviewPlugins}>
111
+ <div className={styles.badge}>
112
+ <Tooltip delay={300} content={envComponentId?.name}>
113
+ <img src={env?.icon} className={styles.envIcon} />
114
+ </Tooltip>
115
+ </div>
116
+ </div>
117
+ );
118
+ },
119
+ },
120
+ new LinkPlugin(),
121
+ ],
122
+ [compModelsById.size]
65
123
  );
124
+
125
+ return plugins;
66
126
  }