@teambit/component-compare 0.0.198 → 0.0.200
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/component-compare-aspects.section.tsx +14 -3
- package/component-compare-changelog.section.tsx +12 -3
- package/component-compare.ui.runtime.tsx +9 -22
- package/dist/component-compare-aspects.section.d.ts +14 -3
- package/dist/component-compare-aspects.section.js +31 -2
- package/dist/component-compare-aspects.section.js.map +1 -1
- package/dist/component-compare-changelog.section.d.ts +12 -3
- package/dist/component-compare-changelog.section.js +23 -2
- package/dist/component-compare-changelog.section.js.map +1 -1
- package/dist/component-compare.graphql.d.ts +3 -0
- package/dist/component-compare.graphql.js +14 -0
- package/dist/component-compare.graphql.js.map +1 -1
- package/dist/component-compare.main.runtime.d.ts +4 -2
- package/dist/component-compare.main.runtime.js +13 -4
- package/dist/component-compare.main.runtime.js.map +1 -1
- package/dist/component-compare.ui.runtime.d.ts +5 -9
- package/dist/component-compare.ui.runtime.js +5 -11
- package/dist/component-compare.ui.runtime.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/{preview-1672744851119.js → preview-1672889151191.js} +2 -2
- package/package-tar/teambit-component-compare-0.0.200.tgz +0 -0
- package/package.json +14 -13
- package/package-tar/teambit-component-compare-0.0.198.tgz +0 -0
|
@@ -1,17 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MenuWidgetIcon } from '@teambit/ui-foundation.ui.menu-widget-icon';
|
|
3
|
+
import { TabItem } from '@teambit/component.ui.component-compare.models.component-compare-props';
|
|
4
|
+
import { ChangeType } from '@teambit/component.ui.component-compare.models.component-compare-change-type';
|
|
1
5
|
import { Section } from '@teambit/component';
|
|
2
6
|
import { ComponentCompareUI } from './component-compare.ui.runtime';
|
|
3
7
|
|
|
4
|
-
export class AspectsCompareSection implements Section {
|
|
8
|
+
export class AspectsCompareSection implements TabItem, Section {
|
|
5
9
|
constructor(private compareUI: ComponentCompareUI) {}
|
|
6
10
|
|
|
7
11
|
navigationLink = {
|
|
8
12
|
href: 'aspects',
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
displayName: 'Aspects',
|
|
14
|
+
children: <MenuWidgetIcon icon="configuration" tooltipContent="Configuration" />,
|
|
11
15
|
};
|
|
12
16
|
|
|
17
|
+
props = this.navigationLink;
|
|
18
|
+
|
|
13
19
|
route = {
|
|
14
20
|
path: 'aspects/*',
|
|
15
21
|
element: this.compareUI.getAspectsComparePage(),
|
|
16
22
|
};
|
|
23
|
+
|
|
24
|
+
order = 60;
|
|
25
|
+
widget = true;
|
|
26
|
+
changeType = ChangeType.ASPECTS;
|
|
27
|
+
id = 'aspects';
|
|
17
28
|
}
|
|
@@ -1,17 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { Section } from '@teambit/component';
|
|
3
|
+
import { TabItem } from '@teambit/component.ui.component-compare.models.component-compare-props';
|
|
4
|
+
import { MenuWidgetIcon } from '@teambit/ui-foundation.ui.menu-widget-icon';
|
|
2
5
|
import { ComponentCompareUI } from './component-compare.ui.runtime';
|
|
3
6
|
|
|
4
|
-
export class CompareChangelogSection implements Section {
|
|
7
|
+
export class CompareChangelogSection implements Section, TabItem {
|
|
5
8
|
constructor(private compareUI: ComponentCompareUI) {}
|
|
6
9
|
|
|
7
10
|
navigationLink = {
|
|
8
11
|
href: 'changelog',
|
|
9
|
-
children:
|
|
10
|
-
|
|
12
|
+
children: <MenuWidgetIcon icon="changelog" tooltipContent="Change log" />,
|
|
13
|
+
displayName: 'Change log',
|
|
11
14
|
};
|
|
12
15
|
|
|
16
|
+
props = this.navigationLink;
|
|
17
|
+
|
|
13
18
|
route = {
|
|
14
19
|
path: 'changelog/*',
|
|
15
20
|
element: this.compareUI.getChangelogComparePage(),
|
|
16
21
|
};
|
|
22
|
+
|
|
23
|
+
order = 70;
|
|
24
|
+
widget = true;
|
|
25
|
+
id = 'changelog';
|
|
17
26
|
}
|
|
@@ -2,12 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import { RouteProps } from 'react-router-dom';
|
|
3
3
|
import flatten from 'lodash.flatten';
|
|
4
4
|
import { Harmony, Slot, SlotRegistry } from '@teambit/harmony';
|
|
5
|
-
import { NavLinkProps } from '@teambit/base-ui.routing.nav-link';
|
|
6
5
|
import ComponentAspect, { ComponentUI } from '@teambit/component';
|
|
7
6
|
import { ComponentCompare } from '@teambit/component.ui.component-compare.component-compare';
|
|
8
7
|
import { UIRuntime } from '@teambit/ui';
|
|
9
8
|
import { RouteSlot } from '@teambit/ui-foundation.ui.react-router.slot-router';
|
|
10
|
-
import { ComponentCompareProps } from '@teambit/component.ui.component-compare.models.component-compare-props';
|
|
9
|
+
import { ComponentCompareProps, TabItem } from '@teambit/component.ui.component-compare.models.component-compare-props';
|
|
11
10
|
import { ComponentCompareChangelog } from '@teambit/component.ui.component-compare.changelog';
|
|
12
11
|
import { ComponentCompareAspects } from '@teambit/component.ui.component-compare.compare-aspects.compare-aspects';
|
|
13
12
|
import { AspectsCompareSection } from './component-compare-aspects.section';
|
|
@@ -15,12 +14,8 @@ import { ComponentCompareAspect } from './component-compare.aspect';
|
|
|
15
14
|
import { ComponentCompareSection } from './component-compare.section';
|
|
16
15
|
import { CompareChangelogSection } from './component-compare-changelog.section';
|
|
17
16
|
|
|
18
|
-
export type ComponentCompareNav =
|
|
19
|
-
|
|
20
|
-
order: number;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export type ComponentCompareNavSlot = SlotRegistry<Array<ComponentCompareNav>>;
|
|
17
|
+
export type ComponentCompareNav = Array<TabItem>;
|
|
18
|
+
export type ComponentCompareNavSlot = SlotRegistry<ComponentCompareNav>;
|
|
24
19
|
export class ComponentCompareUI {
|
|
25
20
|
constructor(private host: string, private navSlot: ComponentCompareNavSlot, private routeSlot: RouteSlot) {}
|
|
26
21
|
|
|
@@ -46,11 +41,11 @@ export class ComponentCompareUI {
|
|
|
46
41
|
return <ComponentCompareChangelog />;
|
|
47
42
|
};
|
|
48
43
|
|
|
49
|
-
registerNavigation(
|
|
50
|
-
if (Array.isArray(
|
|
51
|
-
this.navSlot.register(
|
|
44
|
+
registerNavigation(nav: TabItem | Array<TabItem>) {
|
|
45
|
+
if (Array.isArray(nav)) {
|
|
46
|
+
this.navSlot.register(nav);
|
|
52
47
|
} else {
|
|
53
|
-
this.navSlot.register([
|
|
48
|
+
this.navSlot.register([nav]);
|
|
54
49
|
}
|
|
55
50
|
return this;
|
|
56
51
|
}
|
|
@@ -82,16 +77,8 @@ export class ComponentCompareUI {
|
|
|
82
77
|
componentUi.registerWidget(componentCompareSection.navigationLink, componentCompareSection.order);
|
|
83
78
|
const aspectCompareSection = new AspectsCompareSection(componentCompareUI);
|
|
84
79
|
const compareChangelog = new CompareChangelogSection(componentCompareUI);
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
props: aspectCompareSection.navigationLink,
|
|
88
|
-
order: aspectCompareSection.navigationLink.order,
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
props: compareChangelog.navigationLink,
|
|
92
|
-
order: compareChangelog.navigationLink.order,
|
|
93
|
-
},
|
|
94
|
-
]);
|
|
80
|
+
|
|
81
|
+
componentCompareUI.registerNavigation([aspectCompareSection, compareChangelog]);
|
|
95
82
|
|
|
96
83
|
componentCompareUI.registerRoutes([aspectCompareSection.route, compareChangelog.route]);
|
|
97
84
|
return componentCompareUI;
|
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { TabItem } from '@teambit/component.ui.component-compare.models.component-compare-props';
|
|
3
|
+
import { ChangeType } from '@teambit/component.ui.component-compare.models.component-compare-change-type';
|
|
2
4
|
import { Section } from '@teambit/component';
|
|
3
5
|
import { ComponentCompareUI } from './component-compare.ui.runtime';
|
|
4
|
-
export declare class AspectsCompareSection implements Section {
|
|
6
|
+
export declare class AspectsCompareSection implements TabItem, Section {
|
|
5
7
|
private compareUI;
|
|
6
8
|
constructor(compareUI: ComponentCompareUI);
|
|
7
9
|
navigationLink: {
|
|
8
10
|
href: string;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
displayName: string;
|
|
12
|
+
children: JSX.Element;
|
|
13
|
+
};
|
|
14
|
+
props: {
|
|
15
|
+
href: string;
|
|
16
|
+
displayName: string;
|
|
17
|
+
children: JSX.Element;
|
|
11
18
|
};
|
|
12
19
|
route: {
|
|
13
20
|
path: string;
|
|
14
21
|
element: JSX.Element;
|
|
15
22
|
};
|
|
23
|
+
order: number;
|
|
24
|
+
widget: boolean;
|
|
25
|
+
changeType: ChangeType;
|
|
26
|
+
id: string;
|
|
16
27
|
}
|
|
@@ -12,18 +12,47 @@ function _defineProperty2() {
|
|
|
12
12
|
};
|
|
13
13
|
return data;
|
|
14
14
|
}
|
|
15
|
+
function _react() {
|
|
16
|
+
const data = _interopRequireDefault(require("react"));
|
|
17
|
+
_react = function () {
|
|
18
|
+
return data;
|
|
19
|
+
};
|
|
20
|
+
return data;
|
|
21
|
+
}
|
|
22
|
+
function _uiFoundationUi() {
|
|
23
|
+
const data = require("@teambit/ui-foundation.ui.menu-widget-icon");
|
|
24
|
+
_uiFoundationUi = function () {
|
|
25
|
+
return data;
|
|
26
|
+
};
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
29
|
+
function _componentUiComponentCompareModels() {
|
|
30
|
+
const data = require("@teambit/component.ui.component-compare.models.component-compare-change-type");
|
|
31
|
+
_componentUiComponentCompareModels = function () {
|
|
32
|
+
return data;
|
|
33
|
+
};
|
|
34
|
+
return data;
|
|
35
|
+
}
|
|
15
36
|
class AspectsCompareSection {
|
|
16
37
|
constructor(compareUI) {
|
|
17
38
|
this.compareUI = compareUI;
|
|
18
39
|
(0, _defineProperty2().default)(this, "navigationLink", {
|
|
19
40
|
href: 'aspects',
|
|
20
|
-
|
|
21
|
-
|
|
41
|
+
displayName: 'Aspects',
|
|
42
|
+
children: /*#__PURE__*/_react().default.createElement(_uiFoundationUi().MenuWidgetIcon, {
|
|
43
|
+
icon: "configuration",
|
|
44
|
+
tooltipContent: "Configuration"
|
|
45
|
+
})
|
|
22
46
|
});
|
|
47
|
+
(0, _defineProperty2().default)(this, "props", this.navigationLink);
|
|
23
48
|
(0, _defineProperty2().default)(this, "route", {
|
|
24
49
|
path: 'aspects/*',
|
|
25
50
|
element: this.compareUI.getAspectsComparePage()
|
|
26
51
|
});
|
|
52
|
+
(0, _defineProperty2().default)(this, "order", 60);
|
|
53
|
+
(0, _defineProperty2().default)(this, "widget", true);
|
|
54
|
+
(0, _defineProperty2().default)(this, "changeType", _componentUiComponentCompareModels().ChangeType.ASPECTS);
|
|
55
|
+
(0, _defineProperty2().default)(this, "id", 'aspects');
|
|
27
56
|
}
|
|
28
57
|
}
|
|
29
58
|
exports.AspectsCompareSection = AspectsCompareSection;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AspectsCompareSection","constructor","compareUI","href","children","
|
|
1
|
+
{"version":3,"names":["AspectsCompareSection","constructor","compareUI","href","displayName","children","navigationLink","path","element","getAspectsComparePage","ChangeType","ASPECTS"],"sources":["component-compare-aspects.section.tsx"],"sourcesContent":["import React from 'react';\nimport { MenuWidgetIcon } from '@teambit/ui-foundation.ui.menu-widget-icon';\nimport { TabItem } from '@teambit/component.ui.component-compare.models.component-compare-props';\nimport { ChangeType } from '@teambit/component.ui.component-compare.models.component-compare-change-type';\nimport { Section } from '@teambit/component';\nimport { ComponentCompareUI } from './component-compare.ui.runtime';\n\nexport class AspectsCompareSection implements TabItem, Section {\n constructor(private compareUI: ComponentCompareUI) {}\n\n navigationLink = {\n href: 'aspects',\n displayName: 'Aspects',\n children: <MenuWidgetIcon icon=\"configuration\" tooltipContent=\"Configuration\" />,\n };\n\n props = this.navigationLink;\n\n route = {\n path: 'aspects/*',\n element: this.compareUI.getAspectsComparePage(),\n };\n\n order = 60;\n widget = true;\n changeType = ChangeType.ASPECTS;\n id = 'aspects';\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAIO,MAAMA,qBAAqB,CAA6B;EAC7DC,WAAW,CAASC,SAA6B,EAAE;IAAA,KAA/BA,SAA6B,GAA7BA,SAA6B;IAAA,wDAEhC;MACfC,IAAI,EAAE,SAAS;MACfC,WAAW,EAAE,SAAS;MACtBC,QAAQ,eAAE,+BAAC,gCAAc;QAAC,IAAI,EAAC,eAAe;QAAC,cAAc,EAAC;MAAe;IAC/E,CAAC;IAAA,+CAEO,IAAI,CAACC,cAAc;IAAA,+CAEnB;MACNC,IAAI,EAAE,WAAW;MACjBC,OAAO,EAAE,IAAI,CAACN,SAAS,CAACO,qBAAqB;IAC/C,CAAC;IAAA,+CAEO,EAAE;IAAA,gDACD,IAAI;IAAA,oDACAC,+CAAU,CAACC,OAAO;IAAA,4CAC1B,SAAS;EAlBsC;AAmBtD;AAAC"}
|
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Section } from '@teambit/component';
|
|
3
|
+
import { TabItem } from '@teambit/component.ui.component-compare.models.component-compare-props';
|
|
3
4
|
import { ComponentCompareUI } from './component-compare.ui.runtime';
|
|
4
|
-
export declare class CompareChangelogSection implements Section {
|
|
5
|
+
export declare class CompareChangelogSection implements Section, TabItem {
|
|
5
6
|
private compareUI;
|
|
6
7
|
constructor(compareUI: ComponentCompareUI);
|
|
7
8
|
navigationLink: {
|
|
8
9
|
href: string;
|
|
9
|
-
children:
|
|
10
|
-
|
|
10
|
+
children: JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
13
|
+
props: {
|
|
14
|
+
href: string;
|
|
15
|
+
children: JSX.Element;
|
|
16
|
+
displayName: string;
|
|
11
17
|
};
|
|
12
18
|
route: {
|
|
13
19
|
path: string;
|
|
14
20
|
element: JSX.Element;
|
|
15
21
|
};
|
|
22
|
+
order: number;
|
|
23
|
+
widget: boolean;
|
|
24
|
+
id: string;
|
|
16
25
|
}
|
|
@@ -12,18 +12,39 @@ function _defineProperty2() {
|
|
|
12
12
|
};
|
|
13
13
|
return data;
|
|
14
14
|
}
|
|
15
|
+
function _react() {
|
|
16
|
+
const data = _interopRequireDefault(require("react"));
|
|
17
|
+
_react = function () {
|
|
18
|
+
return data;
|
|
19
|
+
};
|
|
20
|
+
return data;
|
|
21
|
+
}
|
|
22
|
+
function _uiFoundationUi() {
|
|
23
|
+
const data = require("@teambit/ui-foundation.ui.menu-widget-icon");
|
|
24
|
+
_uiFoundationUi = function () {
|
|
25
|
+
return data;
|
|
26
|
+
};
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
15
29
|
class CompareChangelogSection {
|
|
16
30
|
constructor(compareUI) {
|
|
17
31
|
this.compareUI = compareUI;
|
|
18
32
|
(0, _defineProperty2().default)(this, "navigationLink", {
|
|
19
33
|
href: 'changelog',
|
|
20
|
-
children:
|
|
21
|
-
|
|
34
|
+
children: /*#__PURE__*/_react().default.createElement(_uiFoundationUi().MenuWidgetIcon, {
|
|
35
|
+
icon: "changelog",
|
|
36
|
+
tooltipContent: "Change log"
|
|
37
|
+
}),
|
|
38
|
+
displayName: 'Change log'
|
|
22
39
|
});
|
|
40
|
+
(0, _defineProperty2().default)(this, "props", this.navigationLink);
|
|
23
41
|
(0, _defineProperty2().default)(this, "route", {
|
|
24
42
|
path: 'changelog/*',
|
|
25
43
|
element: this.compareUI.getChangelogComparePage()
|
|
26
44
|
});
|
|
45
|
+
(0, _defineProperty2().default)(this, "order", 70);
|
|
46
|
+
(0, _defineProperty2().default)(this, "widget", true);
|
|
47
|
+
(0, _defineProperty2().default)(this, "id", 'changelog');
|
|
27
48
|
}
|
|
28
49
|
}
|
|
29
50
|
exports.CompareChangelogSection = CompareChangelogSection;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CompareChangelogSection","constructor","compareUI","href","children","
|
|
1
|
+
{"version":3,"names":["CompareChangelogSection","constructor","compareUI","href","children","displayName","navigationLink","path","element","getChangelogComparePage"],"sources":["component-compare-changelog.section.tsx"],"sourcesContent":["import React from 'react';\nimport { Section } from '@teambit/component';\nimport { TabItem } from '@teambit/component.ui.component-compare.models.component-compare-props';\nimport { MenuWidgetIcon } from '@teambit/ui-foundation.ui.menu-widget-icon';\nimport { ComponentCompareUI } from './component-compare.ui.runtime';\n\nexport class CompareChangelogSection implements Section, TabItem {\n constructor(private compareUI: ComponentCompareUI) {}\n\n navigationLink = {\n href: 'changelog',\n children: <MenuWidgetIcon icon=\"changelog\" tooltipContent=\"Change log\" />,\n displayName: 'Change log',\n };\n\n props = this.navigationLink;\n\n route = {\n path: 'changelog/*',\n element: this.compareUI.getChangelogComparePage(),\n };\n\n order = 70;\n widget = true;\n id = 'changelog';\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGO,MAAMA,uBAAuB,CAA6B;EAC/DC,WAAW,CAASC,SAA6B,EAAE;IAAA,KAA/BA,SAA6B,GAA7BA,SAA6B;IAAA,wDAEhC;MACfC,IAAI,EAAE,WAAW;MACjBC,QAAQ,eAAE,+BAAC,gCAAc;QAAC,IAAI,EAAC,WAAW;QAAC,cAAc,EAAC;MAAY,EAAG;MACzEC,WAAW,EAAE;IACf,CAAC;IAAA,+CAEO,IAAI,CAACC,cAAc;IAAA,+CAEnB;MACNC,IAAI,EAAE,aAAa;MACnBC,OAAO,EAAE,IAAI,CAACN,SAAS,CAACO,uBAAuB;IACjD,CAAC;IAAA,+CAEO,EAAE;IAAA,gDACD,IAAI;IAAA,4CACR,WAAW;EAjBoC;AAkBtD;AAAC"}
|
|
@@ -22,6 +22,9 @@ export declare function componentCompareSchema(componentCompareMain: ComponentCo
|
|
|
22
22
|
fromContent: string;
|
|
23
23
|
toContent: string;
|
|
24
24
|
}[];
|
|
25
|
+
aspects: (result: ComponentCompareResult, { fieldName }: {
|
|
26
|
+
fieldName?: string | undefined;
|
|
27
|
+
}) => import("@teambit/legacy/dist/consumer/component-ops/components-diff").FieldsDiff[];
|
|
25
28
|
};
|
|
26
29
|
};
|
|
27
30
|
};
|
|
@@ -33,10 +33,16 @@ function componentCompareSchema(componentCompareMain) {
|
|
|
33
33
|
diffOutput: String
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
type FieldCompareResult {
|
|
37
|
+
fieldName: String!
|
|
38
|
+
diffOutput: String
|
|
39
|
+
}
|
|
40
|
+
|
|
36
41
|
type ComponentCompareResult {
|
|
37
42
|
# unique id for graphql - baseId + compareId
|
|
38
43
|
id: String!
|
|
39
44
|
code(fileName: String): [FileCompareResult!]!
|
|
45
|
+
aspects(aspectName: String): [FieldCompareResult!]!
|
|
40
46
|
}
|
|
41
47
|
|
|
42
48
|
extend type ComponentHost {
|
|
@@ -69,6 +75,14 @@ function componentCompareSchema(componentCompareMain) {
|
|
|
69
75
|
baseContent: c.fromContent,
|
|
70
76
|
compareContent: c.toContent
|
|
71
77
|
}));
|
|
78
|
+
},
|
|
79
|
+
aspects: (result, {
|
|
80
|
+
fieldName
|
|
81
|
+
}) => {
|
|
82
|
+
if (fieldName) {
|
|
83
|
+
return result.fields.filter(field => field.fieldName === fieldName);
|
|
84
|
+
}
|
|
85
|
+
return result.fields;
|
|
72
86
|
}
|
|
73
87
|
}
|
|
74
88
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["componentCompareSchema","componentCompareMain","typeDefs","gql","resolvers","ComponentHost","compareComponent","_","baseId","compareId","compare","ComponentCompareResult","id","result","code","fileName","filter","codeFile","filePath","map","c","baseContent","fromContent","compareContent","toContent"],"sources":["component-compare.graphql.ts"],"sourcesContent":["import gql from 'graphql-tag';\nimport { ComponentCompareMain, ComponentCompareResult } from './component-compare.main.runtime';\n\nexport function componentCompareSchema(componentCompareMain: ComponentCompareMain) {\n return {\n typeDefs: gql`\n type FileCompareResult {\n fileName: String!\n baseContent: String!\n compareContent: String!\n status: String\n diffOutput: String\n }\n\n type ComponentCompareResult {\n # unique id for graphql - baseId + compareId\n id: String!\n code(fileName: String): [FileCompareResult!]!\n }\n\n extend type ComponentHost {\n compareComponent(baseId: String!, compareId: String!): ComponentCompareResult\n }\n `,\n resolvers: {\n ComponentHost: {\n compareComponent: async (_, { baseId, compareId }: { baseId: string; compareId: string }) => {\n return componentCompareMain.compare(baseId, compareId);\n },\n },\n ComponentCompareResult: {\n id: (result: ComponentCompareResult) => result.id,\n code: (result: ComponentCompareResult, { fileName }: { fileName?: string }) => {\n if (fileName) {\n return result.code\n .filter((codeFile) => codeFile.filePath === fileName)\n .map((c) => ({ ...c, fileName: c.filePath, baseContent: c.fromContent, compareContent: c.toContent }));\n }\n\n return result.code.map((c) => ({\n ...c,\n fileName: c.filePath,\n baseContent: c.fromContent,\n compareContent: c.toContent,\n }));\n },\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA8B;AAAA;AAGvB,SAASA,sBAAsB,CAACC,oBAA0C,EAAE;EACjF,OAAO;IACLC,QAAQ,EAAE,IAAAC,qBAAG,CAAC;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;IACDC,SAAS,EAAE;MACTC,aAAa,EAAE;QACbC,gBAAgB,EAAE,OAAOC,CAAC,EAAE;UAAEC,MAAM;UAAEC;QAAiD,CAAC,KAAK;UAC3F,OAAOR,oBAAoB,CAACS,OAAO,CAACF,MAAM,EAAEC,SAAS,CAAC;QACxD;MACF,CAAC;MACDE,sBAAsB,EAAE;QACtBC,EAAE,EAAGC,MAA8B,IAAKA,MAAM,CAACD,EAAE;QACjDE,IAAI,EAAE,CAACD,MAA8B,EAAE;UAAEE;QAAgC,CAAC,KAAK;UAC7E,IAAIA,QAAQ,EAAE;YACZ,OAAOF,MAAM,CAACC,IAAI,CACfE,MAAM,CAAEC,QAAQ,IAAKA,QAAQ,CAACC,QAAQ,KAAKH,QAAQ,CAAC,CACpDI,GAAG,CAAEC,CAAC,oCAAWA,CAAC;cAAEL,QAAQ,EAAEK,CAAC,CAACF,QAAQ;cAAEG,WAAW,EAAED,CAAC,CAACE,WAAW;cAAEC,cAAc,EAAEH,CAAC,CAACI;YAAS,EAAG,CAAC;UAC1G;UAEA,OAAOX,MAAM,CAACC,IAAI,CAACK,GAAG,CAAEC,CAAC,oCACpBA,CAAC;YACJL,QAAQ,EAAEK,CAAC,CAACF,QAAQ;YACpBG,WAAW,EAAED,CAAC,CAACE,WAAW;YAC1BC,cAAc,EAAEH,CAAC,CAACI;UAAS,EAC3B,CAAC;QACL;MACF;IACF;EACF,CAAC;AACH"}
|
|
1
|
+
{"version":3,"names":["componentCompareSchema","componentCompareMain","typeDefs","gql","resolvers","ComponentHost","compareComponent","_","baseId","compareId","compare","ComponentCompareResult","id","result","code","fileName","filter","codeFile","filePath","map","c","baseContent","fromContent","compareContent","toContent","aspects","fieldName","fields","field"],"sources":["component-compare.graphql.ts"],"sourcesContent":["import gql from 'graphql-tag';\nimport { ComponentCompareMain, ComponentCompareResult } from './component-compare.main.runtime';\n\nexport function componentCompareSchema(componentCompareMain: ComponentCompareMain) {\n return {\n typeDefs: gql`\n type FileCompareResult {\n fileName: String!\n baseContent: String!\n compareContent: String!\n status: String\n diffOutput: String\n }\n\n type FieldCompareResult {\n fieldName: String!\n diffOutput: String\n }\n\n type ComponentCompareResult {\n # unique id for graphql - baseId + compareId\n id: String!\n code(fileName: String): [FileCompareResult!]!\n aspects(aspectName: String): [FieldCompareResult!]!\n }\n\n extend type ComponentHost {\n compareComponent(baseId: String!, compareId: String!): ComponentCompareResult\n }\n `,\n resolvers: {\n ComponentHost: {\n compareComponent: async (_, { baseId, compareId }: { baseId: string; compareId: string }) => {\n return componentCompareMain.compare(baseId, compareId);\n },\n },\n ComponentCompareResult: {\n id: (result: ComponentCompareResult) => result.id,\n code: (result: ComponentCompareResult, { fileName }: { fileName?: string }) => {\n if (fileName) {\n return result.code\n .filter((codeFile) => codeFile.filePath === fileName)\n .map((c) => ({ ...c, fileName: c.filePath, baseContent: c.fromContent, compareContent: c.toContent }));\n }\n\n return result.code.map((c) => ({\n ...c,\n fileName: c.filePath,\n baseContent: c.fromContent,\n compareContent: c.toContent,\n }));\n },\n aspects: (result: ComponentCompareResult, { fieldName }: { fieldName?: string }) => {\n if (fieldName) {\n return result.fields.filter((field) => field.fieldName === fieldName);\n }\n return result.fields;\n },\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA8B;AAAA;AAGvB,SAASA,sBAAsB,CAACC,oBAA0C,EAAE;EACjF,OAAO;IACLC,QAAQ,EAAE,IAAAC,qBAAG,CAAC;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;IACDC,SAAS,EAAE;MACTC,aAAa,EAAE;QACbC,gBAAgB,EAAE,OAAOC,CAAC,EAAE;UAAEC,MAAM;UAAEC;QAAiD,CAAC,KAAK;UAC3F,OAAOR,oBAAoB,CAACS,OAAO,CAACF,MAAM,EAAEC,SAAS,CAAC;QACxD;MACF,CAAC;MACDE,sBAAsB,EAAE;QACtBC,EAAE,EAAGC,MAA8B,IAAKA,MAAM,CAACD,EAAE;QACjDE,IAAI,EAAE,CAACD,MAA8B,EAAE;UAAEE;QAAgC,CAAC,KAAK;UAC7E,IAAIA,QAAQ,EAAE;YACZ,OAAOF,MAAM,CAACC,IAAI,CACfE,MAAM,CAAEC,QAAQ,IAAKA,QAAQ,CAACC,QAAQ,KAAKH,QAAQ,CAAC,CACpDI,GAAG,CAAEC,CAAC,oCAAWA,CAAC;cAAEL,QAAQ,EAAEK,CAAC,CAACF,QAAQ;cAAEG,WAAW,EAAED,CAAC,CAACE,WAAW;cAAEC,cAAc,EAAEH,CAAC,CAACI;YAAS,EAAG,CAAC;UAC1G;UAEA,OAAOX,MAAM,CAACC,IAAI,CAACK,GAAG,CAAEC,CAAC,oCACpBA,CAAC;YACJL,QAAQ,EAAEK,CAAC,CAACF,QAAQ;YACpBG,WAAW,EAAED,CAAC,CAACE,WAAW;YAC1BC,cAAc,EAAEH,CAAC,CAACI;UAAS,EAC3B,CAAC;QACL,CAAC;QACDC,OAAO,EAAE,CAACZ,MAA8B,EAAE;UAAEa;QAAkC,CAAC,KAAK;UAClF,IAAIA,SAAS,EAAE;YACb,OAAOb,MAAM,CAACc,MAAM,CAACX,MAAM,CAAEY,KAAK,IAAKA,KAAK,CAACF,SAAS,KAAKA,SAAS,CAAC;UACvE;UACA,OAAOb,MAAM,CAACc,MAAM;QACtB;MACF;IACF;EACF,CAAC;AACH"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ScopeMain } from '@teambit/scope';
|
|
2
2
|
import { GraphqlMain } from '@teambit/graphql';
|
|
3
|
+
import { LoggerMain, Logger } from '@teambit/logger';
|
|
3
4
|
import { FieldsDiff, FileDiff } from '@teambit/legacy/dist/consumer/component-ops/components-diff';
|
|
4
5
|
import { ComponentMain } from '@teambit/component';
|
|
5
6
|
export declare type ComponentCompareResult = {
|
|
@@ -10,11 +11,12 @@ export declare type ComponentCompareResult = {
|
|
|
10
11
|
export declare class ComponentCompareMain {
|
|
11
12
|
private componentAspect;
|
|
12
13
|
private scope;
|
|
13
|
-
|
|
14
|
+
private logger;
|
|
15
|
+
constructor(componentAspect: ComponentMain, scope: ScopeMain, logger: Logger);
|
|
14
16
|
compare(baseIdStr: string, compareIdStr: string): Promise<ComponentCompareResult>;
|
|
15
17
|
static slots: never[];
|
|
16
18
|
static dependencies: import("@teambit/harmony").Aspect[];
|
|
17
19
|
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
18
|
-
static provider([graphql, component, scope]: [GraphqlMain, ComponentMain, ScopeMain]): Promise<ComponentCompareMain>;
|
|
20
|
+
static provider([graphql, component, scope, loggerMain]: [GraphqlMain, ComponentMain, ScopeMain, LoggerMain]): Promise<ComponentCompareMain>;
|
|
19
21
|
}
|
|
20
22
|
export default ComponentCompareMain;
|
|
@@ -42,6 +42,13 @@ function _generalError() {
|
|
|
42
42
|
};
|
|
43
43
|
return data;
|
|
44
44
|
}
|
|
45
|
+
function _logger() {
|
|
46
|
+
const data = require("@teambit/logger");
|
|
47
|
+
_logger = function () {
|
|
48
|
+
return data;
|
|
49
|
+
};
|
|
50
|
+
return data;
|
|
51
|
+
}
|
|
45
52
|
function _componentsDiff() {
|
|
46
53
|
const data = require("@teambit/legacy/dist/consumer/component-ops/components-diff");
|
|
47
54
|
_componentsDiff = function () {
|
|
@@ -71,9 +78,10 @@ function _componentCompare2() {
|
|
|
71
78
|
return data;
|
|
72
79
|
}
|
|
73
80
|
class ComponentCompareMain {
|
|
74
|
-
constructor(componentAspect, scope) {
|
|
81
|
+
constructor(componentAspect, scope, logger) {
|
|
75
82
|
this.componentAspect = componentAspect;
|
|
76
83
|
this.scope = scope;
|
|
84
|
+
this.logger = logger;
|
|
77
85
|
}
|
|
78
86
|
async compare(baseIdStr, compareIdStr) {
|
|
79
87
|
const host = this.componentAspect.getHost();
|
|
@@ -95,15 +103,16 @@ class ComponentCompareMain {
|
|
|
95
103
|
};
|
|
96
104
|
return compareResult;
|
|
97
105
|
}
|
|
98
|
-
static async provider([graphql, component, scope]) {
|
|
99
|
-
const
|
|
106
|
+
static async provider([graphql, component, scope, loggerMain]) {
|
|
107
|
+
const logger = loggerMain.createLogger(_componentCompare2().ComponentCompareAspect.id);
|
|
108
|
+
const componentCompareMain = new ComponentCompareMain(component, scope, logger);
|
|
100
109
|
graphql.register((0, _componentCompare().componentCompareSchema)(componentCompareMain));
|
|
101
110
|
return componentCompareMain;
|
|
102
111
|
}
|
|
103
112
|
}
|
|
104
113
|
exports.ComponentCompareMain = ComponentCompareMain;
|
|
105
114
|
(0, _defineProperty2().default)(ComponentCompareMain, "slots", []);
|
|
106
|
-
(0, _defineProperty2().default)(ComponentCompareMain, "dependencies", [_graphql().GraphqlAspect, _component().default, _scope().ScopeAspect]);
|
|
115
|
+
(0, _defineProperty2().default)(ComponentCompareMain, "dependencies", [_graphql().GraphqlAspect, _component().default, _scope().ScopeAspect, _logger().LoggerAspect]);
|
|
107
116
|
(0, _defineProperty2().default)(ComponentCompareMain, "runtime", _cli().MainRuntime);
|
|
108
117
|
_componentCompare2().ComponentCompareAspect.addRuntime(ComponentCompareMain);
|
|
109
118
|
var _default = ComponentCompareMain;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ComponentCompareMain","constructor","componentAspect","scope","compare","baseIdStr","compareIdStr","host","getHost","baseCompId","compareCompId","resolveMultipleComponentIds","modelComponent","legacyScope","getModelComponentIfExist","_legacy","GeneralError","toString","baseVersion","version","compareVersion","repository","objects","baseVersionObject","loadVersion","compareVersionObject","diff","diffBetweenVersionsObjects","compareResult","id","code","filesDiff","fields","fieldsDiff","provider","graphql","component","componentCompareMain","register","componentCompareSchema","GraphqlAspect","ComponentAspect","ScopeAspect","
|
|
1
|
+
{"version":3,"names":["ComponentCompareMain","constructor","componentAspect","scope","logger","compare","baseIdStr","compareIdStr","host","getHost","baseCompId","compareCompId","resolveMultipleComponentIds","modelComponent","legacyScope","getModelComponentIfExist","_legacy","GeneralError","toString","baseVersion","version","compareVersion","repository","objects","baseVersionObject","loadVersion","compareVersionObject","diff","diffBetweenVersionsObjects","compareResult","id","code","filesDiff","fields","fieldsDiff","provider","graphql","component","loggerMain","createLogger","ComponentCompareAspect","componentCompareMain","register","componentCompareSchema","GraphqlAspect","ComponentAspect","ScopeAspect","LoggerAspect","MainRuntime","addRuntime"],"sources":["component-compare.main.runtime.ts"],"sourcesContent":["import { MainRuntime } from '@teambit/cli';\nimport { ScopeMain, ScopeAspect } from '@teambit/scope';\nimport { GraphqlAspect, GraphqlMain } from '@teambit/graphql';\nimport GeneralError from '@teambit/legacy/dist/error/general-error';\nimport { LoggerAspect, LoggerMain, Logger } from '@teambit/logger';\nimport {\n diffBetweenVersionsObjects,\n DiffResults,\n FieldsDiff,\n FileDiff,\n} from '@teambit/legacy/dist/consumer/component-ops/components-diff';\nimport ComponentAspect, { ComponentMain } from '@teambit/component';\nimport { componentCompareSchema } from './component-compare.graphql';\nimport { ComponentCompareAspect } from './component-compare.aspect';\n\nexport type ComponentCompareResult = {\n id: string;\n code: FileDiff[];\n fields: FieldsDiff[];\n};\n\nexport class ComponentCompareMain {\n constructor(private componentAspect: ComponentMain, private scope: ScopeMain, private logger: Logger) {}\n\n async compare(baseIdStr: string, compareIdStr: string): Promise<ComponentCompareResult> {\n const host = this.componentAspect.getHost();\n const [baseCompId, compareCompId] = await host.resolveMultipleComponentIds([baseIdStr, compareIdStr]);\n const modelComponent = await this.scope.legacyScope.getModelComponentIfExist(compareCompId._legacy);\n\n if (!modelComponent) {\n throw new GeneralError(`component ${compareCompId.toString()} doesn't have any version yet`);\n }\n\n const baseVersion = baseCompId.version as string;\n const compareVersion = compareCompId.version as string;\n\n const repository = this.scope.legacyScope.objects;\n const baseVersionObject = await modelComponent.loadVersion(baseVersion, repository);\n const compareVersionObject = await modelComponent.loadVersion(compareVersion, repository);\n\n const diff: DiffResults = await diffBetweenVersionsObjects(\n modelComponent,\n baseVersionObject,\n compareVersionObject,\n baseVersion,\n compareVersion,\n this.scope.legacyScope,\n {}\n );\n\n const compareResult = {\n id: `${baseCompId}-${compareCompId}`,\n code: diff.filesDiff || [],\n fields: diff.fieldsDiff || [],\n };\n\n return compareResult;\n }\n\n static slots = [];\n static dependencies = [GraphqlAspect, ComponentAspect, ScopeAspect, LoggerAspect];\n static runtime = MainRuntime;\n static async provider([graphql, component, scope, loggerMain]: [GraphqlMain, ComponentMain, ScopeMain, LoggerMain]) {\n const logger = loggerMain.createLogger(ComponentCompareAspect.id);\n const componentCompareMain = new ComponentCompareMain(component, scope, logger);\n graphql.register(componentCompareSchema(componentCompareMain));\n return componentCompareMain;\n }\n}\n\nComponentCompareAspect.addRuntime(ComponentCompareMain);\n\nexport default ComponentCompareMain;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAMA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAQO,MAAMA,oBAAoB,CAAC;EAChCC,WAAW,CAASC,eAA8B,EAAUC,KAAgB,EAAUC,MAAc,EAAE;IAAA,KAAlFF,eAA8B,GAA9BA,eAA8B;IAAA,KAAUC,KAAgB,GAAhBA,KAAgB;IAAA,KAAUC,MAAc,GAAdA,MAAc;EAAG;EAEvG,MAAMC,OAAO,CAACC,SAAiB,EAAEC,YAAoB,EAAmC;IACtF,MAAMC,IAAI,GAAG,IAAI,CAACN,eAAe,CAACO,OAAO,EAAE;IAC3C,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAG,MAAMH,IAAI,CAACI,2BAA2B,CAAC,CAACN,SAAS,EAAEC,YAAY,CAAC,CAAC;IACrG,MAAMM,cAAc,GAAG,MAAM,IAAI,CAACV,KAAK,CAACW,WAAW,CAACC,wBAAwB,CAACJ,aAAa,CAACK,OAAO,CAAC;IAEnG,IAAI,CAACH,cAAc,EAAE;MACnB,MAAM,KAAII,uBAAY,EAAE,aAAYN,aAAa,CAACO,QAAQ,EAAG,+BAA8B,CAAC;IAC9F;IAEA,MAAMC,WAAW,GAAGT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AoB,aAwCdgD,kBAAW;AAS9BR,2CAAsB,CAACS,UAAU,CAACjD,oBAAoB,CAAC;AAAC,eAEzCA,oBAAoB;AAAA"}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { RouteProps } from 'react-router-dom';
|
|
3
3
|
import { Harmony, SlotRegistry } from '@teambit/harmony';
|
|
4
|
-
import { NavLinkProps } from '@teambit/base-ui.routing.nav-link';
|
|
5
4
|
import { ComponentUI } from '@teambit/component';
|
|
6
5
|
import { RouteSlot } from '@teambit/ui-foundation.ui.react-router.slot-router';
|
|
7
|
-
import { ComponentCompareProps } from '@teambit/component.ui.component-compare.models.component-compare-props';
|
|
8
|
-
export declare type ComponentCompareNav =
|
|
9
|
-
|
|
10
|
-
order: number;
|
|
11
|
-
};
|
|
12
|
-
export declare type ComponentCompareNavSlot = SlotRegistry<Array<ComponentCompareNav>>;
|
|
6
|
+
import { ComponentCompareProps, TabItem } from '@teambit/component.ui.component-compare.models.component-compare-props';
|
|
7
|
+
export declare type ComponentCompareNav = Array<TabItem>;
|
|
8
|
+
export declare type ComponentCompareNavSlot = SlotRegistry<ComponentCompareNav>;
|
|
13
9
|
export declare class ComponentCompareUI {
|
|
14
10
|
private host;
|
|
15
11
|
private navSlot;
|
|
@@ -21,9 +17,9 @@ export declare class ComponentCompareUI {
|
|
|
21
17
|
getComponentComparePage: (props?: ComponentCompareProps) => JSX.Element;
|
|
22
18
|
getAspectsComparePage: () => JSX.Element;
|
|
23
19
|
getChangelogComparePage: () => JSX.Element;
|
|
24
|
-
registerNavigation(
|
|
20
|
+
registerNavigation(nav: TabItem | Array<TabItem>): this;
|
|
25
21
|
registerRoutes(routes: RouteProps[]): this;
|
|
26
22
|
get routes(): Map<string, RouteProps | RouteProps[]>;
|
|
27
|
-
get navLinks(): Map<string, ComponentCompareNav
|
|
23
|
+
get navLinks(): Map<string, ComponentCompareNav>;
|
|
28
24
|
static provider([componentUi]: [ComponentUI], _: any, [navSlot, routeSlot]: [ComponentCompareNavSlot, RouteSlot], harmony: Harmony): Promise<ComponentCompareUI>;
|
|
29
25
|
}
|
|
@@ -129,11 +129,11 @@ class ComponentCompareUI {
|
|
|
129
129
|
return /*#__PURE__*/_react().default.createElement(_componentUiComponentCompare2().ComponentCompareChangelog, null);
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
|
-
registerNavigation(
|
|
133
|
-
if (Array.isArray(
|
|
134
|
-
this.navSlot.register(
|
|
132
|
+
registerNavigation(nav) {
|
|
133
|
+
if (Array.isArray(nav)) {
|
|
134
|
+
this.navSlot.register(nav);
|
|
135
135
|
} else {
|
|
136
|
-
this.navSlot.register([
|
|
136
|
+
this.navSlot.register([nav]);
|
|
137
137
|
}
|
|
138
138
|
return this;
|
|
139
139
|
}
|
|
@@ -158,13 +158,7 @@ class ComponentCompareUI {
|
|
|
158
158
|
componentUi.registerWidget(componentCompareSection.navigationLink, componentCompareSection.order);
|
|
159
159
|
const aspectCompareSection = new (_componentCompareAspects().AspectsCompareSection)(componentCompareUI);
|
|
160
160
|
const compareChangelog = new (_componentCompareChangelog().CompareChangelogSection)(componentCompareUI);
|
|
161
|
-
componentCompareUI.registerNavigation([
|
|
162
|
-
props: aspectCompareSection.navigationLink,
|
|
163
|
-
order: aspectCompareSection.navigationLink.order
|
|
164
|
-
}, {
|
|
165
|
-
props: compareChangelog.navigationLink,
|
|
166
|
-
order: compareChangelog.navigationLink.order
|
|
167
|
-
}]);
|
|
161
|
+
componentCompareUI.registerNavigation([aspectCompareSection, compareChangelog]);
|
|
168
162
|
componentCompareUI.registerRoutes([aspectCompareSection.route, compareChangelog.route]);
|
|
169
163
|
return componentCompareUI;
|
|
170
164
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ComponentCompareUI","constructor","host","navSlot","routeSlot","props","tabs","flatten","values","routes","registerNavigation","
|
|
1
|
+
{"version":3,"names":["ComponentCompareUI","constructor","host","navSlot","routeSlot","props","tabs","flatten","values","routes","registerNavigation","nav","Array","isArray","register","registerRoutes","map","navLinks","provider","componentUi","_","harmony","config","String","get","componentCompareUI","componentCompareSection","ComponentCompareSection","registerRoute","route","registerWidget","navigationLink","order","aspectCompareSection","AspectsCompareSection","compareChangelog","CompareChangelogSection","UIRuntime","Slot","withType","ComponentAspect","ComponentCompareAspect","addRuntime"],"sources":["component-compare.ui.runtime.tsx"],"sourcesContent":["import React from 'react';\nimport { RouteProps } from 'react-router-dom';\nimport flatten from 'lodash.flatten';\nimport { Harmony, Slot, SlotRegistry } from '@teambit/harmony';\nimport ComponentAspect, { ComponentUI } from '@teambit/component';\nimport { ComponentCompare } from '@teambit/component.ui.component-compare.component-compare';\nimport { UIRuntime } from '@teambit/ui';\nimport { RouteSlot } from '@teambit/ui-foundation.ui.react-router.slot-router';\nimport { ComponentCompareProps, TabItem } from '@teambit/component.ui.component-compare.models.component-compare-props';\nimport { ComponentCompareChangelog } from '@teambit/component.ui.component-compare.changelog';\nimport { ComponentCompareAspects } from '@teambit/component.ui.component-compare.compare-aspects.compare-aspects';\nimport { AspectsCompareSection } from './component-compare-aspects.section';\nimport { ComponentCompareAspect } from './component-compare.aspect';\nimport { ComponentCompareSection } from './component-compare.section';\nimport { CompareChangelogSection } from './component-compare-changelog.section';\n\nexport type ComponentCompareNav = Array<TabItem>;\nexport type ComponentCompareNavSlot = SlotRegistry<ComponentCompareNav>;\nexport class ComponentCompareUI {\n constructor(private host: string, private navSlot: ComponentCompareNavSlot, private routeSlot: RouteSlot) {}\n\n static runtime = UIRuntime;\n\n static slots = [Slot.withType<ComponentCompareNavSlot>(), Slot.withType<RouteSlot>()];\n\n static dependencies = [ComponentAspect];\n\n getComponentComparePage = (props?: ComponentCompareProps) => {\n const tabs = props?.tabs || (() => flatten(this.navSlot.values()));\n const routes = props?.routes || (() => flatten(this.routeSlot.values()));\n const host = props?.host || this.host;\n\n return <ComponentCompare {...(props || {})} tabs={tabs} routes={routes} host={host} />;\n };\n\n getAspectsComparePage = () => {\n return <ComponentCompareAspects host={this.host} />;\n };\n\n getChangelogComparePage = () => {\n return <ComponentCompareChangelog />;\n };\n\n registerNavigation(nav: TabItem | Array<TabItem>) {\n if (Array.isArray(nav)) {\n this.navSlot.register(nav);\n } else {\n this.navSlot.register([nav]);\n }\n return this;\n }\n\n registerRoutes(routes: RouteProps[]) {\n this.routeSlot.register(routes);\n return this;\n }\n\n get routes() {\n return this.routeSlot.map;\n }\n\n get navLinks() {\n return this.navSlot.map;\n }\n\n static async provider(\n [componentUi]: [ComponentUI],\n _,\n [navSlot, routeSlot]: [ComponentCompareNavSlot, RouteSlot],\n harmony: Harmony\n ) {\n const { config } = harmony;\n const host = String(config.get('teambit.harmony/bit'));\n const componentCompareUI = new ComponentCompareUI(host, navSlot, routeSlot);\n const componentCompareSection = new ComponentCompareSection(componentCompareUI);\n componentUi.registerRoute([componentCompareSection.route]);\n componentUi.registerWidget(componentCompareSection.navigationLink, componentCompareSection.order);\n const aspectCompareSection = new AspectsCompareSection(componentCompareUI);\n const compareChangelog = new CompareChangelogSection(componentCompareUI);\n\n componentCompareUI.registerNavigation([aspectCompareSection, compareChangelog]);\n\n componentCompareUI.registerRoutes([aspectCompareSection.route, compareChangelog.route]);\n return componentCompareUI;\n }\n}\n\nComponentCompareAspect.addRuntime(ComponentCompareUI);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;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gB,CAACN,KAAK,CAAC,CAAC;IACvF,OAAOJ,kBAAkB;EAC3B;AACF;AAAC;AAAA,gCAnEYzB,kBAAkB,aAGZqC,eAAS;AAAA,gCAHfrC,kBAAkB,WAKd,CAACsC,eAAI,CAACC,QAAQ,EAA2B,EAAED,eAAI,CAACC,QAAQ,EAAa,CAAC;AAAA,gCAL1EvC,kBAAkB,kBAOP,CAACwC,oBAAe,CAAC;AA8DzCC,0CAAsB,CAACC,UAAU,CAAC1C,kBAAkB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentCompareAspect } from './component-compare.aspect';
|
|
2
2
|
export type { ComponentCompareMain } from './component-compare.main.runtime';
|
|
3
|
-
export type { ComponentCompareUI, ComponentCompareNavSlot
|
|
3
|
+
export type { ComponentCompareUI, ComponentCompareNavSlot } from './component-compare.ui.runtime';
|
|
4
4
|
export { ComponentCompareAspect };
|
|
5
5
|
export default ComponentCompareAspect;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ComponentCompareAspect"],"sources":["index.ts"],"sourcesContent":["import { ComponentCompareAspect } from './component-compare.aspect';\n\nexport type { ComponentCompareMain } from './component-compare.main.runtime';\nexport type { ComponentCompareUI, ComponentCompareNavSlot
|
|
1
|
+
{"version":3,"names":["ComponentCompareAspect"],"sources":["index.ts"],"sourcesContent":["import { ComponentCompareAspect } from './component-compare.aspect';\n\nexport type { ComponentCompareMain } from './component-compare.main.runtime';\nexport type { ComponentCompareUI, ComponentCompareNavSlot } from './component-compare.ui.runtime';\nexport { ComponentCompareAspect };\nexport default ComponentCompareAspect;\n"],"mappings":";;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAoE,eAKrDA,0CAAsB;AAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component-compare@0.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component-compare@0.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component-compare@0.0.200/dist/component-compare.compositions.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component-compare@0.0.200/dist/component-compare.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/component-compare",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.200",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/component/component-compare",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.component",
|
|
8
8
|
"name": "component-compare",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.200"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"graphql-tag": "2.12.1",
|
|
@@ -14,18 +14,19 @@
|
|
|
14
14
|
"core-js": "^3.0.0",
|
|
15
15
|
"@babel/runtime": "7.20.0",
|
|
16
16
|
"@teambit/harmony": "0.4.6",
|
|
17
|
-
"@teambit/
|
|
18
|
-
"@teambit/component": "0.0.
|
|
19
|
-
"@teambit/
|
|
20
|
-
"@teambit/graphql": "0.0.950",
|
|
21
|
-
"@teambit/scope": "0.0.950",
|
|
17
|
+
"@teambit/component.ui.component-compare.models.component-compare-change-type": "0.0.1",
|
|
18
|
+
"@teambit/component.ui.component-compare.models.component-compare-props": "0.0.3",
|
|
19
|
+
"@teambit/component": "0.0.952",
|
|
22
20
|
"@teambit/ui-foundation.ui.menu-widget-icon": "0.0.497",
|
|
23
|
-
"@teambit/
|
|
24
|
-
"@teambit/
|
|
25
|
-
"@teambit/
|
|
26
|
-
"@teambit/
|
|
21
|
+
"@teambit/cli": "0.0.638",
|
|
22
|
+
"@teambit/graphql": "0.0.952",
|
|
23
|
+
"@teambit/logger": "0.0.731",
|
|
24
|
+
"@teambit/scope": "0.0.952",
|
|
25
|
+
"@teambit/component.ui.component-compare.changelog": "0.0.22",
|
|
26
|
+
"@teambit/component.ui.component-compare.compare-aspects.compare-aspects": "0.0.22",
|
|
27
|
+
"@teambit/component.ui.component-compare.component-compare": "0.0.22",
|
|
27
28
|
"@teambit/ui-foundation.ui.react-router.slot-router": "0.0.501",
|
|
28
|
-
"@teambit/ui": "0.0.
|
|
29
|
+
"@teambit/ui": "0.0.952"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
32
|
"@types/react": "^17.0.8",
|
|
@@ -38,7 +39,7 @@
|
|
|
38
39
|
},
|
|
39
40
|
"peerDependencies": {
|
|
40
41
|
"react-router-dom": "^6.0.0",
|
|
41
|
-
"@teambit/legacy": "1.0.
|
|
42
|
+
"@teambit/legacy": "1.0.419",
|
|
42
43
|
"react": "^16.8.0 || ^17.0.0",
|
|
43
44
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
44
45
|
},
|
|
Binary file
|