Skip to content

Commit

Permalink
preparing for 0.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Dragos Cirjan committed Mar 25, 2019
1 parent 39feffb commit 8567ca8
Show file tree
Hide file tree
Showing 37 changed files with 13,754 additions and 4,326 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.0.5] - 2014-03-25
### Added
- Less Compiler.
- Updated required packages.

## [0.0.2] - 2019-02-11
### Added
- 1st public release.

[Unreleased]: https://github.com/dragoscirjan/aurelia-content-loader/compare/v0.0.5...HEAD
[0.0.5]: https://github.com/dragoscirjan/aurelia-content-loader/compare/v-0.0.4...v0.0.5
[0.0.4]: https://github.com/dragoscirjan/aurelia-content-loader/releases/tag/v-0.0.4
1 change: 1 addition & 0 deletions build/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = {
source: appRoot + '**/*.js',
html: appRoot + '**/*.html',
css: appRoot + '**/*.css',
less: appRoot + '**/*.less',
style: 'styles/**/*.css',
output: outputRoot,
doc: 'doc/',
Expand Down
23 changes: 20 additions & 3 deletions build/tasks/build.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
const assign = Object.assign || require('object.assign');
const { clean } = require('./clean');
const compilerOptions = require('../babel-options');
const to5 = require('gulp-babel');
const path = require('path');
const paths = require('../paths');
const less = require('gulp-less');
const to5 = require('gulp-babel');
const { dest, series, src } = require('gulp');
// const uglifycss = require('gulp-uglifycss'); // not sure whether to apply it, yet

const buildHtml = function() {
return src(paths.html)
Expand All @@ -15,11 +18,25 @@ const buildHtml = function() {

const buildCss = function() {
return src(paths.css)
// .pipe(uglifycss())
.pipe(dest(paths.output + 'es2015/'))
.pipe(dest(paths.output + 'commonjs/'))
.pipe(dest(paths.output + 'amd/'))
.pipe(dest(paths.output + 'system/'));
};
};

const buildLess = function() {
return src(paths.less)
.pipe(less({
paths: [ path.join(__dirname, 'less', 'includes') ]
}))
// .pipe(uglifycss())
.pipe(dest(paths.output + 'es2015/'))
.pipe(dest(paths.output + 'commonjs/'))
.pipe(dest(paths.output + 'amd/'))
.pipe(dest(paths.output + 'system/'));

}

const buildEs2015 = function() {
return src(paths.source)
Expand All @@ -46,4 +63,4 @@ const buildSystem = function() {
};

exports.build = buildEs2015;
exports.build = series(clean, buildHtml, buildCss, buildEs2015, buildCommonjs, buildAmd, buildSystem);
exports.build = series(clean, buildHtml, buildCss, buildLess, buildEs2015, buildCommonjs, buildAmd, buildSystem);
263 changes: 88 additions & 175 deletions dist/amd/code-loader.js
Original file line number Diff line number Diff line change
@@ -1,184 +1,97 @@
define(['exports', 'aurelia-templating', './content-loader', './template'], function(
_exports,
_aureliaTemplating,
_contentLoader,
_template
) {
'use strict';

Object.defineProperty(_exports, '__esModule', {
define(["exports", "aurelia-templating", "./content-loader", "./template"], function (_exports, _aureliaTemplating, _contentLoader, _template) {
"use strict";

Object.defineProperty(_exports, "__esModule", {
value: true
});
_exports.SvgCodeLoader = void 0;

var _dec, _dec2, _class, _class2, _descriptor, _temp;

function _initializerDefineProperty(target, property, descriptor, context) {
if (!descriptor) return;
Object.defineProperty(target, property, {
enumerable: descriptor.enumerable,
configurable: descriptor.configurable,
writable: descriptor.writable,
value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
});
}

function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
}

function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}

function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
var desc = {};
Object['ke' + 'ys'](descriptor).forEach(function(key) {
desc[key] = descriptor[key];
});
desc.enumerable = !!desc.enumerable;
desc.configurable = !!desc.configurable;
if ('value' in desc || desc.initializer) {
desc.writable = true;
}
desc = decorators
.slice()
.reverse()
.reduce(function(desc, decorator) {
return decorator(target, property, desc) || desc;
}, desc);
if (context && desc.initializer !== void 0) {
desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
desc.initializer = undefined;
}
if (desc.initializer === void 0) {
Object['define' + 'Property'](target, property, desc);
desc = null;
}
return desc;
}

function _initializerWarningHelper(descriptor, context) {
throw new Error(
'Decorating class property failed. Please ensure that ' +
'proposal-class-properties is enabled and set to use loose mode. ' +
'To use proposal-class-properties in spec mode with decorators, wait for ' +
'the next major version of decorators in stage 2.'
);
}
function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }

function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }

function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and set to use loose mode. ' + 'To use proposal-class-properties in spec mode with decorators, wait for ' + 'the next major version of decorators in stage 2.'); }

var divTemplate = '';
var svgTemplate =
'<rect repeat.for="codeRange of codeRanges()" x="0" y.bind="lineY($index)" rx.bind="cornerRadius" ry.bind="cornerRadius" width.bind="width" height.bind="lineHeight">\n <rect repeat.for="range of codeRange" x.bind="range.start" y.bind="lineY($parent.$index)" rx.bind="cornerRadius" ry.bind="cornerRadius" width.bind="range.length" height.bind="lineHeight"/>\n</rect>';
var SvgCodeLoader = ((_dec = (0, _aureliaTemplating.customElement)('svg-code-loader')),
(_dec2 = (0, _aureliaTemplating.inlineView)((0, _template.template)(divTemplate, svgTemplate))),
(0, _aureliaTemplating.containerless)(
(_class =
_dec(
(_class =
_dec2(
(_class = ((_class2 = ((_temp = (function(_SvgContentLoader) {
_inheritsLoose(SvgCodeLoader, _SvgContentLoader);

function SvgCodeLoader() {
var _this;

for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}

_this = _SvgContentLoader.call.apply(_SvgContentLoader, [this].concat(args)) || this;

_initializerDefineProperty(
_this,
'maxCodeChunks',
_descriptor,
_assertThisInitialized(_assertThisInitialized(_this))
);

return _this;
}

var _proto = SvgCodeLoader.prototype;

_proto.attached = function attached() {
var _SvgContentLoader$pro;

for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}

_SvgContentLoader.prototype.attached &&
(_SvgContentLoader$pro = _SvgContentLoader.prototype.attached).call.apply(
_SvgContentLoader$pro,
[this].concat(args)
);
var clipPath = this.element.querySelector('clipPath');
var rects = Array.prototype.slice.call(this.element.querySelectorAll('clipPath > rect'));
clipPath.innerHTML = rects
.map(function(rect) {
return rect.innerHTML;
})
.join('');
this.addClass('svg-loader__inner--code');
};

_proto.codeRanges = function codeRanges() {
var _this2 = this;

return this.lineRange.map(function() {
var chunkNr = Math.ceil(Math.random() * 5);

var chunkRange = _this2
.arrayRangeFromNumber(chunkNr)
.map(function() {
return Math.ceil(Math.random() * _this2.width);
})
.sort(function(a, b) {
return a - b;
});

return chunkRange.map(function(value, i) {
if (i > 0) {
var length = value - chunkRange[i - 1] - _this2.lineHeight;
return {
start: chunkRange[i - 1] + _this2.lineHeight,
length: length > 0 ? length : 0
};
}

return {
start: 0,
length: value
};
});
});
};

return SvgCodeLoader;
})(_contentLoader.SvgContentLoader)),
_temp)),
(_descriptor = _applyDecoratedDescriptor(
_class2.prototype,
'maxCodeChunks',
[_aureliaTemplating.bindable],
{
configurable: true,
enumerable: true,
writable: true,
initializer: function initializer() {
return 3;
}
}
)),
_class2))
) || _class)
) || _class)
) || _class);
var svgTemplate = "<rect repeat.for=\"codeRange of codeRanges()\" x=\"0\" y.bind=\"lineY($index)\" rx.bind=\"cornerRadius\" ry.bind=\"cornerRadius\" width.bind=\"width\" height.bind=\"lineHeight\">\n <rect repeat.for=\"range of codeRange\" x.bind=\"range.start\" y.bind=\"lineY($parent.$index)\" rx.bind=\"cornerRadius\" ry.bind=\"cornerRadius\" width.bind=\"range.length\" height.bind=\"lineHeight\"/>\n</rect>";
var SvgCodeLoader = (_dec = (0, _aureliaTemplating.customElement)('svg-code-loader'), _dec2 = (0, _aureliaTemplating.inlineView)((0, _template.template)(divTemplate, svgTemplate)), (0, _aureliaTemplating.containerless)(_class = _dec(_class = _dec2(_class = (_class2 = (_temp = function (_SvgContentLoader) {
_inheritsLoose(SvgCodeLoader, _SvgContentLoader);

function SvgCodeLoader() {
var _this;

for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}

_this = _SvgContentLoader.call.apply(_SvgContentLoader, [this].concat(args)) || this;

_initializerDefineProperty(_this, "maxCodeChunks", _descriptor, _assertThisInitialized(_this));

return _this;
}

var _proto = SvgCodeLoader.prototype;

_proto.attached = function attached() {
var _SvgContentLoader$pro;

for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}

_SvgContentLoader.prototype.attached && (_SvgContentLoader$pro = _SvgContentLoader.prototype.attached).call.apply(_SvgContentLoader$pro, [this].concat(args));
var clipPath = this.element.querySelector('clipPath');
var rects = Array.prototype.slice.call(this.element.querySelectorAll('clipPath > rect'));
clipPath.innerHTML = rects.map(function (rect) {
return rect.innerHTML;
}).join('');
this.addClass('svg-loader__inner--code');
};

_proto.codeRanges = function codeRanges() {
var _this2 = this;

return this.lineRange.map(function () {
var chunkNr = Math.ceil(Math.random() * 5);

var chunkRange = _this2.arrayRangeFromNumber(chunkNr).map(function () {
return Math.ceil(Math.random() * _this2.width);
}).sort(function (a, b) {
return a - b;
});

return chunkRange.map(function (value, i) {
if (i > 0) {
var length = value - chunkRange[i - 1] - _this2.lineHeight;
return {
start: chunkRange[i - 1] + _this2.lineHeight,
length: length > 0 ? length : 0
};
}

return {
start: 0,
length: value
};
});
});
};

return SvgCodeLoader;
}(_contentLoader.SvgContentLoader), _temp), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "maxCodeChunks", [_aureliaTemplating.bindable], {
configurable: true,
enumerable: true,
writable: true,
initializer: function initializer() {
return 3;
}
})), _class2)) || _class) || _class) || _class);
_exports.SvgCodeLoader = SvgCodeLoader;
});
});
Loading

0 comments on commit 8567ca8

Please sign in to comment.