@teambit/docs 1.0.516 → 1.0.518
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.ui.runtime.d.ts +12 -3
- package/dist/docs.ui.runtime.js +15 -5
- package/dist/docs.ui.runtime.js.map +1 -1
- package/dist/overview/overview.d.ts +3 -1
- package/dist/overview/overview.js +13 -4
- package/dist/overview/overview.js.map +1 -1
- package/dist/overview.section.d.ts +3 -2
- package/dist/overview.section.js +4 -2
- package/dist/overview.section.js.map +1 -1
- package/dist/{preview-1736997622391.js → preview-1737170420676.js} +2 -2
- package/docs.ui.runtime.tsx +24 -7
- package/overview/overview.tsx +24 -3
- package/overview.section.tsx +4 -2
- package/package.json +21 -20
- package/artifacts/__bit_junit.xml +0 -4
- package/artifacts/preview/static/css/teambit.docs/docs-preview.f44a71ae.css +0 -308
- package/artifacts/preview/static/images/cb4380c886e710d71163.png +0 -0
- package/artifacts/preview/teambit_docs_docs-preview.js +0 -305
- package/artifacts/schema.json +0 -7025
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import React, { ComponentType } from 'react';
|
|
2
2
|
import { ComponentUI } from '@teambit/component';
|
|
3
|
+
import { SlotRegistry } from '@teambit/harmony';
|
|
3
4
|
import { ComponentCompareUI } from '@teambit/component-compare';
|
|
5
|
+
import { UseSandboxPermission } from '@teambit/preview.ui.component-preview';
|
|
4
6
|
import { APIReferenceUI } from '@teambit/api-reference';
|
|
5
7
|
import type { TitleBadgeSlot, TitleBadge, OverviewOptionsSlot, OverviewOptions } from './overview';
|
|
8
|
+
export type UsePreviewSandboxSlot = SlotRegistry<UseSandboxPermission>;
|
|
6
9
|
export declare class DocsUI {
|
|
7
10
|
readonly titleBadgeSlot: TitleBadgeSlot;
|
|
8
11
|
readonly overviewOptionsSlot: OverviewOptionsSlot;
|
|
9
|
-
|
|
12
|
+
private usePreviewSandboxSlot;
|
|
13
|
+
constructor(titleBadgeSlot: TitleBadgeSlot, overviewOptionsSlot: OverviewOptionsSlot, usePreviewSandboxSlot: UsePreviewSandboxSlot);
|
|
10
14
|
/**
|
|
11
15
|
* register a new title badge into the overview section of a component.
|
|
12
16
|
*/
|
|
@@ -17,12 +21,17 @@ export declare class DocsUI {
|
|
|
17
21
|
listTitleBadges(): TitleBadge[];
|
|
18
22
|
private _emptyState?;
|
|
19
23
|
registerEmptyState(emptyState: ComponentType): React.ComponentType;
|
|
24
|
+
registerPreviewSandbox(useSandboxPermission: UseSandboxPermission): void;
|
|
20
25
|
getEmptyState(): React.ComponentType | undefined;
|
|
21
26
|
getDocsCompare(): import("react/jsx-runtime").JSX.Element;
|
|
22
27
|
registerOverviewOptions(options: OverviewOptions): void;
|
|
23
28
|
static dependencies: import("@teambit/harmony").Aspect[];
|
|
24
29
|
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
25
|
-
static slots: (((registerFn: () => string) =>
|
|
26
|
-
static provider([component, componentCompare, apiRef]: [ComponentUI, ComponentCompareUI, APIReferenceUI], config: any, [titleBadgeSlot, overviewOptionsSlot
|
|
30
|
+
static slots: (((registerFn: () => string) => SlotRegistry<TitleBadge>) | ((registerFn: () => string) => SlotRegistry<UseSandboxPermission>))[];
|
|
31
|
+
static provider([component, componentCompare, apiRef]: [ComponentUI, ComponentCompareUI, APIReferenceUI], config: any, [titleBadgeSlot, overviewOptionsSlot, usePreviewSandboxSlot]: [
|
|
32
|
+
TitleBadgeSlot,
|
|
33
|
+
OverviewOptionsSlot,
|
|
34
|
+
UsePreviewSandboxSlot
|
|
35
|
+
]): Promise<DocsUI>;
|
|
27
36
|
}
|
|
28
37
|
export default DocsUI;
|
package/dist/docs.ui.runtime.js
CHANGED
|
@@ -86,9 +86,10 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
|
|
|
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 {
|
|
89
|
-
constructor(titleBadgeSlot, overviewOptionsSlot) {
|
|
89
|
+
constructor(titleBadgeSlot, overviewOptionsSlot, usePreviewSandboxSlot) {
|
|
90
90
|
this.titleBadgeSlot = titleBadgeSlot;
|
|
91
91
|
this.overviewOptionsSlot = overviewOptionsSlot;
|
|
92
|
+
this.usePreviewSandboxSlot = usePreviewSandboxSlot;
|
|
92
93
|
_defineProperty(this, "_emptyState", void 0);
|
|
93
94
|
}
|
|
94
95
|
|
|
@@ -110,6 +111,9 @@ class DocsUI {
|
|
|
110
111
|
registerEmptyState(emptyState) {
|
|
111
112
|
return this._emptyState = emptyState;
|
|
112
113
|
}
|
|
114
|
+
registerPreviewSandbox(useSandboxPermission) {
|
|
115
|
+
this.usePreviewSandboxSlot.register(useSandboxPermission);
|
|
116
|
+
}
|
|
113
117
|
getEmptyState() {
|
|
114
118
|
return this._emptyState;
|
|
115
119
|
}
|
|
@@ -122,21 +126,27 @@ class DocsUI {
|
|
|
122
126
|
registerOverviewOptions(options) {
|
|
123
127
|
this.overviewOptionsSlot.register(options);
|
|
124
128
|
}
|
|
125
|
-
static async provider([component, componentCompare, apiRef], config, [titleBadgeSlot, overviewOptionsSlot]) {
|
|
126
|
-
const docs = new DocsUI(titleBadgeSlot, overviewOptionsSlot);
|
|
127
|
-
const section = new (_overview().OverviewSection)(titleBadgeSlot, overviewOptionsSlot, docs, apiRef);
|
|
129
|
+
static async provider([component, componentCompare, apiRef], config, [titleBadgeSlot, overviewOptionsSlot, usePreviewSandboxSlot]) {
|
|
130
|
+
const docs = new DocsUI(titleBadgeSlot, overviewOptionsSlot, usePreviewSandboxSlot);
|
|
131
|
+
const section = new (_overview().OverviewSection)(titleBadgeSlot, overviewOptionsSlot, docs, apiRef, usePreviewSandboxSlot);
|
|
128
132
|
const compareSection = new (_docsUi2().OverviewCompareSection)(docs);
|
|
129
133
|
component.registerRoute(section.route);
|
|
130
134
|
component.registerNavigation(section.navigationLink, section.order);
|
|
131
135
|
componentCompare.registerNavigation(compareSection);
|
|
132
136
|
componentCompare.registerRoutes([compareSection.route]);
|
|
137
|
+
docs.registerPreviewSandbox((manager, componentModel) => {
|
|
138
|
+
if (componentModel?.host === 'teambit.scope/scope') {
|
|
139
|
+
manager.add('allow-scripts');
|
|
140
|
+
manager.add('allow-same-origin');
|
|
141
|
+
}
|
|
142
|
+
});
|
|
133
143
|
return docs;
|
|
134
144
|
}
|
|
135
145
|
}
|
|
136
146
|
exports.DocsUI = DocsUI;
|
|
137
147
|
_defineProperty(DocsUI, "dependencies", [_component().ComponentAspect, _componentCompare().ComponentCompareAspect, _apiReference().APIReferenceAspect]);
|
|
138
148
|
_defineProperty(DocsUI, "runtime", _ui().UIRuntime);
|
|
139
|
-
_defineProperty(DocsUI, "slots", [_harmony().Slot.withType(), _harmony().Slot.withType()]);
|
|
149
|
+
_defineProperty(DocsUI, "slots", [_harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType()]);
|
|
140
150
|
var _default = exports.default = DocsUI;
|
|
141
151
|
_docs().DocsAspect.addRuntime(DocsUI);
|
|
142
152
|
|
|
@@ -1 +1 @@
|
|
|
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(\n readonly titleBadgeSlot: TitleBadgeSlot,\n readonly overviewOptionsSlot: OverviewOptionsSlot\n ) {}\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
|
|
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","usePreviewSandboxSlot","registerTitleBadge","titleBadges","badges","Array","isArray","register","listTitleBadges","flatten","values","registerEmptyState","emptyState","_emptyState","registerPreviewSandbox","useSandboxPermission","getEmptyState","getDocsCompare","createElement","OverviewCompare","overviewOptions","registerOverviewOptions","options","provider","component","componentCompare","apiRef","config","docs","section","OverviewSection","compareSection","OverviewCompareSection","registerRoute","route","registerNavigation","navigationLink","order","registerRoutes","manager","componentModel","host","add","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, SlotRegistry } 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 { UseSandboxPermission } from '@teambit/preview.ui.component-preview';\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 type UsePreviewSandboxSlot = SlotRegistry<UseSandboxPermission>;\n\nexport class DocsUI {\n constructor(\n readonly titleBadgeSlot: TitleBadgeSlot,\n readonly overviewOptionsSlot: OverviewOptionsSlot,\n private usePreviewSandboxSlot: UsePreviewSandboxSlot\n ) {}\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 registerPreviewSandbox(useSandboxPermission: UseSandboxPermission) {\n this.usePreviewSandboxSlot.register(useSandboxPermission);\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>(), Slot.withType<UseSandboxPermission>()];\n\n static async provider(\n [component, componentCompare, apiRef]: [ComponentUI, ComponentCompareUI, APIReferenceUI],\n config,\n [titleBadgeSlot, overviewOptionsSlot, usePreviewSandboxSlot]: [\n TitleBadgeSlot,\n OverviewOptionsSlot,\n UsePreviewSandboxSlot,\n ]\n ) {\n const docs = new DocsUI(titleBadgeSlot, overviewOptionsSlot, usePreviewSandboxSlot);\n const section = new OverviewSection(titleBadgeSlot, overviewOptionsSlot, docs, apiRef, usePreviewSandboxSlot);\n const compareSection = new OverviewCompareSection(docs);\n component.registerRoute(section.route);\n component.registerNavigation(section.navigationLink, section.order);\n componentCompare.registerNavigation(compareSection);\n componentCompare.registerRoutes([compareSection.route]);\n docs.registerPreviewSandbox((manager, componentModel) => {\n if (componentModel?.host === 'teambit.scope/scope') {\n manager.add('allow-scripts');\n manager.add('allow-same-origin');\n }\n });\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,OAAA;EAAAI,GAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,kBAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,iBAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,QAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAAM,OAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,SAAA;EAAA,MAAAT,IAAA,GAAAE,OAAA;EAAAO,QAAA,YAAAA,CAAA;IAAA,OAAAT,IAAA;EAAA;EAAA,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AA,GA4BxGmB,MAAM;AAErBsD,kBAAU,CAACC,UAAU,CAACvD,MAAM,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { ComponentType } from 'react';
|
|
2
2
|
import type { SlotRegistry } from '@teambit/harmony';
|
|
3
3
|
import { ComponentPreviewProps } from '@teambit/preview.ui.component-preview';
|
|
4
|
+
import { UsePreviewSandboxSlot } from '@teambit/compositions';
|
|
4
5
|
export declare enum BadgePosition {
|
|
5
6
|
Title = 0,
|
|
6
7
|
SubTitle = 1,
|
|
@@ -25,5 +26,6 @@ export type OverviewProps = {
|
|
|
25
26
|
TaggedAPI?: React.ComponentType<{
|
|
26
27
|
componentId: string;
|
|
27
28
|
}>;
|
|
29
|
+
usePreviewSandboxSlot?: UsePreviewSandboxSlot;
|
|
28
30
|
};
|
|
29
|
-
export declare function Overview({ titleBadges, overviewOptions, previewProps, getEmptyState, TaggedAPI }: OverviewProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export declare function Overview({ titleBadges, overviewOptions, previewProps, getEmptyState, TaggedAPI, usePreviewSandboxSlot, }: OverviewProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -105,7 +105,8 @@ function Overview({
|
|
|
105
105
|
overviewOptions,
|
|
106
106
|
previewProps,
|
|
107
107
|
getEmptyState,
|
|
108
|
-
TaggedAPI
|
|
108
|
+
TaggedAPI,
|
|
109
|
+
usePreviewSandboxSlot
|
|
109
110
|
}) {
|
|
110
111
|
const component = (0, _react().useContext)(_component().ComponentContext);
|
|
111
112
|
const componentDescriptor = (0, _component().useComponentDescriptor)();
|
|
@@ -124,6 +125,8 @@ function Overview({
|
|
|
124
125
|
isMinimal
|
|
125
126
|
} = (0, _workspaceUi().useWorkspaceMode)();
|
|
126
127
|
const [isLoading, setLoading] = (0, _react().useState)(defaultLoadingState);
|
|
128
|
+
const previewSandboxHooks = usePreviewSandboxSlot?.values() ?? [];
|
|
129
|
+
const [sandboxValue, setSandboxValue] = (0, _react().useState)('');
|
|
127
130
|
const iframeQueryParams = `onlyOverview=${component.preview?.onlyOverview || 'false'}&skipIncludes=${component.preview?.skipIncludes || component.preview?.onlyOverview}`;
|
|
128
131
|
const overviewPropsValues = overviewProps && overviewProps();
|
|
129
132
|
const themeParams = currentTheme?.themeName ? `theme=${currentTheme?.themeName}` : '';
|
|
@@ -146,7 +149,11 @@ function Overview({
|
|
|
146
149
|
return /*#__PURE__*/_react().default.createElement("div", {
|
|
147
150
|
className: (0, _classnames().default)(_overviewModule().default.overviewWrapper, isLoading && _overviewModule().default.noOverflow),
|
|
148
151
|
key: `${component.id.toString()}`
|
|
149
|
-
},
|
|
152
|
+
}, /*#__PURE__*/_react().default.createElement(_previewUi().SandboxPermissionsAggregator, {
|
|
153
|
+
hooks: previewSandboxHooks,
|
|
154
|
+
onSandboxChange: setSandboxValue,
|
|
155
|
+
component: component
|
|
156
|
+
}), showHeader && /*#__PURE__*/_react().default.createElement(_componentUi().ComponentOverview, {
|
|
150
157
|
className: (0, _classnames().default)(_overviewModule().default.componentOverviewBlock, !isScaling && _overviewModule().default.legacyPreview),
|
|
151
158
|
displayName: component.displayName,
|
|
152
159
|
version: component.version,
|
|
@@ -167,7 +174,8 @@ function Overview({
|
|
|
167
174
|
queryParams: [iframeQueryParams, themeParams, overviewPropsValues?.queryParams || ''],
|
|
168
175
|
viewport: null,
|
|
169
176
|
fullContentHeight: true,
|
|
170
|
-
disableScroll: true
|
|
177
|
+
disableScroll: true,
|
|
178
|
+
sandbox: sandboxValue
|
|
171
179
|
}, rest, {
|
|
172
180
|
component: component,
|
|
173
181
|
style: {
|
|
@@ -186,7 +194,8 @@ function Overview({
|
|
|
186
194
|
queryParams: [iframeQueryParams, themeParams, overviewPropsValues?.queryParams || ''],
|
|
187
195
|
viewport: null,
|
|
188
196
|
fullContentHeight: true,
|
|
189
|
-
disableScroll: true
|
|
197
|
+
disableScroll: true,
|
|
198
|
+
sandbox: sandboxValue
|
|
190
199
|
}, rest, {
|
|
191
200
|
component: component,
|
|
192
201
|
style: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","data","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_lodash","_component","_previewUi","_componentUi","_compositionsPanels","_baseReactThemes","_workspaceUi","_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","s","includes","propertyIsEnumerable","BadgePosition","exports","Overview","titleBadges","overviewOptions","previewProps","getEmptyState","TaggedAPI","component","useContext","ComponentContext","componentDescriptor","useComponentDescriptor","theme","useThemePicker","currentTheme","current","overviewProps","flatten","values","showHeader","preview","legacyHeader","EmptyState","buildFailed","buildStatus","toLowerCase","host","isScaling","Boolean","includesEnvTemplate","defaultLoadingState","React","useMemo","isMinimal","useWorkspaceMode","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","Fragment","ComponentPreview","previewName","pubsub","queryParams","viewport","fullContentHeight","disableScroll","width","height","minHeight","undefined","CompositionGallery","componentId"],"sources":["overview.tsx"],"sourcesContent":["/* eslint-disable complexity */\nimport 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 { useWorkspaceMode } from '@teambit/workspace.ui.use-workspace-mode';\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 theme = useThemePicker();\n const currentTheme = theme?.current;\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 const { isMinimal } = useWorkspaceMode();\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 = currentTheme?.themeName ? `theme=${currentTheme?.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 {!isMinimal ? (\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 </>\n ) : (\n <>\n {component.preview?.onlyOverview && !isLoading && <CompositionGallery component={component} />}\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 </>\n )}\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":";;;;;;;AACA,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,OAAA;EAAAO,mBAAA,YAAAA,CAAA;IAAA,OAAAT,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAU,iBAAA;EAAA,MAAAV,IAAA,GAAAE,OAAA;EAAAQ,gBAAA,Y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A,GAAAiI,kBAAkB;IAAClF,SAAS,EAAEA;EAAU,CAAE,CAAC,eAC9FzD,MAAA,GAAAkB,OAAA,CAAAsF,aAAA,CAAChG,UAAA,GAAAwH,gBAAgB,EAAA5F,QAAA;IACf2D,MAAM,EAAEG,aAAc;IACtB+B,WAAW,EAAC,UAAU;IACtBC,MAAM,EAAE,IAAK;IACbC,WAAW,EAAE,CAAC3C,iBAAiB,EAAEI,WAAW,EAAED,mBAAmB,EAAEwC,WAAW,IAAI,EAAE,CAAE;IACtFC,QAAQ,EAAE,IAAK;IACfC,iBAAiB;IACjBC,aAAa,EAAE;EAAK,GAChBrC,IAAI;IACRxC,SAAS,EAAEA,SAAU;IACrBuC,KAAK,EAAE;MAAEuC,KAAK,EAAE,MAAM;MAAEC,MAAM,EAAE,MAAM;MAAEC,SAAS,EAAE,CAAC5D,SAAS,GAAG,GAAG,GAAG6D;IAAU;EAAE,EACnF,CACD,CACH,EACAjF,SAAS,CAACa,OAAO,EAAEmB,YAAY,IAAI,CAACJ,SAAS,IAAI7B,SAAS,iBACzDxD,MAAA,GAAAkB,OAAA,CAAAsF,aAAA,CAAChD,SAAS;IAACoF,WAAW,EAAEnF,SAAS,CAAC6C,EAAE,CAACC,QAAQ,CAAC;EAAE,CAAE,CAEjD,CACN,EACA9B,WAAW,IAAID,UAAU,iBAAIxE,MAAA,GAAAkB,OAAA,CAAAsF,aAAA,CAAChC,UAAU,MAAE,CACxC,CAAC;AAEV","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","data","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_lodash","_component","_previewUi","_componentUi","_compositionsPanels","_baseReactThemes","_workspaceUi","_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","s","includes","propertyIsEnumerable","BadgePosition","exports","Overview","titleBadges","overviewOptions","previewProps","getEmptyState","TaggedAPI","usePreviewSandboxSlot","component","useContext","ComponentContext","componentDescriptor","useComponentDescriptor","theme","useThemePicker","currentTheme","current","overviewProps","flatten","values","showHeader","preview","legacyHeader","EmptyState","buildFailed","buildStatus","toLowerCase","host","isScaling","Boolean","includesEnvTemplate","defaultLoadingState","React","useMemo","isMinimal","useWorkspaceMode","isLoading","setLoading","useState","previewSandboxHooks","sandboxValue","setSandboxValue","iframeQueryParams","onlyOverview","skipIncludes","overviewPropsValues","themeParams","themeName","_ref","onLoad","style","rest","onPreviewLoad","useCallback","props","useEffect","id","toString","createElement","className","classNames","styles","overviewWrapper","noOverflow","key","SandboxPermissionsAggregator","hooks","onSandboxChange","ComponentOverview","componentOverviewBlock","legacyPreview","displayName","version","abstract","description","labels","packageName","readme","ReadmeSkeleton","CompositionGallerySkeleton","compositionsLength","Math","min","compositions","Fragment","ComponentPreview","previewName","pubsub","queryParams","viewport","fullContentHeight","disableScroll","sandbox","width","height","minHeight","undefined","CompositionGallery","componentId"],"sources":["overview.tsx"],"sourcesContent":["/* eslint-disable complexity */\nimport 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 {\n ComponentPreview,\n ComponentPreviewProps,\n SandboxPermissionsAggregator,\n} 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 { useWorkspaceMode } from '@teambit/workspace.ui.use-workspace-mode';\nimport { UsePreviewSandboxSlot } from '@teambit/compositions';\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 usePreviewSandboxSlot?: UsePreviewSandboxSlot;\n};\n\nexport function Overview({\n titleBadges,\n overviewOptions,\n previewProps,\n getEmptyState,\n TaggedAPI,\n usePreviewSandboxSlot,\n}: OverviewProps) {\n const component = useContext(ComponentContext);\n const componentDescriptor = useComponentDescriptor();\n const theme = useThemePicker();\n const currentTheme = theme?.current;\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 const { isMinimal } = useWorkspaceMode();\n const [isLoading, setLoading] = useState(defaultLoadingState);\n const previewSandboxHooks = usePreviewSandboxSlot?.values() ?? [];\n const [sandboxValue, setSandboxValue] = useState('');\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 = currentTheme?.themeName ? `theme=${currentTheme?.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 <SandboxPermissionsAggregator\n hooks={previewSandboxHooks}\n onSandboxChange={setSandboxValue}\n component={component}\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 {!isMinimal ? (\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 sandbox={sandboxValue}\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 </>\n ) : (\n <>\n {component.preview?.onlyOverview && !isLoading && <CompositionGallery component={component} />}\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 sandbox={sandboxValue}\n {...rest}\n component={component}\n style={{ width: '100%', height: '100%', minHeight: !isScaling ? 500 : undefined }}\n />\n </>\n )}\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":";;;;;;;AACA,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;AAMA,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,OAAA;EAAAO,mBAAA,YAAAA,CAAA;IAAA,OAAAT,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAU,iBAAA;EAAA,MAAAV,IAAA,GAAAE,OAAA;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,MAAA,GAAAkB,OAAA,CAAA0F,aAAA,CAACnC,UAAU,MAAE,CACxC,CAAC;AAEV","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Section } from '@teambit/component';
|
|
2
2
|
import { APIReferenceUI } from '@teambit/api-reference';
|
|
3
3
|
import { TitleBadgeSlot, OverviewOptionsSlot } from './overview';
|
|
4
|
-
import { DocsUI } from './docs.ui.runtime';
|
|
4
|
+
import { DocsUI, UsePreviewSandboxSlot } from './docs.ui.runtime';
|
|
5
5
|
export declare class OverviewSection implements Section {
|
|
6
6
|
/**
|
|
7
7
|
* title badge slot.
|
|
@@ -10,11 +10,12 @@ export declare class OverviewSection implements Section {
|
|
|
10
10
|
private overviewOptionsSlot;
|
|
11
11
|
private docs;
|
|
12
12
|
private apiRef;
|
|
13
|
+
private usePreviewSandboxSlot;
|
|
13
14
|
constructor(
|
|
14
15
|
/**
|
|
15
16
|
* title badge slot.
|
|
16
17
|
*/
|
|
17
|
-
titleBadgeSlot: TitleBadgeSlot, overviewOptionsSlot: OverviewOptionsSlot, docs: DocsUI, apiRef: APIReferenceUI);
|
|
18
|
+
titleBadgeSlot: TitleBadgeSlot, overviewOptionsSlot: OverviewOptionsSlot, docs: DocsUI, apiRef: APIReferenceUI, usePreviewSandboxSlot: UsePreviewSandboxSlot);
|
|
18
19
|
navigationLink: {
|
|
19
20
|
href: string;
|
|
20
21
|
exact: boolean;
|
package/dist/overview.section.js
CHANGED
|
@@ -27,11 +27,12 @@ class OverviewSection {
|
|
|
27
27
|
/**
|
|
28
28
|
* title badge slot.
|
|
29
29
|
*/
|
|
30
|
-
titleBadgeSlot, overviewOptionsSlot, docs, apiRef) {
|
|
30
|
+
titleBadgeSlot, overviewOptionsSlot, docs, apiRef, usePreviewSandboxSlot) {
|
|
31
31
|
this.titleBadgeSlot = titleBadgeSlot;
|
|
32
32
|
this.overviewOptionsSlot = overviewOptionsSlot;
|
|
33
33
|
this.docs = docs;
|
|
34
34
|
this.apiRef = apiRef;
|
|
35
|
+
this.usePreviewSandboxSlot = usePreviewSandboxSlot;
|
|
35
36
|
_defineProperty(this, "navigationLink", {
|
|
36
37
|
href: '.',
|
|
37
38
|
exact: true,
|
|
@@ -43,7 +44,8 @@ class OverviewSection {
|
|
|
43
44
|
titleBadges: this.titleBadgeSlot,
|
|
44
45
|
overviewOptions: this.overviewOptionsSlot,
|
|
45
46
|
getEmptyState: this.docs.getEmptyState.bind(this.docs),
|
|
46
|
-
TaggedAPI: this.apiRef.TaggedAPIPage
|
|
47
|
+
TaggedAPI: this.apiRef.TaggedAPIPage,
|
|
48
|
+
usePreviewSandboxSlot: this.usePreviewSandboxSlot
|
|
47
49
|
})
|
|
48
50
|
});
|
|
49
51
|
_defineProperty(this, "order", 10);
|
|
@@ -1 +1 @@
|
|
|
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.get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J;AACA;EACYC,cAA8B,EAC9BC,mBAAwC,EACxCC,IAAY,EACZC,MAAsB,
|
|
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","usePreviewSandboxSlot","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, UsePreviewSandboxSlot } 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 private usePreviewSandboxSlot: UsePreviewSandboxSlot\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 usePreviewSandboxSlot={this.usePreviewSandboxSlot}\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,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AAE,IAAI;MACXC,QAAQ,EAAE;IACZ,CAAC;IAAA3B,eAAA,gBAEO;MACN4B,KAAK,EAAE,IAAI;MACXC,OAAO,eACLrC,MAAA,GAAAO,OAAA,CAAA+B,aAAA,CAAClC,SAAA,GAAAmC,QAAQ;QACPC,WAAW,EAAE,IAAI,CAACZ,cAAe;QACjCa,eAAe,EAAE,IAAI,CAACZ,mBAAoB;QAC1Ca,aAAa,EAAE,IAAI,CAACZ,IAAI,CAACY,aAAa,CAACC,IAAI,CAAC,IAAI,CAACb,IAAI,CAAE;QACvDc,SAAS,EAAE,IAAI,CAACb,MAAM,CAACc,aAAc;QACrCb,qBAAqB,EAAE,IAAI,CAACA;MAAsB,CACnD;IAEL,CAAC;IAAAxB,eAAA,gBAEO,EAAE;EArBP;AAsBL;AAACsC,OAAA,CAAApB,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/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.518/dist/docs.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.docs_docs@1.0.518/dist/docs.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
package/docs.ui.runtime.tsx
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import React, { ComponentType } from 'react';
|
|
2
2
|
import { flatten } from 'lodash';
|
|
3
3
|
import { ComponentAspect, ComponentUI } from '@teambit/component';
|
|
4
|
-
import { Slot } from '@teambit/harmony';
|
|
4
|
+
import { Slot, SlotRegistry } from '@teambit/harmony';
|
|
5
5
|
import { UIRuntime } from '@teambit/ui';
|
|
6
6
|
import { ComponentCompareAspect, ComponentCompareUI } from '@teambit/component-compare';
|
|
7
7
|
import { OverviewCompare } from '@teambit/docs.ui.overview-compare';
|
|
8
8
|
import { OverviewCompareSection } from '@teambit/docs.ui.overview-compare-section';
|
|
9
|
+
import { UseSandboxPermission } from '@teambit/preview.ui.component-preview';
|
|
9
10
|
import { APIReferenceAspect, APIReferenceUI } from '@teambit/api-reference';
|
|
10
11
|
import { DocsAspect } from './docs.aspect';
|
|
11
12
|
import { OverviewSection } from './overview.section';
|
|
12
13
|
import type { TitleBadgeSlot, TitleBadge, OverviewOptionsSlot, OverviewOptions } from './overview';
|
|
13
14
|
|
|
15
|
+
export type UsePreviewSandboxSlot = SlotRegistry<UseSandboxPermission>;
|
|
16
|
+
|
|
14
17
|
export class DocsUI {
|
|
15
18
|
constructor(
|
|
16
19
|
readonly titleBadgeSlot: TitleBadgeSlot,
|
|
17
|
-
readonly overviewOptionsSlot: OverviewOptionsSlot
|
|
20
|
+
readonly overviewOptionsSlot: OverviewOptionsSlot,
|
|
21
|
+
private usePreviewSandboxSlot: UsePreviewSandboxSlot
|
|
18
22
|
) {}
|
|
19
23
|
|
|
20
24
|
/**
|
|
@@ -39,6 +43,10 @@ export class DocsUI {
|
|
|
39
43
|
return (this._emptyState = emptyState);
|
|
40
44
|
}
|
|
41
45
|
|
|
46
|
+
registerPreviewSandbox(useSandboxPermission: UseSandboxPermission) {
|
|
47
|
+
this.usePreviewSandboxSlot.register(useSandboxPermission);
|
|
48
|
+
}
|
|
49
|
+
|
|
42
50
|
getEmptyState() {
|
|
43
51
|
return this._emptyState;
|
|
44
52
|
}
|
|
@@ -55,21 +63,30 @@ export class DocsUI {
|
|
|
55
63
|
|
|
56
64
|
static runtime = UIRuntime;
|
|
57
65
|
|
|
58
|
-
static slots = [Slot.withType<TitleBadge>(), Slot.withType<OverviewOptions>()];
|
|
66
|
+
static slots = [Slot.withType<TitleBadge>(), Slot.withType<OverviewOptions>(), Slot.withType<UseSandboxPermission>()];
|
|
59
67
|
|
|
60
68
|
static async provider(
|
|
61
69
|
[component, componentCompare, apiRef]: [ComponentUI, ComponentCompareUI, APIReferenceUI],
|
|
62
70
|
config,
|
|
63
|
-
[titleBadgeSlot, overviewOptionsSlot]: [
|
|
71
|
+
[titleBadgeSlot, overviewOptionsSlot, usePreviewSandboxSlot]: [
|
|
72
|
+
TitleBadgeSlot,
|
|
73
|
+
OverviewOptionsSlot,
|
|
74
|
+
UsePreviewSandboxSlot,
|
|
75
|
+
]
|
|
64
76
|
) {
|
|
65
|
-
const docs = new DocsUI(titleBadgeSlot, overviewOptionsSlot);
|
|
66
|
-
const section = new OverviewSection(titleBadgeSlot, overviewOptionsSlot, docs, apiRef);
|
|
77
|
+
const docs = new DocsUI(titleBadgeSlot, overviewOptionsSlot, usePreviewSandboxSlot);
|
|
78
|
+
const section = new OverviewSection(titleBadgeSlot, overviewOptionsSlot, docs, apiRef, usePreviewSandboxSlot);
|
|
67
79
|
const compareSection = new OverviewCompareSection(docs);
|
|
68
|
-
|
|
69
80
|
component.registerRoute(section.route);
|
|
70
81
|
component.registerNavigation(section.navigationLink, section.order);
|
|
71
82
|
componentCompare.registerNavigation(compareSection);
|
|
72
83
|
componentCompare.registerRoutes([compareSection.route]);
|
|
84
|
+
docs.registerPreviewSandbox((manager, componentModel) => {
|
|
85
|
+
if (componentModel?.host === 'teambit.scope/scope') {
|
|
86
|
+
manager.add('allow-scripts');
|
|
87
|
+
manager.add('allow-same-origin');
|
|
88
|
+
}
|
|
89
|
+
});
|
|
73
90
|
return docs;
|
|
74
91
|
}
|
|
75
92
|
}
|
package/overview/overview.tsx
CHANGED
|
@@ -6,12 +6,17 @@ import { flatten } from 'lodash';
|
|
|
6
6
|
// import { LinkedHeading } from '@teambit/documenter.ui.linked-heading';
|
|
7
7
|
import { ComponentContext, useComponentDescriptor } from '@teambit/component';
|
|
8
8
|
import type { SlotRegistry } from '@teambit/harmony';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
ComponentPreview,
|
|
11
|
+
ComponentPreviewProps,
|
|
12
|
+
SandboxPermissionsAggregator,
|
|
13
|
+
} from '@teambit/preview.ui.component-preview';
|
|
10
14
|
// import { StatusMessageCard } from '@teambit/design.ui.surfaces.status-message-card';
|
|
11
15
|
import { ComponentOverview } from '@teambit/component.ui.component-meta';
|
|
12
16
|
import { CompositionGallery, CompositionGallerySkeleton } from '@teambit/compositions.panels.composition-gallery';
|
|
13
17
|
import { useThemePicker } from '@teambit/base-react.themes.theme-switcher';
|
|
14
18
|
import { useWorkspaceMode } from '@teambit/workspace.ui.use-workspace-mode';
|
|
19
|
+
import { UsePreviewSandboxSlot } from '@teambit/compositions';
|
|
15
20
|
import { ReadmeSkeleton } from './readme-skeleton';
|
|
16
21
|
import styles from './overview.module.scss';
|
|
17
22
|
|
|
@@ -40,9 +45,17 @@ export type OverviewProps = {
|
|
|
40
45
|
previewProps?: Partial<ComponentPreviewProps>;
|
|
41
46
|
getEmptyState?: () => ComponentType | undefined;
|
|
42
47
|
TaggedAPI?: React.ComponentType<{ componentId: string }>;
|
|
48
|
+
usePreviewSandboxSlot?: UsePreviewSandboxSlot;
|
|
43
49
|
};
|
|
44
50
|
|
|
45
|
-
export function Overview({
|
|
51
|
+
export function Overview({
|
|
52
|
+
titleBadges,
|
|
53
|
+
overviewOptions,
|
|
54
|
+
previewProps,
|
|
55
|
+
getEmptyState,
|
|
56
|
+
TaggedAPI,
|
|
57
|
+
usePreviewSandboxSlot,
|
|
58
|
+
}: OverviewProps) {
|
|
46
59
|
const component = useContext(ComponentContext);
|
|
47
60
|
const componentDescriptor = useComponentDescriptor();
|
|
48
61
|
const theme = useThemePicker();
|
|
@@ -58,7 +71,8 @@ export function Overview({ titleBadges, overviewOptions, previewProps, getEmptyS
|
|
|
58
71
|
}, [isScaling, includesEnvTemplate]);
|
|
59
72
|
const { isMinimal } = useWorkspaceMode();
|
|
60
73
|
const [isLoading, setLoading] = useState(defaultLoadingState);
|
|
61
|
-
|
|
74
|
+
const previewSandboxHooks = usePreviewSandboxSlot?.values() ?? [];
|
|
75
|
+
const [sandboxValue, setSandboxValue] = useState('');
|
|
62
76
|
const iframeQueryParams = `onlyOverview=${component.preview?.onlyOverview || 'false'}&skipIncludes=${
|
|
63
77
|
component.preview?.skipIncludes || component.preview?.onlyOverview
|
|
64
78
|
}`;
|
|
@@ -88,6 +102,11 @@ export function Overview({ titleBadges, overviewOptions, previewProps, getEmptyS
|
|
|
88
102
|
className={classNames(styles.overviewWrapper, isLoading && styles.noOverflow)}
|
|
89
103
|
key={`${component.id.toString()}`}
|
|
90
104
|
>
|
|
105
|
+
<SandboxPermissionsAggregator
|
|
106
|
+
hooks={previewSandboxHooks}
|
|
107
|
+
onSandboxChange={setSandboxValue}
|
|
108
|
+
component={component}
|
|
109
|
+
/>
|
|
91
110
|
{showHeader && (
|
|
92
111
|
<ComponentOverview
|
|
93
112
|
className={classNames(styles.componentOverviewBlock, !isScaling && styles.legacyPreview)}
|
|
@@ -118,6 +137,7 @@ export function Overview({ titleBadges, overviewOptions, previewProps, getEmptyS
|
|
|
118
137
|
viewport={null}
|
|
119
138
|
fullContentHeight
|
|
120
139
|
disableScroll={true}
|
|
140
|
+
sandbox={sandboxValue}
|
|
121
141
|
{...rest}
|
|
122
142
|
component={component}
|
|
123
143
|
style={{ width: '100%', height: '100%', minHeight: !isScaling ? 500 : undefined }}
|
|
@@ -135,6 +155,7 @@ export function Overview({ titleBadges, overviewOptions, previewProps, getEmptyS
|
|
|
135
155
|
viewport={null}
|
|
136
156
|
fullContentHeight
|
|
137
157
|
disableScroll={true}
|
|
158
|
+
sandbox={sandboxValue}
|
|
138
159
|
{...rest}
|
|
139
160
|
component={component}
|
|
140
161
|
style={{ width: '100%', height: '100%', minHeight: !isScaling ? 500 : undefined }}
|
package/overview.section.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { Section } from '@teambit/component';
|
|
3
3
|
import { APIReferenceUI } from '@teambit/api-reference';
|
|
4
4
|
import { Overview, TitleBadgeSlot, OverviewOptionsSlot } from './overview';
|
|
5
|
-
import { DocsUI } from './docs.ui.runtime';
|
|
5
|
+
import { DocsUI, UsePreviewSandboxSlot } from './docs.ui.runtime';
|
|
6
6
|
|
|
7
7
|
export class OverviewSection implements Section {
|
|
8
8
|
constructor(
|
|
@@ -12,7 +12,8 @@ export class OverviewSection implements Section {
|
|
|
12
12
|
private titleBadgeSlot: TitleBadgeSlot,
|
|
13
13
|
private overviewOptionsSlot: OverviewOptionsSlot,
|
|
14
14
|
private docs: DocsUI,
|
|
15
|
-
private apiRef: APIReferenceUI
|
|
15
|
+
private apiRef: APIReferenceUI,
|
|
16
|
+
private usePreviewSandboxSlot: UsePreviewSandboxSlot
|
|
16
17
|
) {}
|
|
17
18
|
|
|
18
19
|
navigationLink = {
|
|
@@ -29,6 +30,7 @@ export class OverviewSection implements Section {
|
|
|
29
30
|
overviewOptions={this.overviewOptionsSlot}
|
|
30
31
|
getEmptyState={this.docs.getEmptyState.bind(this.docs)}
|
|
31
32
|
TaggedAPI={this.apiRef.TaggedAPIPage}
|
|
33
|
+
usePreviewSandboxSlot={this.usePreviewSandboxSlot}
|
|
32
34
|
/>
|
|
33
35
|
),
|
|
34
36
|
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/docs",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.518",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/docs/docs",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.docs",
|
|
8
8
|
"name": "docs",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.518"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"graphql-tag": "2.12.1",
|
|
@@ -19,26 +19,27 @@
|
|
|
19
19
|
"@teambit/base-react.themes.theme-switcher": "1.1.2",
|
|
20
20
|
"@teambit/component.ui.component-meta": "0.0.364",
|
|
21
21
|
"@teambit/base-ui.loaders.skeleton": "1.0.1",
|
|
22
|
-
"@teambit/compiler": "1.0.
|
|
23
|
-
"@teambit/component": "1.0.
|
|
24
|
-
"@teambit/pkg": "1.0.
|
|
25
|
-
"@teambit/workspace": "1.0.
|
|
26
|
-
"@teambit/cli": "0.0.
|
|
22
|
+
"@teambit/compiler": "1.0.518",
|
|
23
|
+
"@teambit/component": "1.0.518",
|
|
24
|
+
"@teambit/pkg": "1.0.518",
|
|
25
|
+
"@teambit/workspace": "1.0.518",
|
|
26
|
+
"@teambit/cli": "0.0.1095",
|
|
27
27
|
"@teambit/component.sources": "0.0.73",
|
|
28
|
-
"@teambit/dev-files": "1.0.
|
|
29
|
-
"@teambit/envs": "1.0.
|
|
30
|
-
"@teambit/graphql": "1.0.
|
|
28
|
+
"@teambit/dev-files": "1.0.518",
|
|
29
|
+
"@teambit/envs": "1.0.518",
|
|
30
|
+
"@teambit/graphql": "1.0.518",
|
|
31
31
|
"@teambit/legacy.consumer-component": "0.0.22",
|
|
32
|
-
"@teambit/logger": "0.0.
|
|
33
|
-
"@teambit/preview": "1.0.
|
|
34
|
-
"@teambit/scope": "1.0.
|
|
35
|
-
"@teambit/api-reference": "1.0.
|
|
36
|
-
"@teambit/component-compare": "1.0.
|
|
37
|
-
"@teambit/ui": "1.0.
|
|
38
|
-
"@teambit/
|
|
32
|
+
"@teambit/logger": "0.0.1188",
|
|
33
|
+
"@teambit/preview": "1.0.518",
|
|
34
|
+
"@teambit/scope": "1.0.518",
|
|
35
|
+
"@teambit/api-reference": "1.0.518",
|
|
36
|
+
"@teambit/component-compare": "1.0.518",
|
|
37
|
+
"@teambit/preview.ui.component-preview": "1.0.20",
|
|
38
|
+
"@teambit/ui": "1.0.518",
|
|
39
39
|
"@teambit/compositions.panels.composition-gallery": "0.0.217",
|
|
40
|
-
"@teambit/
|
|
41
|
-
"@teambit/workspace.ui.use-workspace-mode": "0.0.2"
|
|
40
|
+
"@teambit/compositions": "1.0.518",
|
|
41
|
+
"@teambit/workspace.ui.use-workspace-mode": "0.0.2",
|
|
42
|
+
"@teambit/pubsub": "1.0.518"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
45
|
"@types/lodash": "4.14.165",
|
|
@@ -46,7 +47,7 @@
|
|
|
46
47
|
"@types/mocha": "9.1.0",
|
|
47
48
|
"@teambit/docs.content.docs-overview": "1.95.9",
|
|
48
49
|
"@teambit/component-id": "1.2.2",
|
|
49
|
-
"@teambit/harmony.envs.core-aspect-env": "0.0.
|
|
50
|
+
"@teambit/harmony.envs.core-aspect-env": "0.0.69"
|
|
50
51
|
},
|
|
51
52
|
"peerDependencies": {
|
|
52
53
|
"react": "^17.0.0 || ^18.0.0",
|