@obliczeniowo/elementary
Version:
Library made in Angular version 20
74 lines (67 loc) • 3.08 kB
JavaScript
import * as i0 from '@angular/core';
import { Pipe } from '@angular/core';
function translate(coordinates, unit = 'px') {
if (coordinates[0] === 0 && coordinates[1]) {
return `translateY(${coordinates[1]}${unit})`;
}
else if (coordinates[1] === 0 && coordinates[0]) {
return `translateX(${coordinates[0]}${unit})`;
}
else if (coordinates.every(value => value === 0)) {
return '';
}
return `translate(${coordinates[0]}${unit}, ${coordinates[1]}${unit})`;
}
class RotatePipe {
transform(angle, center, unit = 'deg', translateUnit = 'px') {
const rotate = `rotate(${angle}${unit})`;
if (angle) {
return center && (center[0] !== 0 || center[1] !== 0) ? `${translate(center, translateUnit)} ${rotate} ${translate([-center[0], -center[1]], translateUnit)}` : rotate;
}
return '';
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: RotatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.4", ngImport: i0, type: RotatePipe, isStandalone: true, name: "oblRotate" });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: RotatePipe, decorators: [{
type: Pipe,
args: [{
name: 'oblRotate',
}]
}] });
class ScalePipe {
transform(scale) {
if (typeof scale === 'number') {
return `scale(${scale})`;
}
else {
return `scale(${(scale)[0]}, ${(scale)[1]})`;
}
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: ScalePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.4", ngImport: i0, type: ScalePipe, isStandalone: true, name: "oblScale" });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: ScalePipe, decorators: [{
type: Pipe,
args: [{
name: 'oblScale'
}]
}] });
class TranslatePipe {
transform(coordinates, unit = 'px') {
return translate(coordinates, unit);
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: TranslatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.4", ngImport: i0, type: TranslatePipe, isStandalone: true, name: "oblTranslate" });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: TranslatePipe, decorators: [{
type: Pipe,
args: [{
name: 'oblTranslate'
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { RotatePipe, ScalePipe, TranslatePipe };
//# sourceMappingURL=obliczeniowo-elementary-html-pipes.mjs.map