@teambit/docs 1.0.282 → 1.0.284
Sign up to get free protection for your applications and to get access to all the features.
- package/artifacts/__bit_junit.xml +1 -1
- package/artifacts/preview/static/css/teambit.docs/{docs-preview.60d67183.css → docs-preview.ee4909d8.css} +5 -5
- package/artifacts/preview/teambit_docs_docs-preview.js +6 -6
- package/artifacts/schema.json +1 -1
- package/dist/default-doc-reader.js +1 -1
- package/dist/default-doc-reader.js.map +1 -1
- package/dist/docs-store.js +1 -1
- package/dist/docs-store.js.map +1 -1
- package/dist/docs.composition.js +1 -1
- package/dist/docs.composition.js.map +1 -1
- package/dist/docs.graphql.js.map +1 -1
- package/dist/docs.main.runtime.js +1 -1
- package/dist/docs.main.runtime.js.map +1 -1
- package/dist/docs.preview-definition.js +1 -1
- package/dist/docs.preview.runtime.js +2 -2
- package/dist/docs.preview.runtime.js.map +1 -1
- package/dist/docs.service.js +1 -1
- package/dist/docs.ui.runtime.js +2 -2
- package/dist/docs.ui.runtime.js.map +1 -1
- package/dist/events/click-inside-an-iframe.js +1 -1
- package/dist/events/click-inside-an-iframe.js.map +1 -1
- package/dist/exceptions/doc-read-error.js.map +1 -1
- package/dist/exceptions/file-extension-not-supported.js.map +1 -1
- package/dist/overview/overview.js +4 -4
- package/dist/overview/overview.js.map +1 -1
- package/dist/overview/readme-skeleton.js +1 -1
- package/dist/overview/readme-skeleton.js.map +1 -1
- package/dist/overview.section.js +2 -2
- package/dist/overview.section.js.map +1 -1
- package/dist/{preview-1716520879631.js → preview-1716693760271.js} +2 -2
- package/package.json +15 -15
package/artifacts/schema.json
CHANGED
@@ -18,7 +18,7 @@ function _docsEntities() {
|
|
18
18
|
};
|
19
19
|
return data;
|
20
20
|
}
|
21
|
-
function _defineProperty(
|
21
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
22
22
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
23
23
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
24
24
|
class DefaultDocReader {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_path","data","require","_docsEntities","_defineProperty","
|
1
|
+
{"version":3,"names":["_path","data","require","_docsEntities","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","DefaultDocReader","constructor","pkg","compiler","workspace","read","path","contents","component","packageName","getPackageName","distPath","getDistPathBySrcPath","docsModule","resolve","Doc","from","labels","default","description","abstract","displayName","componentDisplayName","isFormatSupported","format","supportedExtensions","includes","exports"],"sources":["default-doc-reader.ts"],"sourcesContent":["import { resolve } from 'path';\nimport type { PkgMain } from '@teambit/pkg';\nimport type { Component } from '@teambit/component';\nimport type { CompilerMain } from '@teambit/compiler';\nimport type { Workspace } from '@teambit/workspace';\nimport { Doc } from '@teambit/docs.entities.doc';\nimport { DocReader } from './doc-reader';\n\nexport class DefaultDocReader implements DocReader {\n constructor(private pkg: PkgMain, private compiler: CompilerMain, private workspace: Workspace) {}\n\n async read(path: string, contents: Buffer, component: Component) {\n const packageName = this.pkg.getPackageName(component);\n const distPath = this.compiler.getDistPathBySrcPath(component, path);\n // eslint-disable-next-line\n const docsModule = require(resolve(`${this.workspace.path}/node_modules/${packageName}/${distPath}`));\n return Doc.from(path, {\n labels: docsModule.labels || docsModule.default?.labels,\n description: docsModule.abstract || docsModule.default?.abstract || docsModule.description,\n displayName: docsModule.displayName || docsModule.default?.componentDisplayName,\n });\n }\n\n readonly supportedExtensions = ['.ts', '.js', '.jsx', '.tsx'];\n\n isFormatSupported(format: string) {\n return this.supportedExtensions.includes(format);\n }\n}\n"],"mappings":";;;;;;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;EAdoC;EAEjG,MAAMwB,IAAIA,CAACC,IAAY,EAAEC,QAAgB,EAAEC,SAAoB,EAAE;IAC/D,MAAMC,WAAW,GAAG,IAAI,CAACP,GAAG,CAACQ,cAAc,CAACF,SAAS,CAAC;IACtD,MAAMG,QAAQ,GAAG,IAAI,CAACR,QAAQ,CAACS,oBAAoB,CAACJ,SAAS,EAAEF,IAAI,CAAC;IACpE;IACA,MAAMO,UAAU,GAAGlC,OAAO,CAAC,IAAAmC,eAAO,EAAC,GAAG,IAAI,CAACV,SAAS,CAACE,IAAI,iBAAiBG,WAAW,IAAIE,QAAQ,EAAE,CAAC,CAAC;IACrG,OAAOI,mBAAG,CAACC,IAAI,CAACV,IAAI,EAAE;MACpBW,MAAM,EAAEJ,UAAU,CAACI,MAAM,IAAIJ,UAAU,CAACK,OAAO,EAAED,MAAM;MACvDE,WAAW,EAAEN,UAAU,CAACO,QAAQ,IAAIP,UAAU,CAACK,OAAO,EAAEE,QAAQ,IAAIP,UAAU,CAACM,WAAW;MAC1FE,WAAW,EAAER,UAAU,CAACQ,WAAW,IAAIR,UAAU,CAACK,OAAO,EAAEI;IAC7D,CAAC,CAAC;EACJ;EAIAC,iBAAiBA,CAACC,MAAc,EAAE;IAChC,OAAO,IAAI,CAACC,mBAAmB,CAACC,QAAQ,CAACF,MAAM,CAAC;EAClD;AACF;AAACG,OAAA,CAAA3B,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
package/dist/docs-store.js
CHANGED
@@ -18,7 +18,7 @@ function _reactDom() {
|
|
18
18
|
};
|
19
19
|
return data;
|
20
20
|
}
|
21
|
-
function _interopRequireDefault(
|
21
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
22
22
|
// let docs = [];
|
23
23
|
|
24
24
|
function addDocs(docs) {
|
package/dist/docs-store.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","data","_interopRequireDefault","require","_reactDom","
|
1
|
+
{"version":3,"names":["_react","data","_interopRequireDefault","require","_reactDom","e","__esModule","default","addDocs","docs","Doc","ReactDOM","render","createElement","document","getElementById"],"sources":["docs-store.tsx"],"sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\n\n// let docs = [];\n\nexport function addDocs(docs: any[]) {\n const Doc = docs[0];\n ReactDOM.render(<Doc />, document.getElementById('root'));\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,UAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAiC,SAAAC,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEjC;;AAEO,SAASG,OAAOA,CAACC,IAAW,EAAE;EACnC,MAAMC,GAAG,GAAGD,IAAI,CAAC,CAAC,CAAC;EACnBE,mBAAQ,CAACC,MAAM,eAACZ,MAAA,GAAAO,OAAA,CAAAM,aAAA,CAACH,GAAG,MAAE,CAAC,EAAEI,QAAQ,CAACC,cAAc,CAAC,MAAM,CAAC,CAAC;AAC3D","ignoreList":[]}
|
package/dist/docs.composition.js
CHANGED
@@ -11,7 +11,7 @@ function _react() {
|
|
11
11
|
};
|
12
12
|
return data;
|
13
13
|
}
|
14
|
-
function _interopRequireDefault(
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
15
15
|
const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
|
16
16
|
style: {
|
17
17
|
height: '100%',
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","data","_interopRequireDefault","require","
|
1
|
+
{"version":3,"names":["_react","data","_interopRequireDefault","require","e","__esModule","default","Logo","createElement","style","height","display","justifyContent","width","src","exports"],"sources":["docs.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/docs.svg\" />\n </div>\n);\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0B,SAAAC,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEnB,MAAMG,IAAI,GAAGA,CAAA,kBAClBP,MAAA,GAAAM,OAAA,CAAAE,aAAA;EAAKC,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAM;IAAEC,OAAO,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAS;AAAE,gBACxEZ,MAAA,GAAAM,OAAA,CAAAE,aAAA;EAAKC,KAAK,EAAE;IAAEI,KAAK,EAAE;EAAG,CAAE;EAACC,GAAG,EAAC;AAAkD,CAAE,CAChF,CACN;AAACC,OAAA,CAAAR,IAAA,GAAAA,IAAA","ignoreList":[]}
|
package/dist/docs.graphql.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_graphqlTag","data","require","docsSchema","docs","typeDefs","gql","resolvers","Component","description","component","getDescription","labels","doc","getDoc"],"sources":["docs.graphql.ts"],"sourcesContent":["import { gql } from 'graphql-tag';\nimport { Component } from '@teambit/component';\nimport { DocsMain } from './docs.main.runtime';\n\nexport function docsSchema(docs: DocsMain) {\n return {\n typeDefs: gql`\n extend type Component {\n description: String\n labels: [String]\n }\n `,\n resolvers: {\n Component: {\n description: (component: Component) => {\n return docs.getDescription(component);\n },\n\n labels: (component: Component) => {\n const doc = docs.getDoc(component);\n return doc?.labels || [];\n },\n },\n },\n };\n}\n"],"mappings":";;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIO,SAASE,UAAUA,CAACC,IAAc,EAAE;EACzC,OAAO;IACLC,QAAQ,EAAE,IAAAC,iBAAG
|
1
|
+
{"version":3,"names":["_graphqlTag","data","require","docsSchema","docs","typeDefs","gql","resolvers","Component","description","component","getDescription","labels","doc","getDoc"],"sources":["docs.graphql.ts"],"sourcesContent":["import { gql } from 'graphql-tag';\nimport { Component } from '@teambit/component';\nimport { DocsMain } from './docs.main.runtime';\n\nexport function docsSchema(docs: DocsMain) {\n return {\n typeDefs: gql`\n extend type Component {\n description: String\n labels: [String]\n }\n `,\n resolvers: {\n Component: {\n description: (component: Component) => {\n return docs.getDescription(component);\n },\n\n labels: (component: Component) => {\n const doc = docs.getDoc(component);\n return doc?.labels || [];\n },\n },\n },\n };\n}\n"],"mappings":";;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIO,SAASE,UAAUA,CAACC,IAAc,EAAE;EACzC,OAAO;IACLC,QAAQ,EAAE,IAAAC,iBAAG;AACjB;AACA;AACA;AACA;AACA,KAAK;IACDC,SAAS,EAAE;MACTC,SAAS,EAAE;QACTC,WAAW,EAAGC,SAAoB,IAAK;UACrC,OAAON,IAAI,CAACO,cAAc,CAACD,SAAS,CAAC;QACvC,CAAC;QAEDE,MAAM,EAAGF,SAAoB,IAAK;UAChC,MAAMG,GAAG,GAAGT,IAAI,CAACU,MAAM,CAACJ,SAAS,CAAC;UAClC,OAAOG,GAAG,EAAED,MAAM,IAAI,EAAE;QAC1B;MACF;IACF;EACF,CAAC;AACH","ignoreList":[]}
|
@@ -137,7 +137,7 @@ function _exceptions() {
|
|
137
137
|
};
|
138
138
|
return data;
|
139
139
|
}
|
140
|
-
function _defineProperty(
|
140
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
141
141
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
142
142
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
143
143
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_harmony","data","require","_cli","_logger","_compiler","_component","_scope","_pkg","_graphql","_preview","_devFiles","_workspace","_docsEntities","_lodash","_envs","_docs","_docs2","_docs3","_defaultDocReader","_exceptions","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","DocsMain","constructor","patterns","preview","pkg","compiler","workspace","logger","devFiles","envs","docPropSlot","docReaderSlot","getDocsMap","components","ComponentMap","as","component","getDocsFiles","getDevFiles","docFiles","get","DocsAspect","id","state","filesystem","files","filter","file","includes","relative","getDescription","componentDoc","getDoc","desc","description","getTemplate","env","getDocsTemplate","isFunction","undefined","getDocReader","extension","values","find","docReader","isFormatSupported","computeDoc","length","docFile","extname","FileExtensionNotSupported","doc","read","contents","err","debug","message","docData","Doc","filePath","DocPropList","props","getPatterns","getComponentDevPatterns","calculateEnv","skipWarnings","inInstallContext","componentEnvDocsDevPatterns","getDocsDevPatterns","componentPatterns","concat","name","pattern","getDevPatternToRegister","bind","registerDocReader","register","provider","graphql","loggerAspect","scope","config","createLogger","docs","DefaultDocReader","registerDevPattern","computeDocsOnLoad","opts","loadDocs","toObject","registerOnComponentLoad","registerOnCompAspectReCalc","docsSchema","registerDefinition","DocsPreviewDefinition","exports","Slot","withType","MainRuntime","PreviewAspect","GraphqlAspect","WorkspaceAspect","PkgAspect","CompilerAspect","LoggerAspect","DevFilesAspect","EnvsAspect","ScopeAspect","addRuntime"],"sources":["docs.main.runtime.ts"],"sourcesContent":["import { Slot, SlotRegistry } from '@teambit/harmony';\nimport { MainRuntime } from '@teambit/cli';\nimport { LoggerAspect, LoggerMain, Logger } from '@teambit/logger';\nimport { CompilerAspect, CompilerMain } from '@teambit/compiler';\nimport { Component, ComponentMap, IComponent } from '@teambit/component';\nimport { ScopeAspect, ScopeMain } from '@teambit/scope';\nimport { PkgAspect, PkgMain } from '@teambit/pkg';\nimport type { Environment } from '@teambit/envs';\nimport { GraphqlAspect, GraphqlMain } from '@teambit/graphql';\nimport { PreviewAspect, PreviewMain } from '@teambit/preview';\nimport { DevFilesAspect, DevFilesMain } from '@teambit/dev-files';\nimport { ComponentLoadOptions } from '@teambit/legacy/dist/consumer/component/component-loader';\nimport { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources';\nimport { Workspace, WorkspaceAspect } from '@teambit/workspace';\nimport { Doc, DocPropList } from '@teambit/docs.entities.doc';\nimport { isFunction } from 'lodash';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport { DocsAspect } from './docs.aspect';\nimport { DocsPreviewDefinition } from './docs.preview-definition';\nimport { docsSchema } from './docs.graphql';\nimport { DocReader } from './doc-reader';\nimport { DefaultDocReader } from './default-doc-reader';\nimport { FileExtensionNotSupported } from './exceptions';\n\nexport type ComponentDocs = {\n files: string[];\n component: Component;\n};\n\nexport type DocProp = {};\n\nexport type DocPropSlot = SlotRegistry<DocProp>;\n\nexport type DocReaderSlot = SlotRegistry<DocReader>;\n\nexport type DocsConfig = {\n /**\n * glob patterns to identify doc files.\n */\n patterns: string[];\n};\n\n/**\n * the component documentation extension.\n */\nexport class DocsMain {\n constructor(\n private patterns: string[],\n /**\n * envs extension.\n */\n private preview: PreviewMain,\n\n private pkg: PkgMain,\n\n private compiler: CompilerMain,\n\n private workspace: Workspace,\n\n private logger: Logger,\n\n private devFiles: DevFilesMain,\n\n private envs: EnvsMain,\n\n private docPropSlot: DocPropSlot,\n\n private docReaderSlot: DocReaderSlot\n ) {}\n\n /**\n * returns an array of doc file paths for a set of components.\n */\n getDocsMap(components: Component[]): ComponentMap<AbstractVinyl[]> {\n return ComponentMap.as<AbstractVinyl[]>(components, (component) => {\n return this.getDocsFiles(component);\n });\n }\n\n getDocsFiles(component: Component): AbstractVinyl[] {\n const devFiles = this.devFiles.getDevFiles(component);\n const docFiles = devFiles.get(DocsAspect.id);\n return component.state.filesystem.files.filter((file) => docFiles.includes(file.relative));\n }\n\n /**\n * compute the description of the component from its source code and docs file.\n */\n async getDescription(component: Component): Promise<string> {\n const componentDoc = this.getDoc(component);\n const desc = componentDoc?.description;\n return desc || '';\n }\n\n async getTemplate(env: Environment): Promise<string | undefined> {\n if (env.getDocsTemplate && isFunction(env.getDocsTemplate)) {\n return env.getDocsTemplate();\n }\n return undefined;\n }\n\n getDocReader(extension: string) {\n return this.docReaderSlot.values().find((docReader) => docReader.isFormatSupported(extension));\n }\n\n /**\n * compute a doc for a component.\n */\n async computeDoc(component: Component) {\n const docFiles = this.getDocsFiles(component);\n if (docFiles.length) {\n // currently taking the the first docs file found with an abstract. (we support only one)\n const docFile = docFiles[0];\n\n try {\n const docReader = this.getDocReader(docFile.extname);\n if (!docReader) throw new FileExtensionNotSupported(docFile.relative, docFile.extname);\n const doc = await docReader.read(docFile.relative, docFile.contents, component);\n return doc;\n } catch (err: any) {\n // it's ok to fail here.\n this.logger.debug(`docs.main.runtime.computeDoc caught an error: ${err.message}`);\n return null;\n }\n }\n\n return null;\n }\n\n getDoc(component: IComponent) {\n const docData = component.get(DocsAspect.id)?.data?.doc;\n if (!docData) return null;\n return new Doc(docData.filePath, new DocPropList(docData.props));\n }\n\n getPatterns() {\n return this.patterns;\n }\n\n getComponentDevPatterns(component: Component) {\n const env = this.envs.calculateEnv(component, { skipWarnings: !!this.workspace?.inInstallContext }).env;\n const componentEnvDocsDevPatterns: string[] = env.getDocsDevPatterns ? env.getDocsDevPatterns(component) : [];\n const componentPatterns = componentEnvDocsDevPatterns.concat(this.getPatterns());\n return { name: 'docs', pattern: componentPatterns };\n }\n\n getDevPatternToRegister() {\n return this.getComponentDevPatterns.bind(this);\n }\n /**\n * register a new doc reader. this allows to support further\n * documentation file formats.\n */\n registerDocReader(docReader: DocReader) {\n this.docReaderSlot.register(docReader);\n return this;\n }\n\n static slots = [Slot.withType<DocProp>(), Slot.withType<DocReader>()];\n\n static runtime = MainRuntime;\n static dependencies = [\n PreviewAspect,\n GraphqlAspect,\n WorkspaceAspect,\n PkgAspect,\n CompilerAspect,\n LoggerAspect,\n DevFilesAspect,\n EnvsAspect,\n ScopeAspect,\n ];\n\n static defaultConfig = {\n patterns: ['**/*.docs.*'],\n };\n\n static async provider(\n [preview, graphql, workspace, pkg, compiler, loggerAspect, devFiles, envs, scope]: [\n PreviewMain,\n GraphqlMain,\n Workspace,\n PkgMain,\n CompilerMain,\n LoggerMain,\n DevFilesMain,\n EnvsMain,\n ScopeMain\n ],\n config: DocsConfig,\n [docPropSlot, docReaderSlot]: [DocPropSlot, DocReaderSlot]\n ) {\n const logger = loggerAspect.createLogger(DocsAspect.id);\n const docs = new DocsMain(\n config.patterns,\n preview,\n pkg,\n compiler,\n workspace,\n logger,\n devFiles,\n envs,\n docPropSlot,\n docReaderSlot\n );\n docs.registerDocReader(new DefaultDocReader(pkg, compiler, workspace));\n devFiles.registerDevPattern(docs.getDevPatternToRegister());\n\n const computeDocsOnLoad = async (component: Component, opts?: ComponentLoadOptions) => {\n if (opts?.loadDocs === false) return undefined;\n // const docFiles = await docs.computeDocs(component);\n const doc = await docs.computeDoc(component);\n\n return {\n doc: doc?.toObject(),\n // docFiles\n };\n };\n\n if (workspace) {\n workspace.registerOnComponentLoad(computeDocsOnLoad);\n }\n if (scope) {\n scope.registerOnCompAspectReCalc(computeDocsOnLoad);\n }\n\n graphql.register(docsSchema(docs));\n\n preview.registerDefinition(new DocsPreviewDefinition(docs));\n return docs;\n }\n}\n\nDocsAspect.addRuntime(DocsMain);\n"],"mappings":";;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,KAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,IAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,UAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,SAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,WAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,UAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,OAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,MAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,KAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,IAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAQ,SAAA;EAAA,MAAAR,IAAA,GAAAC,OAAA;EAAAO,QAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,SAAA;EA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,mBAgII;EACrBE,QAAQ,EAAE,CAAC,aAAa;AAC1B,CAAC;AA0DHmB,kBAAU,CAACuF,UAAU,CAAC5G,QAAQ,CAAC","ignoreList":[]}
|
1
|
+
{"version":3,"names":["_harmony","data","require","_cli","_logger","_compiler","_component","_scope","_pkg","_graphql","_preview","_devFiles","_workspace","_docsEntities","_lodash","_envs","_docs","_docs2","_docs3","_defaultDocReader","_exceptions","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","DocsMain","constructor","patterns","preview","pkg","compiler","workspace","logger","devFiles","envs","docPropSlot","docReaderSlot","getDocsMap","components","ComponentMap","as","component","getDocsFiles","getDevFiles","docFiles","get","DocsAspect","id","state","filesystem","files","filter","file","includes","relative","getDescription","componentDoc","getDoc","desc","description","getTemplate","env","getDocsTemplate","isFunction","undefined","getDocReader","extension","values","find","docReader","isFormatSupported","computeDoc","length","docFile","extname","FileExtensionNotSupported","doc","read","contents","err","debug","message","docData","Doc","filePath","DocPropList","props","getPatterns","getComponentDevPatterns","calculateEnv","skipWarnings","inInstallContext","componentEnvDocsDevPatterns","getDocsDevPatterns","componentPatterns","concat","name","pattern","getDevPatternToRegister","bind","registerDocReader","register","provider","graphql","loggerAspect","scope","config","createLogger","docs","DefaultDocReader","registerDevPattern","computeDocsOnLoad","opts","loadDocs","toObject","registerOnComponentLoad","registerOnCompAspectReCalc","docsSchema","registerDefinition","DocsPreviewDefinition","exports","Slot","withType","MainRuntime","PreviewAspect","GraphqlAspect","WorkspaceAspect","PkgAspect","CompilerAspect","LoggerAspect","DevFilesAspect","EnvsAspect","ScopeAspect","addRuntime"],"sources":["docs.main.runtime.ts"],"sourcesContent":["import { Slot, SlotRegistry } from '@teambit/harmony';\nimport { MainRuntime } from '@teambit/cli';\nimport { LoggerAspect, LoggerMain, Logger } from '@teambit/logger';\nimport { CompilerAspect, CompilerMain } from '@teambit/compiler';\nimport { Component, ComponentMap, IComponent } from '@teambit/component';\nimport { ScopeAspect, ScopeMain } from '@teambit/scope';\nimport { PkgAspect, PkgMain } from '@teambit/pkg';\nimport type { Environment } from '@teambit/envs';\nimport { GraphqlAspect, GraphqlMain } from '@teambit/graphql';\nimport { PreviewAspect, PreviewMain } from '@teambit/preview';\nimport { DevFilesAspect, DevFilesMain } from '@teambit/dev-files';\nimport { ComponentLoadOptions } from '@teambit/legacy/dist/consumer/component/component-loader';\nimport { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources';\nimport { Workspace, WorkspaceAspect } from '@teambit/workspace';\nimport { Doc, DocPropList } from '@teambit/docs.entities.doc';\nimport { isFunction } from 'lodash';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport { DocsAspect } from './docs.aspect';\nimport { DocsPreviewDefinition } from './docs.preview-definition';\nimport { docsSchema } from './docs.graphql';\nimport { DocReader } from './doc-reader';\nimport { DefaultDocReader } from './default-doc-reader';\nimport { FileExtensionNotSupported } from './exceptions';\n\nexport type ComponentDocs = {\n files: string[];\n component: Component;\n};\n\nexport type DocProp = {};\n\nexport type DocPropSlot = SlotRegistry<DocProp>;\n\nexport type DocReaderSlot = SlotRegistry<DocReader>;\n\nexport type DocsConfig = {\n /**\n * glob patterns to identify doc files.\n */\n patterns: string[];\n};\n\n/**\n * the component documentation extension.\n */\nexport class DocsMain {\n constructor(\n private patterns: string[],\n /**\n * envs extension.\n */\n private preview: PreviewMain,\n\n private pkg: PkgMain,\n\n private compiler: CompilerMain,\n\n private workspace: Workspace,\n\n private logger: Logger,\n\n private devFiles: DevFilesMain,\n\n private envs: EnvsMain,\n\n private docPropSlot: DocPropSlot,\n\n private docReaderSlot: DocReaderSlot\n ) {}\n\n /**\n * returns an array of doc file paths for a set of components.\n */\n getDocsMap(components: Component[]): ComponentMap<AbstractVinyl[]> {\n return ComponentMap.as<AbstractVinyl[]>(components, (component) => {\n return this.getDocsFiles(component);\n });\n }\n\n getDocsFiles(component: Component): AbstractVinyl[] {\n const devFiles = this.devFiles.getDevFiles(component);\n const docFiles = devFiles.get(DocsAspect.id);\n return component.state.filesystem.files.filter((file) => docFiles.includes(file.relative));\n }\n\n /**\n * compute the description of the component from its source code and docs file.\n */\n async getDescription(component: Component): Promise<string> {\n const componentDoc = this.getDoc(component);\n const desc = componentDoc?.description;\n return desc || '';\n }\n\n async getTemplate(env: Environment): Promise<string | undefined> {\n if (env.getDocsTemplate && isFunction(env.getDocsTemplate)) {\n return env.getDocsTemplate();\n }\n return undefined;\n }\n\n getDocReader(extension: string) {\n return this.docReaderSlot.values().find((docReader) => docReader.isFormatSupported(extension));\n }\n\n /**\n * compute a doc for a component.\n */\n async computeDoc(component: Component) {\n const docFiles = this.getDocsFiles(component);\n if (docFiles.length) {\n // currently taking the the first docs file found with an abstract. (we support only one)\n const docFile = docFiles[0];\n\n try {\n const docReader = this.getDocReader(docFile.extname);\n if (!docReader) throw new FileExtensionNotSupported(docFile.relative, docFile.extname);\n const doc = await docReader.read(docFile.relative, docFile.contents, component);\n return doc;\n } catch (err: any) {\n // it's ok to fail here.\n this.logger.debug(`docs.main.runtime.computeDoc caught an error: ${err.message}`);\n return null;\n }\n }\n\n return null;\n }\n\n getDoc(component: IComponent) {\n const docData = component.get(DocsAspect.id)?.data?.doc;\n if (!docData) return null;\n return new Doc(docData.filePath, new DocPropList(docData.props));\n }\n\n getPatterns() {\n return this.patterns;\n }\n\n getComponentDevPatterns(component: Component) {\n const env = this.envs.calculateEnv(component, { skipWarnings: !!this.workspace?.inInstallContext }).env;\n const componentEnvDocsDevPatterns: string[] = env.getDocsDevPatterns ? env.getDocsDevPatterns(component) : [];\n const componentPatterns = componentEnvDocsDevPatterns.concat(this.getPatterns());\n return { name: 'docs', pattern: componentPatterns };\n }\n\n getDevPatternToRegister() {\n return this.getComponentDevPatterns.bind(this);\n }\n /**\n * register a new doc reader. this allows to support further\n * documentation file formats.\n */\n registerDocReader(docReader: DocReader) {\n this.docReaderSlot.register(docReader);\n return this;\n }\n\n static slots = [Slot.withType<DocProp>(), Slot.withType<DocReader>()];\n\n static runtime = MainRuntime;\n static dependencies = [\n PreviewAspect,\n GraphqlAspect,\n WorkspaceAspect,\n PkgAspect,\n CompilerAspect,\n LoggerAspect,\n DevFilesAspect,\n EnvsAspect,\n ScopeAspect,\n ];\n\n static defaultConfig = {\n patterns: ['**/*.docs.*'],\n };\n\n static async provider(\n [preview, graphql, workspace, pkg, compiler, loggerAspect, devFiles, envs, scope]: [\n PreviewMain,\n GraphqlMain,\n Workspace,\n PkgMain,\n CompilerMain,\n LoggerMain,\n DevFilesMain,\n EnvsMain,\n ScopeMain\n ],\n config: DocsConfig,\n [docPropSlot, docReaderSlot]: [DocPropSlot, DocReaderSlot]\n ) {\n const logger = loggerAspect.createLogger(DocsAspect.id);\n const docs = new DocsMain(\n config.patterns,\n preview,\n pkg,\n compiler,\n workspace,\n logger,\n devFiles,\n envs,\n docPropSlot,\n docReaderSlot\n );\n docs.registerDocReader(new DefaultDocReader(pkg, compiler, workspace));\n devFiles.registerDevPattern(docs.getDevPatternToRegister());\n\n const computeDocsOnLoad = async (component: Component, opts?: ComponentLoadOptions) => {\n if (opts?.loadDocs === false) return undefined;\n // const docFiles = await docs.computeDocs(component);\n const doc = await docs.computeDoc(component);\n\n return {\n doc: doc?.toObject(),\n // docFiles\n };\n };\n\n if (workspace) {\n workspace.registerOnComponentLoad(computeDocsOnLoad);\n }\n if (scope) {\n scope.registerOnCompAspectReCalc(computeDocsOnLoad);\n }\n\n graphql.register(docsSchema(docs));\n\n preview.registerDefinition(new DocsPreviewDefinition(docs));\n return docs;\n }\n}\n\nDocsAspect.addRuntime(DocsMain);\n"],"mappings":";;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,KAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,IAAA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B,SAAS,CAAC;MAE5C,OAAO;QACLmC,GAAG,EAAEA,GAAG,EAAEsC,QAAQ,CAAC;QACnB;MACF,CAAC;IACH,CAAC;IAED,IAAInF,SAAS,EAAE;MACbA,SAAS,CAACoF,uBAAuB,CAACJ,iBAAiB,CAAC;IACtD;IACA,IAAIN,KAAK,EAAE;MACTA,KAAK,CAACW,0BAA0B,CAACL,iBAAiB,CAAC;IACrD;IAEAR,OAAO,CAACF,QAAQ,CAAC,IAAAgB,mBAAU,EAACT,IAAI,CAAC,CAAC;IAElChF,OAAO,CAAC0F,kBAAkB,CAAC,KAAIC,8BAAqB,EAACX,IAAI,CAAC,CAAC;IAC3D,OAAOA,IAAI;EACb;AACF;AAACY,OAAA,CAAA/F,QAAA,GAAAA,QAAA;AAAAnB,eAAA,CA1LYmB,QAAQ,WAiHJ,CAACgG,eAAI,CAACC,QAAQ,CAAU,CAAC,EAAED,eAAI,CAACC,QAAQ,CAAY,CAAC,CAAC;AAAApH,eAAA,CAjH1DmB,QAAQ,aAmHFkG,kBAAW;AAAArH,eAAA,CAnHjBmB,QAAQ,kBAoHG,CACpBmG,wBAAa,EACbC,wBAAa,EACbC,4BAAe,EACfC,gBAAS,EACTC,0BAAc,EACdC,sBAAY,EACZC,0BAAc,EACdC,kBAAU,EACVC,oBAAW,CACZ;AAAA9H,eAAA,CA9HUmB,QAAQ,mBAgII;EACrBE,QAAQ,EAAE,CAAC,aAAa;AAC1B,CAAC;AA0DHmB,kBAAU,CAACuF,UAAU,CAAC5G,QAAQ,CAAC","ignoreList":[]}
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.DocsPreviewDefinition = void 0;
|
7
|
-
function _defineProperty(
|
7
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
9
9
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
10
10
|
class DocsPreviewDefinition {
|
@@ -25,8 +25,8 @@ function _docs() {
|
|
25
25
|
};
|
26
26
|
return data;
|
27
27
|
}
|
28
|
-
function _interopRequireDefault(
|
29
|
-
function _defineProperty(
|
28
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
29
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
30
30
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
31
31
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
32
32
|
class DocsPreview {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","data","_interopRequireDefault","require","_preview","_docs","
|
1
|
+
{"version":3,"names":["_react","data","_interopRequireDefault","require","_preview","_docs","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","DocsPreview","constructor","preview","componentId","envId","modules","compositions","context","docsModule","selectPreviewModel","fullName","mainModule","modulesMap","defaultExports","isObject","apiObject","docsPropsArray","NoopProvider","toString","docsProps","Provider","docs","relevant","componentMap","undefined","provider","docsPreview","registerPreview","name","render","bind","include","exports","PreviewRuntime","PreviewAspect","DocsAspect","addRuntime","children","createElement","Fragment"],"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 = (\n componentId: ComponentID,\n envId: string,\n modules: PreviewModule,\n [compositions]: [any],\n context: RenderingContext\n ) => {\n const docsModule = this.selectPreviewModel(componentId.fullName, modules);\n\n const mainModule = modules.modulesMap[envId] || modules.modulesMap.default;\n let defaultExports = mainModule.default;\n // Sometime when using ESM (package.json with type:\"module\") the default export is nested under \"default\"\n if (typeof defaultExports !== 'function' && defaultExports.default) {\n defaultExports = defaultExports.default;\n }\n // @ts-ignore Gilad - to fix.\n const isObject = !!defaultExports.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 // @ts-ignore Gilad - to fix. it happens because defaultExports might be a func or an object (handled above)\n defaultExports(...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 // @ts-ignore Gilad - to fix. it happens because defaultExports might be a func or an object (handled above)\n defaultExports(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,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,MAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,KAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA2C,SAAAC,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAL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xBF,YAAY;QACZC;MACF,CAAC;MACD;MACAM,cAAc,CAACM,SAAS,CAAC;IAC3B,CAAC;EA7CE;EA+CHV,kBAAkBA,CAACN,WAAmB,EAAEE,OAAsB,EAAE;IAC9D,MAAMiB,QAAQ,GAAGjB,OAAO,CAACkB,YAAY,CAACpB,WAAW,CAAC;IAClD,IAAI,CAACmB,QAAQ,EAAE,OAAOE,SAAS;;IAE/B;IACA,OAAOF,QAAQ,CAAC,CAAC,CAAC;EACpB;EAKA,aAAaG,QAAQA,CAAC,CAACvB,OAAO,CAAmB,EAAE;IACjD,MAAMwB,WAAW,GAAG,IAAI1B,WAAW,CAACE,OAAO,CAAC;IAC5CA,OAAO,CAACyB,eAAe,CAAC;MACtBC,IAAI,EAAE,UAAU;MAChBC,MAAM,EAAEH,WAAW,CAACG,MAAM,CAACC,IAAI,CAACJ,WAAW,CAAC;MAC5CjB,kBAAkB,EAAEiB,WAAW,CAACjB,kBAAkB,CAACqB,IAAI,CAACJ,WAAW,CAAC;MACpEK,OAAO,EAAE,CAAC,cAAc;IAC1B,CAAC,CAAC;IAEF,OAAOL,WAAW;EACpB;AACF;AAACM,OAAA,CAAAhC,WAAA,GAAAA,WAAA;AAAAlB,eAAA,CA3EYkB,WAAW,aA6DLiC,yBAAc;AAAAnD,eAAA,CA7DpBkB,WAAW,kBA8DA,CAACkC,wBAAa,CAAC;AAevCC,kBAAU,CAACC,UAAU,CAACpC,WAAW,CAAC;AAElC,SAASiB,YAAYA,CAAC;EAAEoB;AAAkC,CAAC,EAAE;EAC3D,oBAAOhE,MAAA,GAAAQ,OAAA,CAAAyD,aAAA,CAAAjE,MAAA,GAAAQ,OAAA,CAAA0D,QAAA,QAAGF,QAAW,CAAC;AACxB","ignoreList":[]}
|
package/dist/docs.service.js
CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.DocsService = void 0;
|
7
|
-
function _defineProperty(
|
7
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
9
9
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
10
10
|
class DocsService {
|
package/dist/docs.ui.runtime.js
CHANGED
@@ -81,8 +81,8 @@ function _overview() {
|
|
81
81
|
};
|
82
82
|
return data;
|
83
83
|
}
|
84
|
-
function _interopRequireDefault(
|
85
|
-
function _defineProperty(
|
84
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
85
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
86
86
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
87
87
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
88
88
|
class DocsUI {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","data","_interopRequireDefault","require","_lodash","_component","_harmony","_ui","_componentCompare","_docsUi","_docsUi2","_apiReference","_docs","_overview","
|
1
|
+
{"version":3,"names":["_react","data","_interopRequireDefault","require","_lodash","_component","_harmony","_ui","_componentCompare","_docsUi","_docsUi2","_apiReference","_docs","_overview","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","DocsUI","constructor","titleBadgeSlot","overviewOptionsSlot","registerTitleBadge","titleBadges","badges","Array","isArray","register","listTitleBadges","flatten","values","registerEmptyState","emptyState","_emptyState","getEmptyState","getDocsCompare","createElement","OverviewCompare","overviewOptions","registerOverviewOptions","options","provider","component","componentCompare","apiRef","config","docs","section","OverviewSection","compareSection","OverviewCompareSection","registerRoute","route","registerNavigation","navigationLink","order","registerRoutes","exports","ComponentAspect","ComponentCompareAspect","APIReferenceAspect","UIRuntime","Slot","withType","_default","DocsAspect","addRuntime"],"sources":["docs.ui.runtime.tsx"],"sourcesContent":["import React, { ComponentType } from 'react';\nimport { 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';\nimport { OverviewCompare } from '@teambit/docs.ui.overview-compare';\nimport { OverviewCompareSection } from '@teambit/docs.ui.overview-compare-section';\nimport { APIReferenceAspect, APIReferenceUI } from '@teambit/api-reference';\nimport { DocsAspect } from './docs.aspect';\nimport { OverviewSection } from './overview.section';\nimport type { TitleBadgeSlot, TitleBadge, OverviewOptionsSlot, OverviewOptions } from './overview';\n\nexport class DocsUI {\n constructor(readonly titleBadgeSlot: TitleBadgeSlot, readonly overviewOptionsSlot: OverviewOptionsSlot) {}\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 private _emptyState?: ComponentType;\n\n registerEmptyState(emptyState: ComponentType) {\n return (this._emptyState = emptyState);\n }\n\n getEmptyState() {\n return this._emptyState;\n }\n\n getDocsCompare() {\n return <OverviewCompare titleBadges={this.titleBadgeSlot} overviewOptions={this.overviewOptionsSlot} />;\n }\n\n registerOverviewOptions(options: OverviewOptions) {\n this.overviewOptionsSlot.register(options);\n }\n\n static dependencies = [ComponentAspect, ComponentCompareAspect, APIReferenceAspect];\n\n static runtime = UIRuntime;\n\n static slots = [Slot.withType<TitleBadge>(), Slot.withType<OverviewOptions>()];\n\n static async provider(\n [component, componentCompare, apiRef]: [ComponentUI, ComponentCompareUI, APIReferenceUI],\n config,\n [titleBadgeSlot, overviewOptionsSlot]: [TitleBadgeSlot, OverviewOptionsSlot]\n ) {\n const docs = new DocsUI(titleBadgeSlot, overviewOptionsSlot);\n const section = new OverviewSection(titleBadgeSlot, overviewOptionsSlot, docs, apiRef);\n const compareSection = new OverviewCompareSection(docs);\n\n component.registerRoute(section.route);\n component.registerNavigation(section.navigationLink, section.order);\n componentCompare.registerNavigation(compareSection);\n componentCompare.registerRoutes([compareSection.route]);\n return docs;\n }\n}\n\nexport default DocsUI;\n\nDocsAspect.addRuntime(DocsUI);\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,WAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,UAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,SAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,QAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,IAAA;EAAA,MAAAN,IAAA,GAAAE,O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,CAACC,UAAU,CAAChD,MAAM,CAAC","ignoreList":[]}
|
@@ -11,7 +11,7 @@ function _pubsub() {
|
|
11
11
|
};
|
12
12
|
return data;
|
13
13
|
}
|
14
|
-
function _defineProperty(
|
14
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
15
15
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
16
16
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /* eslint-disable max-classes-per-file */
|
17
17
|
class ClickInsideAnIframeEventData {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_pubsub","data","require","_defineProperty","
|
1
|
+
{"version":3,"names":["_pubsub","data","require","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","ClickInsideAnIframeEventData","constructor","clickEvent","ClickInsideAnIframeEvent","BitBaseEvent","timestamp","Date","now","TYPE","exports"],"sources":["click-inside-an-iframe.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\nimport { BitBaseEvent } from '@teambit/pubsub';\n\nclass ClickInsideAnIframeEventData {\n constructor(private clickEvent: any) {}\n}\n\nexport class ClickInsideAnIframeEvent extends BitBaseEvent<ClickInsideAnIframeEventData> {\n static readonly TYPE = 'click-inside-an-iframe';\n\n constructor(readonly timestamp = Date.now(), readonly clickEvent) {\n super(ClickInsideAnIframeEvent.TYPE, '0.0.1', timestamp, new ClickInsideAnIframeEventData(clickEvent));\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAA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AA,wBAAA;AAAAtB,eAAA,CANYsB,wBAAwB,UACZ,wBAAwB","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["DocReadError","Error","constructor","filePath","error","exports"],"sources":["doc-read-error.ts"],"sourcesContent":["export class DocReadError extends Error {\n constructor(filePath: string, error: Error) {\n super(`failed reading doc in file path: ${filePath} with error: ${error}`);\n }\n}\n"],"mappings":";;;;;;AAAO,MAAMA,YAAY,SAASC,KAAK,CAAC;EACtCC,WAAWA,CAACC,QAAgB,EAAEC,KAAY,EAAE;IAC1C,KAAK,
|
1
|
+
{"version":3,"names":["DocReadError","Error","constructor","filePath","error","exports"],"sources":["doc-read-error.ts"],"sourcesContent":["export class DocReadError extends Error {\n constructor(filePath: string, error: Error) {\n super(`failed reading doc in file path: ${filePath} with error: ${error}`);\n }\n}\n"],"mappings":";;;;;;AAAO,MAAMA,YAAY,SAASC,KAAK,CAAC;EACtCC,WAAWA,CAACC,QAAgB,EAAEC,KAAY,EAAE;IAC1C,KAAK,CAAC,oCAAoCD,QAAQ,gBAAgBC,KAAK,EAAE,CAAC;EAC5E;AACF;AAACC,OAAA,CAAAL,YAAA,GAAAA,YAAA","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["FileExtensionNotSupported","Error","constructor","filePath","extension","exports"],"sources":["file-extension-not-supported.ts"],"sourcesContent":["export class FileExtensionNotSupported extends Error {\n constructor(filePath: string, extension: string) {\n super(`failed reading doc file: ${filePath} as file extension ${extension} is not supported\nby any of registered component doc readers. To register a doc reader please use the 'registerDocReader' API of the teambit.docs/docs.`);\n }\n}\n"],"mappings":";;;;;;AAAO,MAAMA,yBAAyB,SAASC,KAAK,CAAC;EACnDC,WAAWA,CAACC,QAAgB,EAAEC,SAAiB,EAAE;IAC/C,KAAK,
|
1
|
+
{"version":3,"names":["FileExtensionNotSupported","Error","constructor","filePath","extension","exports"],"sources":["file-extension-not-supported.ts"],"sourcesContent":["export class FileExtensionNotSupported extends Error {\n constructor(filePath: string, extension: string) {\n super(`failed reading doc file: ${filePath} as file extension ${extension} is not supported\nby any of registered component doc readers. To register a doc reader please use the 'registerDocReader' API of the teambit.docs/docs.`);\n }\n}\n"],"mappings":";;;;;;AAAO,MAAMA,yBAAyB,SAASC,KAAK,CAAC;EACnDC,WAAWA,CAACC,QAAgB,EAAEC,SAAiB,EAAE;IAC/C,KAAK,CAAC,4BAA4BD,QAAQ,sBAAsBC,SAAS;AAC7E,sIAAsI,CAAC;EACrI;AACF;AAACC,OAAA,CAAAL,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
@@ -78,12 +78,12 @@ function _overviewModule() {
|
|
78
78
|
const _excluded = ["onLoad", "style"]; // import { Icon } from '@teambit/design.elements.icon';
|
79
79
|
// import { LinkedHeading } from '@teambit/documenter.ui.linked-heading';
|
80
80
|
// import { StatusMessageCard } from '@teambit/design.ui.surfaces.status-message-card';
|
81
|
-
function _interopRequireDefault(
|
81
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
82
82
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
83
83
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
84
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
85
|
-
function _objectWithoutProperties(
|
86
|
-
function _objectWithoutPropertiesLoose(
|
84
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
85
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
86
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
87
87
|
let BadgePosition = exports.BadgePosition = /*#__PURE__*/function (BadgePosition) {
|
88
88
|
BadgePosition[BadgePosition["Title"] = 0] = "Title";
|
89
89
|
BadgePosition[BadgePosition["SubTitle"] = 1] = "SubTitle";
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","data","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_lodash","_component","_previewUi","_componentUi","_compositionsPanels","_baseReactThemes","_readmeSkeleton","_overviewModule","_excluded","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","target","arguments","length","source","key","prototype","apply","_objectWithoutProperties","excluded","_objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","indexOf","propertyIsEnumerable","BadgePosition","exports","Overview","titleBadges","overviewOptions","previewProps","getEmptyState","TaggedAPI","component","useContext","ComponentContext","componentDescriptor","useComponentDescriptor","current","useThemePicker","overviewProps","flatten","values","showHeader","preview","legacyHeader","EmptyState","buildFailed","buildStatus","toLowerCase","host","isScaling","Boolean","includesEnvTemplate","defaultLoadingState","React","useMemo","isLoading","setLoading","useState","iframeQueryParams","onlyOverview","skipIncludes","overviewPropsValues","themeParams","themeName","_ref","onLoad","style","rest","onPreviewLoad","useCallback","props","useEffect","id","toString","createElement","className","classNames","styles","overviewWrapper","noOverflow","ComponentOverview","componentOverviewBlock","legacyPreview","displayName","version","abstract","description","labels","packageName","readme","ReadmeSkeleton","CompositionGallerySkeleton","compositionsLength","Math","min","compositions","ComponentPreview","previewName","pubsub","queryParams","viewport","fullContentHeight","disableScroll","width","height","minHeight","undefined","CompositionGallery","componentId"],"sources":["overview.tsx"],"sourcesContent":["import React, { useContext, ComponentType, useState } from 'react';\nimport classNames from 'classnames';\nimport { flatten } from 'lodash';\n// import { Icon } from '@teambit/design.elements.icon';\n// import { LinkedHeading } from '@teambit/documenter.ui.linked-heading';\nimport { ComponentContext, useComponentDescriptor } from '@teambit/component';\nimport type { SlotRegistry } from '@teambit/harmony';\nimport { ComponentPreview, ComponentPreviewProps } from '@teambit/preview.ui.component-preview';\n// import { StatusMessageCard } from '@teambit/design.ui.surfaces.status-message-card';\nimport { ComponentOverview } from '@teambit/component.ui.component-meta';\nimport { CompositionGallery, CompositionGallerySkeleton } from '@teambit/compositions.panels.composition-gallery';\nimport { useThemePicker } from '@teambit/base-react.themes.theme-switcher';\nimport { ReadmeSkeleton } from './readme-skeleton';\nimport styles from './overview.module.scss';\n\nexport enum BadgePosition {\n Title,\n SubTitle,\n Labels,\n Package,\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 OverviewOptions = () => { queryParams?: string };\n\nexport type OverviewOptionsSlot = SlotRegistry<OverviewOptions>;\n\nexport type OverviewProps = {\n titleBadges: TitleBadgeSlot;\n overviewOptions: OverviewOptionsSlot;\n previewProps?: Partial<ComponentPreviewProps>;\n getEmptyState?: () => ComponentType | undefined;\n TaggedAPI?: React.ComponentType<{ componentId: string }>;\n};\n\nexport function Overview({ titleBadges, overviewOptions, previewProps, getEmptyState, TaggedAPI }: OverviewProps) {\n const component = useContext(ComponentContext);\n const componentDescriptor = useComponentDescriptor();\n const { current } = useThemePicker();\n const overviewProps = flatten(overviewOptions.values())[0];\n const showHeader = !component.preview?.legacyHeader;\n const EmptyState = getEmptyState && getEmptyState();\n const buildFailed = component.buildStatus?.toLowerCase() !== 'succeed' && component?.host === 'teambit.scope/scope';\n const isScaling = Boolean(component.preview?.isScaling);\n const includesEnvTemplate = Boolean(component.preview?.includesEnvTemplate);\n const defaultLoadingState = React.useMemo(() => {\n return isScaling && !includesEnvTemplate;\n }, [isScaling, includesEnvTemplate]);\n\n const [isLoading, setLoading] = useState(defaultLoadingState);\n\n const iframeQueryParams = `onlyOverview=${component.preview?.onlyOverview || 'false'}&skipIncludes=${\n component.preview?.skipIncludes || component.preview?.onlyOverview\n }`;\n\n const overviewPropsValues = overviewProps && overviewProps();\n\n const themeParams = current?.themeName ? `theme=${current?.themeName}` : '';\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { onLoad, style, ...rest } = previewProps || {};\n\n const onPreviewLoad = React.useCallback(\n (e, props) => {\n setLoading(false);\n onLoad?.(e, props);\n },\n [onLoad]\n );\n\n React.useEffect(() => {\n if (!isLoading && defaultLoadingState) setLoading(true);\n if (isLoading && !defaultLoadingState) setLoading(false);\n }, [component.id.toString(), defaultLoadingState]);\n\n return (\n <div\n className={classNames(styles.overviewWrapper, isLoading && styles.noOverflow)}\n key={`${component.id.toString()}`}\n >\n {showHeader && (\n <ComponentOverview\n className={classNames(styles.componentOverviewBlock, !isScaling && styles.legacyPreview)}\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 {!buildFailed && (\n <div className={styles.readme}>\n {isLoading && (\n <ReadmeSkeleton>\n <CompositionGallerySkeleton compositionsLength={Math.min(component.compositions.length, 3)} />\n </ReadmeSkeleton>\n )}\n <ComponentPreview\n onLoad={onPreviewLoad}\n previewName=\"overview\"\n pubsub={true}\n queryParams={[iframeQueryParams, themeParams, overviewPropsValues?.queryParams || '']}\n viewport={null}\n fullContentHeight\n disableScroll={true}\n {...rest}\n component={component}\n style={{ width: '100%', height: '100%', minHeight: !isScaling ? 500 : undefined }}\n />\n {component.preview?.onlyOverview && !isLoading && <CompositionGallery component={component} />}\n {component.preview?.onlyOverview && !isLoading && TaggedAPI && (\n <TaggedAPI componentId={component.id.toString()} />\n )}\n </div>\n )}\n {buildFailed && EmptyState && <EmptyState />}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,YAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAF,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAM,WAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,UAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAO,WAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,UAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAQ,aAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAAM,YAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,oBAAA;EAAA,MAAAT,IAAA,GAAAE,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":[]}
|
1
|
+
{"version":3,"names":["_react","data","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_lodash","_component","_previewUi","_componentUi","_compositionsPanels","_baseReactThemes","_readmeSkeleton","_overviewModule","_excluded","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","_objectWithoutProperties","o","_objectWithoutPropertiesLoose","getOwnPropertySymbols","indexOf","propertyIsEnumerable","BadgePosition","exports","Overview","titleBadges","overviewOptions","previewProps","getEmptyState","TaggedAPI","component","useContext","ComponentContext","componentDescriptor","useComponentDescriptor","current","useThemePicker","overviewProps","flatten","values","showHeader","preview","legacyHeader","EmptyState","buildFailed","buildStatus","toLowerCase","host","isScaling","Boolean","includesEnvTemplate","defaultLoadingState","React","useMemo","isLoading","setLoading","useState","iframeQueryParams","onlyOverview","skipIncludes","overviewPropsValues","themeParams","themeName","_ref","onLoad","style","rest","onPreviewLoad","useCallback","props","useEffect","id","toString","createElement","className","classNames","styles","overviewWrapper","noOverflow","key","ComponentOverview","componentOverviewBlock","legacyPreview","displayName","version","abstract","description","labels","packageName","readme","ReadmeSkeleton","CompositionGallerySkeleton","compositionsLength","Math","min","compositions","ComponentPreview","previewName","pubsub","queryParams","viewport","fullContentHeight","disableScroll","width","height","minHeight","undefined","CompositionGallery","componentId"],"sources":["overview.tsx"],"sourcesContent":["import React, { useContext, ComponentType, useState } from 'react';\nimport classNames from 'classnames';\nimport { flatten } from 'lodash';\n// import { Icon } from '@teambit/design.elements.icon';\n// import { LinkedHeading } from '@teambit/documenter.ui.linked-heading';\nimport { ComponentContext, useComponentDescriptor } from '@teambit/component';\nimport type { SlotRegistry } from '@teambit/harmony';\nimport { ComponentPreview, ComponentPreviewProps } from '@teambit/preview.ui.component-preview';\n// import { StatusMessageCard } from '@teambit/design.ui.surfaces.status-message-card';\nimport { ComponentOverview } from '@teambit/component.ui.component-meta';\nimport { CompositionGallery, CompositionGallerySkeleton } from '@teambit/compositions.panels.composition-gallery';\nimport { useThemePicker } from '@teambit/base-react.themes.theme-switcher';\nimport { ReadmeSkeleton } from './readme-skeleton';\nimport styles from './overview.module.scss';\n\nexport enum BadgePosition {\n Title,\n SubTitle,\n Labels,\n Package,\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 OverviewOptions = () => { queryParams?: string };\n\nexport type OverviewOptionsSlot = SlotRegistry<OverviewOptions>;\n\nexport type OverviewProps = {\n titleBadges: TitleBadgeSlot;\n overviewOptions: OverviewOptionsSlot;\n previewProps?: Partial<ComponentPreviewProps>;\n getEmptyState?: () => ComponentType | undefined;\n TaggedAPI?: React.ComponentType<{ componentId: string }>;\n};\n\nexport function Overview({ titleBadges, overviewOptions, previewProps, getEmptyState, TaggedAPI }: OverviewProps) {\n const component = useContext(ComponentContext);\n const componentDescriptor = useComponentDescriptor();\n const { current } = useThemePicker();\n const overviewProps = flatten(overviewOptions.values())[0];\n const showHeader = !component.preview?.legacyHeader;\n const EmptyState = getEmptyState && getEmptyState();\n const buildFailed = component.buildStatus?.toLowerCase() !== 'succeed' && component?.host === 'teambit.scope/scope';\n const isScaling = Boolean(component.preview?.isScaling);\n const includesEnvTemplate = Boolean(component.preview?.includesEnvTemplate);\n const defaultLoadingState = React.useMemo(() => {\n return isScaling && !includesEnvTemplate;\n }, [isScaling, includesEnvTemplate]);\n\n const [isLoading, setLoading] = useState(defaultLoadingState);\n\n const iframeQueryParams = `onlyOverview=${component.preview?.onlyOverview || 'false'}&skipIncludes=${\n component.preview?.skipIncludes || component.preview?.onlyOverview\n }`;\n\n const overviewPropsValues = overviewProps && overviewProps();\n\n const themeParams = current?.themeName ? `theme=${current?.themeName}` : '';\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { onLoad, style, ...rest } = previewProps || {};\n\n const onPreviewLoad = React.useCallback(\n (e, props) => {\n setLoading(false);\n onLoad?.(e, props);\n },\n [onLoad]\n );\n\n React.useEffect(() => {\n if (!isLoading && defaultLoadingState) setLoading(true);\n if (isLoading && !defaultLoadingState) setLoading(false);\n }, [component.id.toString(), defaultLoadingState]);\n\n return (\n <div\n className={classNames(styles.overviewWrapper, isLoading && styles.noOverflow)}\n key={`${component.id.toString()}`}\n >\n {showHeader && (\n <ComponentOverview\n className={classNames(styles.componentOverviewBlock, !isScaling && styles.legacyPreview)}\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 {!buildFailed && (\n <div className={styles.readme}>\n {isLoading && (\n <ReadmeSkeleton>\n <CompositionGallerySkeleton compositionsLength={Math.min(component.compositions.length, 3)} />\n </ReadmeSkeleton>\n )}\n <ComponentPreview\n onLoad={onPreviewLoad}\n previewName=\"overview\"\n pubsub={true}\n queryParams={[iframeQueryParams, themeParams, overviewPropsValues?.queryParams || '']}\n viewport={null}\n fullContentHeight\n disableScroll={true}\n {...rest}\n component={component}\n style={{ width: '100%', height: '100%', minHeight: !isScaling ? 500 : undefined }}\n />\n {component.preview?.onlyOverview && !isLoading && <CompositionGallery component={component} />}\n {component.preview?.onlyOverview && !isLoading && TaggedAPI && (\n <TaggedAPI componentId={component.id.toString()} />\n )}\n </div>\n )}\n {buildFailed && EmptyState && <EmptyState />}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,YAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAF,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OA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CAACW,OAAO,EAAEiB,YAAY,IAAI,CAACJ,SAAS,iBAAI/E,MAAA,GAAAiB,OAAA,CAAAiF,aAAA,CAACxF,mBAAA,GAAA0H,kBAAkB;IAAC7E,SAAS,EAAEA;EAAU,CAAE,CAAC,EAC7FA,SAAS,CAACW,OAAO,EAAEiB,YAAY,IAAI,CAACJ,SAAS,IAAIzB,SAAS,iBACzDtD,MAAA,GAAAiB,OAAA,CAAAiF,aAAA,CAAC5C,SAAS;IAAC+E,WAAW,EAAE9E,SAAS,CAACyC,EAAE,CAACC,QAAQ,CAAC;EAAE,CAAE,CAEjD,CACN,EACA5B,WAAW,IAAID,UAAU,iBAAIpE,MAAA,GAAAiB,OAAA,CAAAiF,aAAA,CAAC9B,UAAU,MAAE,CACxC,CAAC;AAEV","ignoreList":[]}
|
@@ -25,7 +25,7 @@ function _overviewModule() {
|
|
25
25
|
};
|
26
26
|
return data;
|
27
27
|
}
|
28
|
-
function _interopRequireDefault(
|
28
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
29
29
|
function ReadmeSkeleton({
|
30
30
|
children
|
31
31
|
}) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","data","_interopRequireDefault","require","_baseUiLoaders","_overviewModule","
|
1
|
+
{"version":3,"names":["_react","data","_interopRequireDefault","require","_baseUiLoaders","_overviewModule","e","__esModule","default","ReadmeSkeleton","children","createElement","className","styles","readmeSkeleton","LineSkeleton","width","style","marginBottom","BlockSkeleton","lines"],"sources":["readme-skeleton.tsx"],"sourcesContent":["import React from 'react';\nimport { LineSkeleton, BlockSkeleton } from '@teambit/base-ui.loaders.skeleton';\nimport styles from './overview.module.scss';\n\nexport function ReadmeSkeleton({ children }: { children?: React.ReactNode }) {\n return (\n <div className={styles.readmeSkeleton}>\n <LineSkeleton width=\"80%\" />\n <LineSkeleton width=\"70%\" />\n <LineSkeleton width=\"40%\" style={{ marginBottom: 40 }} />\n <LineSkeleton width=\"30%\" style={{ margin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AAEC,YAAY,EAAE;IAAG;EAAE,CAAE,CAAC,eACzDlB,MAAA,GAAAQ,OAAA,CAAAG,aAAA,CAACP,cAAA,GAAAe,aAAa;IAACC,KAAK,EAAE,EAAG;IAACH,KAAK,EAAE;MAAED,KAAK,EAAE,MAAM;MAAEE,YAAY,EAAE;IAAG;EAAE,CAAE,CAAC,EACvER,QACE,CAAC;AAEV","ignoreList":[]}
|
package/dist/overview.section.js
CHANGED
@@ -18,8 +18,8 @@ function _overview() {
|
|
18
18
|
};
|
19
19
|
return data;
|
20
20
|
}
|
21
|
-
function _interopRequireDefault(
|
22
|
-
function _defineProperty(
|
21
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
22
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
23
23
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
24
24
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
25
25
|
class OverviewSection {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","data","_interopRequireDefault","require","_overview","
|
1
|
+
{"version":3,"names":["_react","data","_interopRequireDefault","require","_overview","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","OverviewSection","constructor","titleBadgeSlot","overviewOptionsSlot","docs","apiRef","href","exact","children","index","element","createElement","Overview","titleBadges","overviewOptions","getEmptyState","bind","TaggedAPI","TaggedAPIPage","exports"],"sources":["overview.section.tsx"],"sourcesContent":["import React from 'react';\nimport { Section } from '@teambit/component';\nimport { APIReferenceUI } from '@teambit/api-reference';\nimport { Overview, TitleBadgeSlot, OverviewOptionsSlot } from './overview';\nimport { DocsUI } from './docs.ui.runtime';\n\nexport class OverviewSection implements Section {\n constructor(\n /**\n * title badge slot.\n */\n private titleBadgeSlot: TitleBadgeSlot,\n private overviewOptionsSlot: OverviewOptionsSlot,\n private docs: DocsUI,\n private apiRef: APIReferenceUI\n ) {}\n\n navigationLink = {\n href: '.',\n exact: true,\n children: 'Overview',\n };\n\n route = {\n index: true,\n element: (\n <Overview\n titleBadges={this.titleBadgeSlot}\n overviewOptions={this.overviewOptionsSlot}\n getEmptyState={this.docs.getEmptyState.bind(this.docs)}\n TaggedAPI={this.apiRef.TaggedAPIPage}\n />\n ),\n };\n\n order = 10;\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAG,UAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA2E,SAAAC,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAA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capsules/8891be5ad/teambit.docs_docs@1.0.
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.docs_docs@1.0.
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.docs_docs@1.0.284/dist/docs.composition.js';
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.docs_docs@1.0.284/dist/docs.docs.mdx';
|
3
3
|
|
4
4
|
export const compositions = [compositions_0];
|
5
5
|
export const overview = [overview_0];
|