@teambit/component-compare 0.0.175 → 0.0.176

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,9 +1,8 @@
1
- import React from 'react';
2
1
  import { Section } from '@teambit/component';
3
- import { ComponentCompareAspects } from '@teambit/component.ui.compare';
2
+ import { ComponentCompareUI } from './component-compare.ui.runtime';
4
3
 
5
4
  export class AspectsCompareSection implements Section {
6
- constructor(private host: string) {}
5
+ constructor(private compareUI: ComponentCompareUI) {}
7
6
 
8
7
  navigationLink = {
9
8
  href: 'aspects',
@@ -13,6 +12,6 @@ export class AspectsCompareSection implements Section {
13
12
 
14
13
  route = {
15
14
  path: 'aspects/*',
16
- element: <ComponentCompareAspects host={this.host} />,
15
+ element: this.compareUI.getAspectsComparePage(),
17
16
  };
18
17
  }
@@ -1,8 +1,9 @@
1
- import React from 'react';
2
1
  import { Section } from '@teambit/component';
3
- import { ComponentCompareChangelog } from '@teambit/component.ui.compare';
2
+ import { ComponentCompareUI } from './component-compare.ui.runtime';
4
3
 
5
4
  export class CompareChangelogSection implements Section {
5
+ constructor(private compareUI: ComponentCompareUI) {}
6
+
6
7
  navigationLink = {
7
8
  href: 'changelog',
8
9
  children: 'Changelog',
@@ -11,6 +12,6 @@ export class CompareChangelogSection implements Section {
11
12
 
12
13
  route = {
13
14
  path: 'changelog/*',
14
- element: <ComponentCompareChangelog />,
15
+ element: this.compareUI.getChangelogComparePage(),
15
16
  };
16
17
  }
@@ -1,11 +1,15 @@
1
+ import React from 'react';
2
+ import { RouteProps } from 'react-router-dom';
3
+ import flatten from 'lodash.flatten';
4
+ import { Harmony, Slot, SlotRegistry } from '@teambit/harmony';
1
5
  import { NavLinkProps } from '@teambit/base-ui.routing.nav-link';
2
6
  import ComponentAspect, { ComponentUI } from '@teambit/component';
3
- import { ComponentCompare } from '@teambit/component.ui.compare';
4
- import { Harmony, Slot, SlotRegistry } from '@teambit/harmony';
7
+ import { ComponentCompare } from '@teambit/component.ui.component-compare.component-compare';
5
8
  import { UIRuntime } from '@teambit/ui';
6
9
  import { RouteSlot } from '@teambit/ui-foundation.ui.react-router.slot-router';
7
- import React from 'react';
8
- import { RouteProps } from 'react-router-dom';
10
+ import { ComponentCompareProps } from '@teambit/component.ui.component-compare.models.component-compare-props';
11
+ import { ComponentCompareChangelog } from '@teambit/component.ui.component-compare.changelog';
12
+ import { ComponentCompareAspects } from '@teambit/component.ui.component-compare.compare-aspects.compare-aspects';
9
13
  import { AspectsCompareSection } from './component-compare-aspects.section';
10
14
  import { ComponentCompareAspect } from './component-compare.aspect';
11
15
  import { ComponentCompareSection } from './component-compare.section';
@@ -26,9 +30,21 @@ export class ComponentCompareUI {
26
30
 
27
31
  static dependencies = [ComponentAspect];
28
32
 
29
- getComponentComparePage = () => (
30
- <ComponentCompare navSlot={this.navSlot} routeSlot={this.routeSlot} host={this.host} />
31
- );
33
+ getComponentComparePage = (props?: ComponentCompareProps) => {
34
+ const tabs = props?.tabs || (() => flatten(this.navSlot.values()));
35
+ const routes = props?.routes || (() => flatten(this.routeSlot.values()));
36
+ const host = props?.host || this.host;
37
+
38
+ return <ComponentCompare {...(props || {})} tabs={tabs} routes={routes} host={host} />;
39
+ };
40
+
41
+ getAspectsComparePage = () => {
42
+ return <ComponentCompareAspects host={this.host} />;
43
+ };
44
+
45
+ getChangelogComparePage = () => {
46
+ return <ComponentCompareChangelog />;
47
+ };
32
48
 
33
49
  registerNavigation(route: ComponentCompareNav | Array<ComponentCompareNav>) {
34
50
  if (Array.isArray(route)) {
@@ -44,6 +60,14 @@ export class ComponentCompareUI {
44
60
  return this;
45
61
  }
46
62
 
63
+ get routes() {
64
+ return this.routeSlot.map;
65
+ }
66
+
67
+ get navLinks() {
68
+ return this.navSlot.map;
69
+ }
70
+
47
71
  static async provider(
48
72
  [componentUi]: [ComponentUI],
49
73
  _,
@@ -56,8 +80,8 @@ export class ComponentCompareUI {
56
80
  const componentCompareSection = new ComponentCompareSection(componentCompareUI);
57
81
  componentUi.registerRoute([componentCompareSection.route]);
58
82
  componentUi.registerWidget(componentCompareSection.navigationLink, componentCompareSection.order);
59
- const aspectCompareSection = new AspectsCompareSection(host);
60
- const compareChangelog = new CompareChangelogSection();
83
+ const aspectCompareSection = new AspectsCompareSection(componentCompareUI);
84
+ const compareChangelog = new CompareChangelogSection(componentCompareUI);
61
85
  componentCompareUI.registerNavigation([
62
86
  {
63
87
  props: aspectCompareSection.navigationLink,
@@ -1,8 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  import { Section } from '@teambit/component';
3
+ import { ComponentCompareUI } from './component-compare.ui.runtime';
3
4
  export declare class AspectsCompareSection implements Section {
4
- private host;
5
- constructor(host: string);
5
+ private compareUI;
6
+ constructor(compareUI: ComponentCompareUI);
6
7
  navigationLink: {
7
8
  href: string;
8
9
  children: string;
@@ -12,23 +12,9 @@ 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 _componentUi() {
23
- const data = require("@teambit/component.ui.compare");
24
- _componentUi = function () {
25
- return data;
26
- };
27
- return data;
28
- }
29
15
  class AspectsCompareSection {
30
- constructor(host) {
31
- this.host = host;
16
+ constructor(compareUI) {
17
+ this.compareUI = compareUI;
32
18
  (0, _defineProperty2().default)(this, "navigationLink", {
33
19
  href: 'aspects',
34
20
  children: 'Aspects',
@@ -36,9 +22,7 @@ class AspectsCompareSection {
36
22
  });
37
23
  (0, _defineProperty2().default)(this, "route", {
38
24
  path: 'aspects/*',
39
- element: /*#__PURE__*/_react().default.createElement(_componentUi().ComponentCompareAspects, {
40
- host: this.host
41
- })
25
+ element: this.compareUI.getAspectsComparePage()
42
26
  });
43
27
  }
44
28
  }
@@ -1 +1 @@
1
- {"version":3,"names":["AspectsCompareSection","constructor","host","href","children","order","path","element"],"sources":["component-compare-aspects.section.tsx"],"sourcesContent":["import React from 'react';\nimport { Section } from '@teambit/component';\nimport { ComponentCompareAspects } from '@teambit/component.ui.compare';\n\nexport class AspectsCompareSection implements Section {\n constructor(private host: string) {}\n\n navigationLink = {\n href: 'aspects',\n children: 'Aspects',\n order: 6,\n };\n\n route = {\n path: 'aspects/*',\n element: <ComponentCompareAspects host={this.host} />,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,qBAAqB,CAAoB;EACpDC,WAAW,CAASC,IAAY,EAAE;IAAA,KAAdA,IAAY,GAAZA,IAAY;IAAA,wDAEf;MACfC,IAAI,EAAE,SAAS;MACfC,QAAQ,EAAE,SAAS;MACnBC,KAAK,EAAE;IACT,CAAC;IAAA,+CAEO;MACNC,IAAI,EAAE,WAAW;MACjBC,OAAO,eAAE,+BAAC,sCAAuB;QAAC,IAAI,EAAE,IAAI,CAACL;MAAK;IACpD,CAAC;EAXkC;AAYrC;AAAC"}
1
+ {"version":3,"names":["AspectsCompareSection","constructor","compareUI","href","children","order","path","element","getAspectsComparePage"],"sources":["component-compare-aspects.section.tsx"],"sourcesContent":["import { Section } from '@teambit/component';\nimport { ComponentCompareUI } from './component-compare.ui.runtime';\n\nexport class AspectsCompareSection implements Section {\n constructor(private compareUI: ComponentCompareUI) {}\n\n navigationLink = {\n href: 'aspects',\n children: 'Aspects',\n order: 6,\n };\n\n route = {\n path: 'aspects/*',\n element: this.compareUI.getAspectsComparePage(),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAGO,MAAMA,qBAAqB,CAAoB;EACpDC,WAAW,CAASC,SAA6B,EAAE;IAAA,KAA/BA,SAA6B,GAA7BA,SAA6B;IAAA,wDAEhC;MACfC,IAAI,EAAE,SAAS;MACfC,QAAQ,EAAE,SAAS;MACnBC,KAAK,EAAE;IACT,CAAC;IAAA,+CAEO;MACNC,IAAI,EAAE,WAAW;MACjBC,OAAO,EAAE,IAAI,CAACL,SAAS,CAACM,qBAAqB;IAC/C,CAAC;EAXmD;AAYtD;AAAC"}
@@ -1,6 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  import { Section } from '@teambit/component';
3
+ import { ComponentCompareUI } from './component-compare.ui.runtime';
3
4
  export declare class CompareChangelogSection implements Section {
5
+ private compareUI;
6
+ constructor(compareUI: ComponentCompareUI);
4
7
  navigationLink: {
5
8
  href: string;
6
9
  children: string;
@@ -12,22 +12,9 @@ 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 _componentUi() {
23
- const data = require("@teambit/component.ui.compare");
24
- _componentUi = function () {
25
- return data;
26
- };
27
- return data;
28
- }
29
15
  class CompareChangelogSection {
30
- constructor() {
16
+ constructor(compareUI) {
17
+ this.compareUI = compareUI;
31
18
  (0, _defineProperty2().default)(this, "navigationLink", {
32
19
  href: 'changelog',
33
20
  children: 'Changelog',
@@ -35,7 +22,7 @@ class CompareChangelogSection {
35
22
  });
36
23
  (0, _defineProperty2().default)(this, "route", {
37
24
  path: 'changelog/*',
38
- element: /*#__PURE__*/_react().default.createElement(_componentUi().ComponentCompareChangelog, null)
25
+ element: this.compareUI.getChangelogComparePage()
39
26
  });
40
27
  }
41
28
  }
@@ -1 +1 @@
1
- {"version":3,"names":["CompareChangelogSection","href","children","order","path","element"],"sources":["component-compare-changelog.section.tsx"],"sourcesContent":["import React from 'react';\nimport { Section } from '@teambit/component';\nimport { ComponentCompareChangelog } from '@teambit/component.ui.compare';\n\nexport class CompareChangelogSection implements Section {\n navigationLink = {\n href: 'changelog',\n children: 'Changelog',\n order: 5,\n };\n\n route = {\n path: 'changelog/*',\n element: <ComponentCompareChangelog />,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,uBAAuB,CAAoB;EAAA;IAAA,wDACrC;MACfC,IAAI,EAAE,WAAW;MACjBC,QAAQ,EAAE,WAAW;MACrBC,KAAK,EAAE;IACT,CAAC;IAAA,+CAEO;MACNC,IAAI,EAAE,aAAa;MACnBC,OAAO,eAAE,+BAAC,wCAAyB;IACrC,CAAC;EAAA;AACH;AAAC"}
1
+ {"version":3,"names":["CompareChangelogSection","constructor","compareUI","href","children","order","path","element","getChangelogComparePage"],"sources":["component-compare-changelog.section.tsx"],"sourcesContent":["import { Section } from '@teambit/component';\nimport { ComponentCompareUI } from './component-compare.ui.runtime';\n\nexport class CompareChangelogSection implements Section {\n constructor(private compareUI: ComponentCompareUI) {}\n\n navigationLink = {\n href: 'changelog',\n children: 'Changelog',\n order: 5,\n };\n\n route = {\n path: 'changelog/*',\n element: this.compareUI.getChangelogComparePage(),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAGO,MAAMA,uBAAuB,CAAoB;EACtDC,WAAW,CAASC,SAA6B,EAAE;IAAA,KAA/BA,SAA6B,GAA7BA,SAA6B;IAAA,wDAEhC;MACfC,IAAI,EAAE,WAAW;MACjBC,QAAQ,EAAE,WAAW;MACrBC,KAAK,EAAE;IACT,CAAC;IAAA,+CAEO;MACNC,IAAI,EAAE,aAAa;MACnBC,OAAO,EAAE,IAAI,CAACL,SAAS,CAACM,uBAAuB;IACjD,CAAC;EAXmD;AAYtD;AAAC"}
@@ -1,9 +1,10 @@
1
1
  /// <reference types="react" />
2
+ import { RouteProps } from 'react-router-dom';
3
+ import { Harmony, SlotRegistry } from '@teambit/harmony';
2
4
  import { NavLinkProps } from '@teambit/base-ui.routing.nav-link';
3
5
  import { ComponentUI } from '@teambit/component';
4
- import { Harmony, SlotRegistry } from '@teambit/harmony';
5
6
  import { RouteSlot } from '@teambit/ui-foundation.ui.react-router.slot-router';
6
- import { RouteProps } from 'react-router-dom';
7
+ import { ComponentCompareProps } from '@teambit/component.ui.component-compare.models.component-compare-props';
7
8
  export declare type ComponentCompareNav = {
8
9
  props: NavLinkProps;
9
10
  order: number;
@@ -17,8 +18,12 @@ export declare class ComponentCompareUI {
17
18
  static runtime: import("@teambit/harmony").RuntimeDefinition;
18
19
  static slots: (((registerFn: () => string) => SlotRegistry<ComponentCompareNavSlot>) | ((registerFn: () => string) => SlotRegistry<RouteSlot>))[];
19
20
  static dependencies: import("@teambit/harmony").Aspect[];
20
- getComponentComparePage: () => JSX.Element;
21
+ getComponentComparePage: (props?: ComponentCompareProps) => JSX.Element;
22
+ getAspectsComparePage: () => JSX.Element;
23
+ getChangelogComparePage: () => JSX.Element;
21
24
  registerNavigation(route: ComponentCompareNav | Array<ComponentCompareNav>): this;
22
25
  registerRoutes(routes: RouteProps[]): this;
26
+ get routes(): Map<string, RouteProps | RouteProps[]>;
27
+ get navLinks(): Map<string, ComponentCompareNav[]>;
23
28
  static provider([componentUi]: [ComponentUI], _: any, [navSlot, routeSlot]: [ComponentCompareNavSlot, RouteSlot], harmony: Harmony): Promise<ComponentCompareUI>;
24
29
  }
@@ -7,6 +7,13 @@ Object.defineProperty(exports, "__esModule", {
7
7
  value: true
8
8
  });
9
9
  exports.ComponentCompareUI = void 0;
10
+ function _extends2() {
11
+ const data = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
12
+ _extends2 = function () {
13
+ return data;
14
+ };
15
+ return data;
16
+ }
10
17
  function _defineProperty2() {
11
18
  const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
19
  _defineProperty2 = function () {
@@ -14,16 +21,16 @@ function _defineProperty2() {
14
21
  };
15
22
  return data;
16
23
  }
17
- function _component() {
18
- const data = _interopRequireDefault(require("@teambit/component"));
19
- _component = function () {
24
+ function _react() {
25
+ const data = _interopRequireDefault(require("react"));
26
+ _react = function () {
20
27
  return data;
21
28
  };
22
29
  return data;
23
30
  }
24
- function _componentUi() {
25
- const data = require("@teambit/component.ui.compare");
26
- _componentUi = function () {
31
+ function _lodash() {
32
+ const data = _interopRequireDefault(require("lodash.flatten"));
33
+ _lodash = function () {
27
34
  return data;
28
35
  };
29
36
  return data;
@@ -35,6 +42,20 @@ function _harmony() {
35
42
  };
36
43
  return data;
37
44
  }
45
+ function _component() {
46
+ const data = _interopRequireDefault(require("@teambit/component"));
47
+ _component = function () {
48
+ return data;
49
+ };
50
+ return data;
51
+ }
52
+ function _componentUiComponentCompare() {
53
+ const data = require("@teambit/component.ui.component-compare.component-compare");
54
+ _componentUiComponentCompare = function () {
55
+ return data;
56
+ };
57
+ return data;
58
+ }
38
59
  function _ui() {
39
60
  const data = require("@teambit/ui");
40
61
  _ui = function () {
@@ -42,9 +63,16 @@ function _ui() {
42
63
  };
43
64
  return data;
44
65
  }
45
- function _react() {
46
- const data = _interopRequireDefault(require("react"));
47
- _react = function () {
66
+ function _componentUiComponentCompare2() {
67
+ const data = require("@teambit/component.ui.component-compare.changelog");
68
+ _componentUiComponentCompare2 = function () {
69
+ return data;
70
+ };
71
+ return data;
72
+ }
73
+ function _componentUiComponentCompareCompareAspects() {
74
+ const data = require("@teambit/component.ui.component-compare.compare-aspects.compare-aspects");
75
+ _componentUiComponentCompareCompareAspects = function () {
48
76
  return data;
49
77
  };
50
78
  return data;
@@ -82,11 +110,24 @@ class ComponentCompareUI {
82
110
  this.host = host;
83
111
  this.navSlot = navSlot;
84
112
  this.routeSlot = routeSlot;
85
- (0, _defineProperty2().default)(this, "getComponentComparePage", () => /*#__PURE__*/_react().default.createElement(_componentUi().ComponentCompare, {
86
- navSlot: this.navSlot,
87
- routeSlot: this.routeSlot,
88
- host: this.host
89
- }));
113
+ (0, _defineProperty2().default)(this, "getComponentComparePage", props => {
114
+ const tabs = (props === null || props === void 0 ? void 0 : props.tabs) || (() => (0, _lodash().default)(this.navSlot.values()));
115
+ const routes = (props === null || props === void 0 ? void 0 : props.routes) || (() => (0, _lodash().default)(this.routeSlot.values()));
116
+ const host = (props === null || props === void 0 ? void 0 : props.host) || this.host;
117
+ return /*#__PURE__*/_react().default.createElement(_componentUiComponentCompare().ComponentCompare, (0, _extends2().default)({}, props || {}, {
118
+ tabs: tabs,
119
+ routes: routes,
120
+ host: host
121
+ }));
122
+ });
123
+ (0, _defineProperty2().default)(this, "getAspectsComparePage", () => {
124
+ return /*#__PURE__*/_react().default.createElement(_componentUiComponentCompareCompareAspects().ComponentCompareAspects, {
125
+ host: this.host
126
+ });
127
+ });
128
+ (0, _defineProperty2().default)(this, "getChangelogComparePage", () => {
129
+ return /*#__PURE__*/_react().default.createElement(_componentUiComponentCompare2().ComponentCompareChangelog, null);
130
+ });
90
131
  }
91
132
  registerNavigation(route) {
92
133
  if (Array.isArray(route)) {
@@ -100,6 +141,12 @@ class ComponentCompareUI {
100
141
  this.routeSlot.register(routes);
101
142
  return this;
102
143
  }
144
+ get routes() {
145
+ return this.routeSlot.map;
146
+ }
147
+ get navLinks() {
148
+ return this.navSlot.map;
149
+ }
103
150
  static async provider([componentUi], _, [navSlot, routeSlot], harmony) {
104
151
  const {
105
152
  config
@@ -109,8 +156,8 @@ class ComponentCompareUI {
109
156
  const componentCompareSection = new (_componentCompare2().ComponentCompareSection)(componentCompareUI);
110
157
  componentUi.registerRoute([componentCompareSection.route]);
111
158
  componentUi.registerWidget(componentCompareSection.navigationLink, componentCompareSection.order);
112
- const aspectCompareSection = new (_componentCompareAspects().AspectsCompareSection)(host);
113
- const compareChangelog = new (_componentCompareChangelog().CompareChangelogSection)();
159
+ const aspectCompareSection = new (_componentCompareAspects().AspectsCompareSection)(componentCompareUI);
160
+ const compareChangelog = new (_componentCompareChangelog().CompareChangelogSection)(componentCompareUI);
114
161
  componentCompareUI.registerNavigation([{
115
162
  props: aspectCompareSection.navigationLink,
116
163
  order: aspectCompareSection.navigationLink.order
@@ -1 +1 @@
1
- {"version":3,"names":["ComponentCompareUI","constructor","host","navSlot","routeSlot","registerNavigation","route","Array","isArray","register","registerRoutes","routes","provider","componentUi","_","harmony","config","String","get","componentCompareUI","componentCompareSection","ComponentCompareSection","registerRoute","registerWidget","navigationLink","order","aspectCompareSection","AspectsCompareSection","compareChangelog","CompareChangelogSection","props","UIRuntime","Slot","withType","ComponentAspect","ComponentCompareAspect","addRuntime"],"sources":["component-compare.ui.runtime.tsx"],"sourcesContent":["import { NavLinkProps } from '@teambit/base-ui.routing.nav-link';\nimport ComponentAspect, { ComponentUI } from '@teambit/component';\nimport { ComponentCompare } from '@teambit/component.ui.compare';\nimport { Harmony, Slot, SlotRegistry } from '@teambit/harmony';\nimport { UIRuntime } from '@teambit/ui';\nimport { RouteSlot } from '@teambit/ui-foundation.ui.react-router.slot-router';\nimport React from 'react';\nimport { RouteProps } from 'react-router-dom';\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 = {\n props: NavLinkProps;\n order: number;\n};\n\nexport type ComponentCompareNavSlot = SlotRegistry<Array<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 = () => (\n <ComponentCompare navSlot={this.navSlot} routeSlot={this.routeSlot} host={this.host} />\n );\n\n registerNavigation(route: ComponentCompareNav | Array<ComponentCompareNav>) {\n if (Array.isArray(route)) {\n this.navSlot.register(route);\n } else {\n this.navSlot.register([route]);\n }\n return this;\n }\n\n registerRoutes(routes: RouteProps[]) {\n this.routeSlot.register(routes);\n return this;\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(host);\n const compareChangelog = new CompareChangelogSection();\n componentCompareUI.registerNavigation([\n {\n props: aspectCompareSection.navigationLink,\n order: aspectCompareSection.navigationLink.order,\n },\n {\n props: compareChangelog.navigationLink,\n order: compareChangelog.navigationLink.order,\n },\n ]);\n\n componentCompareUI.registerRoutes([aspectCompareSection.route, compareChangelog.route]);\n return componentCompareUI;\n }\n}\n\nComponentCompareAspect.addRuntime(ComponentCompareUI);\n"],"mappings":";;;;;;;;;;;;;;;;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;AAEA;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;AAQO,MAAMA,kBAAkB,CAAC;EAC9BC,WAAW,CAASC,IAAY,EAAUC,OAAgC,EAAUC,SAAoB,EAAE;IAAA,KAAtFF,IAAY,GAAZA,IAAY;IAAA,KAAUC,OAAgC,GAAhCA,OAAgC;IAAA,KAAUC,SAAoB,GAApBA,SAAoB;IAAA,iEAQ9E,mBACxB,+BAAC,+BAAgB;MAAC,OAAO,EAAE,IAAI,CAACD,OAAQ;MAAC,SAAS,EAAE,IAAI,CAACC,SAAU;MAAC,IAAI,EAAE,IAAI,CAACF;IAAK,EACrF;EAV0G;EAY3GG,kBAAkB,CAACC,KAAuD,EAAE;IAC1E,IAAIC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,E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AkB,CAACT,cAAc,CAAC,CAACgB,oBAAoB,CAACpB,KAAK,EAAEsB,gBAAgB,CAACtB,KAAK,CAAC,CAAC;IACvF,OAAOa,kBAAkB;EAC3B;AACF;AAAC;AAAA,gCAvDYnB,kBAAkB,aAGZ+B,eAAS;AAAA,gCAHf/B,kBAAkB,WAKd,CAACgC,eAAI,CAACC,QAAQ,EAA2B,EAAED,eAAI,CAACC,QAAQ,EAAa,CAAC;AAAA,gCAL1EjC,kBAAkB,kBAOP,CAACkC,oBAAe,CAAC;AAkDzCC,0CAAsB,CAACC,UAAU,CAACpC,kBAAkB,CAAC"}
1
+ {"version":3,"names":["ComponentCompareUI","constructor","host","navSlot","routeSlot","props","tabs","flatten","values","routes","registerNavigation","route","Array","isArray","register","registerRoutes","map","navLinks","provider","componentUi","_","harmony","config","String","get","componentCompareUI","componentCompareSection","ComponentCompareSection","registerRoute","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 { NavLinkProps } from '@teambit/base-ui.routing.nav-link';\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 } 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 = {\n props: NavLinkProps;\n order: number;\n};\n\nexport type ComponentCompareNavSlot = SlotRegistry<Array<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(route: ComponentCompareNav | Array<ComponentCompareNav>) {\n if (Array.isArray(route)) {\n this.navSlot.register(route);\n } else {\n this.navSlot.register([route]);\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 componentCompareUI.registerNavigation([\n {\n props: aspectCompareSection.navigationLink,\n order: aspectCompareSection.navigationLink.order,\n },\n {\n props: compareChangelog.navigationLink,\n order: compareChangelog.navigationLink.order,\n },\n ]);\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;AAEA;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;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAQO,MAAMA,kBAAkB,CAAC;EAC9BC,WAAW,CAASC,IAAY,EAAUC,OAAgC,EAAUC,SAAoB,EAAE;IAAA,KAAtFF,IAAY,GAAZA,IAAY;IAAA,KAAUC,OAAgC,GAAhCA,OAAgC;IAAA,KAAUC,SAAoB,GAApBA,SAAoB;IAAA,iEAQ7EC,KAA6B,IAAK;MAC3D,MAAMC,IAAI,GAAG,CAAAD,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEC,IAAI,MAAK,MAAM,IAAAC,iBAAO,EAAC,IAAI,CAACJ,OAAO,CAACK,MAAM,EAAE,CAAC,CAAC;MAClE,MAAMC,MAAM,GAAG,CAAAJ,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEI,MAAM,MAAK,MAAM,IAAAF,iBAAO,EAAC,IAAI,CAACH,SAAS,CAACI,MAAM,E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D,MAAMC,kBAAkB,GAAG,IAAIzB,kBAAkB,CAACE,IAAI,EAAEC,OAAO,EAAEC,SAAS,CAAC;IAC3E,MAAMsB,uBAAuB,GAAG,KAAIC,4CAAuB,EAACF,kBAAkB,CAAC;IAC/EN,WAAW,CAACS,aAAa,CAAC,CAACF,uBAAuB,CAACf,KAAK,CAAC,CAAC;IAC1DQ,WAAW,CAACU,cAAc,CAACH,uBAAuB,CAACI,cAAc,EAAEJ,uBAAuB,CAACK,KAAK,CAAC;IACjG,MAAMC,oBAAoB,GAAG,KAAIC,gDAAqB,EAACR,kBAAkB,CAAC;IAC1E,MAAMS,gBAAgB,GAAG,KAAIC,oDAAuB,EAACV,kBAAkB,CAAC;IACxEA,kBAAkB,CAACf,kBAAkB,CAAC,CACpC;MACEL,KAAK,EAAE2B,oBAAoB,CAACF,cAAc;MAC1CC,KAAK,EAAEC,oBAAoB,CAACF,cAAc,CAACC;IAC7C,CAAC,EACD;MACE1B,KAAK,EAAE6B,gBAAgB,CAACJ,cAAc;MACtCC,KAAK,EAAEG,gBAAgB,CAACJ,cAAc,CAACC;IACzC,CAAC,CACF,CAAC;IAEFN,kBAAkB,CAACV,cAAc,CAAC,CAACiB,oBAAoB,CAACrB,KAAK,EAAEuB,gBAAgB,CAACvB,KAAK,CAAC,CAAC;IACvF,OAAOc,kBAAkB;EAC3B;AACF;AAAC;AAAA,gCA3EYzB,kBAAkB,aAGZoC,eAAS;AAAA,gCAHfpC,kBAAkB,WAKd,CAACqC,eAAI,CAACC,QAAQ,EAA2B,EAAED,eAAI,CAACC,QAAQ,EAAa,CAAC;AAAA,gCAL1EtC,kBAAkB,kBAOP,CAACuC,oBAAe,CAAC;AAsEzCC,0CAAsB,CAACC,UAAU,CAACzC,kBAAkB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { ComponentCompareAspect } from './component-compare.aspect';
2
2
  export type { ComponentCompareMain } from './component-compare.main.runtime';
3
- export { ComponentCompareSection } from './component-compare.section';
4
3
  export type { ComponentCompareUI, ComponentCompareNavSlot, ComponentCompareNav } from './component-compare.ui.runtime';
5
4
  export { ComponentCompareAspect };
6
5
  export default ComponentCompareAspect;
package/dist/index.js CHANGED
@@ -9,12 +9,6 @@ Object.defineProperty(exports, "ComponentCompareAspect", {
9
9
  return _componentCompare().ComponentCompareAspect;
10
10
  }
11
11
  });
12
- Object.defineProperty(exports, "ComponentCompareSection", {
13
- enumerable: true,
14
- get: function () {
15
- return _componentCompare2().ComponentCompareSection;
16
- }
17
- });
18
12
  exports.default = void 0;
19
13
  function _componentCompare() {
20
14
  const data = require("./component-compare.aspect");
@@ -23,13 +17,6 @@ function _componentCompare() {
23
17
  };
24
18
  return data;
25
19
  }
26
- function _componentCompare2() {
27
- const data = require("./component-compare.section");
28
- _componentCompare2 = function () {
29
- return data;
30
- };
31
- return data;
32
- }
33
20
  var _default = _componentCompare().ComponentCompareAspect;
34
21
  exports.default = _default;
35
22
 
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';\n\nexport { ComponentCompareSection } from './component-compare.section';\nexport type { ComponentCompareUI, ComponentCompareNavSlot, ComponentCompareNav } from './component-compare.ui.runtime';\nexport { ComponentCompareAspect };\nexport default ComponentCompareAspect;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAIA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAsE,eAGvDA,0CAAsB;AAAA"}
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, ComponentCompareNav } 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.175/dist/component-compare.compositions.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component-compare@0.0.175/dist/component-compare.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component-compare@0.0.176/dist/component-compare.compositions.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component-compare@0.0.176/dist/component-compare.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
package/package.json CHANGED
@@ -1,30 +1,35 @@
1
1
  {
2
2
  "name": "@teambit/component-compare",
3
- "version": "0.0.175",
3
+ "version": "0.0.176",
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.175"
9
+ "version": "0.0.176"
10
10
  },
11
11
  "dependencies": {
12
12
  "graphql-tag": "2.12.1",
13
+ "lodash.flatten": "4.4.0",
13
14
  "@babel/runtime": "7.20.0",
14
15
  "core-js": "^3.0.0",
15
16
  "@teambit/harmony": "0.3.3",
16
17
  "@teambit/base-ui.routing.nav-link": "1.0.0",
17
- "@teambit/component.ui.compare": "0.0.138",
18
- "@teambit/component": "0.0.927",
19
- "@teambit/cli": "0.0.620",
20
- "@teambit/graphql": "0.0.927",
21
- "@teambit/scope": "0.0.927",
18
+ "@teambit/component": "0.0.928",
19
+ "@teambit/cli": "0.0.621",
20
+ "@teambit/graphql": "0.0.928",
21
+ "@teambit/scope": "0.0.928",
22
22
  "@teambit/ui-foundation.ui.menu-widget-icon": "0.0.497",
23
- "@teambit/ui-foundation.ui.react-router.slot-router": "0.0.499",
24
- "@teambit/ui": "0.0.927"
23
+ "@teambit/component.ui.component-compare.changelog": "0.0.4",
24
+ "@teambit/component.ui.component-compare.compare-aspects.compare-aspects": "0.0.4",
25
+ "@teambit/component.ui.component-compare.component-compare": "0.0.4",
26
+ "@teambit/component.ui.component-compare.models.component-compare-props": "0.0.1",
27
+ "@teambit/ui-foundation.ui.react-router.slot-router": "0.0.500",
28
+ "@teambit/ui": "0.0.928"
25
29
  },
26
30
  "devDependencies": {
27
31
  "@types/react": "^17.0.8",
32
+ "@types/lodash.flatten": "4.4.6",
28
33
  "@types/mocha": "9.1.0",
29
34
  "@types/testing-library__jest-dom": "5.9.5",
30
35
  "@types/jest": "^26.0.0",
@@ -33,7 +38,7 @@
33
38
  },
34
39
  "peerDependencies": {
35
40
  "react-router-dom": "^6.0.0",
36
- "@teambit/legacy": "1.0.401",
41
+ "@teambit/legacy": "1.0.402",
37
42
  "react-dom": "^16.8.0 || ^17.0.0",
38
43
  "react": "^16.8.0 || ^17.0.0"
39
44
  },