mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-01 06:26:33 +00:00

* chartjs test * [WIP] Modified for Chart.js * Tweaking styles ( tooltips and lines ) * Almost done TODO: Change tooltips to HTML tag Improve color function * More work on Tooltips * Improve update logic Fix linting * resolve conflict * [WIP] Create new tooltip mode hack. Add axis padding to top and botton to prevent axis cutoff * TODO: cleanup * FIXME: tooltip in history graph not working correctly reorganize some code * fix build problem * Fix color and tooltip issue Fix label max width for timeline chart * update dep * Fix strange color after build due to `uglify` bug with reference the minified version. Make line chart behavior more similar to Google Charts. Make the chart honor to `unknown` and other state by manually calculate point value. * fix bugs * Remove label for only one data in timeline chart. Fix bug for infinite loop in some cases * Add HTML legend to chart. * Fix isSingleDevice bug due to calculation. Add isSingleDevice property support. * fix for lint * Replace innerHTML code with polymer node. * Replace tooltip with HTML code * fix tooltip style * move default tooltip mode to plugin * LINTING * fix Move localize history data to Timeline Chart. Fix timeline static color. Rework on chart resize. * Bug fix: Chart may disappear on some case. Timeline chart calculation issue. Change timeline chart hidden logic. * fix tooltip rework for resize event * lint * element * Replace `var` to `let`. Move import and ChartJs injection code to `ha-chart-scripts.html`. * lint: convert more let to const * fix font fix undef * update bower.json * move * Load chart code on demand
66 lines
2.0 KiB
JavaScript
66 lines
2.0 KiB
JavaScript
const gulp = require('gulp');
|
|
const filter = require('gulp-filter');
|
|
const { PolymerProject, } = require('polymer-build');
|
|
const {
|
|
composeStrategies,
|
|
generateShellMergeStrategy,
|
|
} = require('polymer-bundler');
|
|
const mergeStream = require('merge-stream');
|
|
const rename = require('gulp-rename');
|
|
|
|
const polymerConfig = require('../../polymer');
|
|
|
|
const minifyStream = require('../common/transform').minifyStream;
|
|
const {
|
|
stripImportsStrategy,
|
|
stripAllButEntrypointStrategy
|
|
} = require('../common/strategy');
|
|
|
|
function renamePanel(path) {
|
|
// Rename panels to be panels/* and not their subdir
|
|
if (path.basename.substr(0, 9) === 'ha-panel-' && path.extname === '.html') {
|
|
path.dirname = 'panels/';
|
|
}
|
|
|
|
// Rename frontend
|
|
if (path.dirname === 'src' && path.basename === 'home-assistant' &&
|
|
path.extname === '.html') {
|
|
path.dirname = '';
|
|
path.basename = 'frontend';
|
|
}
|
|
}
|
|
|
|
function build(es6) {
|
|
const strategy = composeStrategies([
|
|
generateShellMergeStrategy(polymerConfig.shell),
|
|
stripImportsStrategy([
|
|
'bower_components/font-roboto/roboto.html',
|
|
'bower_components/paper-styles/color.html',
|
|
'src/resources/ha-chart-scripts.html',
|
|
]),
|
|
stripAllButEntrypointStrategy('panels/hassio/ha-panel-hassio.html')
|
|
]);
|
|
const project = new PolymerProject(polymerConfig);
|
|
|
|
return mergeStream(
|
|
minifyStream(project.sources(), es6),
|
|
minifyStream(project.dependencies(), es6)
|
|
)
|
|
.pipe(project.bundler({
|
|
strategy,
|
|
strip: true,
|
|
sourcemaps: false,
|
|
stripComments: true,
|
|
inlineScripts: true,
|
|
inlineCss: true,
|
|
implicitStrip: true,
|
|
}))
|
|
.pipe(rename(renamePanel))
|
|
.pipe(filter(['**', '!src/entrypoint.html']))
|
|
.pipe(gulp.dest(es6 ? 'build' : 'build-es5'));
|
|
}
|
|
gulp.task('build_es5', ['ru_all', 'ru_all_es5', 'build-translations'], () => build(/* es6= */ false));
|
|
gulp.task('build_es6', ['ru_all', 'build-translations'], () => build(/* es6= */ true));
|
|
|
|
gulp.task('build', ['build_es5', 'build_es6']);
|