@teambit/component.ui.component-compare.component-compare 0.0.4

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.
@@ -0,0 +1,51 @@
1
+ .componentCompareContainer {
2
+ display: flex;
3
+ flex-direction: column;
4
+ height: 100%;
5
+ overflow: hidden;
6
+ }
7
+
8
+ .top {
9
+ display: flex;
10
+ flex-direction: column;
11
+ padding: 24px 24px 16px 24px;
12
+ }
13
+
14
+ .bottom {
15
+ display: flex;
16
+ overflow: hidden;
17
+ flex-direction: column;
18
+ flex: 1;
19
+ padding-bottom: 16px;
20
+ }
21
+
22
+ .navContainer {
23
+ display: flex;
24
+ align-items: center;
25
+ min-height: 48px;
26
+ border-bottom: 1px solid var(--bit-border-color-lightest, #ededed);
27
+ font-size: var(--bit-p-xs, 14px);
28
+ }
29
+
30
+ .navigation {
31
+ display: flex;
32
+ list-style: none;
33
+ min-height: 48px;
34
+
35
+ @media screen and (max-width: 768px) {
36
+ padding-left: 6px;
37
+ }
38
+
39
+ > li {
40
+ display: block;
41
+ margin-right: 16px;
42
+ height: 100%;
43
+ }
44
+ }
45
+
46
+ .loader {
47
+ display: flex;
48
+ height: 100%;
49
+ width: 100%;
50
+ margin: auto;
51
+ }
@@ -0,0 +1,162 @@
1
+ import React, { useContext, useMemo } from 'react';
2
+ import classnames from 'classnames';
3
+ import { LegacyComponentLog } from '@teambit/legacy-component-log';
4
+ import { ComponentContext, TopBarNav, useComponent } from '@teambit/component';
5
+ import { ComponentCompareContext } from '@teambit/component.ui.component-compare.context';
6
+ import { useCompareQueryParam } from '@teambit/component.ui.component-compare.hooks.use-component-compare-url';
7
+ import { ComponentCompareVersionPicker } from '@teambit/component.ui.component-compare.version-picker';
8
+ import { ComponentCompareBlankState } from '@teambit/component.ui.component-compare.blank-state';
9
+ import { ComponentCompareHooks } from '@teambit/component.ui.component-compare.models.component-compare-hooks';
10
+ import { RoundLoader } from '@teambit/design.ui.round-loader';
11
+ import { useLocation } from '@teambit/base-react.navigation.link';
12
+ import { SlotRouter } from '@teambit/ui-foundation.ui.react-router.slot-router';
13
+ import { ComponentCompareProps } from '@teambit/component.ui.component-compare.models.component-compare-props';
14
+ import { groupByVersion } from '@teambit/component.ui.component-compare.utils.group-by-version';
15
+ import { sortTabs } from '@teambit/component.ui.component-compare.utils.sort-tabs';
16
+ import { sortByDateDsc } from '@teambit/component.ui.component-compare.utils.sort-logs';
17
+ import { extractLazyLoadedData } from '@teambit/component.ui.component-compare.utils.lazy-loading';
18
+
19
+ import styles from './component-compare.module.scss';
20
+
21
+ const findPrevVersionFromCurrent = (compareVersion) => (_, index: number, logs: LegacyComponentLog[]) => {
22
+ if (compareVersion === 'workspace' || logs.length === 1) return true;
23
+
24
+ if (index === 0) return false;
25
+
26
+ const prevIndex = index - 1;
27
+
28
+ return logs[prevIndex].tag === compareVersion || logs[prevIndex].hash === compareVersion;
29
+ };
30
+
31
+ export function ComponentCompare(props: ComponentCompareProps) {
32
+ const {
33
+ host,
34
+ baseId: _baseId,
35
+ compareId: _compareId,
36
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
37
+ routes,
38
+ state,
39
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
40
+ tabs,
41
+ className,
42
+ hooks,
43
+ customUseComponent,
44
+ ...rest
45
+ } = props;
46
+ const baseVersion = useCompareQueryParam('baseVersion');
47
+ const component = useContext(ComponentContext);
48
+ const location = useLocation();
49
+
50
+ const isWorkspace = host === 'teambit.workspace/workspace';
51
+ const allVersionInfo = useMemo(() => component.logs?.slice().sort(sortByDateDsc) || [], [component.id.toString()]);
52
+ const isNew = allVersionInfo.length === 0;
53
+ const compareVersion =
54
+ isWorkspace && !isNew && !location?.search.includes('version') ? 'workspace' : component.id.version;
55
+ const compareIsLocalChanges = compareVersion === 'workspace';
56
+
57
+ const lastVersionInfo = useMemo(() => {
58
+ const prevVersionInfo = allVersionInfo.find(findPrevVersionFromCurrent(compareVersion));
59
+ return prevVersionInfo;
60
+ }, [component.logs]);
61
+
62
+ const baseId =
63
+ _baseId ||
64
+ (baseVersion && component.id.changeVersion(baseVersion)) ||
65
+ (lastVersionInfo && component.id.changeVersion(lastVersionInfo.tag || lastVersionInfo.hash)) ||
66
+ component.id;
67
+
68
+ const { component: base, loading: loadingBase } = useComponent(host, baseId.toString(), { customUseComponent });
69
+ const { component: compareComponent, loading: loadingCompare } = useComponent(host, _compareId?.toString() || '', {
70
+ skip: !_compareId,
71
+ customUseComponent,
72
+ });
73
+
74
+ const loading = loadingBase || loadingCompare;
75
+
76
+ const compare = _compareId ? compareComponent : component;
77
+
78
+ const isEmpty = !loading && !compareIsLocalChanges && !compare && !base;
79
+
80
+ const logsByVersion = useMemo(() => {
81
+ return (compare?.logs || []).slice().reduce(groupByVersion, new Map<string, LegacyComponentLog>());
82
+ }, [compare?.id.toString()]);
83
+
84
+ const componentCompareModel = {
85
+ compare: compare && {
86
+ model: compare,
87
+ hasLocalChanges: compareIsLocalChanges,
88
+ },
89
+ base: base && {
90
+ model: base,
91
+ },
92
+ loading,
93
+ logsByVersion,
94
+ state,
95
+ hooks,
96
+ };
97
+
98
+ return (
99
+ <ComponentCompareContext.Provider value={componentCompareModel}>
100
+ <div className={classnames(styles.componentCompareContainer, className)} {...rest}>
101
+ {loading && (
102
+ <div className={styles.loader}>
103
+ <RoundLoader />
104
+ </div>
105
+ )}
106
+ {isEmpty && <ComponentCompareBlankState />}
107
+ {!isEmpty && <RenderCompareScreen {...props} />}
108
+ </div>
109
+ </ComponentCompareContext.Provider>
110
+ );
111
+ }
112
+
113
+ function RenderCompareScreen(props: ComponentCompareProps) {
114
+ const { routes, state } = props;
115
+
116
+ return (
117
+ <>
118
+ <div className={styles.top}>
119
+ {(!state?.versionPicker && <ComponentCompareVersionPicker />) || state?.versionPicker?.element}
120
+ </div>
121
+ <div className={styles.bottom}>
122
+ <CompareMenuNav {...props} />
123
+ {(extractLazyLoadedData(routes) || []).length > 0 && (
124
+ <SlotRouter routes={extractLazyLoadedData(routes) || []} />
125
+ )}
126
+ {state?.tabs?.element}
127
+ </div>
128
+ </>
129
+ );
130
+ }
131
+
132
+ function CompareMenuNav({ tabs, state, hooks }: ComponentCompareProps) {
133
+ const sortedTabs = (extractLazyLoadedData(tabs) || []).sort(sortTabs);
134
+
135
+ const activeTab = state?.tabs?.id;
136
+ const isControlled = state?.tabs?.controlled;
137
+
138
+ return (
139
+ <div className={styles.navContainer}>
140
+ <nav className={styles.navigation}>
141
+ {sortedTabs.map((tabItem, index) => {
142
+ const isActive = !state ? undefined : !!activeTab && !!tabItem.id && activeTab === tabItem.id;
143
+
144
+ return (
145
+ <TopBarNav
146
+ {...(tabItem.props || {})}
147
+ key={`compare-menu-nav-${index}-${tabItem.id}`}
148
+ active={isActive}
149
+ onClick={onNavClicked({ id: tabItem.id, hooks })}
150
+ href={(!isControlled && tabItem.props?.href) || undefined}
151
+ />
152
+ );
153
+ })}
154
+ </nav>
155
+ </div>
156
+ );
157
+ }
158
+
159
+ function onNavClicked({ hooks, id }: { hooks?: ComponentCompareHooks; id?: string }) {
160
+ if (!hooks?.tabs?.onClick) return undefined;
161
+ return (e) => hooks?.tabs?.onClick?.(id, e);
162
+ }
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { ComponentCompareProps } from '@teambit/component.ui.component-compare.models.component-compare-props';
3
+ export declare function ComponentCompare(props: ComponentCompareProps): JSX.Element;
@@ -0,0 +1,146 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __rest = (this && this.__rest) || function (s, e) {
26
+ var t = {};
27
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
28
+ t[p] = s[p];
29
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
30
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
31
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
32
+ t[p[i]] = s[p[i]];
33
+ }
34
+ return t;
35
+ };
36
+ var __importDefault = (this && this.__importDefault) || function (mod) {
37
+ return (mod && mod.__esModule) ? mod : { "default": mod };
38
+ };
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ exports.ComponentCompare = void 0;
41
+ const react_1 = __importStar(require("react"));
42
+ const classnames_1 = __importDefault(require("classnames"));
43
+ const component_1 = require("@teambit/component");
44
+ const component_ui_component_compare_context_1 = require("@teambit/component.ui.component-compare.context");
45
+ const component_ui_component_compare_hooks_use_component_compare_url_1 = require("@teambit/component.ui.component-compare.hooks.use-component-compare-url");
46
+ const component_ui_component_compare_version_picker_1 = require("@teambit/component.ui.component-compare.version-picker");
47
+ const component_ui_component_compare_blank_state_1 = require("@teambit/component.ui.component-compare.blank-state");
48
+ const design_ui_round_loader_1 = require("@teambit/design.ui.round-loader");
49
+ const base_react_navigation_link_1 = require("@teambit/base-react.navigation.link");
50
+ const ui_foundation_ui_react_router_slot_router_1 = require("@teambit/ui-foundation.ui.react-router.slot-router");
51
+ const component_ui_component_compare_utils_group_by_version_1 = require("@teambit/component.ui.component-compare.utils.group-by-version");
52
+ const component_ui_component_compare_utils_sort_tabs_1 = require("@teambit/component.ui.component-compare.utils.sort-tabs");
53
+ const component_ui_component_compare_utils_sort_logs_1 = require("@teambit/component.ui.component-compare.utils.sort-logs");
54
+ const component_ui_component_compare_utils_lazy_loading_1 = require("@teambit/component.ui.component-compare.utils.lazy-loading");
55
+ const component_compare_module_scss_1 = __importDefault(require("./component-compare.module.scss"));
56
+ const findPrevVersionFromCurrent = (compareVersion) => (_, index, logs) => {
57
+ if (compareVersion === 'workspace' || logs.length === 1)
58
+ return true;
59
+ if (index === 0)
60
+ return false;
61
+ const prevIndex = index - 1;
62
+ return logs[prevIndex].tag === compareVersion || logs[prevIndex].hash === compareVersion;
63
+ };
64
+ function ComponentCompare(props) {
65
+ const { host, baseId: _baseId, compareId: _compareId,
66
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
67
+ routes, state,
68
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
69
+ tabs, className, hooks, customUseComponent } = props, rest = __rest(props, ["host", "baseId", "compareId", "routes", "state", "tabs", "className", "hooks", "customUseComponent"]);
70
+ const baseVersion = (0, component_ui_component_compare_hooks_use_component_compare_url_1.useCompareQueryParam)('baseVersion');
71
+ const component = (0, react_1.useContext)(component_1.ComponentContext);
72
+ const location = (0, base_react_navigation_link_1.useLocation)();
73
+ const isWorkspace = host === 'teambit.workspace/workspace';
74
+ const allVersionInfo = (0, react_1.useMemo)(() => { var _a; return ((_a = component.logs) === null || _a === void 0 ? void 0 : _a.slice().sort(component_ui_component_compare_utils_sort_logs_1.sortByDateDsc)) || []; }, [component.id.toString()]);
75
+ const isNew = allVersionInfo.length === 0;
76
+ const compareVersion = isWorkspace && !isNew && !(location === null || location === void 0 ? void 0 : location.search.includes('version')) ? 'workspace' : component.id.version;
77
+ const compareIsLocalChanges = compareVersion === 'workspace';
78
+ const lastVersionInfo = (0, react_1.useMemo)(() => {
79
+ const prevVersionInfo = allVersionInfo.find(findPrevVersionFromCurrent(compareVersion));
80
+ return prevVersionInfo;
81
+ }, [component.logs]);
82
+ const baseId = _baseId ||
83
+ (baseVersion && component.id.changeVersion(baseVersion)) ||
84
+ (lastVersionInfo && component.id.changeVersion(lastVersionInfo.tag || lastVersionInfo.hash)) ||
85
+ component.id;
86
+ const { component: base, loading: loadingBase } = (0, component_1.useComponent)(host, baseId.toString(), { customUseComponent });
87
+ const { component: compareComponent, loading: loadingCompare } = (0, component_1.useComponent)(host, (_compareId === null || _compareId === void 0 ? void 0 : _compareId.toString()) || '', {
88
+ skip: !_compareId,
89
+ customUseComponent,
90
+ });
91
+ const loading = loadingBase || loadingCompare;
92
+ const compare = _compareId ? compareComponent : component;
93
+ const isEmpty = !loading && !compareIsLocalChanges && !compare && !base;
94
+ const logsByVersion = (0, react_1.useMemo)(() => {
95
+ return ((compare === null || compare === void 0 ? void 0 : compare.logs) || []).slice().reduce(component_ui_component_compare_utils_group_by_version_1.groupByVersion, new Map());
96
+ }, [compare === null || compare === void 0 ? void 0 : compare.id.toString()]);
97
+ const componentCompareModel = {
98
+ compare: compare && {
99
+ model: compare,
100
+ hasLocalChanges: compareIsLocalChanges,
101
+ },
102
+ base: base && {
103
+ model: base,
104
+ },
105
+ loading,
106
+ logsByVersion,
107
+ state,
108
+ hooks,
109
+ };
110
+ return (react_1.default.createElement(component_ui_component_compare_context_1.ComponentCompareContext.Provider, { value: componentCompareModel },
111
+ react_1.default.createElement("div", Object.assign({ className: (0, classnames_1.default)(component_compare_module_scss_1.default.componentCompareContainer, className) }, rest),
112
+ loading && (react_1.default.createElement("div", { className: component_compare_module_scss_1.default.loader },
113
+ react_1.default.createElement(design_ui_round_loader_1.RoundLoader, null))),
114
+ isEmpty && react_1.default.createElement(component_ui_component_compare_blank_state_1.ComponentCompareBlankState, null),
115
+ !isEmpty && react_1.default.createElement(RenderCompareScreen, Object.assign({}, props)))));
116
+ }
117
+ exports.ComponentCompare = ComponentCompare;
118
+ function RenderCompareScreen(props) {
119
+ var _a, _b;
120
+ const { routes, state } = props;
121
+ return (react_1.default.createElement(react_1.default.Fragment, null,
122
+ react_1.default.createElement("div", { className: component_compare_module_scss_1.default.top }, (!(state === null || state === void 0 ? void 0 : state.versionPicker) && react_1.default.createElement(component_ui_component_compare_version_picker_1.ComponentCompareVersionPicker, null)) || ((_a = state === null || state === void 0 ? void 0 : state.versionPicker) === null || _a === void 0 ? void 0 : _a.element)),
123
+ react_1.default.createElement("div", { className: component_compare_module_scss_1.default.bottom },
124
+ react_1.default.createElement(CompareMenuNav, Object.assign({}, props)),
125
+ ((0, component_ui_component_compare_utils_lazy_loading_1.extractLazyLoadedData)(routes) || []).length > 0 && (react_1.default.createElement(ui_foundation_ui_react_router_slot_router_1.SlotRouter, { routes: (0, component_ui_component_compare_utils_lazy_loading_1.extractLazyLoadedData)(routes) || [] })), (_b = state === null || state === void 0 ? void 0 : state.tabs) === null || _b === void 0 ? void 0 :
126
+ _b.element)));
127
+ }
128
+ function CompareMenuNav({ tabs, state, hooks }) {
129
+ var _a, _b;
130
+ const sortedTabs = ((0, component_ui_component_compare_utils_lazy_loading_1.extractLazyLoadedData)(tabs) || []).sort(component_ui_component_compare_utils_sort_tabs_1.sortTabs);
131
+ const activeTab = (_a = state === null || state === void 0 ? void 0 : state.tabs) === null || _a === void 0 ? void 0 : _a.id;
132
+ const isControlled = (_b = state === null || state === void 0 ? void 0 : state.tabs) === null || _b === void 0 ? void 0 : _b.controlled;
133
+ return (react_1.default.createElement("div", { className: component_compare_module_scss_1.default.navContainer },
134
+ react_1.default.createElement("nav", { className: component_compare_module_scss_1.default.navigation }, sortedTabs.map((tabItem, index) => {
135
+ var _a;
136
+ const isActive = !state ? undefined : !!activeTab && !!tabItem.id && activeTab === tabItem.id;
137
+ return (react_1.default.createElement(component_1.TopBarNav, Object.assign({}, (tabItem.props || {}), { key: `compare-menu-nav-${index}-${tabItem.id}`, active: isActive, onClick: onNavClicked({ id: tabItem.id, hooks }), href: (!isControlled && ((_a = tabItem.props) === null || _a === void 0 ? void 0 : _a.href)) || undefined })));
138
+ }))));
139
+ }
140
+ function onNavClicked({ hooks, id }) {
141
+ var _a;
142
+ if (!((_a = hooks === null || hooks === void 0 ? void 0 : hooks.tabs) === null || _a === void 0 ? void 0 : _a.onClick))
143
+ return undefined;
144
+ return (e) => { var _a, _b; return (_b = (_a = hooks === null || hooks === void 0 ? void 0 : hooks.tabs) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a, id, e); };
145
+ }
146
+ //# sourceMappingURL=component-compare.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-compare.js","sourceRoot":"","sources":["../component-compare.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAmD;AACnD,4DAAoC;AAEpC,kDAA+E;AAC/E,4GAA0F;AAC1F,4JAA+G;AAC/G,0HAAuG;AACvG,oHAAiG;AAEjG,4EAA8D;AAC9D,oFAAkE;AAClE,kHAAgF;AAEhF,0IAAgG;AAChG,4HAAmF;AACnF,4HAAwF;AACxF,kIAAmG;AAEnG,oGAAqD;AAErD,MAAM,0BAA0B,GAAG,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAa,EAAE,IAA0B,EAAE,EAAE;IACtG,IAAI,cAAc,KAAK,WAAW,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAErE,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAE9B,MAAM,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;IAE5B,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,KAAK,cAAc,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,KAAK,cAAc,CAAC;AAC3F,CAAC,CAAC;AAEF,SAAgB,gBAAgB,CAAC,KAA4B;IAC3D,MAAM,E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,CACH,CAAC;QACJ,CAAC,CAAC,CACE,CACF,CACP,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,EAAE,KAAK,EAAE,EAAE,EAAkD;;IACjF,IAAI,CAAC,CAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,0CAAE,OAAO,CAAA;QAAE,OAAO,SAAS,CAAC;IAC5C,OAAO,CAAC,CAAC,EAAE,EAAE,eAAC,OAAA,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,0CAAE,OAAO,mDAAG,EAAE,EAAE,CAAC,CAAC,CAAA,EAAA,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,51 @@
1
+ .componentCompareContainer {
2
+ display: flex;
3
+ flex-direction: column;
4
+ height: 100%;
5
+ overflow: hidden;
6
+ }
7
+
8
+ .top {
9
+ display: flex;
10
+ flex-direction: column;
11
+ padding: 24px 24px 16px 24px;
12
+ }
13
+
14
+ .bottom {
15
+ display: flex;
16
+ overflow: hidden;
17
+ flex-direction: column;
18
+ flex: 1;
19
+ padding-bottom: 16px;
20
+ }
21
+
22
+ .navContainer {
23
+ display: flex;
24
+ align-items: center;
25
+ min-height: 48px;
26
+ border-bottom: 1px solid var(--bit-border-color-lightest, #ededed);
27
+ font-size: var(--bit-p-xs, 14px);
28
+ }
29
+
30
+ .navigation {
31
+ display: flex;
32
+ list-style: none;
33
+ min-height: 48px;
34
+
35
+ @media screen and (max-width: 768px) {
36
+ padding-left: 6px;
37
+ }
38
+
39
+ > li {
40
+ display: block;
41
+ margin-right: 16px;
42
+ height: 100%;
43
+ }
44
+ }
45
+
46
+ .loader {
47
+ display: flex;
48
+ height: 100%;
49
+ width: 100%;
50
+ margin: auto;
51
+ }
@@ -0,0 +1 @@
1
+ export { ComponentCompare } from './component-compare';
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ComponentCompare = void 0;
4
+ var component_compare_1 = require("./component-compare");
5
+ Object.defineProperty(exports, "ComponentCompare", { enumerable: true, get: function () { return component_compare_1.ComponentCompare; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,yDAAuD;AAA9C,qHAAA,gBAAgB,OAAA"}
@@ -0,0 +1,7 @@
1
+ ;
2
+ ;
3
+
4
+ export const compositions = [];
5
+ export const overview = [];
6
+
7
+ export const compositions_metadata = {"compositions":[]};
@@ -0,0 +1,32 @@
1
+ {
2
+ "compilerOptions": {
3
+ "lib": [
4
+ "es2019",
5
+ "DOM",
6
+ "ES6",
7
+ "DOM.Iterable"
8
+ ],
9
+ "target": "es2015",
10
+ "module": "CommonJS",
11
+ "jsx": "react",
12
+ "allowJs": true,
13
+ "composite": true,
14
+ "declaration": true,
15
+ "sourceMap": true,
16
+ "skipLibCheck": true,
17
+ "experimentalDecorators": true,
18
+ "outDir": "dist",
19
+ "moduleResolution": "node",
20
+ "esModuleInterop": true,
21
+ "rootDir": ".",
22
+ "resolveJsonModule": true
23
+ },
24
+ "exclude": [
25
+ "dist",
26
+ "package.json"
27
+ ],
28
+ "include": [
29
+ "**/*",
30
+ "**/*.json"
31
+ ]
32
+ }
package/index.ts ADDED
@@ -0,0 +1 @@
1
+ export { ComponentCompare } from './component-compare';
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@teambit/component.ui.component-compare.component-compare",
3
+ "version": "0.0.4",
4
+ "homepage": "https://bit.dev/teambit/component/ui/component-compare/component-compare",
5
+ "main": "dist/index.js",
6
+ "componentId": {
7
+ "scope": "teambit.component",
8
+ "name": "ui/component-compare/component-compare",
9
+ "version": "0.0.4"
10
+ },
11
+ "dependencies": {
12
+ "classnames": "2.2.6",
13
+ "core-js": "^3.0.0",
14
+ "@teambit/base-react.navigation.link": "2.0.27",
15
+ "@teambit/component.ui.component-compare.blank-state": "0.0.1",
16
+ "@teambit/component.ui.component-compare.hooks.use-component-compare-url": "0.0.1",
17
+ "@teambit/component.ui.component-compare.context": "0.0.4",
18
+ "@teambit/component.ui.component-compare.models.component-compare-hooks": "0.0.1",
19
+ "@teambit/component.ui.component-compare.models.component-compare-props": "0.0.1",
20
+ "@teambit/component.ui.component-compare.utils.group-by-version": "0.0.1",
21
+ "@teambit/component.ui.component-compare.utils.lazy-loading": "0.0.1",
22
+ "@teambit/component.ui.component-compare.utils.sort-logs": "0.0.1",
23
+ "@teambit/component.ui.component-compare.utils.sort-tabs": "0.0.1",
24
+ "@teambit/component.ui.component-compare.version-picker": "0.0.4",
25
+ "@teambit/design.ui.round-loader": "0.0.355",
26
+ "@teambit/legacy-component-log": "0.0.399",
27
+ "@teambit/ui-foundation.ui.react-router.slot-router": "0.0.500"
28
+ },
29
+ "devDependencies": {
30
+ "@types/classnames": "2.2.11",
31
+ "@types/react": "^17.0.8",
32
+ "@types/mocha": "9.1.0",
33
+ "@types/testing-library__jest-dom": "5.9.5",
34
+ "@babel/runtime": "7.20.0",
35
+ "@types/jest": "^26.0.0",
36
+ "@types/react-dom": "^17.0.5",
37
+ "@types/node": "12.20.4"
38
+ },
39
+ "peerDependencies": {
40
+ "react-dom": "^16.8.0 || ^17.0.0",
41
+ "react": "^16.8.0 || ^17.0.0"
42
+ },
43
+ "license": "Apache-2.0",
44
+ "private": false,
45
+ "engines": {
46
+ "node": ">=12.22.0"
47
+ },
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "https://github.com/teambit/bit"
51
+ },
52
+ "keywords": [
53
+ "bit",
54
+ "components",
55
+ "collaboration",
56
+ "web",
57
+ "react",
58
+ "react-components",
59
+ "angular",
60
+ "angular-components"
61
+ ]
62
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "compilerOptions": {
3
+ "lib": [
4
+ "es2019",
5
+ "DOM",
6
+ "ES6",
7
+ "DOM.Iterable"
8
+ ],
9
+ "target": "es2015",
10
+ "module": "CommonJS",
11
+ "jsx": "react",
12
+ "allowJs": true,
13
+ "composite": true,
14
+ "declaration": true,
15
+ "sourceMap": true,
16
+ "skipLibCheck": true,
17
+ "experimentalDecorators": true,
18
+ "outDir": "dist",
19
+ "moduleResolution": "node",
20
+ "esModuleInterop": true,
21
+ "rootDir": ".",
22
+ "resolveJsonModule": true
23
+ },
24
+ "exclude": [
25
+ "dist",
26
+ "package.json"
27
+ ],
28
+ "include": [
29
+ "**/*",
30
+ "**/*.json"
31
+ ]
32
+ }
@@ -0,0 +1,29 @@
1
+ declare module '*.png' {
2
+ const value: any;
3
+ export = value;
4
+ }
5
+ declare module '*.svg' {
6
+ import type { FunctionComponent, SVGProps } from 'react';
7
+
8
+ export const ReactComponent: FunctionComponent<SVGProps<SVGSVGElement> & { title?: string }>;
9
+ const src: string;
10
+ export default src;
11
+ }
12
+
13
+ // @TODO Gilad
14
+ declare module '*.jpg' {
15
+ const value: any;
16
+ export = value;
17
+ }
18
+ declare module '*.jpeg' {
19
+ const value: any;
20
+ export = value;
21
+ }
22
+ declare module '*.gif' {
23
+ const value: any;
24
+ export = value;
25
+ }
26
+ declare module '*.bmp' {
27
+ const value: any;
28
+ export = value;
29
+ }
@@ -0,0 +1,42 @@
1
+ declare module '*.module.css' {
2
+ const classes: { readonly [key: string]: string };
3
+ export default classes;
4
+ }
5
+ declare module '*.module.scss' {
6
+ const classes: { readonly [key: string]: string };
7
+ export default classes;
8
+ }
9
+ declare module '*.module.sass' {
10
+ const classes: { readonly [key: string]: string };
11
+ export default classes;
12
+ }
13
+
14
+ declare module '*.module.less' {
15
+ const classes: { readonly [key: string]: string };
16
+ export default classes;
17
+ }
18
+
19
+ declare module '*.less' {
20
+ const classes: { readonly [key: string]: string };
21
+ export default classes;
22
+ }
23
+
24
+ declare module '*.css' {
25
+ const classes: { readonly [key: string]: string };
26
+ export default classes;
27
+ }
28
+
29
+ declare module '*.sass' {
30
+ const classes: { readonly [key: string]: string };
31
+ export default classes;
32
+ }
33
+
34
+ declare module '*.scss' {
35
+ const classes: { readonly [key: string]: string };
36
+ export default classes;
37
+ }
38
+
39
+ declare module '*.mdx' {
40
+ const component: any;
41
+ export default component;
42
+ }