Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Enable export to codepen for react charting",
"packageName": "@fluentui/react-docsite-components",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Add react charting to support export to codepen",
"packageName": "@fluentui/react-monaco-editor",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ const CodepenComponentBase: React.FunctionComponent<ICodepenProps> = props => {
jsContentStr.indexOf('window.FluentUIExampleData') !== -1
? script('@fluentui/example-data@8/dist/example-data.js')
: '',
// load charting bundle only if used
jsContentStr.indexOf('window.FluentUIReactCharting') !== -1
? script('@fluentui/react-charting@5/dist/react-charting.js')
: '',
`<div id="${CONTENT_ID}"></div>`,
]
.filter(line => !!line)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ const exampleDataGroup: IPackageGroup = {
loadGlobal: cb => require.ensure([], require => cb(require('@fluentui/example-data'))),
packages: [],
};
const chartingGroup: IPackageGroup = {
globalName: 'FluentUIReactCharting',
loadGlobal: cb => require.ensure([], require => cb(require('@fluentui/react-charting'))),
packages: [],
};

let typesContext: __WebpackModuleApi.RequireContext | undefined;
try {
Expand All @@ -32,6 +37,7 @@ try {
} catch (ex) {
// We're probably running in jest, which doesn't have webpack's require.context
}
const loadTypes = () => '';
if (typesContext) {
typesContext.keys().forEach(dtsPath => {
// The api-extractor .d.ts rollups use the package's unscoped name (such as "utilities")
Expand All @@ -57,7 +63,6 @@ if (typesContext) {
});
} else {
// Use some defaults for jest tests (real types won't be loaded)
const loadTypes = () => '';
fabricGroup.packages.push(
{ packageName: '@fluentui/date-time-utilities', loadTypes },
{ packageName: '@fluentui/dom-utilities', loadTypes },
Expand All @@ -74,9 +79,12 @@ if (typesContext) {
hooksGroup.packages.push({ packageName: '@fluentui/react-hooks', loadTypes });
exampleDataGroup.packages.push({ packageName: '@fluentui/example-data', loadTypes });
}
if (typeof window === 'object' && window.location.href.indexOf('react-charting') !== -1) {
chartingGroup.packages.push({ packageName: '@fluentui/react-charting', loadTypes });
}

/**
* Default supported packages for imports: `@fluentui/react` and everything it exports,
* plus `@fluentui/example-data`. (React is implicitly supported.)
*/
export const SUPPORTED_PACKAGES: IPackageGroup[] = [fabricGroup, hooksGroup, exampleDataGroup];
export const SUPPORTED_PACKAGES: IPackageGroup[] = [fabricGroup, hooksGroup, exampleDataGroup, chartingGroup];