@teambit/docs 0.0.785 → 0.0.786
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.d.ts +14 -1
- package/dist/docs.js.map +1 -1
- package/dist/docs.preview.runtime.d.ts +9 -0
- package/dist/docs.preview.runtime.js +19 -1
- package/dist/docs.preview.runtime.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js.map +1 -1
- package/docs.preview.runtime.tsx +35 -1
- package/package-tar/teambit-docs-0.0.786.tgz +0 -0
- package/package.json +13 -13
- package/{preview-1657337177086.js → preview-1657510339341.js} +2 -2
- package/package-tar/teambit-docs-0.0.785.tgz +0 -0
package/dist/docs.d.ts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ReactElement } from 'react';
|
|
2
|
+
export declare type Example = {
|
|
3
|
+
title?: string;
|
|
4
|
+
description?: ReactElement;
|
|
5
|
+
scope?: {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
};
|
|
8
|
+
jsx?: JSX.Element;
|
|
9
|
+
code: string;
|
|
10
|
+
};
|
|
2
11
|
export declare type Docs = {
|
|
3
12
|
/**
|
|
4
13
|
* default is the docs content.
|
|
@@ -12,4 +21,8 @@ export declare type Docs = {
|
|
|
12
21
|
* array of labels.
|
|
13
22
|
*/
|
|
14
23
|
labels: string[];
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated
|
|
26
|
+
*/
|
|
27
|
+
examples: Example[];
|
|
15
28
|
};
|
package/dist/docs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["docs.ts"],"sourcesContent":["import React from 'react';\n\nexport type Docs = {\n /**\n * default is the docs content.\n */\n default: React.ComponentType;\n\n /**\n * component abstract.\n */\n abstract: string;\n\n /**\n * array of labels.\n */\n labels: string[];\n};\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["docs.ts"],"sourcesContent":["import React, { ReactElement } from 'react';\n\nexport type Example = {\n title?: string;\n description?: ReactElement;\n scope?: { [key: string]: any };\n jsx?: JSX.Element;\n code: string;\n};\n\nexport type Docs = {\n /**\n * default is the docs content.\n */\n default: React.ComponentType;\n\n /**\n * component abstract.\n */\n abstract: string;\n\n /**\n * array of labels.\n */\n labels: string[];\n\n /**\n * @deprecated\n */\n examples: Example[];\n};\n"],"mappings":""}
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { RenderingContext, PreviewPreview, PreviewModule } from '@teambit/preview';
|
|
2
3
|
import { ComponentID } from '@teambit/component-id';
|
|
4
|
+
import type { Docs } from './docs';
|
|
5
|
+
export declare type DocsRootProps = {
|
|
6
|
+
Provider: React.ComponentType | undefined;
|
|
7
|
+
componentId: string;
|
|
8
|
+
docs: Docs | undefined;
|
|
9
|
+
compositions: any;
|
|
10
|
+
context: RenderingContext;
|
|
11
|
+
};
|
|
3
12
|
export declare class DocsPreview {
|
|
4
13
|
/**
|
|
5
14
|
* preview extension.
|
|
@@ -60,7 +60,25 @@ class DocsPreview {
|
|
|
60
60
|
this.preview = preview;
|
|
61
61
|
(0, _defineProperty2().default)(this, "render", (componentId, modules, [compositions], context) => {
|
|
62
62
|
const docsModule = this.selectPreviewModel(componentId.fullName, modules);
|
|
63
|
-
modules.mainModule.default
|
|
63
|
+
const isObject = !!modules.mainModule.default.apiObject;
|
|
64
|
+
/**
|
|
65
|
+
* for backwards compatibility - can be removed end of 2022
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
if (!isObject) {
|
|
69
|
+
const docsPropsArray = [NoopProvider, componentId.toString(), docsModule, compositions, context];
|
|
70
|
+
modules.mainModule.default(...docsPropsArray);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const docsProps = {
|
|
75
|
+
Provider: NoopProvider,
|
|
76
|
+
componentId: componentId.toString(),
|
|
77
|
+
docs: docsModule,
|
|
78
|
+
compositions,
|
|
79
|
+
context
|
|
80
|
+
};
|
|
81
|
+
modules.mainModule.default(docsProps);
|
|
64
82
|
});
|
|
65
83
|
}
|
|
66
84
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DocsPreview","constructor","preview","componentId","modules","compositions","context","docsModule","selectPreviewModel","fullName","mainModule","default","NoopProvider","toString","relevant","componentMap","undefined","provider","docsPreview","registerPreview","name","render","bind","include","PreviewRuntime","PreviewAspect","DocsAspect","addRuntime","children"],"sources":["docs.preview.runtime.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\nimport { PreviewAspect, RenderingContext, PreviewPreview, PreviewRuntime, PreviewModule } from '@teambit/preview';\nimport { ComponentID } from '@teambit/component-id';\n\nimport { DocsAspect } from './docs.aspect';\n\nexport class DocsPreview {\n constructor(\n /**\n * preview extension.\n */\n private preview: PreviewPreview\n ) {}\n\n render = (componentId: ComponentID, modules: PreviewModule, [compositions]: [any], context: RenderingContext) => {\n const docsModule = this.selectPreviewModel(componentId.fullName, modules);\n\n modules.mainModule.default(NoopProvider
|
|
1
|
+
{"version":3,"names":["DocsPreview","constructor","preview","componentId","modules","compositions","context","docsModule","selectPreviewModel","fullName","isObject","mainModule","default","apiObject","docsPropsArray","NoopProvider","toString","docsProps","Provider","docs","relevant","componentMap","undefined","provider","docsPreview","registerPreview","name","render","bind","include","PreviewRuntime","PreviewAspect","DocsAspect","addRuntime","children"],"sources":["docs.preview.runtime.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\nimport { PreviewAspect, RenderingContext, PreviewPreview, PreviewRuntime, PreviewModule } from '@teambit/preview';\nimport { ComponentID } from '@teambit/component-id';\n\nimport { DocsAspect } from './docs.aspect';\nimport type { Docs } from './docs';\n\nexport type DocsRootProps = {\n Provider: React.ComponentType | undefined;\n componentId: string;\n docs: Docs | undefined;\n compositions: any;\n context: RenderingContext;\n};\n\nexport class DocsPreview {\n constructor(\n /**\n * preview extension.\n */\n private preview: PreviewPreview\n ) {}\n\n render = (componentId: ComponentID, modules: PreviewModule, [compositions]: [any], context: RenderingContext) => {\n const docsModule = this.selectPreviewModel(componentId.fullName, modules);\n\n const isObject = !!modules.mainModule.default.apiObject;\n\n /**\n * for backwards compatibility - can be removed end of 2022\n */\n if (!isObject) {\n const docsPropsArray = [\n NoopProvider as React.ComponentType,\n componentId.toString(),\n docsModule as Docs,\n compositions,\n context,\n ];\n modules.mainModule.default(...docsPropsArray);\n return;\n }\n\n const docsProps: DocsRootProps = {\n Provider: NoopProvider as React.ComponentType,\n componentId: componentId.toString(),\n docs: docsModule as Docs,\n compositions,\n context,\n };\n\n modules.mainModule.default(docsProps);\n };\n\n selectPreviewModel(componentId: string, modules: PreviewModule) {\n const relevant = modules.componentMap[componentId];\n if (!relevant) return undefined;\n\n // only one doc file is supported.\n return relevant[0];\n }\n\n static runtime = PreviewRuntime;\n static dependencies = [PreviewAspect];\n\n static async provider([preview]: [PreviewPreview]) {\n const docsPreview = new DocsPreview(preview);\n preview.registerPreview({\n name: 'overview',\n render: docsPreview.render.bind(docsPreview),\n selectPreviewModel: docsPreview.selectPreviewModel.bind(docsPreview),\n include: ['compositions'],\n });\n\n return docsPreview;\n }\n}\n\nDocsAspect.addRuntime(DocsPreview);\n\nfunction NoopProvider({ children }: { children: ReactNode }) {\n return <>{children}</>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAWO,MAAMA,WAAN,CAAkB;EACvBC,WAAW;EACT;AACJ;AACA;EACYC,OAJC,EAKT;IAAA,KADQA,OACR,GADQA,OACR;IAAA,gDAEO,CAACC,WAAD,EAA2BC,OAA3B,EAAmD,CAACC,YAAD,CAAnD,EAA0EC,OAA1E,KAAwG;MAC/G,MAAMC,UAAU,GAAG,KAAKC,kBAA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;IAJa,CAAxB;IAOA,OAAOL,WAAP;EACD;;AA5DsB;;;gCAAZxB,W,aA+CM8B,yB;gCA/CN9B,W,kBAgDW,CAAC+B,wBAAD,C;;AAexBC,kBAAA,CAAWC,UAAX,CAAsBjC,WAAtB;;AAEA,SAASe,YAAT,CAAsB;EAAEmB;AAAF,CAAtB,EAA6D;EAC3D,oBAAO,gEAAGA,QAAH,CAAP;AACD"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,8 +6,9 @@ import { DocsAspect } from './docs.aspect';
|
|
|
6
6
|
export { Doc, DocProp, DocPropList } from '@teambit/docs.entities.doc';
|
|
7
7
|
export type { DocsMain } from './docs.main.runtime';
|
|
8
8
|
export type { DocsUI } from './docs.ui.runtime';
|
|
9
|
-
export type { DocsPreview } from './docs.preview.runtime';
|
|
9
|
+
export type { DocsPreview, DocsRootProps } from './docs.preview.runtime';
|
|
10
10
|
export type { DocReader } from './doc-reader';
|
|
11
|
+
export type { Docs, Example } from './docs';
|
|
11
12
|
export type { TitleBadgeSlot } from './overview';
|
|
12
13
|
export { Overview } from './overview';
|
|
13
14
|
export { DocsAspect };
|
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 } from './docs.preview.runtime';\nexport type { DocReader } from './doc-reader';\n\nexport type { TitleBadgeSlot } from './overview';\nexport { Overview } from './overview';\n\nexport { DocsAspect };\nexport default DocsAspect;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAMA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;
|
|
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';\n\nexport type { TitleBadgeSlot } from './overview';\nexport { Overview } from './overview';\n\nexport { DocsAspect };\nexport default DocsAspect;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAMA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AASA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAbA;AACA;AACA;AACA;eAaeA,kB"}
|
package/docs.preview.runtime.tsx
CHANGED
|
@@ -3,6 +3,15 @@ import { PreviewAspect, RenderingContext, PreviewPreview, PreviewRuntime, Previe
|
|
|
3
3
|
import { ComponentID } from '@teambit/component-id';
|
|
4
4
|
|
|
5
5
|
import { DocsAspect } from './docs.aspect';
|
|
6
|
+
import type { Docs } from './docs';
|
|
7
|
+
|
|
8
|
+
export type DocsRootProps = {
|
|
9
|
+
Provider: React.ComponentType | undefined;
|
|
10
|
+
componentId: string;
|
|
11
|
+
docs: Docs | undefined;
|
|
12
|
+
compositions: any;
|
|
13
|
+
context: RenderingContext;
|
|
14
|
+
};
|
|
6
15
|
|
|
7
16
|
export class DocsPreview {
|
|
8
17
|
constructor(
|
|
@@ -15,7 +24,32 @@ export class DocsPreview {
|
|
|
15
24
|
render = (componentId: ComponentID, modules: PreviewModule, [compositions]: [any], context: RenderingContext) => {
|
|
16
25
|
const docsModule = this.selectPreviewModel(componentId.fullName, modules);
|
|
17
26
|
|
|
18
|
-
modules.mainModule.default
|
|
27
|
+
const isObject = !!modules.mainModule.default.apiObject;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* for backwards compatibility - can be removed end of 2022
|
|
31
|
+
*/
|
|
32
|
+
if (!isObject) {
|
|
33
|
+
const docsPropsArray = [
|
|
34
|
+
NoopProvider as React.ComponentType,
|
|
35
|
+
componentId.toString(),
|
|
36
|
+
docsModule as Docs,
|
|
37
|
+
compositions,
|
|
38
|
+
context,
|
|
39
|
+
];
|
|
40
|
+
modules.mainModule.default(...docsPropsArray);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const docsProps: DocsRootProps = {
|
|
45
|
+
Provider: NoopProvider as React.ComponentType,
|
|
46
|
+
componentId: componentId.toString(),
|
|
47
|
+
docs: docsModule as Docs,
|
|
48
|
+
compositions,
|
|
49
|
+
context,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
modules.mainModule.default(docsProps);
|
|
19
53
|
};
|
|
20
54
|
|
|
21
55
|
selectPreviewModel(componentId: string, modules: PreviewModule) {
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/docs",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.786",
|
|
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.786"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"graphql-tag": "2.12.1",
|
|
@@ -15,23 +15,23 @@
|
|
|
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.786",
|
|
19
|
+
"@teambit/component": "0.0.786",
|
|
20
20
|
"@teambit/docs.entities.doc": "0.0.3",
|
|
21
|
-
"@teambit/pkg": "0.0.
|
|
22
|
-
"@teambit/workspace": "0.0.
|
|
21
|
+
"@teambit/pkg": "0.0.786",
|
|
22
|
+
"@teambit/workspace": "0.0.786",
|
|
23
23
|
"@teambit/docs.ui.overview-compare": "0.0.26",
|
|
24
24
|
"@teambit/cli": "0.0.519",
|
|
25
|
-
"@teambit/dev-files": "0.0.
|
|
26
|
-
"@teambit/envs": "0.0.
|
|
27
|
-
"@teambit/graphql": "0.0.
|
|
25
|
+
"@teambit/dev-files": "0.0.786",
|
|
26
|
+
"@teambit/envs": "0.0.786",
|
|
27
|
+
"@teambit/graphql": "0.0.786",
|
|
28
28
|
"@teambit/logger": "0.0.612",
|
|
29
|
-
"@teambit/preview": "0.0.
|
|
29
|
+
"@teambit/preview": "0.0.786",
|
|
30
30
|
"@teambit/component-id": "0.0.402",
|
|
31
|
-
"@teambit/component-compare": "0.0.
|
|
31
|
+
"@teambit/component-compare": "0.0.34",
|
|
32
32
|
"@teambit/component.ui.component-meta": "0.0.79",
|
|
33
|
-
"@teambit/ui": "0.0.
|
|
34
|
-
"@teambit/pubsub": "0.0.
|
|
33
|
+
"@teambit/ui": "0.0.786",
|
|
34
|
+
"@teambit/pubsub": "0.0.786",
|
|
35
35
|
"@teambit/design.ui.surfaces.status-message-card": "0.0.8",
|
|
36
36
|
"@teambit/lanes.ui.lanes": "0.0.87",
|
|
37
37
|
"@teambit/preview.ui.component-preview": "0.0.493"
|
|
@@ -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.786/dist/docs.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.docs_docs@0.0.786/dist/docs.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
|
Binary file
|