@teambit/compositions 0.0.858 → 0.0.860
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compositions.preview.runtime.js +6 -4
- package/dist/compositions.preview.runtime.js.map +1 -1
- package/package-tar/teambit-compositions-0.0.860.tgz +0 -0
- package/package.json +15 -15
- package/{preview-1663645073615.js → preview-1663731461630.js} +2 -2
- package/package-tar/teambit-compositions-0.0.858.tgz +0 -0
|
@@ -6,6 +6,8 @@ require("core-js/modules/es.array.iterator.js");
|
|
|
6
6
|
|
|
7
7
|
require("core-js/modules/es.promise.js");
|
|
8
8
|
|
|
9
|
+
require("core-js/modules/es.regexp.exec.js");
|
|
10
|
+
|
|
9
11
|
Object.defineProperty(exports, "__esModule", {
|
|
10
12
|
value: true
|
|
11
13
|
});
|
|
@@ -88,12 +90,12 @@ class CompositionsPreview {
|
|
|
88
90
|
}
|
|
89
91
|
|
|
90
92
|
getActiveComposition(module, metadata) {
|
|
91
|
-
|
|
93
|
+
const firstQueryParam = window.location.hash.split('&')[1];
|
|
92
94
|
const query = this.preview.getQuery();
|
|
93
|
-
const
|
|
95
|
+
const compositionId = this.preview.getParam(query, 'name') || firstQueryParam;
|
|
94
96
|
|
|
95
|
-
if (
|
|
96
|
-
return module[
|
|
97
|
+
if (compositionId && module[compositionId]) {
|
|
98
|
+
return module[compositionId];
|
|
97
99
|
}
|
|
98
100
|
|
|
99
101
|
if (metadata && metadata.compositions) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CompositionsPreview","constructor","preview","render","componentId","modules","otherPreviewDefs","context","componentMap","fullName","compositions","selectPreviewModel","metadata","getMetadata","active","getActiveComposition","mainModule","default","componentFullName","previewModule","files","combined","Object","assign","componentMapMetadata","undefined","module","query","getQuery","
|
|
1
|
+
{"version":3,"names":["CompositionsPreview","constructor","preview","render","componentId","modules","otherPreviewDefs","context","componentMap","fullName","compositions","selectPreviewModel","metadata","getMetadata","active","getActiveComposition","mainModule","default","componentFullName","previewModule","files","combined","Object","assign","componentMapMetadata","undefined","module","firstQueryParam","window","location","hash","split","query","getQuery","compositionId","getParam","first","head","firstId","identifier","values","provider","compPreview","registerPreview","name","bind","PreviewRuntime","PreviewAspect","CompositionsAspect","addRuntime"],"sources":["compositions.preview.runtime.ts"],"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';\nimport { CompositionBrowserMetadataObject } from './composition';\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\n const compositions = this.selectPreviewModel(componentId.fullName, modules);\n const metadata = this.getMetadata(componentId.fullName, modules);\n const active = this.getActiveComposition(compositions, metadata);\n\n modules.mainModule.default(active, context);\n }\n\n /** gets relevant information for this preview to render */\n selectPreviewModel(componentFullName: string, previewModule: PreviewModule) {\n const files = previewModule.componentMap[componentFullName] || [];\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 getMetadata(componentFullName: string, previewModule: PreviewModule): CompositionBrowserMetadataObject | undefined {\n const metadata = previewModule?.componentMapMetadata\n ? previewModule.componentMapMetadata[componentFullName]\n : undefined;\n if (metadata){\n return metadata as CompositionBrowserMetadataObject\n }\n return undefined;\n }\n\n private getActiveComposition(module: ModuleFile, metadata?: CompositionBrowserMetadataObject) {\n const firstQueryParam = window.location.hash.split('&')[1];\n const query = this.preview.getQuery();\n const compositionId = this.preview.getParam(query, 'name') || firstQueryParam;\n\n if (compositionId && module[compositionId]) {\n return module[compositionId];\n }\n\n if (metadata && metadata.compositions) {\n const first = head(metadata.compositions);\n const firstId = first?.identifier;\n if (firstId && module[firstId]) {\n return module[firstId];\n }\n }\n\n const first = head(Object.values(module));\n return first;\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAQA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,mBAAN,CAA0B;EAC/BC,WAAW;EACT;AACJ;AACA;EACYC,OAJC,EAKT;IAAA,KADQA,OACR,GADQA,OACR;EAAE;;EAEJC,MAAM,CAACC,WAAD,EAA2BC,OAA3B,EAAmDC,gBAAnD,EAAqEC,OAArE,EAAgG;IACpG,IAAI,CAACF,OAAO,CAACG,YAAR,CAAqBJ,WAAW,CAACK,QAAjC,CAAL,EAAiD;IAGjD,MAAMC,YAAY,GAAG,KAAKC,kBAAL,CAAwBP,WAAW,CAACK,QAApC,EAA8CJ,OAA9C,CAArB;IACA,MAAMO,QAAQ,GAAG,KAAKC,WAAL,CAAiBT,WAAW,CAACK,QAA7B,EAAuCJ,OAAvC,CAAjB;IACA,MAAMS,MAAM,GAAG,KAAKC,oBAAL,CAA0BL,YAA1B,EAAwCE,QAAxC,CAAf;IAEAP,OAAO,CAACW,UAAR,CAAmBC,OAAnB,CAA2BH,MAA3B,EAAmCP,OAAnC;EACD;EAED;;;EACAI,kBAAkB,CAACO,iBAAD,EAA4BC,aAA5B,EAA0D;IAC1E,MAAMC,KAAK,GAAGD,aAAa,CAACX,YAAd,CAA2BU,iBAA3B,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,CAAd;IACA,OAAOU,KAAP;EACD;;EAMoB,aAARK,QAAQ,CAAC,CAACvC,OAAD,CAAD,EAA8B;IACjD,MAAMwC,WAAW,GAAG,IAAI1C,mBAAJ,CAAwBE,OAAxB,CAApB;IACAA,OAAO,CAACyC,eAAR,CAAwB;MACtBC,IAAI,EAAE,cADgB;MAEtBzC,MAAM,EAAEuC,WAAW,CAACvC,MAAZ,CAAmB0C,IAAnB,CAAwBH,WAAxB,CAFc;MAGtB/B,kBAAkB,EAAE+B,WAAW,CAAC/B,kBAAZ,CAA+BkC,IAA/B,CAAoCH,WAApC,CAHE;MAItBzB,OAAO,EAAE;IAJa,CAAxB;IAOA,OAAOyB,WAAP;EACD;;AAzE8B;;;gCAApB1C,mB,aA2DM8C,yB;gCA3DN9C,mB,kBA6DW,CAAC+C,wBAAD,C;;AAexBC,kCAAA,CAAmBC,UAAnB,CAA8BjD,mBAA9B"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/compositions",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.860",
|
|
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.
|
|
9
|
+
"version": "0.0.860"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"graphql-tag": "2.12.1",
|
|
@@ -25,17 +25,17 @@
|
|
|
25
25
|
"@teambit/documenter.ui.heading": "4.1.1",
|
|
26
26
|
"@teambit/documenter.ui.property-table": "4.1.3",
|
|
27
27
|
"@teambit/evangelist.elements.icon": "1.0.2",
|
|
28
|
-
"@teambit/component": "0.0.
|
|
29
|
-
"@teambit/compositions.ui.composition-compare": "0.0.
|
|
28
|
+
"@teambit/component": "0.0.860",
|
|
29
|
+
"@teambit/compositions.ui.composition-compare": "0.0.86",
|
|
30
30
|
"@teambit/compositions.model.composition-id": "0.0.494",
|
|
31
|
-
"@teambit/graphql": "0.0.
|
|
32
|
-
"@teambit/cli": "0.0.
|
|
33
|
-
"@teambit/dev-files": "0.0.
|
|
34
|
-
"@teambit/envs": "0.0.
|
|
35
|
-
"@teambit/preview": "0.0.
|
|
36
|
-
"@teambit/schema": "0.0.
|
|
31
|
+
"@teambit/graphql": "0.0.860",
|
|
32
|
+
"@teambit/cli": "0.0.572",
|
|
33
|
+
"@teambit/dev-files": "0.0.860",
|
|
34
|
+
"@teambit/envs": "0.0.860",
|
|
35
|
+
"@teambit/preview": "0.0.860",
|
|
36
|
+
"@teambit/schema": "0.0.860",
|
|
37
37
|
"@teambit/toolbox.path.match-patterns": "0.0.7",
|
|
38
|
-
"@teambit/workspace": "0.0.
|
|
38
|
+
"@teambit/workspace": "0.0.860",
|
|
39
39
|
"@teambit/ui-foundation.ui.constants.z-indexes": "0.0.494",
|
|
40
40
|
"@teambit/component-id": "0.0.417",
|
|
41
41
|
"@teambit/compositions.ui.compositions-menu-bar": "0.0.169",
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
"@teambit/design.ui.surfaces.status-message-card": "0.0.14",
|
|
46
46
|
"@teambit/docs.ui.queries.get-docs": "0.0.495",
|
|
47
47
|
"@teambit/mdx.ui.mdx-layout": "0.0.507",
|
|
48
|
-
"@teambit/panels": "0.0.
|
|
48
|
+
"@teambit/panels": "0.0.573",
|
|
49
49
|
"@teambit/preview.ui.component-preview": "0.0.503",
|
|
50
50
|
"@teambit/ui-foundation.ui.buttons.collapser": "0.0.201",
|
|
51
51
|
"@teambit/ui-foundation.ui.hooks.use-is-mobile": "0.0.185",
|
|
52
|
-
"@teambit/component-compare": "0.0.
|
|
53
|
-
"@teambit/ui": "0.0.
|
|
52
|
+
"@teambit/component-compare": "0.0.108",
|
|
53
|
+
"@teambit/ui": "0.0.860",
|
|
54
54
|
"@teambit/compositions.model.composition-type": "0.0.495",
|
|
55
55
|
"@teambit/compositions.ui.composition-card": "0.0.502"
|
|
56
56
|
},
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@teambit/compositions.aspect-docs.compositions": "0.0.145"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@teambit/legacy": "1.0.
|
|
69
|
+
"@teambit/legacy": "1.0.352",
|
|
70
70
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
71
71
|
"react": "^16.8.0 || ^17.0.0"
|
|
72
72
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compositions_compositions@0.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compositions_compositions@0.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compositions_compositions@0.0.860/dist/compositions.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compositions_compositions@0.0.860/dist/compositions.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
|
Binary file
|