@teambit/compositions 0.0.665 → 0.0.668

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,4 @@
1
+ import { ComponentID } from '@teambit/component-id';
1
2
  import { PreviewPreview, RenderingContext, PreviewModule } from '@teambit/preview';
2
3
  export declare class CompositionsPreview {
3
4
  /**
@@ -9,7 +10,7 @@ export declare class CompositionsPreview {
9
10
  * preview extension.
10
11
  */
11
12
  preview: PreviewPreview);
12
- render(componentId: string, modules: PreviewModule, otherPreviewDefs: any, context: RenderingContext): void;
13
+ render(componentId: ComponentID, modules: PreviewModule, otherPreviewDefs: any, context: RenderingContext): void;
13
14
  /** gets relevant information for this preview to render */
14
15
  selectPreviewModel(componentId: string, previewModule: PreviewModule): any;
15
16
  private getActiveComposition;
@@ -63,8 +63,8 @@ class CompositionsPreview {
63
63
  }
64
64
 
65
65
  render(componentId, modules, otherPreviewDefs, context) {
66
- if (!modules.componentMap[componentId]) return;
67
- const compositions = this.selectPreviewModel(componentId, modules);
66
+ if (!modules.componentMap[componentId.fullName]) return;
67
+ const compositions = this.selectPreviewModel(componentId.fullName, modules);
68
68
  const active = this.getActiveComposition(compositions);
69
69
  modules.mainModule.default(active, context);
70
70
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["compositions.preview.runtime.ts"],"names":["CompositionsPreview","constructor","preview","render","componentId","modules","otherPreviewDefs","context","componentMap","compositions","selectPreviewModel","active","getActiveComposition","mainModule","default","previewModule","files","combined","Object","assign","module","chosen","window","location","hash","split","first","values","provider","compPreview","registerPreview","name","bind","PreviewRuntime","PreviewAspect","CompositionsAspect","addRuntime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAQA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEO,MAAMA,mBAAN,CA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tBC,MAAAA,IAAI,EAAE,cADgB;AAEtB5B,MAAAA,MAAM,EAAE0B,WAAW,CAAC1B,MAAZ,CAAmB6B,IAAnB,CAAwBH,WAAxB,CAFc;AAGtBnB,MAAAA,kBAAkB,EAAEmB,WAAW,CAACnB,kBAAZ,CAA+BsB,IAA/B,CAAoCH,WAApC,CAHE;AAItBf,MAAAA,OAAO,EAAE;AAJa,KAAxB;AAOA,WAAOe,WAAP;AACD;;AAnD8B;;;gCAApB7B,mB,aAqCMiC,yB;gCArCNjC,mB,kBAuCW,CAACkC,wBAAD,C;;AAexBC,mCAAmBC,UAAnB,CAA8BpC,mBAA9B","sourcesContent":["import {\n PreviewAspect,\n PreviewPreview,\n RenderingContext,\n PreviewRuntime,\n PreviewModule,\n ModuleFile,\n} from '@teambit/preview';\nimport head from 'lodash.head';\n\nimport { CompositionsAspect } from './compositions.aspect';\n\nexport class CompositionsPreview {\n constructor(\n /**\n * preview extension.\n */\n private preview: PreviewPreview\n ) {}\n\n render(componentId: string, modules: PreviewModule, otherPreviewDefs, context: RenderingContext) {\n if (!modules.componentMap[componentId]) return;\n\n const compositions = this.selectPreviewModel(componentId, modules);\n const active = this.getActiveComposition(compositions);\n\n modules.mainModule.default(active, context);\n }\n\n /** gets relevant information for this preview to render */\n selectPreviewModel(componentId: string, previewModule: PreviewModule) {\n const files = previewModule.componentMap[componentId] || [];\n\n // allow compositions to come from many files. It is assumed they will have unique named\n const combined = Object.assign({}, ...files);\n return combined;\n }\n\n private getActiveComposition(module: ModuleFile) {\n const chosen = window.location.hash.split('&')[1];\n\n if (!chosen) {\n const first = head(Object.values(module));\n return first;\n }\n\n return module[chosen];\n }\n\n static runtime = PreviewRuntime;\n\n static dependencies = [PreviewAspect];\n\n static async provider([preview]: [PreviewPreview]) {\n const compPreview = new CompositionsPreview(preview);\n preview.registerPreview({\n name: 'compositions',\n render: compPreview.render.bind(compPreview),\n selectPreviewModel: compPreview.selectPreviewModel.bind(compPreview),\n default: true,\n });\n\n return compPreview;\n }\n}\n\nCompositionsAspect.addRuntime(CompositionsPreview);\n"]}
1
+ {"version":3,"sources":["compositions.preview.runtime.ts"],"names":["CompositionsPreview","constructor","preview","render","componentId","modules","otherPreviewDefs","context","componentMap","fullName","compositions","selectPreviewModel","active","getActiveComposition","mainModule","default","previewModule","files","combined","Object","assign","module","chosen","window","location","hash","split","first","values","provider","compPreview","registerPreview","name","bind","PreviewRuntime","PreviewAspect","CompositionsAspect","addRuntime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAQA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEO,MAAMA,mBAAN,CAA0B;AAC/BC,EAAAA,WAAW;AACT;AACJ;AACA;AACYC,EAAAA,OAJC,EAKT;AAAA,SADQA,OACR,GADQA,OACR;AAAE;;AAEJC,EAAAA,MAAM,CAACC,WAAD,EAA2BC,OAA3B,EAAmDC,gBAAnD,EAAqEC,OAArE,EAAgG;AACpG,QAAI,CAACF,OAAO,CAACG,YAAR,CAAqBJ,WAAW,CAACK,QAAjC,CAAL,EAAiD;AAEjD,UAAMC,YAAY,GAAG,KAAKC,kBAAL,CAAwBP,WAAW,CAACK,QAApC,EAA8CJ,OAA9C,CAArB;AACA,UAAMO,MAAM,GAAG,KAAKC,oBAAL,CAA0BH,YAA1B,CAAf;AAEAL,IAAAA,OAAO,CAACS,UAAR,CAAmBC,OAAnB,CAA2BH,MAA3B,EAAmCL,OAAnC;AACD;AAED;;;AACAI,EAAAA,kBAAkB,CAACP,WAAD,EAAsBY,aAAtB,EAAoD;AACpE,UAAMC,KAAK,GAAGD,aAAa,CAACR,YAAd,CAA2BJ,WAA3B,KAA2C,EAAzD,CADoE,CAGpE;;AACA,UAAMc,QAAQ,GAAGC,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkB,GAAGH,KAArB,CAAjB;AACA,WAAOC,QAAP;AACD;;AAEOL,EAAAA,oBAAoB,CAACQ,MAAD,EAAqB;AAC/C,UAAMC,MAAM,GAAGC,MAAM,CAACC,QAAP,CAAgBC,IAAhB,CAAqBC,KAArB,CAA2B,GAA3B,EAAgC,CAAhC,CAAf;;AAEA,QAAI,CAACJ,MAAL,EAAa;AACX,YAAMK,KAAK,GAAG,uBAAKR,MAAM,CAACS,MAAP,CAAcP,MAAd,CAAL,CAAd;AACA,aAAOM,KAAP;AACD;;AAED,WAAON,MAAM,CAACC,MAAD,CAAb;AACD;;AAMoB,eAARO,QAAQ,CAAC,CAAC3B,OAAD,CAAD,EAA8B;AACjD,UAAM4B,WAAW,GAAG,IAAI9B,mBAAJ,CAAwBE,OAAxB,CAApB;AACAA,IAAAA,OAAO,CAAC6B,eAAR,CAAwB;AACtBC,MAAAA,IAAI,EAAE,cADgB;AAEtB7B,MAAAA,MAAM,EAAE2B,WAAW,CAAC3B,MAAZ,CAAmB8B,IAAnB,CAAwBH,WAAxB,CAFc;AAGtBnB,MAAAA,kBAAkB,EAAEmB,WAAW,CAACnB,kBAAZ,CAA+BsB,IAA/B,CAAoCH,WAApC,CAHE;AAItBf,MAAAA,OAAO,EAAE;AAJa,KAAxB;AAOA,WAAOe,WAAP;AACD;;AAnD8B;;;gCAApB9B,mB,aAqCMkC,yB;gCArCNlC,mB,kBAuCW,CAACmC,wBAAD,C;;AAexBC,mCAAmBC,UAAnB,CAA8BrC,mBAA9B","sourcesContent":["import { ComponentID } from '@teambit/component-id';\nimport {\n PreviewAspect,\n PreviewPreview,\n RenderingContext,\n PreviewRuntime,\n PreviewModule,\n ModuleFile,\n} from '@teambit/preview';\nimport head from 'lodash.head';\n\nimport { CompositionsAspect } from './compositions.aspect';\n\nexport class CompositionsPreview {\n constructor(\n /**\n * preview extension.\n */\n private preview: PreviewPreview\n ) {}\n\n render(componentId: ComponentID, modules: PreviewModule, otherPreviewDefs, context: RenderingContext) {\n if (!modules.componentMap[componentId.fullName]) return;\n\n const compositions = this.selectPreviewModel(componentId.fullName, modules);\n const active = this.getActiveComposition(compositions);\n\n modules.mainModule.default(active, context);\n }\n\n /** gets relevant information for this preview to render */\n selectPreviewModel(componentId: string, previewModule: PreviewModule) {\n const files = previewModule.componentMap[componentId] || [];\n\n // allow compositions to come from many files. It is assumed they will have unique named\n const combined = Object.assign({}, ...files);\n return combined;\n }\n\n private getActiveComposition(module: ModuleFile) {\n const chosen = window.location.hash.split('&')[1];\n\n if (!chosen) {\n const first = head(Object.values(module));\n return first;\n }\n\n return module[chosen];\n }\n\n static runtime = PreviewRuntime;\n\n static dependencies = [PreviewAspect];\n\n static async provider([preview]: [PreviewPreview]) {\n const compPreview = new CompositionsPreview(preview);\n preview.registerPreview({\n name: 'compositions',\n render: compPreview.render.bind(compPreview),\n selectPreviewModel: compPreview.selectPreviewModel.bind(compPreview),\n default: true,\n });\n\n return compPreview;\n }\n}\n\nCompositionsAspect.addRuntime(CompositionsPreview);\n"]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/compositions",
3
- "version": "0.0.665",
3
+ "version": "0.0.668",
4
4
  "homepage": "https://bit.dev/teambit/compositions/compositions",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.compositions",
8
8
  "name": "compositions",
9
- "version": "0.0.665"
9
+ "version": "0.0.668"
10
10
  },
11
11
  "dependencies": {
12
12
  "@teambit/harmony": "0.2.11",
@@ -23,16 +23,17 @@
23
23
  "@teambit/documenter.ui.heading": "4.1.1",
24
24
  "@teambit/documenter.ui.property-table": "4.1.3",
25
25
  "@teambit/evangelist.elements.icon": "1.0.2",
26
- "@teambit/component": "0.0.665",
26
+ "@teambit/component": "0.0.668",
27
27
  "@teambit/compositions.model.composition-id": "0.0.486",
28
- "@teambit/graphql": "0.0.665",
29
- "@teambit/cli": "0.0.450",
30
- "@teambit/dev-files": "0.0.665",
31
- "@teambit/preview": "0.0.665",
32
- "@teambit/schema": "0.0.665",
33
- "@teambit/workspace": "0.0.665",
28
+ "@teambit/graphql": "0.0.668",
29
+ "@teambit/cli": "0.0.451",
30
+ "@teambit/dev-files": "0.0.668",
31
+ "@teambit/preview": "0.0.668",
32
+ "@teambit/schema": "0.0.668",
33
+ "@teambit/workspace": "0.0.668",
34
34
  "@teambit/ui-foundation.ui.constants.z-indexes": "0.0.487",
35
- "@teambit/envs": "0.0.665",
35
+ "@teambit/envs": "0.0.668",
36
+ "@teambit/component-id": "0.0.401",
36
37
  "@teambit/compositions.ui.compositions-menu-bar": "0.0.163",
37
38
  "@teambit/compositions.ui.hooks.use-composition": "0.0.163",
38
39
  "@teambit/design.ui.alert-card": "0.0.14",
@@ -42,11 +43,11 @@
42
43
  "@teambit/design.ui.surfaces.status-message-card": "0.0.7",
43
44
  "@teambit/docs.ui.queries.get-docs": "0.0.487",
44
45
  "@teambit/mdx.ui.mdx-layout": "0.0.494",
45
- "@teambit/panels": "0.0.451",
46
- "@teambit/preview.ui.component-preview": "0.0.491",
46
+ "@teambit/panels": "0.0.452",
47
+ "@teambit/preview.ui.component-preview": "0.0.492",
47
48
  "@teambit/ui-foundation.ui.buttons.collapser": "0.0.193",
48
49
  "@teambit/ui-foundation.ui.hooks.use-is-mobile": "0.0.179",
49
- "@teambit/ui": "0.0.665",
50
+ "@teambit/ui": "0.0.668",
50
51
  "@teambit/compositions.model.composition-type": "0.0.487",
51
52
  "@teambit/compositions.ui.composition-card": "0.0.493"
52
53
  },
@@ -62,7 +63,7 @@
62
63
  "@teambit/compositions.aspect-docs.compositions": "0.0.132"
63
64
  },
64
65
  "peerDependencies": {
65
- "@teambit/legacy": "1.0.229",
66
+ "@teambit/legacy": "1.0.230",
66
67
  "react-dom": "^16.8.0 || ^17.0.0",
67
68
  "react": "^16.8.0 || ^17.0.0"
68
69
  },
@@ -90,7 +91,7 @@
90
91
  "react": "-"
91
92
  },
92
93
  "peerDependencies": {
93
- "@teambit/legacy": "1.0.229",
94
+ "@teambit/legacy": "1.0.230",
94
95
  "react-dom": "^16.8.0 || ^17.0.0",
95
96
  "react": "^16.8.0 || ^17.0.0"
96
97
  }
@@ -1 +1 @@
1
- export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compositions_compositions@0.0.665/dist/compositions.docs.mdx')]
1
+ export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compositions_compositions@0.0.668/dist/compositions.docs.mdx')]