UNPKG

jqwidgets-ng

Version:

[![Price](https://img.shields.io/badge/price-COMMERCIAL-0098f7.svg)](https://jqwidgets.com/license/)

61 lines 2.74 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const schematics_1 = require("@angular-devkit/schematics"); const schematics_2 = require("jqwidgets-ng/schematics/cdk/schematics"); const config_1 = require("@schematics/angular/utility/workspace"); const material_fonts_1 = require("../../fonts/material-fonts"); const theming_1 = require("../../theming/theming"); /** Name of the Angular module that enables Angular browser animations. */ const browserAnimationsModuleName = 'BrowserAnimationsModule'; /** Name of the module that switches Angular animations to a noop implementation. */ const noopAnimationsModuleName = 'NoopAnimationsModule'; /** * Scaffolds the basics of a Angular Material application, this includes: * - Add Packages to package.json * - Adds pre-built themes to styles.ext * - Adds Browser Animation to app.module */ function default_1(options) { return schematics_1.chain([ theming_1.addThemeToAppStyles(options), material_fonts_1.addFontsToIndex(options), addMaterialAppStyles(options), theming_1.addTypographyClass(options), ]); } exports.default = default_1; /** * Adds custom Material styles to the project style file. The custom CSS sets up the Roboto font * and reset the default browser body margin. */ function addMaterialAppStyles(options) { return (host, context) => { const workspace = config_1.getWorkspace(host); const project = schematics_2.getProjectFromWorkspace(workspace, options.project); const styleFilePath = schematics_2.getProjectStyleFile(project); const logger = context.logger; if (!styleFilePath) { logger.error(`Could not find the default style file for this project.`); logger.info(`Please consider manually setting up the Roboto font in your CSS.`); return; } const buffer = host.read(styleFilePath); if (!buffer) { logger.error(`Could not read the default style file within the project ` + `(${styleFilePath})`); logger.info(`Please consider manually setting up the Robot font.`); return; } const htmlContent = buffer.toString(); const insertion = '\n' + `html, body { height: 100%; }\n` + `body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }\n`; if (htmlContent.includes(insertion)) { return; } const recorder = host.beginUpdate(styleFilePath); recorder.insertLeft(htmlContent.length, insertion); host.commitUpdate(recorder); }; } //# sourceMappingURL=setup-project.js.map