@ng-doc/builder
Version:
<!-- PROJECT LOGO --> <br /> <div align="center"> <a href="https://github.com/ng-doc/ng-doc"> <img src="https://ng-doc.com/assets/images/ng-doc.svg?raw=true" alt="Logo" height="150px"> </a>
31 lines • 1.28 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.playgroundAction = playgroundAction;
const core_1 = require("@ng-doc/core");
const index_1 = require("../../../index");
/**
* Renders playground point on the page, it will be rendered by the application
* @param pId - Playground id in the config
* @param options - Options for configuring the action
*/
function playgroundAction(pId, options) {
return (page) => {
const playgroundMetadata = (0, index_1.getPlaygroundMetadata)(page.parent.entry, page.objectExpression());
const metadata = playgroundMetadata[pId];
if (metadata) {
return {
output: `<ng-doc-playground id="${pId}" indexable="false">
<div id="selectors">${metadata.selector ?? ''}</div>
<div id="pipeName">${metadata.name ?? ''}</div>
<div id="data">${(0, core_1.escapeHtml)(JSON.stringify(metadata.properties))}</div>
<div id="options">${(0, core_1.escapeHtml)(JSON.stringify(options ?? {}))}</div>
</ng-doc-playground>`,
dependencies: [metadata.class.getSourceFile().getFilePath()],
};
}
else {
return { output: '' };
}
};
}
//# sourceMappingURL=playground.action.js.map
;