@obliczeniowo/elementary
Version:
Library made in Angular version 20
137 lines (128 loc) • 19.1 kB
JavaScript
import * as i0 from '@angular/core';
import { input, Component, HostListener, NgModule } from '@angular/core';
import * as i2 from '@angular/common';
import { CommonModule } from '@angular/common';
const allowSigns = /[^0-9.e\-:]/g;
class DotsComponent {
dots = {
dot: [true, false, false],
colon: [true, true, false]
};
dotsType = input('colon');
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: DotsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.0.4", type: DotsComponent, isStandalone: false, selector: "obl-dots", inputs: { dotsType: { classPropertyName: "dotsType", publicName: "dotsType", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<svg xmlns:svg=\"http://www.w3.org/2000/svg\" width=\"4\" height=\"28\" viewBox=\"0 0 1 7.4\">\n <path\n class=\"dot-3\"\n [class.lighted]=\"dots[dotsType()][2]\"\n d=\"M 0,0.52916663 0.52916668,0 1.0583333,0.52916667 0.52916668,1.0583334 Z\"\n style=\"stroke:none;\" />\n <path\n class=\"dot-2\"\n [class.lighted]=\"dots[dotsType()][1]\"\n d=\"M 0.52916668,3.175 0,3.7041666 0.52916668,4.2333334 1.0583333,3.7041667 Z\"\n style=\"stroke:none;\" />\n <path\n class=\"dot-1\"\n [class.lighted]=\"dots[dotsType()][0]\"\n d=\"M 0.52916668,6.35 0,6.8791666 0.52916668,7.4083334 1.0583334,6.8791668 Z\"\n style=\"stroke:none;\" />\n</svg>\n", styles: [":root{--obl-primary: #00afaf;--obl-secondary: #008caf;--default-border-color: gray;--default-focus-color: gray;--default-border-outline-color: #080808;--default-disabled-color: gray;--default-background-color: white;--default-hover-color: #eeeeee;--obl-default-error-color: red;--obl-dialog-background: #d3d3d3;--default-radio-color: black;--disabled-color: gray;--default-hex-button-border-color: #008caf;--default-hex-button-hover-border-color: #00afaf;--select-item-background-color: #e4e4e4;--select-item-text-color: #5a5a5a;--default-text-color: black;--obl-default-button-text-color: black;--obl-default-icon-color: black;--equalizer-background-bar-color: #575656;--equalizer-value-bar-color: #e6e6e6;--diagram-3d-background-color: black;--slider-value-container-color: gray;--slider-value-color: #d1d1d1;--slider-hover-value-color: white;--digit-fill-color: #cccccc;--digit-lighted-color: black;--horizontal-progress-bar-value-color: #504f4f;--horizontal-progress-bar-background-pattern-color: #dddddd;--horizontal-progress-bar-value-pattern-color: #b3b3b3;--horizontal-progress-bar-border-rect-color: #cccccc;--temperature-text-color: black;--temperature-path-stroke-color: black;--post-diagram-scale-line-color: #c8c8c8;--volume-channel-secondary-color: gray;--volume-channel-primary-color: #f2f2f2;--arch-progress-secondary-color: #eeeeee;--obl-linear-diagram-greed-color: gray;--obl-rating-selected-color: gold;--obl-rating-color: #cccccc}.dot-1,.dot-2,.dot-3{fill:none}path.lighted{fill:var(--digit-lighted-color)}:host{margin:2px}\n"] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: DotsComponent, decorators: [{
type: Component,
args: [{ selector: 'obl-dots', standalone: false, template: "<svg xmlns:svg=\"http://www.w3.org/2000/svg\" width=\"4\" height=\"28\" viewBox=\"0 0 1 7.4\">\n <path\n class=\"dot-3\"\n [class.lighted]=\"dots[dotsType()][2]\"\n d=\"M 0,0.52916663 0.52916668,0 1.0583333,0.52916667 0.52916668,1.0583334 Z\"\n style=\"stroke:none;\" />\n <path\n class=\"dot-2\"\n [class.lighted]=\"dots[dotsType()][1]\"\n d=\"M 0.52916668,3.175 0,3.7041666 0.52916668,4.2333334 1.0583333,3.7041667 Z\"\n style=\"stroke:none;\" />\n <path\n class=\"dot-1\"\n [class.lighted]=\"dots[dotsType()][0]\"\n d=\"M 0.52916668,6.35 0,6.8791666 0.52916668,7.4083334 1.0583334,6.8791668 Z\"\n style=\"stroke:none;\" />\n</svg>\n", styles: [":root{--obl-primary: #00afaf;--obl-secondary: #008caf;--default-border-color: gray;--default-focus-color: gray;--default-border-outline-color: #080808;--default-disabled-color: gray;--default-background-color: white;--default-hover-color: #eeeeee;--obl-default-error-color: red;--obl-dialog-background: #d3d3d3;--default-radio-color: black;--disabled-color: gray;--default-hex-button-border-color: #008caf;--default-hex-button-hover-border-color: #00afaf;--select-item-background-color: #e4e4e4;--select-item-text-color: #5a5a5a;--default-text-color: black;--obl-default-button-text-color: black;--obl-default-icon-color: black;--equalizer-background-bar-color: #575656;--equalizer-value-bar-color: #e6e6e6;--diagram-3d-background-color: black;--slider-value-container-color: gray;--slider-value-color: #d1d1d1;--slider-hover-value-color: white;--digit-fill-color: #cccccc;--digit-lighted-color: black;--horizontal-progress-bar-value-color: #504f4f;--horizontal-progress-bar-background-pattern-color: #dddddd;--horizontal-progress-bar-value-pattern-color: #b3b3b3;--horizontal-progress-bar-border-rect-color: #cccccc;--temperature-text-color: black;--temperature-path-stroke-color: black;--post-diagram-scale-line-color: #c8c8c8;--volume-channel-secondary-color: gray;--volume-channel-primary-color: #f2f2f2;--arch-progress-secondary-color: #eeeeee;--obl-linear-diagram-greed-color: gray;--obl-rating-selected-color: gold;--obl-rating-color: #cccccc}.dot-1,.dot-2,.dot-3{fill:none}path.lighted{fill:var(--digit-lighted-color)}:host{margin:2px}\n"] }]
}] });
class DigitComponent {
signs = {
0: [true, true, true, false, true, true, true],
1: [false, false, true, false, false, true, false],
2: [true, false, true, true, true, false, true],
3: [true, false, true, true, false, true, true],
4: [false, true, true, true, false, true, false],
5: [true, true, false, true, false, true, true],
6: [true, true, false, true, true, true, true],
7: [true, false, true, false, false, true, false],
8: [true, true, true, true, true, true, true],
9: [true, true, true, true, false, true, true],
'-': [false, false, false, true, false, false, false],
e: [true, true, false, true, true, false, true],
'.': [false, false, false, false, false, false, false],
':': [false, false, false, false, false, false, false],
};
digit = input('0', { transform: (value) => (value.toString().replace(allowSigns, '')[0] || '0') });
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: DigitComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.4", type: DigitComponent, isStandalone: false, selector: "obl-digit", inputs: { digit: { classPropertyName: "digit", publicName: "digit", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if (digit() === '.' || digit() === ':') {\n <obl-dots [dotsType]=\"digit() === '.' ? 'dot' : 'colon'\" ></obl-dots>\n} @else {\n <svg viewBox=\"0 0 4 7.4\" height=\"28\" width=\"15\">\n <defs id=\"defs2\" />\n <path\n class=\"ds-1\"\n [class.lighted]=\"signs[digit()][0]\"\n d=\"M 0.52916666,0.26458016 0.79374999,-3.1666666e-6 H 3.175 L 3.4395833,0.26458016 3.175,0.52916349 H 0.79374999 Z\"\n style=\"stroke: none\"\n />\n <path\n class=\"ds-2\"\n [class.lighted]=\"signs[digit()][1]\"\n d=\"M 0.26458333,0.52916349 0.52916666,0.79374682 V 3.1749968 L 0.26458333,3.4395801 0,3.1749968 V 0.79374682 Z\"\n style=\"stroke: none\"\n />\n <path\n class=\"ds-3\"\n [class.lighted]=\"signs[digit()][2]\"\n d=\"M 3.4395833,0.79374682 3.7041666,0.52916349 3.96875,0.79374682 V 3.1749968 L 3.7041666,3.4395801 3.4395833,3.1749968 Z\"\n style=\"stroke: none\"\n />\n <path\n class=\"ds-4\"\n [class.lighted]=\"signs[digit()][3]\"\n d=\"M 3.175,3.4395801 3.4395833,3.7041634 3.175,3.9687468 H 0.79374999 L 0.52916666,3.7041634 0.79374999,3.4395801 Z\"\n style=\"stroke: none\"\n />\n <path\n class=\"ds-5\"\n [class.lighted]=\"signs[digit()][4]\"\n d=\"m 0.26458333,3.9687468 0.26458333,0.2645833 v 2.38125 L 0.26458333,6.8791634 0,6.6145801 v -2.38125 z\"\n style=\"stroke: none\"\n />\n <path\n class=\"ds-6\"\n [class.lighted]=\"signs[digit()][5]\"\n d=\"M 3.4395833,4.2333301 3.7041666,3.9687468 3.96875,4.2333301 v 2.38125 L 3.7041666,6.8791634 3.4395833,6.6145801 Z\"\n style=\"stroke: none\"\n />\n <path\n class=\"ds-7\"\n [class.lighted]=\"signs[digit()][6]\"\n d=\"M 3.175,6.8791634 3.4395833,7.1437467 3.175,7.4083301 H 0.79374999 L 0.52916666,7.1437467 0.79374999,6.8791634 Z\"\n style=\"stroke: none\"\n />\n </svg>\n}\n ", styles: [":root{--obl-primary: #00afaf;--obl-secondary: #008caf;--default-border-color: gray;--default-focus-color: gray;--default-border-outline-color: #080808;--default-disabled-color: gray;--default-background-color: white;--default-hover-color: #eeeeee;--obl-default-error-color: red;--obl-dialog-background: #d3d3d3;--default-radio-color: black;--disabled-color: gray;--default-hex-button-border-color: #008caf;--default-hex-button-hover-border-color: #00afaf;--select-item-background-color: #e4e4e4;--select-item-text-color: #5a5a5a;--default-text-color: black;--obl-default-button-text-color: black;--obl-default-icon-color: black;--equalizer-background-bar-color: #575656;--equalizer-value-bar-color: #e6e6e6;--diagram-3d-background-color: black;--slider-value-container-color: gray;--slider-value-color: #d1d1d1;--slider-hover-value-color: white;--digit-fill-color: #cccccc;--digit-lighted-color: black;--horizontal-progress-bar-value-color: #504f4f;--horizontal-progress-bar-background-pattern-color: #dddddd;--horizontal-progress-bar-value-pattern-color: #b3b3b3;--horizontal-progress-bar-border-rect-color: #cccccc;--temperature-text-color: black;--temperature-path-stroke-color: black;--post-diagram-scale-line-color: #c8c8c8;--volume-channel-secondary-color: gray;--volume-channel-primary-color: #f2f2f2;--arch-progress-secondary-color: #eeeeee;--obl-linear-diagram-greed-color: gray;--obl-rating-selected-color: gold;--obl-rating-color: #cccccc}svg path{fill:var(--digit-fill-color)}svg path.lighted{fill:var(--digit-lighted-color)}\n"], dependencies: [{ kind: "component", type: DotsComponent, selector: "obl-dots", inputs: ["dotsType"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: DigitComponent, decorators: [{
type: Component,
args: [{ selector: 'obl-digit', standalone: false, template: "@if (digit() === '.' || digit() === ':') {\n <obl-dots [dotsType]=\"digit() === '.' ? 'dot' : 'colon'\" ></obl-dots>\n} @else {\n <svg viewBox=\"0 0 4 7.4\" height=\"28\" width=\"15\">\n <defs id=\"defs2\" />\n <path\n class=\"ds-1\"\n [class.lighted]=\"signs[digit()][0]\"\n d=\"M 0.52916666,0.26458016 0.79374999,-3.1666666e-6 H 3.175 L 3.4395833,0.26458016 3.175,0.52916349 H 0.79374999 Z\"\n style=\"stroke: none\"\n />\n <path\n class=\"ds-2\"\n [class.lighted]=\"signs[digit()][1]\"\n d=\"M 0.26458333,0.52916349 0.52916666,0.79374682 V 3.1749968 L 0.26458333,3.4395801 0,3.1749968 V 0.79374682 Z\"\n style=\"stroke: none\"\n />\n <path\n class=\"ds-3\"\n [class.lighted]=\"signs[digit()][2]\"\n d=\"M 3.4395833,0.79374682 3.7041666,0.52916349 3.96875,0.79374682 V 3.1749968 L 3.7041666,3.4395801 3.4395833,3.1749968 Z\"\n style=\"stroke: none\"\n />\n <path\n class=\"ds-4\"\n [class.lighted]=\"signs[digit()][3]\"\n d=\"M 3.175,3.4395801 3.4395833,3.7041634 3.175,3.9687468 H 0.79374999 L 0.52916666,3.7041634 0.79374999,3.4395801 Z\"\n style=\"stroke: none\"\n />\n <path\n class=\"ds-5\"\n [class.lighted]=\"signs[digit()][4]\"\n d=\"m 0.26458333,3.9687468 0.26458333,0.2645833 v 2.38125 L 0.26458333,6.8791634 0,6.6145801 v -2.38125 z\"\n style=\"stroke: none\"\n />\n <path\n class=\"ds-6\"\n [class.lighted]=\"signs[digit()][5]\"\n d=\"M 3.4395833,4.2333301 3.7041666,3.9687468 3.96875,4.2333301 v 2.38125 L 3.7041666,6.8791634 3.4395833,6.6145801 Z\"\n style=\"stroke: none\"\n />\n <path\n class=\"ds-7\"\n [class.lighted]=\"signs[digit()][6]\"\n d=\"M 3.175,6.8791634 3.4395833,7.1437467 3.175,7.4083301 H 0.79374999 L 0.52916666,7.1437467 0.79374999,6.8791634 Z\"\n style=\"stroke: none\"\n />\n </svg>\n}\n ", styles: [":root{--obl-primary: #00afaf;--obl-secondary: #008caf;--default-border-color: gray;--default-focus-color: gray;--default-border-outline-color: #080808;--default-disabled-color: gray;--default-background-color: white;--default-hover-color: #eeeeee;--obl-default-error-color: red;--obl-dialog-background: #d3d3d3;--default-radio-color: black;--disabled-color: gray;--default-hex-button-border-color: #008caf;--default-hex-button-hover-border-color: #00afaf;--select-item-background-color: #e4e4e4;--select-item-text-color: #5a5a5a;--default-text-color: black;--obl-default-button-text-color: black;--obl-default-icon-color: black;--equalizer-background-bar-color: #575656;--equalizer-value-bar-color: #e6e6e6;--diagram-3d-background-color: black;--slider-value-container-color: gray;--slider-value-color: #d1d1d1;--slider-hover-value-color: white;--digit-fill-color: #cccccc;--digit-lighted-color: black;--horizontal-progress-bar-value-color: #504f4f;--horizontal-progress-bar-background-pattern-color: #dddddd;--horizontal-progress-bar-value-pattern-color: #b3b3b3;--horizontal-progress-bar-border-rect-color: #cccccc;--temperature-text-color: black;--temperature-path-stroke-color: black;--post-diagram-scale-line-color: #c8c8c8;--volume-channel-secondary-color: gray;--volume-channel-primary-color: #f2f2f2;--arch-progress-secondary-color: #eeeeee;--obl-linear-diagram-greed-color: gray;--obl-rating-selected-color: gold;--obl-rating-color: #cccccc}svg path{fill:var(--digit-fill-color)}svg path.lighted{fill:var(--digit-lighted-color)}\n"] }]
}] });
class DigitsComponent {
clicked = () => {
const { _value } = this;
if (_value) {
navigator.clipboard.writeText(_value.toString());
}
};
_value;
value = input.required({
transform: (value) => {
value = typeof value === 'string' ? value.replace(allowSigns, '') : value;
this._value = value;
if (!value) {
return [];
}
if (typeof value === 'number') {
return value.toString().split('');
}
else {
return value.split('');
}
}
});
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: DigitsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.4", type: DigitsComponent, isStandalone: false, selector: "obl-digits", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "click": "clicked()" } }, ngImport: i0, template: "@for (nr of value(); track $index) {\n <obl-digit [digit]=\"nr\"></obl-digit>\n}", styles: ["obl-digit{margin:2px}\n"], dependencies: [{ kind: "component", type: DigitComponent, selector: "obl-digit", inputs: ["digit"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: DigitsComponent, decorators: [{
type: Component,
args: [{ selector: 'obl-digits', standalone: false, template: "@for (nr of value(); track $index) {\n <obl-digit [digit]=\"nr\"></obl-digit>\n}", styles: ["obl-digit{margin:2px}\n"] }]
}], propDecorators: { clicked: [{
type: HostListener,
args: ['click']
}] } });
class DigitalTimerComponent {
date = new Date();
time;
ngOnInit() {
this.time = setInterval(() => {
this.date = new Date();
}, 1000);
}
ngOnDestroy() {
clearInterval(this.time);
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: DigitalTimerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.4", type: DigitalTimerComponent, isStandalone: false, selector: "obl-digital-timer", ngImport: i0, template: "<obl-digits [value]=\"date | date : 'HH:mm:ss'\"></obl-digits>\n", styles: [""], dependencies: [{ kind: "component", type: DigitsComponent, selector: "obl-digits", inputs: ["value"] }, { kind: "pipe", type: i2.DatePipe, name: "date" }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: DigitalTimerComponent, decorators: [{
type: Component,
args: [{ selector: 'obl-digital-timer', standalone: false, template: "<obl-digits [value]=\"date | date : 'HH:mm:ss'\"></obl-digits>\n" }]
}] });
class DigitalModule {
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: DigitalModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.4", ngImport: i0, type: DigitalModule, declarations: [DigitComponent,
DigitsComponent,
DigitalTimerComponent,
DotsComponent], imports: [CommonModule], exports: [DigitComponent,
DigitsComponent,
DigitalTimerComponent] });
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: DigitalModule, imports: [CommonModule] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: DigitalModule, decorators: [{
type: NgModule,
args: [{
declarations: [
DigitComponent,
DigitsComponent,
DigitalTimerComponent,
DotsComponent
],
imports: [
CommonModule
],
exports: [
DigitComponent,
DigitsComponent,
DigitalTimerComponent
]
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { DigitComponent, DigitalModule, DigitalTimerComponent, DigitsComponent, DotsComponent };
//# sourceMappingURL=obliczeniowo-elementary-digital.mjs.map