@teambit/docs 0.0.804 → 0.0.805
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs.compare.section.d.ts +1 -1
- package/dist/docs.compare.section.js.map +1 -1
- package/dist/docs.ui.runtime.d.ts +3 -4
- package/dist/docs.ui.runtime.js +15 -4
- package/dist/docs.ui.runtime.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/overview/index.d.ts +2 -2
- package/dist/overview/index.js +6 -0
- package/dist/overview/index.js.map +1 -1
- package/dist/overview/overview.d.ts +13 -2
- package/dist/overview/overview.js +14 -2
- package/dist/overview/overview.js.map +1 -1
- package/dist/overview.section.d.ts +5 -5
- package/dist/overview.section.js +4 -4
- package/dist/overview.section.js.map +1 -1
- package/docs.compare.section.tsx +1 -1
- package/docs.ui.runtime.tsx +7 -6
- package/overview/index.ts +2 -2
- package/overview/overview.tsx +17 -3
- package/overview.section.tsx +5 -7
- package/package-tar/teambit-docs-0.0.805.tgz +0 -0
- package/package.json +21 -21
- package/{preview-1659347901202.js → preview-1659456045857.js} +2 -2
- package/package-tar/teambit-docs-0.0.804.tgz +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { TitleBadgeSlot } from '@teambit/docs';
|
|
3
2
|
import { Section } from '@teambit/component';
|
|
3
|
+
import { TitleBadgeSlot } from './overview';
|
|
4
4
|
export declare class OverviewCompareSection implements Section {
|
|
5
5
|
private titleBadgeSlot;
|
|
6
6
|
constructor(titleBadgeSlot: TitleBadgeSlot);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["OverviewCompareSection","constructor","titleBadgeSlot","href","children","exact","order","path","element"],"sources":["docs.compare.section.tsx"],"sourcesContent":["import React from 'react';\nimport {
|
|
1
|
+
{"version":3,"names":["OverviewCompareSection","constructor","titleBadgeSlot","href","children","exact","order","path","element"],"sources":["docs.compare.section.tsx"],"sourcesContent":["import React from 'react';\nimport { Section } from '@teambit/component';\nimport { OverviewCompare } from '@teambit/docs.ui.overview-compare';\nimport { TitleBadgeSlot } from './overview';\n\nexport class OverviewCompareSection implements Section {\n constructor(private titleBadgeSlot: TitleBadgeSlot) {}\n\n navigationLink = {\n href: '.',\n children: 'Overview',\n exact: true,\n order: 0,\n };\n\n route = {\n path: '*',\n element: <OverviewCompare titleBadges={this.titleBadgeSlot} />,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGO,MAAMA,sBAAN,CAAgD;EACrDC,WAAW,CAASC,cAAT,EAAyC;IAAA,KAAhCA,cAAgC,GAAhCA,cAAgC;IAAA,wDAEnC;MACfC,IAAI,EAAE,GADS;MAEfC,QAAQ,EAAE,UAFK;MAGfC,KAAK,EAAE,IAHQ;MAIfC,KAAK,EAAE;IAJQ,CAFmC;IAAA,+CAS5C;MACNC,IAAI,EAAE,GADA;MAENC,OAAO,eAAE,+BAAC,yBAAD;QAAiB,WAAW,EAAE,KAAKN;MAAnC;IAFH,CAT4C;EAAE;;AADD"}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { ComponentUI } from '@teambit/component';
|
|
2
|
-
import type { TitleBadge } from '@teambit/component.ui.component-meta';
|
|
3
2
|
import { ComponentCompareUI } from '@teambit/component-compare';
|
|
4
|
-
import { TitleBadgeSlot } from './overview';
|
|
3
|
+
import type { TitleBadgeSlot, TitleBadge } from './overview';
|
|
5
4
|
export declare class DocsUI {
|
|
6
5
|
readonly titleBadgeSlot: TitleBadgeSlot;
|
|
7
6
|
constructor(titleBadgeSlot: TitleBadgeSlot);
|
|
8
7
|
/**
|
|
9
8
|
* register a new title badge into the overview section of a component.
|
|
10
9
|
*/
|
|
11
|
-
registerTitleBadge(
|
|
10
|
+
registerTitleBadge(titleBadges: TitleBadge | TitleBadge[]): this;
|
|
12
11
|
/**
|
|
13
12
|
* list all title badges registered.
|
|
14
13
|
*/
|
|
15
|
-
listTitleBadges():
|
|
14
|
+
listTitleBadges(): TitleBadge[];
|
|
16
15
|
static dependencies: import("@teambit/harmony").Aspect[];
|
|
17
16
|
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
18
17
|
static slots: ((registerFn: () => string) => import("@teambit/harmony").SlotRegistry<TitleBadge>)[];
|
package/dist/docs.ui.runtime.js
CHANGED
|
@@ -21,6 +21,16 @@ function _defineProperty2() {
|
|
|
21
21
|
return data;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
function _lodash() {
|
|
25
|
+
const data = require("lodash");
|
|
26
|
+
|
|
27
|
+
_lodash = function () {
|
|
28
|
+
return data;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return data;
|
|
32
|
+
}
|
|
33
|
+
|
|
24
34
|
function _component() {
|
|
25
35
|
const data = require("@teambit/component");
|
|
26
36
|
|
|
@@ -100,8 +110,9 @@ class DocsUI {
|
|
|
100
110
|
*/
|
|
101
111
|
|
|
102
112
|
|
|
103
|
-
registerTitleBadge(
|
|
104
|
-
|
|
113
|
+
registerTitleBadge(titleBadges) {
|
|
114
|
+
const badges = Array.isArray(titleBadges) ? titleBadges : [titleBadges];
|
|
115
|
+
this.titleBadgeSlot.register(badges);
|
|
105
116
|
return this;
|
|
106
117
|
}
|
|
107
118
|
/**
|
|
@@ -110,12 +121,12 @@ class DocsUI {
|
|
|
110
121
|
|
|
111
122
|
|
|
112
123
|
listTitleBadges() {
|
|
113
|
-
return this.titleBadgeSlot;
|
|
124
|
+
return (0, _lodash().flatten)(this.titleBadgeSlot.values());
|
|
114
125
|
}
|
|
115
126
|
|
|
116
127
|
static async provider([component, componentCompare], config, [titleBadgeSlot]) {
|
|
117
128
|
const docs = new DocsUI(titleBadgeSlot);
|
|
118
|
-
const section = new (_overview().OverviewSection)(
|
|
129
|
+
const section = new (_overview().OverviewSection)(titleBadgeSlot);
|
|
119
130
|
const compareSection = new (_docsCompare().OverviewCompareSection)(titleBadgeSlot);
|
|
120
131
|
component.registerRoute(section.route);
|
|
121
132
|
component.registerNavigation(section.navigationLink, section.order);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DocsUI","constructor","titleBadgeSlot","registerTitleBadge","
|
|
1
|
+
{"version":3,"names":["DocsUI","constructor","titleBadgeSlot","registerTitleBadge","titleBadges","badges","Array","isArray","register","listTitleBadges","flatten","values","provider","component","componentCompare","config","docs","section","OverviewSection","compareSection","OverviewCompareSection","registerRoute","route","registerNavigation","navigationLink","order","props","registerRoutes","ComponentAspect","ComponentCompareAspect","UIRuntime","Slot","withType","DocsAspect","addRuntime"],"sources":["docs.ui.runtime.tsx"],"sourcesContent":["import { flatten } from 'lodash';\nimport { ComponentAspect, ComponentUI } from '@teambit/component';\nimport { Slot } from '@teambit/harmony';\nimport { UIRuntime } from '@teambit/ui';\nimport ComponentCompareAspect, { ComponentCompareUI } from '@teambit/component-compare';\n\nimport { DocsAspect } from './docs.aspect';\nimport { OverviewSection } from './overview.section';\nimport type { TitleBadgeSlot, TitleBadge } from './overview';\nimport { OverviewCompareSection } from './docs.compare.section';\n\nexport class DocsUI {\n constructor(readonly titleBadgeSlot: TitleBadgeSlot) {}\n\n /**\n * register a new title badge into the overview section of a component.\n */\n registerTitleBadge(titleBadges: TitleBadge | TitleBadge[]) {\n const badges = Array.isArray(titleBadges) ? titleBadges : [titleBadges];\n this.titleBadgeSlot.register(badges);\n return this;\n }\n\n /**\n * list all title badges registered.\n */\n listTitleBadges() {\n return flatten(this.titleBadgeSlot.values());\n }\n\n static dependencies = [ComponentAspect, ComponentCompareAspect];\n\n static runtime = UIRuntime;\n\n static slots = [Slot.withType<TitleBadge>()];\n\n static async provider(\n [component, componentCompare]: [ComponentUI, ComponentCompareUI],\n config,\n [titleBadgeSlot]: [TitleBadgeSlot]\n ) {\n const docs = new DocsUI(titleBadgeSlot);\n const section = new OverviewSection(titleBadgeSlot);\n const compareSection = new OverviewCompareSection(titleBadgeSlot);\n\n component.registerRoute(section.route);\n component.registerNavigation(section.navigationLink, section.order);\n componentCompare.registerNavigation({\n props: compareSection.navigationLink,\n order: compareSection.navigationLink.order,\n });\n componentCompare.registerRoutes([compareSection.route]);\n return docs;\n }\n}\n\nexport default DocsUI;\n\nDocsAspect.addRuntime(DocsUI);\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;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,MAAN,CAAa;EAClBC,WAAW,CAAUC,cAAV,EAA0C;IAAA,KAAhCA,cAAgC,GAAhCA,cAAgC;EAAE;EAEvD;AACF;AACA;;;EACEC,kBAAkB,CAACC,WAAD,EAAyC;IACzD,MAAMC,MAAM,GAAGC,KAAK,CAACC,OAAN,CAAcH,WAAd,IAA6BA,WAA7B,GAA2C,CAACA,WAAD,CAA1D;IACA,KAAKF,cAAL,CAAoBM,QAApB,CAA6BH,MAA7B;IACA,OAAO,IAAP;EACD;EAED;AACF;AACA;;;EACEI,eAAe,GAAG;IAChB,OAAO,IAAAC,iBAAA,EAAQ,KAAKR,cAAL,CAAoBS,MAApB,EAAR,CAAP;EACD;;EAQoB,aAARC,QAAQ,CACnB,CAACC,SAAD,EAAYC,gBAAZ,CADmB,EAEnBC,MAFmB,EAGnB,CAACb,cAAD,CAHmB,EAInB;IACA,MAAMc,IAAI,GAAG,IAAIhB,MAAJ,CAAWE,cAAX,CAAb;IACA,MAAMe,OAAO,GAAG,KAAIC,2BAAJ,EAAoBhB,cAApB,CAAhB;IACA,MAAMiB,cAAc,GAAG,KAAIC,qCAAJ,EAA2BlB,cAA3B,CAAvB;IAEAW,SAAS,CAACQ,aAAV,CAAwBJ,OAAO,CAACK,KAAhC;IACAT,SAAS,CAACU,kBAAV,CAA6BN,OAAO,CAACO,cAArC,EAAqDP,OAAO,CAACQ,KAA7D;IACAX,gBAAgB,CAACS,kBAAjB,CAAoC;MAClCG,KAAK,EAAEP,cAAc,CAACK,cADY;MAElCC,KAAK,EAAEN,cAAc,CAACK,cAAf,CAA8BC;IAFH,CAApC;IAIAX,gBAAgB,CAACa,cAAjB,CAAgC,CAACR,cAAc,CAACG,KAAhB,CAAhC;IACA,OAAON,IAAP;EACD;;AA1CiB;;;gCAAPhB,M,kBAmBW,CAAC4B,4BAAD,EAAkBC,2BAAlB,C;gCAnBX7B,M,aAqBM8B,e;gCArBN9B,M,WAuBI,CAAC+B,eAAA,CAAKC,QAAL,EAAD,C;eAsBFhC,M;;;AAEfiC,kBAAA,CAAWC,UAAX,CAAsBlC,MAAtB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export type { DocsPreview, DocsRootProps } from './docs.preview.runtime';
|
|
|
10
10
|
export type { DocReader } from './doc-reader';
|
|
11
11
|
export type { Docs, Example } from './docs';
|
|
12
12
|
export { defaultDocs } from './docs';
|
|
13
|
-
export type { TitleBadgeSlot } from './overview';
|
|
14
|
-
export { Overview } from './overview';
|
|
13
|
+
export type { TitleBadgeSlot, TitleBadge } from './overview';
|
|
14
|
+
export { Overview, BadgePosition } from './overview';
|
|
15
15
|
export { DocsAspect };
|
|
16
16
|
export default DocsAspect;
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "BadgePosition", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _overview().BadgePosition;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
Object.defineProperty(exports, "Doc", {
|
|
7
13
|
enumerable: true,
|
|
8
14
|
get: function () {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DocsAspect"],"sources":["index.ts"],"sourcesContent":["import { DocsAspect } from './docs.aspect';\n\n/**\n * Doc entity.\n * @deprecated - please dont use this. use directly from @teambit/docs.entities.doc.\n */\nexport { Doc, DocProp, DocPropList } from '@teambit/docs.entities.doc';\n\nexport type { DocsMain } from './docs.main.runtime';\nexport type { DocsUI } from './docs.ui.runtime';\nexport type { DocsPreview, DocsRootProps } from './docs.preview.runtime';\nexport type { DocReader } from './doc-reader';\nexport type { Docs, Example } from './docs';\nexport { defaultDocs } from './docs';\n\nexport type { TitleBadgeSlot } from './overview';\nexport { Overview } from './overview';\n\nexport { DocsAspect };\nexport default DocsAspect;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["DocsAspect"],"sources":["index.ts"],"sourcesContent":["import { DocsAspect } from './docs.aspect';\n\n/**\n * Doc entity.\n * @deprecated - please dont use this. use directly from @teambit/docs.entities.doc.\n */\nexport { Doc, DocProp, DocPropList } from '@teambit/docs.entities.doc';\n\nexport type { DocsMain } from './docs.main.runtime';\nexport type { DocsUI } from './docs.ui.runtime';\nexport type { DocsPreview, DocsRootProps } from './docs.preview.runtime';\nexport type { DocReader } from './doc-reader';\nexport type { Docs, Example } from './docs';\nexport { defaultDocs } from './docs';\n\nexport type { TitleBadgeSlot, TitleBadge } from './overview';\nexport { Overview, BadgePosition } from './overview';\n\nexport { DocsAspect };\nexport default DocsAspect;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAMA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAOA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAdA;AACA;AACA;AACA;eAceA,kB"}
|
package/dist/overview/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Overview } from './overview';
|
|
2
|
-
export type { TitleBadgeSlot } from './overview';
|
|
1
|
+
export { Overview, BadgePosition } from './overview';
|
|
2
|
+
export type { TitleBadgeSlot, TitleBadge } from './overview';
|
package/dist/overview/index.js
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "BadgePosition", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _overview().BadgePosition;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
Object.defineProperty(exports, "Overview", {
|
|
7
13
|
enumerable: true,
|
|
8
14
|
get: function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { Overview } from './overview';\nexport type { TitleBadgeSlot } from './overview';\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { Overview, BadgePosition } from './overview';\nexport type { TitleBadgeSlot, TitleBadge } from './overview';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA"}
|
|
@@ -1,6 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
2
|
import type { SlotRegistry } from '@teambit/harmony';
|
|
3
|
-
|
|
3
|
+
export declare enum BadgePosition {
|
|
4
|
+
Title = 0,
|
|
5
|
+
SubTitle = 1,
|
|
6
|
+
Labels = 2,
|
|
7
|
+
Package = 3,
|
|
8
|
+
ElementsPackage = 4
|
|
9
|
+
}
|
|
10
|
+
export declare type TitleBadge = {
|
|
11
|
+
component: ComponentType<any>;
|
|
12
|
+
weight?: number;
|
|
13
|
+
position?: BadgePosition;
|
|
14
|
+
};
|
|
4
15
|
export declare type TitleBadgeSlot = SlotRegistry<TitleBadge[]>;
|
|
5
16
|
export declare type OverviewProps = {
|
|
6
17
|
titleBadges: TitleBadgeSlot;
|
|
@@ -9,6 +9,7 @@ require("core-js/modules/es.array.iterator.js");
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", {
|
|
10
10
|
value: true
|
|
11
11
|
});
|
|
12
|
+
exports.BadgePosition = void 0;
|
|
12
13
|
exports.Overview = Overview;
|
|
13
14
|
|
|
14
15
|
function _react() {
|
|
@@ -22,7 +23,7 @@ function _react() {
|
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
function _lodash() {
|
|
25
|
-
const data =
|
|
26
|
+
const data = require("lodash");
|
|
26
27
|
|
|
27
28
|
_lodash = function () {
|
|
28
29
|
return data;
|
|
@@ -105,6 +106,17 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
105
106
|
|
|
106
107
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
107
108
|
|
|
109
|
+
let BadgePosition;
|
|
110
|
+
exports.BadgePosition = BadgePosition;
|
|
111
|
+
|
|
112
|
+
(function (BadgePosition) {
|
|
113
|
+
BadgePosition[BadgePosition["Title"] = 0] = "Title";
|
|
114
|
+
BadgePosition[BadgePosition["SubTitle"] = 1] = "SubTitle";
|
|
115
|
+
BadgePosition[BadgePosition["Labels"] = 2] = "Labels";
|
|
116
|
+
BadgePosition[BadgePosition["Package"] = 3] = "Package";
|
|
117
|
+
BadgePosition[BadgePosition["ElementsPackage"] = 4] = "ElementsPackage";
|
|
118
|
+
})(BadgePosition || (exports.BadgePosition = BadgePosition = {}));
|
|
119
|
+
|
|
108
120
|
function Overview({
|
|
109
121
|
titleBadges
|
|
110
122
|
}) {
|
|
@@ -142,7 +154,7 @@ function Overview({
|
|
|
142
154
|
abstract: component.description,
|
|
143
155
|
labels: component.labels,
|
|
144
156
|
packageName: component.packageName,
|
|
145
|
-
titleBadges: (0, _lodash().
|
|
157
|
+
titleBadges: (0, _lodash().flatten)(titleBadges.values()),
|
|
146
158
|
componentDescriptor: componentDescriptor,
|
|
147
159
|
component: component
|
|
148
160
|
}), /*#__PURE__*/_react().default.createElement(_previewUi().ComponentPreview, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Overview","titleBadges","component","useContext","ComponentContext","componentDescriptor","useComponentDescriptor","lanesModel","useLanesContext","currentLane","viewedLane","showHeader","preview","legacyHeader","buildStatus","host","margin","styles","overviewWrapper","componentOverviewBlock","displayName","version","description","labels","packageName","flatten","values","width","height"],"sources":["overview.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport flatten from 'lodash
|
|
1
|
+
{"version":3,"names":["BadgePosition","Overview","titleBadges","component","useContext","ComponentContext","componentDescriptor","useComponentDescriptor","lanesModel","useLanesContext","currentLane","viewedLane","showHeader","preview","legacyHeader","buildStatus","host","margin","styles","overviewWrapper","componentOverviewBlock","displayName","version","description","labels","packageName","flatten","values","width","height"],"sources":["overview.tsx"],"sourcesContent":["import React, { useContext, ComponentType } from 'react';\nimport { flatten } from 'lodash';\nimport { ComponentContext, useComponentDescriptor } from '@teambit/component';\nimport type { SlotRegistry } from '@teambit/harmony';\nimport { ComponentPreview } from '@teambit/preview.ui.component-preview';\nimport { StatusMessageCard } from '@teambit/design.ui.surfaces.status-message-card';\nimport { ComponentOverview } from '@teambit/component.ui.component-meta';\nimport { LaneBreadcrumb, useLanesContext } from '@teambit/lanes.ui.lanes';\nimport { Separator } from '@teambit/design.ui.separator';\nimport styles from './overview.module.scss';\n\nexport enum BadgePosition {\n Title,\n SubTitle,\n Labels,\n Package,\n ElementsPackage,\n}\n\nexport type TitleBadge = {\n component: ComponentType<any>;\n weight?: number;\n position?: BadgePosition;\n};\n\nexport type TitleBadgeSlot = SlotRegistry<TitleBadge[]>;\n\nexport type OverviewProps = {\n titleBadges: TitleBadgeSlot;\n};\n\nexport function Overview({ titleBadges }: OverviewProps) {\n const component = useContext(ComponentContext);\n const componentDescriptor = useComponentDescriptor();\n const lanesModel = useLanesContext();\n const currentLane = lanesModel?.viewedLane;\n\n const showHeader = !component.preview?.legacyHeader;\n\n if (component?.buildStatus === 'pending' && component?.host === 'teambit.scope/scope')\n return (\n <StatusMessageCard style={{ margin: 'auto' }} status=\"PROCESSING\" title=\"component preview pending\">\n this might take some time\n </StatusMessageCard>\n );\n\n if (component?.buildStatus === 'failed' && component?.host === 'teambit.scope/scope')\n return <StatusMessageCard style={{ margin: 'auto' }} status=\"FAILURE\" title=\"failed to get component preview \" />;\n\n return (\n <div className={styles.overviewWrapper}>\n {currentLane && <LaneBreadcrumb lane={currentLane} />}\n {currentLane && <Separator isPresentational />}\n {showHeader && (\n <ComponentOverview\n className={styles.componentOverviewBlock}\n displayName={component.displayName}\n version={component.version}\n abstract={component.description}\n labels={component.labels}\n packageName={component.packageName}\n titleBadges={flatten(titleBadges.values())}\n componentDescriptor={componentDescriptor}\n component={component}\n />\n )}\n <ComponentPreview\n component={component}\n style={{ width: '100%', height: '100%' }}\n previewName=\"overview\"\n fullContentHeight\n scrolling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
|
import { Section } from '@teambit/component';
|
|
3
|
-
import {
|
|
3
|
+
import { TitleBadgeSlot } from './overview';
|
|
4
4
|
export declare class OverviewSection implements Section {
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* title badge slot.
|
|
7
7
|
*/
|
|
8
|
-
private
|
|
8
|
+
private titleBadgeSlot;
|
|
9
9
|
constructor(
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* title badge slot.
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
titleBadgeSlot: TitleBadgeSlot);
|
|
14
14
|
navigationLink: {
|
|
15
15
|
href: string;
|
|
16
16
|
exact: boolean;
|
package/dist/overview.section.js
CHANGED
|
@@ -40,10 +40,10 @@ function _overview() {
|
|
|
40
40
|
class OverviewSection {
|
|
41
41
|
constructor(
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
43
|
+
* title badge slot.
|
|
44
44
|
*/
|
|
45
|
-
|
|
46
|
-
this.
|
|
45
|
+
titleBadgeSlot) {
|
|
46
|
+
this.titleBadgeSlot = titleBadgeSlot;
|
|
47
47
|
(0, _defineProperty2().default)(this, "navigationLink", {
|
|
48
48
|
href: '.',
|
|
49
49
|
exact: true,
|
|
@@ -52,7 +52,7 @@ class OverviewSection {
|
|
|
52
52
|
(0, _defineProperty2().default)(this, "route", {
|
|
53
53
|
index: true,
|
|
54
54
|
element: /*#__PURE__*/_react().default.createElement(_overview().Overview, {
|
|
55
|
-
titleBadges: this.
|
|
55
|
+
titleBadges: this.titleBadgeSlot
|
|
56
56
|
})
|
|
57
57
|
});
|
|
58
58
|
(0, _defineProperty2().default)(this, "order", 10);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["OverviewSection","constructor","
|
|
1
|
+
{"version":3,"names":["OverviewSection","constructor","titleBadgeSlot","href","exact","children","index","element"],"sources":["overview.section.tsx"],"sourcesContent":["import React from 'react';\nimport { Section } from '@teambit/component';\nimport { Overview, TitleBadgeSlot } from './overview';\n\nexport class OverviewSection implements Section {\n constructor(\n /**\n * title badge slot.\n */\n private titleBadgeSlot: TitleBadgeSlot\n ) {}\n\n navigationLink = {\n href: '.',\n exact: true,\n children: 'Overview',\n };\n\n route = {\n index: true,\n element: <Overview titleBadges={this.titleBadgeSlot} />,\n };\n\n order = 10;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,eAAN,CAAyC;EAC9CC,WAAW;EACT;AACJ;AACA;EACYC,cAJC,EAKT;IAAA,KADQA,cACR,GADQA,cACR;IAAA,wDAEe;MACfC,IAAI,EAAE,GADS;MAEfC,KAAK,EAAE,IAFQ;MAGfC,QAAQ,EAAE;IAHK,CAFf;IAAA,+CAQM;MACNC,KAAK,EAAE,IADD;MAENC,OAAO,eAAE,+BAAC,oBAAD;QAAU,WAAW,EAAE,KAAKL;MAA5B;IAFH,CARN;IAAA,+CAaM,EAbN;EAAE;;AAN0C"}
|
package/docs.compare.section.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TitleBadgeSlot } from '@teambit/docs';
|
|
3
2
|
import { Section } from '@teambit/component';
|
|
4
3
|
import { OverviewCompare } from '@teambit/docs.ui.overview-compare';
|
|
4
|
+
import { TitleBadgeSlot } from './overview';
|
|
5
5
|
|
|
6
6
|
export class OverviewCompareSection implements Section {
|
|
7
7
|
constructor(private titleBadgeSlot: TitleBadgeSlot) {}
|
package/docs.ui.runtime.tsx
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { flatten } from 'lodash';
|
|
1
2
|
import { ComponentAspect, ComponentUI } from '@teambit/component';
|
|
2
3
|
import { Slot } from '@teambit/harmony';
|
|
3
|
-
import type { TitleBadge } from '@teambit/component.ui.component-meta';
|
|
4
4
|
import { UIRuntime } from '@teambit/ui';
|
|
5
5
|
import ComponentCompareAspect, { ComponentCompareUI } from '@teambit/component-compare';
|
|
6
6
|
|
|
7
7
|
import { DocsAspect } from './docs.aspect';
|
|
8
8
|
import { OverviewSection } from './overview.section';
|
|
9
|
-
import { TitleBadgeSlot } from './overview';
|
|
9
|
+
import type { TitleBadgeSlot, TitleBadge } from './overview';
|
|
10
10
|
import { OverviewCompareSection } from './docs.compare.section';
|
|
11
11
|
|
|
12
12
|
export class DocsUI {
|
|
@@ -15,8 +15,9 @@ export class DocsUI {
|
|
|
15
15
|
/**
|
|
16
16
|
* register a new title badge into the overview section of a component.
|
|
17
17
|
*/
|
|
18
|
-
registerTitleBadge(
|
|
19
|
-
|
|
18
|
+
registerTitleBadge(titleBadges: TitleBadge | TitleBadge[]) {
|
|
19
|
+
const badges = Array.isArray(titleBadges) ? titleBadges : [titleBadges];
|
|
20
|
+
this.titleBadgeSlot.register(badges);
|
|
20
21
|
return this;
|
|
21
22
|
}
|
|
22
23
|
|
|
@@ -24,7 +25,7 @@ export class DocsUI {
|
|
|
24
25
|
* list all title badges registered.
|
|
25
26
|
*/
|
|
26
27
|
listTitleBadges() {
|
|
27
|
-
return this.titleBadgeSlot;
|
|
28
|
+
return flatten(this.titleBadgeSlot.values());
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
static dependencies = [ComponentAspect, ComponentCompareAspect];
|
|
@@ -39,7 +40,7 @@ export class DocsUI {
|
|
|
39
40
|
[titleBadgeSlot]: [TitleBadgeSlot]
|
|
40
41
|
) {
|
|
41
42
|
const docs = new DocsUI(titleBadgeSlot);
|
|
42
|
-
const section = new OverviewSection(
|
|
43
|
+
const section = new OverviewSection(titleBadgeSlot);
|
|
43
44
|
const compareSection = new OverviewCompareSection(titleBadgeSlot);
|
|
44
45
|
|
|
45
46
|
component.registerRoute(section.route);
|
package/overview/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Overview } from './overview';
|
|
2
|
-
export type { TitleBadgeSlot } from './overview';
|
|
1
|
+
export { Overview, BadgePosition } from './overview';
|
|
2
|
+
export type { TitleBadgeSlot, TitleBadge } from './overview';
|
package/overview/overview.tsx
CHANGED
|
@@ -1,14 +1,28 @@
|
|
|
1
|
-
import React, { useContext } from 'react';
|
|
2
|
-
import flatten from 'lodash
|
|
1
|
+
import React, { useContext, ComponentType } from 'react';
|
|
2
|
+
import { flatten } from 'lodash';
|
|
3
3
|
import { ComponentContext, useComponentDescriptor } from '@teambit/component';
|
|
4
4
|
import type { SlotRegistry } from '@teambit/harmony';
|
|
5
5
|
import { ComponentPreview } from '@teambit/preview.ui.component-preview';
|
|
6
6
|
import { StatusMessageCard } from '@teambit/design.ui.surfaces.status-message-card';
|
|
7
|
-
import { ComponentOverview
|
|
7
|
+
import { ComponentOverview } from '@teambit/component.ui.component-meta';
|
|
8
8
|
import { LaneBreadcrumb, useLanesContext } from '@teambit/lanes.ui.lanes';
|
|
9
9
|
import { Separator } from '@teambit/design.ui.separator';
|
|
10
10
|
import styles from './overview.module.scss';
|
|
11
11
|
|
|
12
|
+
export enum BadgePosition {
|
|
13
|
+
Title,
|
|
14
|
+
SubTitle,
|
|
15
|
+
Labels,
|
|
16
|
+
Package,
|
|
17
|
+
ElementsPackage,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type TitleBadge = {
|
|
21
|
+
component: ComponentType<any>;
|
|
22
|
+
weight?: number;
|
|
23
|
+
position?: BadgePosition;
|
|
24
|
+
};
|
|
25
|
+
|
|
12
26
|
export type TitleBadgeSlot = SlotRegistry<TitleBadge[]>;
|
|
13
27
|
|
|
14
28
|
export type OverviewProps = {
|
package/overview.section.tsx
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import { Section } from '@teambit/component';
|
|
2
1
|
import React from 'react';
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import { Overview } from './overview';
|
|
2
|
+
import { Section } from '@teambit/component';
|
|
3
|
+
import { Overview, TitleBadgeSlot } from './overview';
|
|
6
4
|
|
|
7
5
|
export class OverviewSection implements Section {
|
|
8
6
|
constructor(
|
|
9
7
|
/**
|
|
10
|
-
*
|
|
8
|
+
* title badge slot.
|
|
11
9
|
*/
|
|
12
|
-
private
|
|
10
|
+
private titleBadgeSlot: TitleBadgeSlot
|
|
13
11
|
) {}
|
|
14
12
|
|
|
15
13
|
navigationLink = {
|
|
@@ -20,7 +18,7 @@ export class OverviewSection implements Section {
|
|
|
20
18
|
|
|
21
19
|
route = {
|
|
22
20
|
index: true,
|
|
23
|
-
element: <Overview titleBadges={this.
|
|
21
|
+
element: <Overview titleBadges={this.titleBadgeSlot} />,
|
|
24
22
|
};
|
|
25
23
|
|
|
26
24
|
order = 10;
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/docs",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.805",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/docs/docs",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.docs",
|
|
8
8
|
"name": "docs",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.805"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"graphql-tag": "2.12.1",
|
|
13
|
-
"lodash
|
|
13
|
+
"lodash": "4.17.21",
|
|
14
14
|
"@babel/runtime": "7.12.18",
|
|
15
15
|
"core-js": "^3.0.0",
|
|
16
16
|
"@teambit/harmony": "0.3.3",
|
|
17
17
|
"@teambit/design.ui.separator": "0.0.354",
|
|
18
|
-
"@teambit/compiler": "0.0.
|
|
19
|
-
"@teambit/component": "0.0.
|
|
18
|
+
"@teambit/compiler": "0.0.805",
|
|
19
|
+
"@teambit/component": "0.0.805",
|
|
20
20
|
"@teambit/docs.entities.doc": "0.0.4",
|
|
21
|
-
"@teambit/pkg": "0.0.
|
|
22
|
-
"@teambit/workspace": "0.0.
|
|
23
|
-
"@teambit/docs.ui.overview-compare": "0.0.
|
|
24
|
-
"@teambit/cli": "0.0.
|
|
25
|
-
"@teambit/dev-files": "0.0.
|
|
26
|
-
"@teambit/envs": "0.0.
|
|
27
|
-
"@teambit/graphql": "0.0.
|
|
28
|
-
"@teambit/logger": "0.0.
|
|
29
|
-
"@teambit/preview": "0.0.
|
|
21
|
+
"@teambit/pkg": "0.0.805",
|
|
22
|
+
"@teambit/workspace": "0.0.805",
|
|
23
|
+
"@teambit/docs.ui.overview-compare": "0.0.44",
|
|
24
|
+
"@teambit/cli": "0.0.536",
|
|
25
|
+
"@teambit/dev-files": "0.0.805",
|
|
26
|
+
"@teambit/envs": "0.0.805",
|
|
27
|
+
"@teambit/graphql": "0.0.805",
|
|
28
|
+
"@teambit/logger": "0.0.629",
|
|
29
|
+
"@teambit/preview": "0.0.805",
|
|
30
30
|
"@teambit/component-id": "0.0.405",
|
|
31
|
-
"@teambit/component-compare": "0.0.
|
|
32
|
-
"@teambit/
|
|
33
|
-
"@teambit/
|
|
34
|
-
"@teambit/
|
|
31
|
+
"@teambit/component-compare": "0.0.53",
|
|
32
|
+
"@teambit/ui": "0.0.805",
|
|
33
|
+
"@teambit/pubsub": "0.0.805",
|
|
34
|
+
"@teambit/component.ui.component-meta": "0.0.97",
|
|
35
35
|
"@teambit/design.ui.surfaces.status-message-card": "0.0.8",
|
|
36
|
-
"@teambit/lanes.ui.lanes": "0.0.
|
|
36
|
+
"@teambit/lanes.ui.lanes": "0.0.105",
|
|
37
37
|
"@teambit/preview.ui.component-preview": "0.0.494"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/react-dom": "^17.0.5",
|
|
41
41
|
"@types/react": "^17.0.8",
|
|
42
|
-
"@types/lodash
|
|
42
|
+
"@types/lodash": "4.14.165",
|
|
43
43
|
"@types/mocha": "9.1.0",
|
|
44
44
|
"@types/testing-library__jest-dom": "5.9.5",
|
|
45
45
|
"@types/jest": "^26.0.0",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@teambit/docs.content.docs-overview": "1.95.9"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@teambit/legacy": "1.0.
|
|
50
|
+
"@teambit/legacy": "1.0.319",
|
|
51
51
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
52
52
|
"react": "^16.8.0 || ^17.0.0"
|
|
53
53
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.docs_docs@0.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.docs_docs@0.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.docs_docs@0.0.805/dist/docs.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.docs_docs@0.0.805/dist/docs.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
|
Binary file
|