@workday/canvas-kit-docs
Version:
Documentation components of Canvas Kit components
32 lines (31 loc) • 1.94 kB
JavaScript
// prettier-ignore
const externalSymbols = {
lib: {
Promise: 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise',
Function: 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function',
Array: 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array',
Object: 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object',
Element: 'https://developer.mozilla.org/en-US/docs/Web/API/element',
Event: 'https://developer.mozilla.org/en-US/docs/Web/API/event',
Record: 'https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type',
CSSObject: 'https://emotion.sh/docs/object-styles',
CSSProperties: 'https://emotion.sh/docs/object-styles'
},
react: {
Element: 'https://reactjs.org/docs/rendering-elements.html',
ReactElement: 'https://reactjs.org/docs/rendering-elements.html',
'React.ReactElement': 'https://reactjs.org/docs/rendering-elements.html',
ReactNode: 'https://reactjs.org/docs/rendering-elements.html',
'React.ReactNode': 'https://reactjs.org/docs/rendering-elements.html',
SyntheticEvent: 'https://reactjs.org/docs/events.html',
'React.SyntheticEvent': 'https://reactjs.org/docs/events.html',
'React.CSSProperties': 'https://developer.mozilla.org/en-US/docs/Web/CSS',
'Ref': 'https://reactjs.org/docs/refs-and-the-dom.html',
'React.Ref': 'https://reactjs.org/docs/refs-and-the-dom.html',
PopperOptions: 'https://popper.js.org/docs/v2/constructors/#options'
}
};
export function getExternalSymbol(key, declarationFile) {
const lib = (declarationFile === null || declarationFile === void 0 ? void 0 : declarationFile.includes('react')) ? 'react' : 'lib';
return externalSymbols[lib][key] || undefined;
}