@teambit/env 1.0.209 → 1.0.210

Sign up to get free protection for your applications and to get access to all the features.
Files changed (22) hide show
  1. package/artifacts/__bit_junit.xml +1 -1
  2. package/artifacts/env-template/public/{310.26b43bf6f6658e87fc58.js → 310.1bdd70f95e2ae9ddc094.js} +8 -8
  3. package/artifacts/env-template/public/{170.e2586eafaae3c27235b8.js → 873.bb143d45f2fc3510cd88.js} +3 -3
  4. package/artifacts/env-template/public/assets-manifest.json +12 -12
  5. package/artifacts/env-template/public/compositions.c7c1d2f528c28865a09f.js +17 -0
  6. package/artifacts/env-template/public/compositions.html +1 -1
  7. package/artifacts/env-template/public/{overview.7c8598f70e9ab413928c.js → overview.903ca5cb26de560f7580.js} +1 -1
  8. package/artifacts/env-template/public/overview.html +1 -1
  9. package/artifacts/env-template/public/peers.10b809d7c5292dad93b6.js +1 -0
  10. package/artifacts/env-template/public/{preview-root.1a09ddf180be0092f126.js → preview-root.c040b7b16d03bf82254f.js} +1 -1
  11. package/artifacts/preview/teambit_envs_env-preview.js +1 -1
  12. package/artifacts/schema.json +1 -1
  13. package/dist/env.env.js +1 -1
  14. package/dist/env.env.js.map +1 -1
  15. package/dist/env.main.runtime.js +1 -1
  16. package/dist/env.main.runtime.js.map +1 -1
  17. package/dist/{preview-1711509617758.js → preview-1711617900376.js} +2 -2
  18. package/package.json +6 -6
  19. package/artifacts/env-template/public/compositions.7fa6c70f6569383f318a.js +0 -17
  20. package/artifacts/env-template/public/peers.c4f7970832a3693bee9e.js +0 -1
  21. /package/{compositions-1711509617758.js → compositions-1711617900376.js} +0 -0
  22. /package/{overview-1711509617758.js → overview-1711617900376.js} +0 -0
@@ -1,25 +1,25 @@
1
1
  {
2
- "170.e2586eafaae3c27235b8.js": "170.e2586eafaae3c27235b8.js",
3
- "310.26b43bf6f6658e87fc58.js": "310.26b43bf6f6658e87fc58.js",
2
+ "310.1bdd70f95e2ae9ddc094.js": "310.1bdd70f95e2ae9ddc094.js",
4
3
  "700.f5fce5db582bd65bc0df.js": "700.f5fce5db582bd65bc0df.js",
5
4
  "851.d2664a57f5d46b636e5f.js": "851.d2664a57f5d46b636e5f.js",
5
+ "873.bb143d45f2fc3510cd88.js": "873.bb143d45f2fc3510cd88.js",
6
6
  "compositions.css": "static/css/compositions.2a7f63f9.css",
7
7
  "compositions.html": "compositions.html",
8
- "compositions.js": "compositions.7fa6c70f6569383f318a.js",
8
+ "compositions.js": "compositions.c7c1d2f528c28865a09f.js",
9
9
  "entrypoints": {
10
10
  "peers": {
11
11
  "assets": {
12
12
  "js": [
13
13
  "851.d2664a57f5d46b636e5f.js",
14
- "peers.c4f7970832a3693bee9e.js"
14
+ "peers.10b809d7c5292dad93b6.js"
15
15
  ]
16
16
  }
17
17
  },
18
18
  "preview-root": {
19
19
  "assets": {
20
20
  "js": [
21
- "170.e2586eafaae3c27235b8.js",
22
- "preview-root.1a09ddf180be0092f126.js"
21
+ "873.bb143d45f2fc3510cd88.js",
22
+ "preview-root.c040b7b16d03bf82254f.js"
23
23
  ],
24
24
  "css": [
25
25
  "static/css/preview-root.5fd7d59d.css"
@@ -30,7 +30,7 @@
30
30
  "assets": {
31
31
  "js": [
32
32
  "700.f5fce5db582bd65bc0df.js",
33
- "compositions.7fa6c70f6569383f318a.js"
33
+ "compositions.c7c1d2f528c28865a09f.js"
34
34
  ],
35
35
  "css": [
36
36
  "static/css/compositions.2a7f63f9.css"
@@ -40,8 +40,8 @@
40
40
  "overview": {
41
41
  "assets": {
42
42
  "js": [
43
- "310.26b43bf6f6658e87fc58.js",
44
- "overview.7c8598f70e9ab413928c.js"
43
+ "310.1bdd70f95e2ae9ddc094.js",
44
+ "overview.903ca5cb26de560f7580.js"
45
45
  ],
46
46
  "css": [
47
47
  "static/css/310.cdd78dee.css"
@@ -50,9 +50,9 @@
50
50
  }
51
51
  },
52
52
  "overview.html": "overview.html",
53
- "overview.js": "overview.7c8598f70e9ab413928c.js",
54
- "peers.js": "peers.c4f7970832a3693bee9e.js",
53
+ "overview.js": "overview.903ca5cb26de560f7580.js",
54
+ "peers.js": "peers.10b809d7c5292dad93b6.js",
55
55
  "preview-root.css": "static/css/preview-root.5fd7d59d.css",
56
- "preview-root.js": "preview-root.1a09ddf180be0092f126.js",
56
+ "preview-root.js": "preview-root.c040b7b16d03bf82254f.js",
57
57
  "static/css/310.cdd78dee.css": "static/css/310.cdd78dee.css"
58
58
  }
@@ -0,0 +1,17 @@
1
+ "use strict";(self.__loadChunks_EnvTemplate=self.__loadChunks_EnvTemplate||[]).push([[384],{58091:(__unused_webpack_module,exports)=>{Object.defineProperty(exports,"__esModule",{value:!0}),exports.BitBaseEvent=void 0;class BitBaseEvent{constructor(type,version,timestamp,data){this.type=type,this.version=version,this.timestamp=timestamp,this.data=data}}exports.BitBaseEvent=BitBaseEvent},23732:(__unused_webpack_module,exports,__webpack_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"BitBaseEvent",{enumerable:!0,get:function(){return _bitBaseEvent().BitBaseEvent}}),Object.defineProperty(exports,"PubsubAspect",{enumerable:!0,get:function(){return _pubsub().PubsubAspect}}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return _pubsub().PubsubAspect}}),Object.defineProperty(exports,"usePubSub",{enumerable:!0,get:function(){return _pubsubContext().usePubSub}}),Object.defineProperty(exports,"usePubSubIframe",{enumerable:!0,get:function(){return _pubsubContext().usePubSubIframe}});function _pubsub(){const data=__webpack_require__(1737);return _pubsub=function(){return data},data}function _bitBaseEvent(){const data=__webpack_require__(58091);return _bitBaseEvent=function(){return data},data}function _pubsubContext(){const data=__webpack_require__(47492);return _pubsubContext=function(){return data},data}},47492:(__unused_webpack_module,exports,__webpack_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0}),exports.createProvider=createProvider,exports.pubsubRegistry=void 0,exports.usePubSub=usePubSub,exports.usePubSubIframe=usePubSubIframe;function _react(){const data=_interopRequireWildcard(__webpack_require__(59496));return _react=function(){return data},data}function _getRequireWildcardCache(e){if(typeof WeakMap!="function")return null;var r=new WeakMap,t=new WeakMap;return(_getRequireWildcardCache=function(e2){return e2?t:r})(e)}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")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(u!=="default"&&{}.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}const pubsubRegistry=exports.pubsubRegistry=(0,_react().createContext)(void 0);function createProvider(pubSubContext){return({children})=>_react().default.createElement(pubsubRegistry.Provider,{value:pubSubContext},children)}function usePubSub(){return(0,_react().useContext)(pubsubRegistry)}function usePubSubIframe(ref){const pubSub=usePubSub();(0,_react().useEffect)(()=>{if(!ref?.current||!pubSub)return()=>{};const destroyConnection=pubSub.connect(ref.current);return()=>destroyConnection()},[ref?.current,pubSub])}},1737:(__unused_webpack_module,exports,__webpack_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.PubsubAspect=void 0;function _harmony(){const data=__webpack_require__(25217);return _harmony=function(){return data},data}const PubsubAspect=exports.PubsubAspect=_harmony().Aspect.create({id:"teambit.harmony/pubsub",dependencies:[]});var _default=exports.default=PubsubAspect},9898:(__unused_webpack_module,exports,__webpack_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0}),exports.ClickInsideAnIframeEvent=void 0;function _pubsub(){const data=__webpack_require__(23732);return _pubsub=function(){return data},data}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return typeof i=="symbol"?i:i+""}function _toPrimitive(t,r){if(typeof t!="object"||!t)return t;var e=t[Symbol.toPrimitive];if(e!==void 0){var i=e.call(t,r||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}class ClickInsideAnIframeEventData{constructor(clickEvent){this.clickEvent=clickEvent}}class ClickInsideAnIframeEvent extends _pubsub().BitBaseEvent{constructor(timestamp=Date.now(),clickEvent){super(ClickInsideAnIframeEvent.TYPE,"0.0.1",timestamp,new ClickInsideAnIframeEventData(clickEvent));this.timestamp=timestamp,this.clickEvent=clickEvent}}exports.ClickInsideAnIframeEvent=ClickInsideAnIframeEvent,_defineProperty(ClickInsideAnIframeEvent,"TYPE","click-inside-an-iframe")},10459:(__unused_webpack_module,exports,__webpack_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0});var _clickInsideAnIframe=__webpack_require__(9898);Object.keys(_clickInsideAnIframe).forEach(function(key){key==="default"||key==="__esModule"||key in exports&&exports[key]===_clickInsideAnIframe[key]||Object.defineProperty(exports,key,{enumerable:!0,get:function(){return _clickInsideAnIframe[key]}})})},72409:(__unused_webpack_module,exports)=>{Object.defineProperty(exports,"__esModule",{value:!0}),exports.BundlingStrategyNotFound=void 0;class BundlingStrategyNotFound extends Error{constructor(strategyName){super(`bundling strategy with name ${strategyName} was not found`);this.strategyName=strategyName}}exports.BundlingStrategyNotFound=BundlingStrategyNotFound},45294:(__unused_webpack_module,exports,__webpack_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"BundlingStrategyNotFound",{enumerable:!0,get:function(){return _bundlingStrategyNotFound().BundlingStrategyNotFound}}),Object.defineProperty(exports,"PreviewArtifactNotFound",{enumerable:!0,get:function(){return _previewArtifactNotFound().PreviewArtifactNotFound}}),Object.defineProperty(exports,"PreviewNotFound",{enumerable:!0,get:function(){return _previewNotFound().PreviewNotFound}}),Object.defineProperty(exports,"PreviewOutputFileNotFound",{enumerable:!0,get:function(){return _previewOutputFileNotFound().PreviewOutputFileNotFound}});function _previewNotFound(){const data=__webpack_require__(68124);return _previewNotFound=function(){return data},data}function _previewArtifactNotFound(){const data=__webpack_require__(46419);return _previewArtifactNotFound=function(){return data},data}function _bundlingStrategyNotFound(){const data=__webpack_require__(72409);return _bundlingStrategyNotFound=function(){return data},data}function _previewOutputFileNotFound(){const data=__webpack_require__(2356);return _previewOutputFileNotFound=function(){return data},data}},46419:(__unused_webpack_module,exports,__webpack_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0}),exports.PreviewArtifactNotFound=void 0;function _bitError(){const data=__webpack_require__(75345);return _bitError=function(){return data},data}class PreviewArtifactNotFound extends _bitError().BitError{constructor(componentId){super(`preview for component ${componentId.toString()} was not found`)}}exports.PreviewArtifactNotFound=PreviewArtifactNotFound},68124:(__unused_webpack_module,exports)=>{Object.defineProperty(exports,"__esModule",{value:!0}),exports.PreviewNotFound=void 0;class PreviewNotFound extends Error{constructor(name){super(`Preview for name: ${name} was not found`)}}exports.PreviewNotFound=PreviewNotFound},2356:(__unused_webpack_module,exports,__webpack_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0}),exports.PreviewOutputFileNotFound=void 0;function _bitError(){const data=__webpack_require__(75345);return _bitError=function(){return data},data}class PreviewOutputFileNotFound extends _bitError().BitError{constructor(componentId,filePath){super(`preview output file for component: "${componentId.toString()}" was not found in the path: "${filePath}".
2
+
3
+ This is usually a result of an error during the bundling process.
4
+ The error might be an error of another component that uses the same env.
5
+ Run "bit build" with "--dev" to see more info.
6
+ Run "bit envs" to see other components that uses the same env`)}}exports.PreviewOutputFileNotFound=PreviewOutputFileNotFound},35102:(__unused_webpack_module,exports,__webpack_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0}),exports.fetchComponentAspects=fetchComponentAspects;function _graphqlRequest(){const data=__webpack_require__(80507);return _graphqlRequest=function(){return data},data}const GQL_SERVER="/graphql",GET_COMPONENT_ASPECTS=(0,_graphqlRequest().gql)`
7
+ query getComponentAspects($id: String!) {
8
+ getHost {
9
+ id
10
+ get(id: $id) {
11
+ aspects {
12
+ id
13
+ }
14
+ }
15
+ }
16
+ }
17
+ `;async function fetchComponentAspects(componentId){try{return(await(0,_graphqlRequest().request)(GQL_SERVER,GET_COMPONENT_ASPECTS,{id:componentId.toString()})).getHost.get.aspects.map(x=>x.id)}catch(err){console.error(`[gql] error on "getComponentAspects" - "${err.toString()}"`);return}}},90990:(__unused_webpack_module,exports)=>{Object.defineProperty(exports,"__esModule",{value:!0}),exports.loadLink=loadLink,exports.loadScript=loadScript;function loadScript({src}){return new Promise((resolve,reject)=>{const script=document.createElement("script");script.setAttribute("defer","defer"),script.src=src,script.onload=()=>resolve(),script.onerror=(message,_,_1,_2,error)=>reject(error||new Error(`[preview.preview] failed to load script: ${message}`)),document.head.appendChild(script)})}function loadLink({href}){return new Promise((resolve,reject)=>{const link=document.createElement("link");href.endsWith(".css")&&link.setAttribute("rel","stylesheet"),link.setAttribute("href",href),link.onload=()=>resolve(),link.onerror=(message,_,_1,_2,error)=>reject(error||new Error(`[preview.preview] failed to load link: ${message}`)),document.head.appendChild(link)})}},42476:(__unused_webpack_module,exports,__webpack_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"PREVIEW_MODULES",{enumerable:!0,get:function(){return _previewModules().PREVIEW_MODULES}}),Object.defineProperty(exports,"PreviewModules",{enumerable:!0,get:function(){return _previewModules().PreviewModules}}),Object.defineProperty(exports,"linkModules",{enumerable:!0,get:function(){return _previewModules().linkModules}});function _previewModules(){const data=__webpack_require__(54710);return _previewModules=function(){return data},data}},92046:(__unused_webpack_module,exports,__webpack_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.PreviewRuntime=exports.PreviewAspect=void 0;function _harmony(){const data=__webpack_require__(25217);return _harmony=function(){return data},data}const PreviewRuntime=exports.PreviewRuntime=new(_harmony()).RuntimeDefinition("preview"),PreviewAspect=exports.PreviewAspect=_harmony().Aspect.create({id:"teambit.preview/preview",dependencies:[],defaultConfig:{},declareRuntime:PreviewRuntime});var _default=exports.default=PreviewAspect},53476:(__unused_webpack_module,exports,__webpack_require__)=>{var __webpack_unused_export__;__webpack_unused_export__={value:!0},__webpack_unused_export__=void 0,Object.defineProperty(exports,"Bu",{enumerable:!0,get:function(){return _previewModules().linkModules}});function _pubsub(){const data=__webpack_require__(23732);return _pubsub=function(){return data},data}function _harmony(){const data=__webpack_require__(25217);return _harmony=function(){return data},data}function _componentId(){const data=__webpack_require__(83947);return _componentId=function(){return data},data}function _crossFetch(){const data=_interopRequireDefault(__webpack_require__(6));return _crossFetch=function(){return data},data}function _memoizee(){const data=_interopRequireDefault(__webpack_require__(94300));return _memoizee=function(){return data},data}function _lodash(){const data=__webpack_require__(58822);return _lodash=function(){return data},data}function _exceptions(){const data=__webpack_require__(45294);return _exceptions=function(){return data},data}function _preview(){const data=__webpack_require__(92046);return _preview=function(){return data},data}function _events(){const data=__webpack_require__(10459);return _events=function(){return data},data}function _renderingContext(){const data=__webpack_require__(49460);return _renderingContext=function(){return data},data}function _fetchComponentAspects(){const data=__webpack_require__(35102);return _fetchComponentAspects=function(){return data},data}function _previewModules(){const data=__webpack_require__(42476);return _previewModules=function(){return data},data}function _htmlUtils(){const data=__webpack_require__(90990);return _htmlUtils=function(){return data},data}function _sizeEvent(){const data=__webpack_require__(66450);return _sizeEvent=function(){return data},data}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return typeof i=="symbol"?i:i+""}function _toPrimitive(t,r){if(typeof t!="object"||!t)return t;var e=t[Symbol.toPrimitive];if(e!==void 0){var i=e.call(t,r||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}class PreviewPreview{constructor(pubsub,previewSlot,renderingContextSlot){this.pubsub=pubsub,this.previewSlot=previewSlot,this.renderingContextSlot=renderingContextSlot,_defineProperty(this,"isDev",!1),_defineProperty(this,"_setupPromise",void 0),_defineProperty(this,"setup",()=>this.isReady()?Promise.resolve():(this._setupPromise??=new Promise(resolve=>{_previewModules().PREVIEW_MODULES.onSet.add(()=>{this.isReady()&&resolve()})}),this._setupPromise)),_defineProperty(this,"render",async rootExt=>{window.document.body.style.width="fit-content";const{previewName,componentId,envId}=this.getLocation(),name=previewName||this.getDefault();rootExt&&(this.isDev=rootExt==="teambit.workspace/workspace");const preview=this.getPreview(name);if(!preview||!componentId)throw new(_exceptions()).PreviewNotFound(previewName);const includesAll=await Promise.all((preview.include||[]).map(async inclPreviewName=>{const includedPreview=this.getPreview(inclPreviewName);if(!includedPreview)return;const inclPreviewModule=await this.getPreviewModule(inclPreviewName,componentId);return includedPreview.selectPreviewModel?.(componentId.fullName,inclPreviewModule)})),query=this.getQuery(),includes=this.getParam(query,"onlyOverview")==="true"?[]:includesAll.filter(module=>!!module).map(module=>{if(!module.default||!(0,_lodash().isObject)(module.default))return module;const keysWithoutDefault=Object.keys(module).filter(key=>key!=="default"),defaultKeys=Object.keys(module.default);return(0,_lodash().intersection)(keysWithoutDefault,defaultKeys).length===defaultKeys.length?module.default:module}),componentAspects=this.isDev?await this.getComponentAspects(componentId.toString()):void 0,previewModule=await this.getPreviewModule(name,componentId),render=preview.render(componentId,envId||"",previewModule,includes,this.getRenderingContext(componentAspects));return this.reportSize(),this.setViewport(),this.setFullScreen(),render}),_defineProperty(this,"getComponentAspects",(0,_memoizee().default)(_fetchComponentAspects().fetchComponentAspects,{max:100,maxAge:12*60*60*1e3})),this.registerClickPubSub()}registerClickPubSub(){window.addEventListener("click",e=>{const timestamp=Date.now(),clickEvent=Object.assign({},e);this.pubsub.pub(_preview().PreviewAspect.id,new(_events()).ClickInsideAnIframeEvent(timestamp,clickEvent))})}isReady(){const{previewName}=this.getLocation(),name=previewName||this.getDefault();if(!_previewModules().PREVIEW_MODULES.has(name))return!1;const preview=this.getPreview(name);return!(!preview||!(preview.include?.every(included=>_previewModules().PREVIEW_MODULES.has(included))??!0))}setFullScreen(){const query=this.getQuery();if(!this.getParam(query,"fullscreen"))return;const root=window.document.getElementById("root");root&&(root.style.height="100vh")}setViewport(){const query=this.getQuery(),viewPort=this.getParam(query,"viewport");if(!viewPort){window.document.body.style.width="100%";return}window.document.body.style.maxWidth=`${viewPort}px`}reportSize(){if(!window?.parent||!window?.document)return;const sendPubsubEvent=()=>{this.pubsub.pub(_preview().PreviewAspect.id,new(_sizeEvent()).SizeEvent({width:window.document.body.offsetWidth,height:window.document.body.offsetHeight}))};window.document.body.addEventListener("resize",(0,_lodash().debounce)(sendPubsubEvent,300));let counter=0;const interval=setInterval(()=>{if(counter+=1,counter>10){clearInterval(interval);return}this.pubsub.pub(_preview().PreviewAspect.id,new(_sizeEvent()).SizeEvent({width:window.document.body.offsetWidth,height:window.document.body.offsetHeight}))},200)}async getPreviewModule(previewName,id){const compShortId=id.fullName,relevantModel=_previewModules().PREVIEW_MODULES.get(previewName);if(!relevantModel)throw new Error(`[preview.preview] missing preview "${previewName}"`);if(relevantModel.componentMap[compShortId])return relevantModel;const componentPreviews=await this.fetchComponentPreview(id,previewName);_previewModules().PREVIEW_MODULES.loadComponentPreviews(compShortId,componentPreviews);const component=componentPreviews[previewName],metadata=componentPreviews[`${previewName}_metadata`];return{modulesMap:relevantModel.modulesMap,componentMap:{[id.fullName]:component},componentMapMetadata:{[id.fullName]:metadata}}}async fetchComponentPreview(id,name){let previewFile;const allFiles=await this.fetchComponentPreviewFiles(id,name);return allFiles===null?{}:(await Promise.all(allFiles.map(file=>{if(file.endsWith("-preview.js")){previewFile=file;return}return this.addComponentFileElement(id,file)})),previewFile?this.loadPreviewScript(id,name,previewFile):{})}addComponentFileElement(id,previewBundleFileName){if(previewBundleFileName.endsWith(".js"))return this.addComponentFileScriptElement(id,previewBundleFileName);this.addComponentFileLinkElement(id,previewBundleFileName).catch(err=>{throw new Error(`[preview.preview] failed loading asset "${previewBundleFileName}". Error - "${err?.toString()}"`)})}async fetchComponentPreviewFiles(id,previewName){const previewAssetsRoute="~aspect/preview-assets",url=`/api/${id.toString()}/${previewAssetsRoute}`,res=await(0,_crossFetch().default)(url);if(res.status>=400)throw new(_exceptions()).PreviewNotFound(previewName);const parsed=await res.json();if(parsed.isBundledWithEnv)return null;if(!parsed.files||!parsed.files.length)throw new(_exceptions()).PreviewNotFound(previewName);return parsed.files}addComponentFileScriptElement(id,previewBundleFileName){const previewRoute="~aspect/component-preview",src=`/api/${id.toString()}/${previewRoute}/${previewBundleFileName}`;return(0,_htmlUtils().loadScript)({src})}addComponentFileLinkElement(id,previewBundleFileName){const href=`/api/${id.toString()}/~aspect/component-preview/${previewBundleFileName}`;return(0,_htmlUtils().loadLink)({href})}async loadPreviewScript(id,previewName,previewBundleFileName){const previewRoute="~aspect/component-preview",src=`/api/${id.toString()}/${previewRoute}/${previewBundleFileName}`;await(0,_htmlUtils().loadScript)({src});const globalId=`${id.toStringWithoutVersion()}-preview`,componentPreview=window[globalId];if(!componentPreview)throw new(_exceptions()).PreviewNotFound(previewName);return componentPreview}registerPreview(preview){return this.previewSlot.register(preview),this}getRenderingContext(aspectsFilter){return new(_renderingContext()).RenderingContext(this.renderingContextSlot,{aspectsFilter})}registerRenderContext(renderContext){return this.renderingContextSlot.register(renderContext),this}getDefault(){const previews=this.previewSlot.values();return previews.find(previewCandidate=>previewCandidate.default)?.name||previews[0].name}getPreview(previewName){return this.previewSlot.values().find(previewCandidate=>previewCandidate.name===previewName)}getParam(query,param){return new URLSearchParams(query).get(param)}getQuery(){const withoutHash=window.location.hash.substring(1),[,after]=withoutHash.split("?");return after}getLocation(){const withoutHash=window.location.hash.substring(1),[before,after]=withoutHash.split("?");return{previewName:this.getParam(after,"preview"),envId:this.getParam(after,"env"),componentId:_componentId().ComponentID.tryFromString(before)}}static async provider([pubsub],config,[previewSlot,renderingContextSlot]){const preview=new PreviewPreview(pubsub,previewSlot,renderingContextSlot);return window.addEventListener("hashchange",()=>{preview.render()}),preview}}__webpack_unused_export__=PreviewPreview,_defineProperty(PreviewPreview,"runtime",_preview().PreviewRuntime),_defineProperty(PreviewPreview,"dependencies",[_pubsub().PubsubAspect]),_defineProperty(PreviewPreview,"slots",[_harmony().Slot.withType(),_harmony().Slot.withType()]),_preview().PreviewAspect.addRuntime(PreviewPreview)},49460:(__unused_webpack_module,exports)=>{Object.defineProperty(exports,"__esModule",{value:!0}),exports.RenderingContext=void 0;class RenderingContext{constructor(contexts,options={}){this.contexts=contexts,this.options=options}get(aspectId){return this.contexts.get(aspectId)?.(this.options)}}exports.RenderingContext=RenderingContext},66450:(__unused_webpack_module,exports,__webpack_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0}),exports.SizeEvent=void 0;function _pubsub(){const data=__webpack_require__(23732);return _pubsub=function(){return data},data}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return typeof i=="symbol"?i:i+""}function _toPrimitive(t,r){if(typeof t!="object"||!t)return t;var e=t[Symbol.toPrimitive];if(e!==void 0){var i=e.call(t,r||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}class SizeEvent extends _pubsub().BitBaseEvent{constructor(sizeEvent){super(SizeEvent.TYPE,"0.0.1",new Date().getTime(),sizeEvent)}}exports.SizeEvent=SizeEvent,_defineProperty(SizeEvent,"TYPE","preview-size")},52725:(__unused_webpack_module,__unused_webpack___webpack_exports__,__webpack_require__)=>{var _teambit_preview_dist_preview_preview_runtime_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(53476),_home_circleci_bit_bit_node_modules_teambit_react_ui_compositions_app_dist_index_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(5659),_home_circleci_bit_bit_node_modules_teambit_react_ui_compositions_app_dist_index_js__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(_home_circleci_bit_bit_node_modules_teambit_react_ui_compositions_app_dist_index_js__WEBPACK_IMPORTED_MODULE_1__);(0,_teambit_preview_dist_preview_preview_runtime_js__WEBPACK_IMPORTED_MODULE_0__.Bu)("compositions",{modulesMap:{default:_home_circleci_bit_bit_node_modules_teambit_react_ui_compositions_app_dist_index_js__WEBPACK_IMPORTED_MODULE_1__},isSplitComponentBundle:!1,componentMap:{}})}},__webpack_require__=>{var __webpack_exec__=moduleId=>__webpack_require__(__webpack_require__.s=moduleId);__webpack_require__.O(0,[700,851,873,629],()=>__webpack_exec__(52725));var __webpack_exports__=__webpack_require__.O()}]);
@@ -1,2 +1,2 @@
1
1
  <!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Preview</title><script>// Allow to use react dev-tools inside the examples
2
- try { window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__REACT_DEVTOOLS_GLOBAL_HOOK__; } catch {}</script><style>body { margin: 0; }</style><script defer="defer" src="851.d2664a57f5d46b636e5f.js"></script><script defer="defer" src="peers.c4f7970832a3693bee9e.js"></script><script defer="defer" src="170.e2586eafaae3c27235b8.js"></script><script defer="defer" src="preview-root.1a09ddf180be0092f126.js"></script><script defer="defer" src="700.f5fce5db582bd65bc0df.js"></script><script defer="defer" src="compositions.7fa6c70f6569383f318a.js"></script><link href="static/css/preview-root.5fd7d59d.css" rel="stylesheet"><link href="static/css/compositions.2a7f63f9.css" rel="stylesheet"></head><body><div id="root"></div></body></html>
2
+ try { window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__REACT_DEVTOOLS_GLOBAL_HOOK__; } catch {}</script><style>body { margin: 0; }</style><script defer="defer" src="851.d2664a57f5d46b636e5f.js"></script><script defer="defer" src="peers.10b809d7c5292dad93b6.js"></script><script defer="defer" src="873.bb143d45f2fc3510cd88.js"></script><script defer="defer" src="preview-root.c040b7b16d03bf82254f.js"></script><script defer="defer" src="700.f5fce5db582bd65bc0df.js"></script><script defer="defer" src="compositions.c7c1d2f528c28865a09f.js"></script><link href="static/css/preview-root.5fd7d59d.css" rel="stylesheet"><link href="static/css/compositions.2a7f63f9.css" rel="stylesheet"></head><body><div id="root"></div></body></html>
@@ -2,4 +2,4 @@
2
2
  `:`
3
3
  `,newline=/\r\n|\r|\n/g;function converts(text,to){if(Buffer.isBuffer(text)){if((0,_isbinaryfile().isBinaryFileSync)(text))return text;const str=text.toString(),strReplaced=str.replace(newline,to);return str!==strReplaced?Buffer.from(strReplaced):text}return text.toString().replace(newline,to)}function lf(text){return converts(text,`
4
4
  `)}function auto(text){return converts(text,lineBreak)}function cr(text){return converts(text,"\r")}function crlf(text){return converts(text,`\r
5
- `)}},30755:(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getLatestVersion=getLatestVersion,exports.getValidVersionOrReleaseType=getValidVersionOrReleaseType,exports.isReleaseTypeSupported=isReleaseTypeSupported,exports.isStrReleaseType=isStrReleaseType,exports.throwForUnsupportedReleaseType=throwForUnsupportedReleaseType,exports.validateVersion=validateVersion;function _semver(){const data=__webpack_require__(9131);return _semver=function(){return data},data}function _componentVersion(){const data=__webpack_require__(22670);return _componentVersion=function(){return data},data}function isStrReleaseType(str){return["major","premajor","minor","preminor","patch","prepatch","prerelease"].includes(str)}function isReleaseTypeSupported(str){return["patch","minor","major","prerelease"].includes(str)}function throwForUnsupportedReleaseType(str){if(!isReleaseTypeSupported(str))throw new Error(`the release-type "${str}" is not supported`)}function validateVersion(version){if(version){const validVersion=(0,_semver().valid)(version);if(!validVersion)throw new(_componentVersion()).InvalidVersion(version);return validVersion}}function getValidVersionOrReleaseType(str){if(isStrReleaseType(str)){const releaseType=str;return throwForUnsupportedReleaseType(releaseType),{releaseType}}return{exactVersion:validateVersion(str)}}function getLatestVersion(versions){const max=(0,_semver().maxSatisfying)(versions,"*",{includePrerelease:!0});if(!max)throw new Error(`unable to find the latest version from ${versions.join(", ")}`);return max}},68256:(__unused_webpack_module,__unused_webpack___webpack_exports__,__webpack_require__)=>{"use strict";var _teambit_preview_dist_preview_preview_runtime_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(3767),_home_circleci_bit_bit_node_modules_teambit_react_ui_docs_app_dist_index_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(79022),_home_circleci_bit_bit_node_modules_teambit_react_ui_docs_app_dist_index_js__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(_home_circleci_bit_bit_node_modules_teambit_react_ui_docs_app_dist_index_js__WEBPACK_IMPORTED_MODULE_1__);(0,_teambit_preview_dist_preview_preview_runtime_js__WEBPACK_IMPORTED_MODULE_0__.Bu)("overview",{modulesMap:{default:_home_circleci_bit_bit_node_modules_teambit_react_ui_docs_app_dist_index_js__WEBPACK_IMPORTED_MODULE_1__},isSplitComponentBundle:!1,componentMap:{}})},27127:()=>{},5010:()=>{},65660:()=>{},87942:()=>{},82880:()=>{}},__webpack_require__=>{var __webpack_exec__=moduleId=>__webpack_require__(__webpack_require__.s=moduleId);__webpack_require__.O(0,[310,851,170,629,700,384],()=>__webpack_exec__(68256));var __webpack_exports__=__webpack_require__.O()}]);
5
+ `)}},30755:(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getLatestVersion=getLatestVersion,exports.getValidVersionOrReleaseType=getValidVersionOrReleaseType,exports.isReleaseTypeSupported=isReleaseTypeSupported,exports.isStrReleaseType=isStrReleaseType,exports.throwForUnsupportedReleaseType=throwForUnsupportedReleaseType,exports.validateVersion=validateVersion;function _semver(){const data=__webpack_require__(9131);return _semver=function(){return data},data}function _componentVersion(){const data=__webpack_require__(22670);return _componentVersion=function(){return data},data}function isStrReleaseType(str){return["major","premajor","minor","preminor","patch","prepatch","prerelease"].includes(str)}function isReleaseTypeSupported(str){return["patch","minor","major","prerelease"].includes(str)}function throwForUnsupportedReleaseType(str){if(!isReleaseTypeSupported(str))throw new Error(`the release-type "${str}" is not supported`)}function validateVersion(version){if(version){const validVersion=(0,_semver().valid)(version);if(!validVersion)throw new(_componentVersion()).InvalidVersion(version);return validVersion}}function getValidVersionOrReleaseType(str){if(isStrReleaseType(str)){const releaseType=str;return throwForUnsupportedReleaseType(releaseType),{releaseType}}return{exactVersion:validateVersion(str)}}function getLatestVersion(versions){const max=(0,_semver().maxSatisfying)(versions,"*",{includePrerelease:!0});if(!max)throw new Error(`unable to find the latest version from ${versions.join(", ")}`);return max}},17233:(__unused_webpack_module,__unused_webpack___webpack_exports__,__webpack_require__)=>{"use strict";var _teambit_preview_dist_preview_preview_runtime_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(53476),_home_circleci_bit_bit_node_modules_teambit_react_ui_docs_app_dist_index_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(79022),_home_circleci_bit_bit_node_modules_teambit_react_ui_docs_app_dist_index_js__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(_home_circleci_bit_bit_node_modules_teambit_react_ui_docs_app_dist_index_js__WEBPACK_IMPORTED_MODULE_1__);(0,_teambit_preview_dist_preview_preview_runtime_js__WEBPACK_IMPORTED_MODULE_0__.Bu)("overview",{modulesMap:{default:_home_circleci_bit_bit_node_modules_teambit_react_ui_docs_app_dist_index_js__WEBPACK_IMPORTED_MODULE_1__},isSplitComponentBundle:!1,componentMap:{}})},27127:()=>{},5010:()=>{},65660:()=>{},87942:()=>{},82880:()=>{}},__webpack_require__=>{var __webpack_exec__=moduleId=>__webpack_require__(__webpack_require__.s=moduleId);__webpack_require__.O(0,[310,851,873,629,700,384],()=>__webpack_exec__(17233));var __webpack_exports__=__webpack_require__.O()}]);
@@ -1,2 +1,2 @@
1
1
  <!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Preview</title><script>// Allow to use react dev-tools inside the examples
2
- try { window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__REACT_DEVTOOLS_GLOBAL_HOOK__; } catch {}</script><style>body { margin: 0; }</style><script defer="defer" src="851.d2664a57f5d46b636e5f.js"></script><script defer="defer" src="peers.c4f7970832a3693bee9e.js"></script><script defer="defer" src="170.e2586eafaae3c27235b8.js"></script><script defer="defer" src="preview-root.1a09ddf180be0092f126.js"></script><script defer="defer" src="700.f5fce5db582bd65bc0df.js"></script><script defer="defer" src="compositions.7fa6c70f6569383f318a.js"></script><script defer="defer" src="310.26b43bf6f6658e87fc58.js"></script><script defer="defer" src="overview.7c8598f70e9ab413928c.js"></script><link href="static/css/preview-root.5fd7d59d.css" rel="stylesheet"><link href="static/css/compositions.2a7f63f9.css" rel="stylesheet"><link href="static/css/310.cdd78dee.css" rel="stylesheet"></head><body><div id="root"></div></body></html>
2
+ try { window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__REACT_DEVTOOLS_GLOBAL_HOOK__; } catch {}</script><style>body { margin: 0; }</style><script defer="defer" src="851.d2664a57f5d46b636e5f.js"></script><script defer="defer" src="peers.10b809d7c5292dad93b6.js"></script><script defer="defer" src="873.bb143d45f2fc3510cd88.js"></script><script defer="defer" src="preview-root.c040b7b16d03bf82254f.js"></script><script defer="defer" src="700.f5fce5db582bd65bc0df.js"></script><script defer="defer" src="compositions.c7c1d2f528c28865a09f.js"></script><script defer="defer" src="310.1bdd70f95e2ae9ddc094.js"></script><script defer="defer" src="overview.903ca5cb26de560f7580.js"></script><link href="static/css/preview-root.5fd7d59d.css" rel="stylesheet"><link href="static/css/compositions.2a7f63f9.css" rel="stylesheet"><link href="static/css/310.cdd78dee.css" rel="stylesheet"></head><body><div id="root"></div></body></html>
@@ -0,0 +1 @@
1
+ (()=>{"use strict";var __webpack_modules__={94704:(__unused_webpack_module,__unused_webpack___webpack_exports__,__webpack_require__2)=>{var react__WEBPACK_IMPORTED_MODULE_2___namespace_cache,react_dom__WEBPACK_IMPORTED_MODULE_3___namespace_cache,_teambit_mdx_ui_mdx_scope_context__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__2(81846),_mdx_js_react__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__2(49613),react__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__2(59496),react_dom__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__2(87995),globalObj=window;guard("TeambitMdxUiMdxScopeContext",_teambit_mdx_ui_mdx_scope_context__WEBPACK_IMPORTED_MODULE_0__),guard("MdxJsReact",_mdx_js_react__WEBPACK_IMPORTED_MODULE_1__),guard("React",react__WEBPACK_IMPORTED_MODULE_2___namespace_cache||(react__WEBPACK_IMPORTED_MODULE_2___namespace_cache=__webpack_require__2.t(react__WEBPACK_IMPORTED_MODULE_2__,2))),guard("ReactDom",react_dom__WEBPACK_IMPORTED_MODULE_3___namespace_cache||(react_dom__WEBPACK_IMPORTED_MODULE_3___namespace_cache=__webpack_require__2.t(react_dom__WEBPACK_IMPORTED_MODULE_3__,2))),globalObj.TeambitMdxUiMdxScopeContext=_teambit_mdx_ui_mdx_scope_context__WEBPACK_IMPORTED_MODULE_0__,globalObj.MdxJsReact=_mdx_js_react__WEBPACK_IMPORTED_MODULE_1__,globalObj.React=react__WEBPACK_IMPORTED_MODULE_2___namespace_cache||(react__WEBPACK_IMPORTED_MODULE_2___namespace_cache=__webpack_require__2.t(react__WEBPACK_IMPORTED_MODULE_2__,2)),globalObj.ReactDom=react_dom__WEBPACK_IMPORTED_MODULE_3___namespace_cache||(react_dom__WEBPACK_IMPORTED_MODULE_3___namespace_cache=__webpack_require__2.t(react_dom__WEBPACK_IMPORTED_MODULE_3__,2));function guard(property,expected){var existing=globalObj[property];if(existing===expected&&expected!==void 0)console.warn('[expose-peers] "'+property+'" already exists in global scope, but with correct value');else if(existing!==void 0)throw new Error('[expose-peers] "'+property+'" already exists in the global scope, cannot overwrite')}}},__webpack_module_cache__={};function __webpack_require__(moduleId){var cachedModule=__webpack_module_cache__[moduleId];if(cachedModule!==void 0)return cachedModule.exports;var module=__webpack_module_cache__[moduleId]={id:moduleId,loaded:!1,exports:{}};return __webpack_modules__[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.loaded=!0,module.exports}__webpack_require__.m=__webpack_modules__,(()=>{var deferred=[];__webpack_require__.O=(result,chunkIds,fn,priority)=>{if(chunkIds){priority=priority||0;for(var i=deferred.length;i>0&&deferred[i-1][2]>priority;i--)deferred[i]=deferred[i-1];deferred[i]=[chunkIds,fn,priority];return}for(var notFulfilled=1/0,i=0;i<deferred.length;i++){for(var[chunkIds,fn,priority]=deferred[i],fulfilled=!0,j=0;j<chunkIds.length;j++)(priority&!1||notFulfilled>=priority)&&Object.keys(__webpack_require__.O).every(key=>__webpack_require__.O[key](chunkIds[j]))?chunkIds.splice(j--,1):(fulfilled=!1,priority<notFulfilled&&(notFulfilled=priority));if(fulfilled){deferred.splice(i--,1);var r=fn();r!==void 0&&(result=r)}}return result}})(),__webpack_require__.n=module=>{var getter=module&&module.__esModule?()=>module.default:()=>module;return __webpack_require__.d(getter,{a:getter}),getter},(()=>{var getProto=Object.getPrototypeOf?obj=>Object.getPrototypeOf(obj):obj=>obj.__proto__,leafPrototypes;__webpack_require__.t=function(value,mode){if(mode&1&&(value=this(value)),mode&8||typeof value=="object"&&value&&(mode&4&&value.__esModule||mode&16&&typeof value.then=="function"))return value;var ns=Object.create(null);__webpack_require__.r(ns);var def={};leafPrototypes=leafPrototypes||[null,getProto({}),getProto([]),getProto(getProto)];for(var current=mode&2&&value;typeof current=="object"&&!~leafPrototypes.indexOf(current);current=getProto(current))Object.getOwnPropertyNames(current).forEach(key=>def[key]=()=>value[key]);return def.default=()=>value,__webpack_require__.d(ns,def),ns}})(),__webpack_require__.d=(exports,definition)=>{for(var key in definition)__webpack_require__.o(definition,key)&&!__webpack_require__.o(exports,key)&&Object.defineProperty(exports,key,{enumerable:!0,get:definition[key]})},__webpack_require__.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),__webpack_require__.o=(obj,prop)=>Object.prototype.hasOwnProperty.call(obj,prop),__webpack_require__.r=exports=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(exports,"__esModule",{value:!0})},__webpack_require__.nmd=module=>(module.paths=[],module.children||(module.children=[]),module),(()=>{var installedChunks={703:0};__webpack_require__.O.j=chunkId=>installedChunks[chunkId]===0;var webpackJsonpCallback=(parentChunkLoadingFunction,data)=>{var[chunkIds,moreModules,runtime]=data,moduleId,chunkId,i=0;if(chunkIds.some(id=>installedChunks[id]!==0)){for(moduleId in moreModules)__webpack_require__.o(moreModules,moduleId)&&(__webpack_require__.m[moduleId]=moreModules[moduleId]);if(runtime)var result=runtime(__webpack_require__)}for(parentChunkLoadingFunction&&parentChunkLoadingFunction(data);i<chunkIds.length;i++)chunkId=chunkIds[i],__webpack_require__.o(installedChunks,chunkId)&&installedChunks[chunkId]&&installedChunks[chunkId][0](),installedChunks[chunkId]=0;return __webpack_require__.O(result)},chunkLoadingGlobal=self.__loadChunks_EnvTemplate=self.__loadChunks_EnvTemplate||[];chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null,0)),chunkLoadingGlobal.push=webpackJsonpCallback.bind(null,chunkLoadingGlobal.push.bind(chunkLoadingGlobal))})();var __webpack_exports__=__webpack_require__.O(void 0,[851],()=>__webpack_require__(94704));__webpack_exports__=__webpack_require__.O(__webpack_exports__)})();
@@ -1 +1 @@
1
- "use strict";(self.__loadChunks_EnvTemplate=self.__loadChunks_EnvTemplate||[]).push([[629],{},__webpack_require__=>{var __webpack_exec__=moduleId=>__webpack_require__(__webpack_require__.s=moduleId);__webpack_require__.O(0,[170,851],()=>__webpack_exec__(16170));var __webpack_exports__=__webpack_require__.O()}]);
1
+ "use strict";(self.__loadChunks_EnvTemplate=self.__loadChunks_EnvTemplate||[]).push([[629],{},__webpack_require__=>{var __webpack_exec__=moduleId=>__webpack_require__(__webpack_require__.s=moduleId);__webpack_require__.O(0,[873,851],()=>__webpack_exec__(37873));var __webpack_exports__=__webpack_require__.O()}]);
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.envs/env-preview"]=t():e["teambit.envs/env-preview"]=t()}(self,(()=>(()=>{"use strict";var e={77476:(e,t,o)=>{var n={id:"teambit.envs/env@1.0.209",homepage:"https://bit.cloud/teambit/envs/env",exported:!0};function r(){const e=i(o(41594));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=n,i.__bit_component=n;const s=()=>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/env.svg"}));s.__bit_component=n,t.Logo=s},41594:e=>{e.exports=React}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,o),i.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{o.r(n),o.d(n,{compositions:()=>u,compositions_metadata:()=>l,overview:()=>f});var e={};o.r(e),o.d(e,{default:()=>d});var t=o(77476);o(41594);const r=MdxJsReact,i=TeambitMdxUiMdxScopeContext;var s=["components"];function p(){return p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},p.apply(this,arguments)}var a={},c="wrapper";function d(e){var t=e.components,o=function(e,t){if(null==e)return{};var o,n,r=function(e,t){if(null==e)return{};var o,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}(e,s);return(0,r.mdx)(c,p({},a,o,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)(i.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"}))}d.isMDXComponent=!0;const u=[t],f=[e],l={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),n})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.envs/env-preview"]=t():e["teambit.envs/env-preview"]=t()}(self,(()=>(()=>{"use strict";var e={88820:(e,t,o)=>{var n={id:"teambit.envs/env@1.0.210",homepage:"https://bit.cloud/teambit/envs/env",exported:!0};function r(){const e=i(o(41594));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=n,i.__bit_component=n;const s=()=>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/env.svg"}));s.__bit_component=n,t.Logo=s},41594:e=>{e.exports=React}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,o),i.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{o.r(n),o.d(n,{compositions:()=>u,compositions_metadata:()=>l,overview:()=>f});var e={};o.r(e),o.d(e,{default:()=>d});var t=o(88820);o(41594);const r=MdxJsReact,i=TeambitMdxUiMdxScopeContext;var s=["components"];function p(){return p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},p.apply(this,arguments)}var a={},c="wrapper";function d(e){var t=e.components,o=function(e,t){if(null==e)return{};var o,n,r=function(e,t){if(null==e)return{};var o,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}(e,s);return(0,r.mdx)(c,p({},a,o,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)(i.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"}))}d.isMDXComponent=!0;const u=[t],f=[e],l={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),n})()));
@@ -1086,7 +1086,7 @@
1086
1086
  "componentId": {
1087
1087
  "scope": "teambit.envs",
1088
1088
  "name": "env",
1089
- "version": "1.0.209"
1089
+ "version": "1.0.210"
1090
1090
  },
1091
1091
  "taggedModuleExports": []
1092
1092
  }
package/dist/env.env.js CHANGED
@@ -12,7 +12,7 @@ function _preview() {
12
12
  return data;
13
13
  }
14
14
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
15
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
15
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
16
16
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
17
17
  const EnvEnvType = exports.EnvEnvType = 'env';
18
18
 
@@ -1 +1 @@
1
- {"version":3,"names":["_preview","data","require","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","EnvEnvType","exports","EnvEnv","constructor","aspectEnv","__getDescriptor","type","getPackageJsonProps","packageJsonProps","getPreviewConfig","strategyName","COMPONENT_PREVIEW_STRATEGY_NAME","splitComponentBundle"],"sources":["env.env.ts"],"sourcesContent":["import { AspectEnv } from '@teambit/aspect';\nimport { PackageJsonProps } from '@teambit/pkg';\nimport { COMPONENT_PREVIEW_STRATEGY_NAME, PreviewStrategyName } from '@teambit/preview';\n\nexport const EnvEnvType = 'env';\n\n/**\n * a component environment built for Envs.\n */\nexport class EnvEnv {\n constructor(private aspectEnv: AspectEnv) {}\n // TODO: consider special icon for envs?\n icon = 'https://static.bit.dev/extensions-icons/default.svg';\n\n async __getDescriptor() {\n return {\n type: EnvEnvType,\n };\n }\n\n getPackageJsonProps(): PackageJsonProps {\n const packageJsonProps = this.aspectEnv.getPackageJsonProps();\n delete packageJsonProps.exports;\n return packageJsonProps;\n }\n\n getPreviewConfig() {\n return {\n strategyName: COMPONENT_PREVIEW_STRATEGY_NAME as PreviewStrategyName,\n splitComponentBundle: false,\n };\n }\n}\n"],"mappings":";;;;;;AAEA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAwF,SAAAE,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,CAAA,QAAAC,CAAA,GAAAC,YAAA,CAAAF,CAAA,uCAAAC,CAAA,GAAAA,CAAA,GAAAE,MAAA,CAAAF,CAAA;AAAA,SAAAC,aAAAF,CAAA,EAAAI,CAAA,2BAAAJ,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAK,CAAA,GAAAL,CAAA,CAAAM,MAAA,CAAAC,WAAA,kBAAAF,CAAA,QAAAJ,CAAA,GAAAI,CAAA,CAAAG,IAAA,CAAAR,CAAA,EAAAI,CAAA,uCAAAH,CAAA,SAAAA,CAAA,YAAAQ,SAAA,yEAAAL,CAAA,GAAAD,MAAA,GAAAO,MAAA,EAAAV,CAAA;AAEjF,MAAMW,UAAU,GAAAC,OAAA,CAAAD,UAAA,GAAG,KAAK;;AAE/B;AACA;AACA;AACO,MAAME,MAAM,CAAC;EAClBC,WAAWA,CAASC,SAAoB,EAAE;IAAA,KAAtBA,SAAoB,GAApBA,SAAoB;IACxC;IAAAzB,eAAA,eACO,qDAAqD;EAFjB;EAI3C,MAAM0B,eAAeA,CAAA,EAAG;IACtB,OAAO;MACLC,IAAI,EAAEN;IACR,CAAC;EACH;EAEAO,mBAAmBA,CAAA,EAAqB;IACtC,MAAMC,gBAAgB,GAAG,IAAI,CAACJ,SAAS,CAACG,mBAAmB,CAAC,CAAC;IAC7D,OAAOC,gBAAgB,CAACP,OAAO;IAC/B,OAAOO,gBAAgB;EACzB;EAEAC,gBAAgBA,CAAA,EAAG;IACjB,OAAO;MACLC,YAAY,EAAEC,0CAAsD;MACpEC,oBAAoB,EAAE;IACxB,CAAC;EACH;AACF;AAACX,OAAA,CAAAC,MAAA,GAAAA,MAAA","ignoreList":[]}
1
+ {"version":3,"names":["_preview","data","require","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","EnvEnvType","exports","EnvEnv","constructor","aspectEnv","__getDescriptor","type","getPackageJsonProps","packageJsonProps","getPreviewConfig","strategyName","COMPONENT_PREVIEW_STRATEGY_NAME","splitComponentBundle"],"sources":["env.env.ts"],"sourcesContent":["import { AspectEnv } from '@teambit/aspect';\nimport { PackageJsonProps } from '@teambit/pkg';\nimport { COMPONENT_PREVIEW_STRATEGY_NAME, PreviewStrategyName } from '@teambit/preview';\n\nexport const EnvEnvType = 'env';\n\n/**\n * a component environment built for Envs.\n */\nexport class EnvEnv {\n constructor(private aspectEnv: AspectEnv) {}\n // TODO: consider special icon for envs?\n icon = 'https://static.bit.dev/extensions-icons/default.svg';\n\n async __getDescriptor() {\n return {\n type: EnvEnvType,\n };\n }\n\n getPackageJsonProps(): PackageJsonProps {\n const packageJsonProps = this.aspectEnv.getPackageJsonProps();\n delete packageJsonProps.exports;\n return packageJsonProps;\n }\n\n getPreviewConfig() {\n return {\n strategyName: COMPONENT_PREVIEW_STRATEGY_NAME as PreviewStrategyName,\n splitComponentBundle: false,\n };\n }\n}\n"],"mappings":";;;;;;AAEA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAwF,SAAAE,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,CAAA,QAAAC,CAAA,GAAAC,YAAA,CAAAF,CAAA,uCAAAC,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAF,CAAA,EAAAG,CAAA,2BAAAH,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAI,CAAA,GAAAJ,CAAA,CAAAK,MAAA,CAAAC,WAAA,kBAAAF,CAAA,QAAAH,CAAA,GAAAG,CAAA,CAAAG,IAAA,CAAAP,CAAA,EAAAG,CAAA,uCAAAF,CAAA,SAAAA,CAAA,YAAAO,SAAA,yEAAAL,CAAA,GAAAM,MAAA,GAAAC,MAAA,EAAAV,CAAA;AAEjF,MAAMW,UAAU,GAAAC,OAAA,CAAAD,UAAA,GAAG,KAAK;;AAE/B;AACA;AACA;AACO,MAAME,MAAM,CAAC;EAClBC,WAAWA,CAASC,SAAoB,EAAE;IAAA,KAAtBA,SAAoB,GAApBA,SAAoB;IACxC;IAAAzB,eAAA,eACO,qDAAqD;EAFjB;EAI3C,MAAM0B,eAAeA,CAAA,EAAG;IACtB,OAAO;MACLC,IAAI,EAAEN;IACR,CAAC;EACH;EAEAO,mBAAmBA,CAAA,EAAqB;IACtC,MAAMC,gBAAgB,GAAG,IAAI,CAACJ,SAAS,CAACG,mBAAmB,CAAC,CAAC;IAC7D,OAAOC,gBAAgB,CAACP,OAAO;IAC/B,OAAOO,gBAAgB;EACzB;EAEAC,gBAAgBA,CAAA,EAAG;IACjB,OAAO;MACLC,YAAY,EAAEC,0CAAsD;MACpEC,oBAAoB,EAAE;IACxB,CAAC;EACH;AACF;AAACX,OAAA,CAAAC,MAAA,GAAAA,MAAA","ignoreList":[]}
@@ -40,7 +40,7 @@ function _env2() {
40
40
  return data;
41
41
  }
42
42
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
43
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
43
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
44
44
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
45
45
  class EnvMain {
46
46
  constructor(envEnv, envs) {
@@ -1 +1 @@
1
- {"version":3,"names":["_aspect","data","require","_cli","_envs","_env","_env2","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","EnvMain","constructor","envEnv","envs","compose","transformers","targetEnv","merge","provider","aspectAspect","EnvEnv","aspectEnv","registerEnv","exports","AspectAspect","EnvsAspect","MainRuntime","EnvAspect","addRuntime"],"sources":["env.main.runtime.ts"],"sourcesContent":["import { AspectAspect, AspectMain } from '@teambit/aspect';\nimport { MainRuntime } from '@teambit/cli';\nimport { EnvsAspect, Environment, EnvsMain, EnvTransformer } from '@teambit/envs';\nimport { EnvAspect } from './env.aspect';\nimport { EnvEnv } from './env.env';\n\nexport class EnvMain {\n constructor(readonly envEnv: EnvEnv, private envs: EnvsMain) {}\n\n /**\n * compose your own aspect environment.\n */\n compose(transformers: EnvTransformer[] = [], targetEnv: Environment = {}) {\n return this.envs.compose(this.envs.merge(targetEnv, this.envEnv), transformers);\n }\n\n static slots = [];\n static dependencies = [AspectAspect, EnvsAspect];\n static runtime = MainRuntime;\n static async provider([aspectAspect, envs]: [AspectMain, EnvsMain]) {\n const envEnv = aspectAspect.compose([], new EnvEnv(aspectAspect.aspectEnv));\n\n envs.registerEnv(envEnv);\n return new EnvMain(envEnv as EnvEnv, envs);\n }\n}\n\nEnvAspect.addRuntime(EnvMain);\n"],"mappings":";;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,KAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,IAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,KAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,IAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,MAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,KAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAmC,SAAAM,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,CAAA,QAAAC,CAAA,GAAAC,YAAA,CAAAF,CAAA,uCAAAC,CAAA,GAAAA,CAAA,GAAAE,MAAA,CAAAF,CAAA;AAAA,SAAAC,aAAAF,CAAA,EAAAI,CAAA,2BAAAJ,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAK,CAAA,GAAAL,CAAA,CAAAM,MAAA,CAAAC,WAAA,kBAAAF,CAAA,QAAAJ,CAAA,GAAAI,CAAA,CAAAG,IAAA,CAAAR,CAAA,EAAAI,CAAA,uCAAAH,CAAA,SAAAA,CAAA,YAAAQ,SAAA,yEAAAL,CAAA,GAAAD,MAAA,GAAAO,MAAA,EAAAV,CAAA;AAE5B,MAAMW,OAAO,CAAC;EACnBC,WAAWA,CAAUC,MAAc,EAAUC,IAAc,EAAE;IAAA,KAAxCD,MAAc,GAAdA,MAAc;IAAA,KAAUC,IAAc,GAAdA,IAAc;EAAG;;EAE9D;AACF;AACA;EACEC,OAAOA,CAACC,YAA8B,GAAG,EAAE,EAAEC,SAAsB,GAAG,CAAC,CAAC,EAAE;IACxE,OAAO,IAAI,CAACH,IAAI,CAACC,OAAO,CAAC,IAAI,CAACD,IAAI,CAACI,KAAK,CAACD,SAAS,EAAE,IAAI,CAACJ,MAAM,CAAC,EAAEG,YAAY,CAAC;EACjF;EAKA,aAAaG,QAAQA,CAAC,CAACC,YAAY,EAAEN,IAAI,CAAyB,EAAE;IAClE,MAAMD,MAAM,GAAGO,YAAY,CAACL,OAAO,CAAC,EAAE,EAAE,KAAIM,cAAM,EAACD,YAAY,CAACE,SAAS,CAAC,CAAC;IAE3ER,IAAI,CAACS,WAAW,CAACV,MAAM,CAAC;IACxB,OAAO,IAAIF,OAAO,CAACE,MAAM,EAAYC,IAAI,CAAC;EAC5C;AACF;AAACU,OAAA,CAAAb,OAAA,GAAAA,OAAA;AAAArB,eAAA,CAnBYqB,OAAO,WAUH,EAAE;AAAArB,eAAA,CAVNqB,OAAO,kBAWI,CAACc,sBAAY,EAAEC,kBAAU,CAAC;AAAApC,eAAA,CAXrCqB,OAAO,aAYDgB,kBAAW;AAS9BC,gBAAS,CAACC,UAAU,CAAClB,OAAO,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_aspect","data","require","_cli","_envs","_env","_env2","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","EnvMain","constructor","envEnv","envs","compose","transformers","targetEnv","merge","provider","aspectAspect","EnvEnv","aspectEnv","registerEnv","exports","AspectAspect","EnvsAspect","MainRuntime","EnvAspect","addRuntime"],"sources":["env.main.runtime.ts"],"sourcesContent":["import { AspectAspect, AspectMain } from '@teambit/aspect';\nimport { MainRuntime } from '@teambit/cli';\nimport { EnvsAspect, Environment, EnvsMain, EnvTransformer } from '@teambit/envs';\nimport { EnvAspect } from './env.aspect';\nimport { EnvEnv } from './env.env';\n\nexport class EnvMain {\n constructor(readonly envEnv: EnvEnv, private envs: EnvsMain) {}\n\n /**\n * compose your own aspect environment.\n */\n compose(transformers: EnvTransformer[] = [], targetEnv: Environment = {}) {\n return this.envs.compose(this.envs.merge(targetEnv, this.envEnv), transformers);\n }\n\n static slots = [];\n static dependencies = [AspectAspect, EnvsAspect];\n static runtime = MainRuntime;\n static async provider([aspectAspect, envs]: [AspectMain, EnvsMain]) {\n const envEnv = aspectAspect.compose([], new EnvEnv(aspectAspect.aspectEnv));\n\n envs.registerEnv(envEnv);\n return new EnvMain(envEnv as EnvEnv, envs);\n }\n}\n\nEnvAspect.addRuntime(EnvMain);\n"],"mappings":";;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,KAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,IAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,KAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,IAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,MAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,KAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAmC,SAAAM,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,CAAA,QAAAC,CAAA,GAAAC,YAAA,CAAAF,CAAA,uCAAAC,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAF,CAAA,EAAAG,CAAA,2BAAAH,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAI,CAAA,GAAAJ,CAAA,CAAAK,MAAA,CAAAC,WAAA,kBAAAF,CAAA,QAAAH,CAAA,GAAAG,CAAA,CAAAG,IAAA,CAAAP,CAAA,EAAAG,CAAA,uCAAAF,CAAA,SAAAA,CAAA,YAAAO,SAAA,yEAAAL,CAAA,GAAAM,MAAA,GAAAC,MAAA,EAAAV,CAAA;AAE5B,MAAMW,OAAO,CAAC;EACnBC,WAAWA,CAAUC,MAAc,EAAUC,IAAc,EAAE;IAAA,KAAxCD,MAAc,GAAdA,MAAc;IAAA,KAAUC,IAAc,GAAdA,IAAc;EAAG;;EAE9D;AACF;AACA;EACEC,OAAOA,CAACC,YAA8B,GAAG,EAAE,EAAEC,SAAsB,GAAG,CAAC,CAAC,EAAE;IACxE,OAAO,IAAI,CAACH,IAAI,CAACC,OAAO,CAAC,IAAI,CAACD,IAAI,CAACI,KAAK,CAACD,SAAS,EAAE,IAAI,CAACJ,MAAM,CAAC,EAAEG,YAAY,CAAC;EACjF;EAKA,aAAaG,QAAQA,CAAC,CAACC,YAAY,EAAEN,IAAI,CAAyB,EAAE;IAClE,MAAMD,MAAM,GAAGO,YAAY,CAACL,OAAO,CAAC,EAAE,EAAE,KAAIM,cAAM,EAACD,YAAY,CAACE,SAAS,CAAC,CAAC;IAE3ER,IAAI,CAACS,WAAW,CAACV,MAAM,CAAC;IACxB,OAAO,IAAIF,OAAO,CAACE,MAAM,EAAYC,IAAI,CAAC;EAC5C;AACF;AAACU,OAAA,CAAAb,OAAA,GAAAA,OAAA;AAAArB,eAAA,CAnBYqB,OAAO,WAUH,EAAE;AAAArB,eAAA,CAVNqB,OAAO,kBAWI,CAACc,sBAAY,EAAEC,kBAAU,CAAC;AAAApC,eAAA,CAXrCqB,OAAO,aAYDgB,kBAAW;AAS9BC,gBAAS,CAACC,UAAU,CAAClB,OAAO,CAAC","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.envs_env@1.0.209/dist/env.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.envs_env@1.0.209/dist/env.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.envs_env@1.0.210/dist/env.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.envs_env@1.0.210/dist/env.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/env",
3
- "version": "1.0.209",
3
+ "version": "1.0.210",
4
4
  "homepage": "https://bit.cloud/teambit/envs/env",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.envs",
8
8
  "name": "env",
9
- "version": "1.0.209"
9
+ "version": "1.0.210"
10
10
  },
11
11
  "dependencies": {
12
12
  "eslint-mdx": "1.17.1",
@@ -21,11 +21,11 @@
21
21
  "react": "^16.8.0 || ^17.0.0",
22
22
  "react-dom": "^16.8.0 || ^17.0.0",
23
23
  "@teambit/harmony": "0.4.6",
24
- "@teambit/aspect": "1.0.209",
25
- "@teambit/pkg": "1.0.209",
26
- "@teambit/preview": "1.0.209",
24
+ "@teambit/aspect": "1.0.210",
25
+ "@teambit/pkg": "1.0.210",
26
+ "@teambit/preview": "1.0.210",
27
27
  "@teambit/cli": "0.0.858",
28
- "@teambit/envs": "1.0.209"
28
+ "@teambit/envs": "1.0.210"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/mocha": "10.0.1",
@@ -1,17 +0,0 @@
1
- "use strict";(self.__loadChunks_EnvTemplate=self.__loadChunks_EnvTemplate||[]).push([[384],{6894:(__unused_webpack_module,exports)=>{Object.defineProperty(exports,"__esModule",{value:!0}),exports.BitBaseEvent=void 0;class BitBaseEvent{constructor(type,version,timestamp,data){this.type=type,this.version=version,this.timestamp=timestamp,this.data=data}}exports.BitBaseEvent=BitBaseEvent},7382:(__unused_webpack_module,exports,__webpack_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"BitBaseEvent",{enumerable:!0,get:function(){return _bitBaseEvent().BitBaseEvent}}),Object.defineProperty(exports,"PubsubAspect",{enumerable:!0,get:function(){return _pubsub().PubsubAspect}}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return _pubsub().PubsubAspect}}),Object.defineProperty(exports,"usePubSub",{enumerable:!0,get:function(){return _pubsubContext().usePubSub}}),Object.defineProperty(exports,"usePubSubIframe",{enumerable:!0,get:function(){return _pubsubContext().usePubSubIframe}});function _pubsub(){const data=__webpack_require__(60238);return _pubsub=function(){return data},data}function _bitBaseEvent(){const data=__webpack_require__(6894);return _bitBaseEvent=function(){return data},data}function _pubsubContext(){const data=__webpack_require__(87640);return _pubsubContext=function(){return data},data}},87640:(__unused_webpack_module,exports,__webpack_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0}),exports.createProvider=createProvider,exports.pubsubRegistry=void 0,exports.usePubSub=usePubSub,exports.usePubSubIframe=usePubSubIframe;function _react(){const data=_interopRequireWildcard(__webpack_require__(59496));return _react=function(){return data},data}function _getRequireWildcardCache(e){if(typeof WeakMap!="function")return null;var r=new WeakMap,t=new WeakMap;return(_getRequireWildcardCache=function(e2){return e2?t:r})(e)}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")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(u!=="default"&&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}const pubsubRegistry=exports.pubsubRegistry=(0,_react().createContext)(void 0);function createProvider(pubSubContext){return({children})=>_react().default.createElement(pubsubRegistry.Provider,{value:pubSubContext},children)}function usePubSub(){return(0,_react().useContext)(pubsubRegistry)}function usePubSubIframe(ref){const pubSub=usePubSub();(0,_react().useEffect)(()=>{if(!ref?.current||!pubSub)return()=>{};const destroyConnection=pubSub.connect(ref.current);return()=>destroyConnection()},[ref?.current,pubSub])}},60238:(__unused_webpack_module,exports,__webpack_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.PubsubAspect=void 0;function _harmony(){const data=__webpack_require__(25217);return _harmony=function(){return data},data}const PubsubAspect=exports.PubsubAspect=_harmony().Aspect.create({id:"teambit.harmony/pubsub",dependencies:[]});var _default=exports.default=PubsubAspect},5874:(__unused_webpack_module,exports,__webpack_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0}),exports.ClickInsideAnIframeEvent=void 0;function _pubsub(){const data=__webpack_require__(7382);return _pubsub=function(){return data},data}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return typeof i=="symbol"?i:String(i)}function _toPrimitive(t,r){if(typeof t!="object"||!t)return t;var e=t[Symbol.toPrimitive];if(e!==void 0){var i=e.call(t,r||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}class ClickInsideAnIframeEventData{constructor(clickEvent){this.clickEvent=clickEvent}}class ClickInsideAnIframeEvent extends _pubsub().BitBaseEvent{constructor(timestamp=Date.now(),clickEvent){super(ClickInsideAnIframeEvent.TYPE,"0.0.1",timestamp,new ClickInsideAnIframeEventData(clickEvent));this.timestamp=timestamp,this.clickEvent=clickEvent}}exports.ClickInsideAnIframeEvent=ClickInsideAnIframeEvent,_defineProperty(ClickInsideAnIframeEvent,"TYPE","click-inside-an-iframe")},79398:(__unused_webpack_module,exports,__webpack_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0});var _clickInsideAnIframe=__webpack_require__(5874);Object.keys(_clickInsideAnIframe).forEach(function(key){key==="default"||key==="__esModule"||key in exports&&exports[key]===_clickInsideAnIframe[key]||Object.defineProperty(exports,key,{enumerable:!0,get:function(){return _clickInsideAnIframe[key]}})})},28628:(__unused_webpack_module,exports)=>{Object.defineProperty(exports,"__esModule",{value:!0}),exports.BundlingStrategyNotFound=void 0;class BundlingStrategyNotFound extends Error{constructor(strategyName){super(`bundling strategy with name ${strategyName} was not found`);this.strategyName=strategyName}}exports.BundlingStrategyNotFound=BundlingStrategyNotFound},32287:(__unused_webpack_module,exports,__webpack_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"BundlingStrategyNotFound",{enumerable:!0,get:function(){return _bundlingStrategyNotFound().BundlingStrategyNotFound}}),Object.defineProperty(exports,"PreviewArtifactNotFound",{enumerable:!0,get:function(){return _previewArtifactNotFound().PreviewArtifactNotFound}}),Object.defineProperty(exports,"PreviewNotFound",{enumerable:!0,get:function(){return _previewNotFound().PreviewNotFound}}),Object.defineProperty(exports,"PreviewOutputFileNotFound",{enumerable:!0,get:function(){return _previewOutputFileNotFound().PreviewOutputFileNotFound}});function _previewNotFound(){const data=__webpack_require__(78508);return _previewNotFound=function(){return data},data}function _previewArtifactNotFound(){const data=__webpack_require__(14734);return _previewArtifactNotFound=function(){return data},data}function _bundlingStrategyNotFound(){const data=__webpack_require__(28628);return _bundlingStrategyNotFound=function(){return data},data}function _previewOutputFileNotFound(){const data=__webpack_require__(5028);return _previewOutputFileNotFound=function(){return data},data}},14734:(__unused_webpack_module,exports,__webpack_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0}),exports.PreviewArtifactNotFound=void 0;function _bitError(){const data=__webpack_require__(75345);return _bitError=function(){return data},data}class PreviewArtifactNotFound extends _bitError().BitError{constructor(componentId){super(`preview for component ${componentId.toString()} was not found`)}}exports.PreviewArtifactNotFound=PreviewArtifactNotFound},78508:(__unused_webpack_module,exports)=>{Object.defineProperty(exports,"__esModule",{value:!0}),exports.PreviewNotFound=void 0;class PreviewNotFound extends Error{constructor(name){super(`Preview for name: ${name} was not found`)}}exports.PreviewNotFound=PreviewNotFound},5028:(__unused_webpack_module,exports,__webpack_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0}),exports.PreviewOutputFileNotFound=void 0;function _bitError(){const data=__webpack_require__(75345);return _bitError=function(){return data},data}class PreviewOutputFileNotFound extends _bitError().BitError{constructor(componentId,filePath){super(`preview output file for component: "${componentId.toString()}" was not found in the path: "${filePath}".
2
-
3
- This is usually a result of an error during the bundling process.
4
- The error might be an error of another component that uses the same env.
5
- Run "bit build" with "--dev" to see more info.
6
- Run "bit envs" to see other components that uses the same env`)}}exports.PreviewOutputFileNotFound=PreviewOutputFileNotFound},98447:(__unused_webpack_module,exports,__webpack_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0}),exports.fetchComponentAspects=fetchComponentAspects;function _graphqlRequest(){const data=__webpack_require__(80507);return _graphqlRequest=function(){return data},data}const GQL_SERVER="/graphql",GET_COMPONENT_ASPECTS=(0,_graphqlRequest().gql)`
7
- query getComponentAspects($id: String!) {
8
- getHost {
9
- id
10
- get(id: $id) {
11
- aspects {
12
- id
13
- }
14
- }
15
- }
16
- }
17
- `;async function fetchComponentAspects(componentId){try{return(await(0,_graphqlRequest().request)(GQL_SERVER,GET_COMPONENT_ASPECTS,{id:componentId.toString()})).getHost.get.aspects.map(x=>x.id)}catch(err){console.error(`[gql] error on "getComponentAspects" - "${err.toString()}"`);return}}},99186:(__unused_webpack_module,exports)=>{Object.defineProperty(exports,"__esModule",{value:!0}),exports.loadLink=loadLink,exports.loadScript=loadScript;function loadScript({src}){return new Promise((resolve,reject)=>{const script=document.createElement("script");script.setAttribute("defer","defer"),script.src=src,script.onload=()=>resolve(),script.onerror=(message,_,_1,_2,error)=>reject(error||new Error(`[preview.preview] failed to load script: ${message}`)),document.head.appendChild(script)})}function loadLink({href}){return new Promise((resolve,reject)=>{const link=document.createElement("link");href.endsWith(".css")&&link.setAttribute("rel","stylesheet"),link.setAttribute("href",href),link.onload=()=>resolve(),link.onerror=(message,_,_1,_2,error)=>reject(error||new Error(`[preview.preview] failed to load link: ${message}`)),document.head.appendChild(link)})}},45532:(__unused_webpack_module,exports,__webpack_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"PREVIEW_MODULES",{enumerable:!0,get:function(){return _previewModules().PREVIEW_MODULES}}),Object.defineProperty(exports,"PreviewModules",{enumerable:!0,get:function(){return _previewModules().PreviewModules}}),Object.defineProperty(exports,"linkModules",{enumerable:!0,get:function(){return _previewModules().linkModules}});function _previewModules(){const data=__webpack_require__(54710);return _previewModules=function(){return data},data}},43451:(__unused_webpack_module,exports,__webpack_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.PreviewRuntime=exports.PreviewAspect=void 0;function _harmony(){const data=__webpack_require__(25217);return _harmony=function(){return data},data}const PreviewRuntime=exports.PreviewRuntime=new(_harmony()).RuntimeDefinition("preview"),PreviewAspect=exports.PreviewAspect=_harmony().Aspect.create({id:"teambit.preview/preview",dependencies:[],defaultConfig:{},declareRuntime:PreviewRuntime});var _default=exports.default=PreviewAspect},3767:(__unused_webpack_module,exports,__webpack_require__)=>{var __webpack_unused_export__;__webpack_unused_export__={value:!0},__webpack_unused_export__=void 0,Object.defineProperty(exports,"Bu",{enumerable:!0,get:function(){return _previewModules().linkModules}});function _pubsub(){const data=__webpack_require__(7382);return _pubsub=function(){return data},data}function _harmony(){const data=__webpack_require__(25217);return _harmony=function(){return data},data}function _componentId(){const data=__webpack_require__(83947);return _componentId=function(){return data},data}function _crossFetch(){const data=_interopRequireDefault(__webpack_require__(6));return _crossFetch=function(){return data},data}function _memoizee(){const data=_interopRequireDefault(__webpack_require__(94300));return _memoizee=function(){return data},data}function _lodash(){const data=__webpack_require__(58822);return _lodash=function(){return data},data}function _exceptions(){const data=__webpack_require__(32287);return _exceptions=function(){return data},data}function _preview(){const data=__webpack_require__(43451);return _preview=function(){return data},data}function _events(){const data=__webpack_require__(79398);return _events=function(){return data},data}function _renderingContext(){const data=__webpack_require__(84764);return _renderingContext=function(){return data},data}function _fetchComponentAspects(){const data=__webpack_require__(98447);return _fetchComponentAspects=function(){return data},data}function _previewModules(){const data=__webpack_require__(45532);return _previewModules=function(){return data},data}function _htmlUtils(){const data=__webpack_require__(99186);return _htmlUtils=function(){return data},data}function _sizeEvent(){const data=__webpack_require__(69493);return _sizeEvent=function(){return data},data}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return typeof i=="symbol"?i:String(i)}function _toPrimitive(t,r){if(typeof t!="object"||!t)return t;var e=t[Symbol.toPrimitive];if(e!==void 0){var i=e.call(t,r||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}class PreviewPreview{constructor(pubsub,previewSlot,renderingContextSlot){this.pubsub=pubsub,this.previewSlot=previewSlot,this.renderingContextSlot=renderingContextSlot,_defineProperty(this,"isDev",!1),_defineProperty(this,"_setupPromise",void 0),_defineProperty(this,"setup",()=>this.isReady()?Promise.resolve():(this._setupPromise??=new Promise(resolve=>{_previewModules().PREVIEW_MODULES.onSet.add(()=>{this.isReady()&&resolve()})}),this._setupPromise)),_defineProperty(this,"render",async rootExt=>{window.document.body.style.width="fit-content";const{previewName,componentId,envId}=this.getLocation(),name=previewName||this.getDefault();rootExt&&(this.isDev=rootExt==="teambit.workspace/workspace");const preview=this.getPreview(name);if(!preview||!componentId)throw new(_exceptions()).PreviewNotFound(previewName);const includesAll=await Promise.all((preview.include||[]).map(async inclPreviewName=>{const includedPreview=this.getPreview(inclPreviewName);if(!includedPreview)return;const inclPreviewModule=await this.getPreviewModule(inclPreviewName,componentId);return includedPreview.selectPreviewModel?.(componentId.fullName,inclPreviewModule)})),query=this.getQuery(),includes=this.getParam(query,"onlyOverview")==="true"?[]:includesAll.filter(module=>!!module).map(module=>{if(!module.default||!(0,_lodash().isObject)(module.default))return module;const keysWithoutDefault=Object.keys(module).filter(key=>key!=="default"),defaultKeys=Object.keys(module.default);return(0,_lodash().intersection)(keysWithoutDefault,defaultKeys).length===defaultKeys.length?module.default:module}),componentAspects=this.isDev?await this.getComponentAspects(componentId.toString()):void 0,previewModule=await this.getPreviewModule(name,componentId),render=preview.render(componentId,envId||"",previewModule,includes,this.getRenderingContext(componentAspects));return this.reportSize(),this.setViewport(),this.setFullScreen(),render}),_defineProperty(this,"getComponentAspects",(0,_memoizee().default)(_fetchComponentAspects().fetchComponentAspects,{max:100,maxAge:12*60*60*1e3})),this.registerClickPubSub()}registerClickPubSub(){window.addEventListener("click",e=>{const timestamp=Date.now(),clickEvent=Object.assign({},e);this.pubsub.pub(_preview().PreviewAspect.id,new(_events()).ClickInsideAnIframeEvent(timestamp,clickEvent))})}isReady(){const{previewName}=this.getLocation(),name=previewName||this.getDefault();if(!_previewModules().PREVIEW_MODULES.has(name))return!1;const preview=this.getPreview(name);return!(!preview||!(preview.include?.every(included=>_previewModules().PREVIEW_MODULES.has(included))??!0))}setFullScreen(){const query=this.getQuery();if(!this.getParam(query,"fullscreen"))return;const root=window.document.getElementById("root");root&&(root.style.height="100vh")}setViewport(){const query=this.getQuery(),viewPort=this.getParam(query,"viewport");if(!viewPort){window.document.body.style.width="100%";return}window.document.body.style.maxWidth=`${viewPort}px`}reportSize(){if(!window?.parent||!window?.document)return;const sendPubsubEvent=()=>{this.pubsub.pub(_preview().PreviewAspect.id,new(_sizeEvent()).SizeEvent({width:window.document.body.offsetWidth,height:window.document.body.offsetHeight}))};window.document.body.addEventListener("resize",(0,_lodash().debounce)(sendPubsubEvent,300));let counter=0;const interval=setInterval(()=>{if(counter+=1,counter>10){clearInterval(interval);return}this.pubsub.pub(_preview().PreviewAspect.id,new(_sizeEvent()).SizeEvent({width:window.document.body.offsetWidth,height:window.document.body.offsetHeight}))},200)}async getPreviewModule(previewName,id){const compShortId=id.fullName,relevantModel=_previewModules().PREVIEW_MODULES.get(previewName);if(!relevantModel)throw new Error(`[preview.preview] missing preview "${previewName}"`);if(relevantModel.componentMap[compShortId])return relevantModel;const componentPreviews=await this.fetchComponentPreview(id,previewName);_previewModules().PREVIEW_MODULES.loadComponentPreviews(compShortId,componentPreviews);const component=componentPreviews[previewName],metadata=componentPreviews[`${previewName}_metadata`];return{modulesMap:relevantModel.modulesMap,componentMap:{[id.fullName]:component},componentMapMetadata:{[id.fullName]:metadata}}}async fetchComponentPreview(id,name){let previewFile;const allFiles=await this.fetchComponentPreviewFiles(id,name);return allFiles===null?{}:(await Promise.all(allFiles.map(file=>{if(file.endsWith("-preview.js")){previewFile=file;return}return this.addComponentFileElement(id,file)})),previewFile?this.loadPreviewScript(id,name,previewFile):{})}addComponentFileElement(id,previewBundleFileName){if(previewBundleFileName.endsWith(".js"))return this.addComponentFileScriptElement(id,previewBundleFileName);this.addComponentFileLinkElement(id,previewBundleFileName).catch(err=>{throw new Error(`[preview.preview] failed loading asset "${previewBundleFileName}". Error - "${err?.toString()}"`)})}async fetchComponentPreviewFiles(id,previewName){const previewAssetsRoute="~aspect/preview-assets",url=`/api/${id.toString()}/${previewAssetsRoute}`,res=await(0,_crossFetch().default)(url);if(res.status>=400)throw new(_exceptions()).PreviewNotFound(previewName);const parsed=await res.json();if(parsed.isBundledWithEnv)return null;if(!parsed.files||!parsed.files.length)throw new(_exceptions()).PreviewNotFound(previewName);return parsed.files}addComponentFileScriptElement(id,previewBundleFileName){const previewRoute="~aspect/component-preview",src=`/api/${id.toString()}/${previewRoute}/${previewBundleFileName}`;return(0,_htmlUtils().loadScript)({src})}addComponentFileLinkElement(id,previewBundleFileName){const href=`/api/${id.toString()}/~aspect/component-preview/${previewBundleFileName}`;return(0,_htmlUtils().loadLink)({href})}async loadPreviewScript(id,previewName,previewBundleFileName){const previewRoute="~aspect/component-preview",src=`/api/${id.toString()}/${previewRoute}/${previewBundleFileName}`;await(0,_htmlUtils().loadScript)({src});const globalId=`${id.toStringWithoutVersion()}-preview`,componentPreview=window[globalId];if(!componentPreview)throw new(_exceptions()).PreviewNotFound(previewName);return componentPreview}registerPreview(preview){return this.previewSlot.register(preview),this}getRenderingContext(aspectsFilter){return new(_renderingContext()).RenderingContext(this.renderingContextSlot,{aspectsFilter})}registerRenderContext(renderContext){return this.renderingContextSlot.register(renderContext),this}getDefault(){const previews=this.previewSlot.values();return previews.find(previewCandidate=>previewCandidate.default)?.name||previews[0].name}getPreview(previewName){return this.previewSlot.values().find(previewCandidate=>previewCandidate.name===previewName)}getParam(query,param){return new URLSearchParams(query).get(param)}getQuery(){const withoutHash=window.location.hash.substring(1),[,after]=withoutHash.split("?");return after}getLocation(){const withoutHash=window.location.hash.substring(1),[before,after]=withoutHash.split("?");return{previewName:this.getParam(after,"preview"),envId:this.getParam(after,"env"),componentId:_componentId().ComponentID.tryFromString(before)}}static async provider([pubsub],config,[previewSlot,renderingContextSlot]){const preview=new PreviewPreview(pubsub,previewSlot,renderingContextSlot);return window.addEventListener("hashchange",()=>{preview.render()}),preview}}__webpack_unused_export__=PreviewPreview,_defineProperty(PreviewPreview,"runtime",_preview().PreviewRuntime),_defineProperty(PreviewPreview,"dependencies",[_pubsub().PubsubAspect]),_defineProperty(PreviewPreview,"slots",[_harmony().Slot.withType(),_harmony().Slot.withType()]),_preview().PreviewAspect.addRuntime(PreviewPreview)},84764:(__unused_webpack_module,exports)=>{Object.defineProperty(exports,"__esModule",{value:!0}),exports.RenderingContext=void 0;class RenderingContext{constructor(contexts,options={}){this.contexts=contexts,this.options=options}get(aspectId){return this.contexts.get(aspectId)?.(this.options)}}exports.RenderingContext=RenderingContext},69493:(__unused_webpack_module,exports,__webpack_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0}),exports.SizeEvent=void 0;function _pubsub(){const data=__webpack_require__(7382);return _pubsub=function(){return data},data}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return typeof i=="symbol"?i:String(i)}function _toPrimitive(t,r){if(typeof t!="object"||!t)return t;var e=t[Symbol.toPrimitive];if(e!==void 0){var i=e.call(t,r||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}class SizeEvent extends _pubsub().BitBaseEvent{constructor(sizeEvent){super(SizeEvent.TYPE,"0.0.1",new Date().getTime(),sizeEvent)}}exports.SizeEvent=SizeEvent,_defineProperty(SizeEvent,"TYPE","preview-size")},31291:(__unused_webpack_module,__unused_webpack___webpack_exports__,__webpack_require__)=>{var _teambit_preview_dist_preview_preview_runtime_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(3767),_home_circleci_bit_bit_node_modules_teambit_react_ui_compositions_app_dist_index_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(5659),_home_circleci_bit_bit_node_modules_teambit_react_ui_compositions_app_dist_index_js__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(_home_circleci_bit_bit_node_modules_teambit_react_ui_compositions_app_dist_index_js__WEBPACK_IMPORTED_MODULE_1__);(0,_teambit_preview_dist_preview_preview_runtime_js__WEBPACK_IMPORTED_MODULE_0__.Bu)("compositions",{modulesMap:{default:_home_circleci_bit_bit_node_modules_teambit_react_ui_compositions_app_dist_index_js__WEBPACK_IMPORTED_MODULE_1__},isSplitComponentBundle:!1,componentMap:{}})}},__webpack_require__=>{var __webpack_exec__=moduleId=>__webpack_require__(__webpack_require__.s=moduleId);__webpack_require__.O(0,[700,851,170,629],()=>__webpack_exec__(31291));var __webpack_exports__=__webpack_require__.O()}]);
@@ -1 +0,0 @@
1
- (()=>{"use strict";var __webpack_modules__={8449:(__unused_webpack_module,__unused_webpack___webpack_exports__,__webpack_require__2)=>{var react__WEBPACK_IMPORTED_MODULE_2___namespace_cache,react_dom__WEBPACK_IMPORTED_MODULE_3___namespace_cache,_teambit_mdx_ui_mdx_scope_context__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__2(81846),_mdx_js_react__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__2(49613),react__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__2(59496),react_dom__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__2(87995),globalObj=window;guard("TeambitMdxUiMdxScopeContext",_teambit_mdx_ui_mdx_scope_context__WEBPACK_IMPORTED_MODULE_0__),guard("MdxJsReact",_mdx_js_react__WEBPACK_IMPORTED_MODULE_1__),guard("React",react__WEBPACK_IMPORTED_MODULE_2___namespace_cache||(react__WEBPACK_IMPORTED_MODULE_2___namespace_cache=__webpack_require__2.t(react__WEBPACK_IMPORTED_MODULE_2__,2))),guard("ReactDom",react_dom__WEBPACK_IMPORTED_MODULE_3___namespace_cache||(react_dom__WEBPACK_IMPORTED_MODULE_3___namespace_cache=__webpack_require__2.t(react_dom__WEBPACK_IMPORTED_MODULE_3__,2))),globalObj.TeambitMdxUiMdxScopeContext=_teambit_mdx_ui_mdx_scope_context__WEBPACK_IMPORTED_MODULE_0__,globalObj.MdxJsReact=_mdx_js_react__WEBPACK_IMPORTED_MODULE_1__,globalObj.React=react__WEBPACK_IMPORTED_MODULE_2___namespace_cache||(react__WEBPACK_IMPORTED_MODULE_2___namespace_cache=__webpack_require__2.t(react__WEBPACK_IMPORTED_MODULE_2__,2)),globalObj.ReactDom=react_dom__WEBPACK_IMPORTED_MODULE_3___namespace_cache||(react_dom__WEBPACK_IMPORTED_MODULE_3___namespace_cache=__webpack_require__2.t(react_dom__WEBPACK_IMPORTED_MODULE_3__,2));function guard(property,expected){var existing=globalObj[property];if(existing===expected&&expected!==void 0)console.warn('[expose-peers] "'+property+'" already exists in global scope, but with correct value');else if(existing!==void 0)throw new Error('[expose-peers] "'+property+'" already exists in the global scope, cannot overwrite')}}},__webpack_module_cache__={};function __webpack_require__(moduleId){var cachedModule=__webpack_module_cache__[moduleId];if(cachedModule!==void 0)return cachedModule.exports;var module=__webpack_module_cache__[moduleId]={id:moduleId,loaded:!1,exports:{}};return __webpack_modules__[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.loaded=!0,module.exports}__webpack_require__.m=__webpack_modules__,(()=>{var deferred=[];__webpack_require__.O=(result,chunkIds,fn,priority)=>{if(chunkIds){priority=priority||0;for(var i=deferred.length;i>0&&deferred[i-1][2]>priority;i--)deferred[i]=deferred[i-1];deferred[i]=[chunkIds,fn,priority];return}for(var notFulfilled=1/0,i=0;i<deferred.length;i++){for(var[chunkIds,fn,priority]=deferred[i],fulfilled=!0,j=0;j<chunkIds.length;j++)(priority&!1||notFulfilled>=priority)&&Object.keys(__webpack_require__.O).every(key=>__webpack_require__.O[key](chunkIds[j]))?chunkIds.splice(j--,1):(fulfilled=!1,priority<notFulfilled&&(notFulfilled=priority));if(fulfilled){deferred.splice(i--,1);var r=fn();r!==void 0&&(result=r)}}return result}})(),__webpack_require__.n=module=>{var getter=module&&module.__esModule?()=>module.default:()=>module;return __webpack_require__.d(getter,{a:getter}),getter},(()=>{var getProto=Object.getPrototypeOf?obj=>Object.getPrototypeOf(obj):obj=>obj.__proto__,leafPrototypes;__webpack_require__.t=function(value,mode){if(mode&1&&(value=this(value)),mode&8||typeof value=="object"&&value&&(mode&4&&value.__esModule||mode&16&&typeof value.then=="function"))return value;var ns=Object.create(null);__webpack_require__.r(ns);var def={};leafPrototypes=leafPrototypes||[null,getProto({}),getProto([]),getProto(getProto)];for(var current=mode&2&&value;typeof current=="object"&&!~leafPrototypes.indexOf(current);current=getProto(current))Object.getOwnPropertyNames(current).forEach(key=>def[key]=()=>value[key]);return def.default=()=>value,__webpack_require__.d(ns,def),ns}})(),__webpack_require__.d=(exports,definition)=>{for(var key in definition)__webpack_require__.o(definition,key)&&!__webpack_require__.o(exports,key)&&Object.defineProperty(exports,key,{enumerable:!0,get:definition[key]})},__webpack_require__.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),__webpack_require__.o=(obj,prop)=>Object.prototype.hasOwnProperty.call(obj,prop),__webpack_require__.r=exports=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(exports,"__esModule",{value:!0})},__webpack_require__.nmd=module=>(module.paths=[],module.children||(module.children=[]),module),(()=>{var installedChunks={703:0};__webpack_require__.O.j=chunkId=>installedChunks[chunkId]===0;var webpackJsonpCallback=(parentChunkLoadingFunction,data)=>{var[chunkIds,moreModules,runtime]=data,moduleId,chunkId,i=0;if(chunkIds.some(id=>installedChunks[id]!==0)){for(moduleId in moreModules)__webpack_require__.o(moreModules,moduleId)&&(__webpack_require__.m[moduleId]=moreModules[moduleId]);if(runtime)var result=runtime(__webpack_require__)}for(parentChunkLoadingFunction&&parentChunkLoadingFunction(data);i<chunkIds.length;i++)chunkId=chunkIds[i],__webpack_require__.o(installedChunks,chunkId)&&installedChunks[chunkId]&&installedChunks[chunkId][0](),installedChunks[chunkId]=0;return __webpack_require__.O(result)},chunkLoadingGlobal=self.__loadChunks_EnvTemplate=self.__loadChunks_EnvTemplate||[];chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null,0)),chunkLoadingGlobal.push=webpackJsonpCallback.bind(null,chunkLoadingGlobal.push.bind(chunkLoadingGlobal))})();var __webpack_exports__=__webpack_require__.O(void 0,[851],()=>__webpack_require__(8449));__webpack_exports__=__webpack_require__.O(__webpack_exports__)})();