@andi1986/angular-skeuomorphism-lib 0.0.0-stage → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, LOCALE_ID, computed, inject, input } from "@angular/core";
|
|
3
|
+
import { GAUGE_SWEEP, angleAt, buildTicks, pickMajorStep, startRotation } from "@andi1986/angular-ui-lib";
|
|
4
|
+
var Speedometer = class Speedometer {
|
|
5
|
+
value = input(0, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
6
|
+
min = input(0, ...ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []);
|
|
7
|
+
max = input(100, ...ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []);
|
|
8
|
+
unit = input("", ...ngDevMode ? [{ debugName: "unit" }] : /* istanbul ignore next */ []);
|
|
9
|
+
label = input("", ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
|
|
10
|
+
shape = input("wide", ...ngDevMode ? [{ debugName: "shape" }] : /* istanbul ignore next */ []);
|
|
11
|
+
design = input("classic", ...ngDevMode ? [{ debugName: "design" }] : /* istanbul ignore next */ []);
|
|
12
|
+
majorStep = input(...ngDevMode ? [void 0, { debugName: "majorStep" }] : /* istanbul ignore next */ []);
|
|
13
|
+
minorTicks = input(4, ...ngDevMode ? [{ debugName: "minorTicks" }] : /* istanbul ignore next */ []);
|
|
14
|
+
zones = input([], ...ngDevMode ? [{ debugName: "zones" }] : /* istanbul ignore next */ []);
|
|
15
|
+
size = input("14rem", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
|
|
16
|
+
showNumbers = input(true, ...ngDevMode ? [{ debugName: "showNumbers" }] : /* istanbul ignore next */ []);
|
|
17
|
+
showReadout = input(true, ...ngDevMode ? [{ debugName: "showReadout" }] : /* istanbul ignore next */ []);
|
|
18
|
+
animated = input(false, ...ngDevMode ? [{ debugName: "animated" }] : /* istanbul ignore next */ []);
|
|
19
|
+
locale = inject(LOCALE_ID);
|
|
20
|
+
sweep = computed(() => GAUGE_SWEEP[this.shape()], ...ngDevMode ? [{ debugName: "sweep" }] : /* istanbul ignore next */ []);
|
|
21
|
+
classic = computed(() => this.design() === "classic", ...ngDevMode ? [{ debugName: "classic" }] : /* istanbul ignore next */ []);
|
|
22
|
+
viewBox = computed(() => this.shape() === "half" ? "0 0 100 70" : "0 0 100 100", ...ngDevMode ? [{ debugName: "viewBox" }] : /* istanbul ignore next */ []);
|
|
23
|
+
rotation = computed(() => startRotation(this.sweep()), ...ngDevMode ? [{ debugName: "rotation" }] : /* istanbul ignore next */ []);
|
|
24
|
+
sweepLength = computed(() => this.sweep() / 360 * 100, ...ngDevMode ? [{ debugName: "sweepLength" }] : /* istanbul ignore next */ []);
|
|
25
|
+
clamped = computed(() => Math.min(Math.max(this.value(), this.min()), this.max()), ...ngDevMode ? [{ debugName: "clamped" }] : /* istanbul ignore next */ []);
|
|
26
|
+
fraction = computed(() => {
|
|
27
|
+
const range = this.max() - this.min();
|
|
28
|
+
return range > 0 ? (this.clamped() - this.min()) / range : 0;
|
|
29
|
+
}, ...ngDevMode ? [{ debugName: "fraction" }] : /* istanbul ignore next */ []);
|
|
30
|
+
angle = computed(() => angleAt(this.fraction(), this.sweep()), ...ngDevMode ? [{ debugName: "angle" }] : /* istanbul ignore next */ []);
|
|
31
|
+
startAngle = computed(() => angleAt(0, this.sweep()), ...ngDevMode ? [{ debugName: "startAngle" }] : /* istanbul ignore next */ []);
|
|
32
|
+
scale = computed(() => {
|
|
33
|
+
const step = this.majorStep() ?? pickMajorStep(this.max() - this.min(), this.shape() === "half" ? 6 : 10);
|
|
34
|
+
return buildTicks({
|
|
35
|
+
min: this.min(),
|
|
36
|
+
max: this.max(),
|
|
37
|
+
majorStep: step,
|
|
38
|
+
minorPerMajor: this.minorTicks(),
|
|
39
|
+
sweep: this.sweep(),
|
|
40
|
+
outerRadius: 44,
|
|
41
|
+
majorLength: this.classic() ? 6 : 4,
|
|
42
|
+
minorLength: this.classic() ? 3 : 2,
|
|
43
|
+
labelRadius: this.classic() ? 31 : 34
|
|
44
|
+
});
|
|
45
|
+
}, ...ngDevMode ? [{ debugName: "scale" }] : /* istanbul ignore next */ []);
|
|
46
|
+
bands = computed(() => {
|
|
47
|
+
const range = this.max() - this.min();
|
|
48
|
+
if (range <= 0) return [];
|
|
49
|
+
let from = this.min();
|
|
50
|
+
return [...this.zones()].sort((a, b) => a.to - b.to).flatMap((zone) => {
|
|
51
|
+
const to = Math.min(zone.to, this.max());
|
|
52
|
+
const start = (from - this.min()) / range;
|
|
53
|
+
const end = (to - this.min()) / range;
|
|
54
|
+
from = Math.max(from, to);
|
|
55
|
+
return end > start ? [{
|
|
56
|
+
color: zone.color,
|
|
57
|
+
length: (end - start) * this.sweepLength(),
|
|
58
|
+
offset: -start * this.sweepLength()
|
|
59
|
+
}] : [];
|
|
60
|
+
});
|
|
61
|
+
}, ...ngDevMode ? [{ debugName: "bands" }] : /* istanbul ignore next */ []);
|
|
62
|
+
bandRadius = computed(() => this.classic() ? 46.5 : 47, ...ngDevMode ? [{ debugName: "bandRadius" }] : /* istanbul ignore next */ []);
|
|
63
|
+
bandWidth = computed(() => this.classic() ? 3 : 1.6, ...ngDevMode ? [{ debugName: "bandWidth" }] : /* istanbul ignore next */ []);
|
|
64
|
+
needleLength = computed(() => this.classic() ? 37 : 41, ...ngDevMode ? [{ debugName: "needleLength" }] : /* istanbul ignore next */ []);
|
|
65
|
+
readoutY = computed(() => ({
|
|
66
|
+
half: 58,
|
|
67
|
+
wide: 72,
|
|
68
|
+
full: 68
|
|
69
|
+
})[this.shape()], ...ngDevMode ? [{ debugName: "readoutY" }] : /* istanbul ignore next */ []);
|
|
70
|
+
labelY = computed(() => ({
|
|
71
|
+
half: 66,
|
|
72
|
+
wide: 79,
|
|
73
|
+
full: 75
|
|
74
|
+
})[this.shape()], ...ngDevMode ? [{ debugName: "labelY" }] : /* istanbul ignore next */ []);
|
|
75
|
+
caption = computed(() => [this.shape() === "half" ? "" : this.unit(), this.label()].filter(Boolean).join(" · "), ...ngDevMode ? [{ debugName: "caption" }] : /* istanbul ignore next */ []);
|
|
76
|
+
text = computed(() => new Intl.NumberFormat(this.locale, { maximumFractionDigits: 1 }).format(this.clamped()), ...ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []);
|
|
77
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
78
|
+
minVersion: "12.0.0",
|
|
79
|
+
version: "22.2.1",
|
|
80
|
+
ngImport: i0,
|
|
81
|
+
type: Speedometer,
|
|
82
|
+
deps: [],
|
|
83
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
84
|
+
});
|
|
85
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
86
|
+
minVersion: "17.0.0",
|
|
87
|
+
version: "22.2.1",
|
|
88
|
+
type: Speedometer,
|
|
89
|
+
isStandalone: true,
|
|
90
|
+
selector: "lib-speedometer",
|
|
91
|
+
inputs: {
|
|
92
|
+
value: {
|
|
93
|
+
classPropertyName: "value",
|
|
94
|
+
publicName: "value",
|
|
95
|
+
isSignal: true,
|
|
96
|
+
isRequired: false,
|
|
97
|
+
transformFunction: null
|
|
98
|
+
},
|
|
99
|
+
min: {
|
|
100
|
+
classPropertyName: "min",
|
|
101
|
+
publicName: "min",
|
|
102
|
+
isSignal: true,
|
|
103
|
+
isRequired: false,
|
|
104
|
+
transformFunction: null
|
|
105
|
+
},
|
|
106
|
+
max: {
|
|
107
|
+
classPropertyName: "max",
|
|
108
|
+
publicName: "max",
|
|
109
|
+
isSignal: true,
|
|
110
|
+
isRequired: false,
|
|
111
|
+
transformFunction: null
|
|
112
|
+
},
|
|
113
|
+
unit: {
|
|
114
|
+
classPropertyName: "unit",
|
|
115
|
+
publicName: "unit",
|
|
116
|
+
isSignal: true,
|
|
117
|
+
isRequired: false,
|
|
118
|
+
transformFunction: null
|
|
119
|
+
},
|
|
120
|
+
label: {
|
|
121
|
+
classPropertyName: "label",
|
|
122
|
+
publicName: "label",
|
|
123
|
+
isSignal: true,
|
|
124
|
+
isRequired: false,
|
|
125
|
+
transformFunction: null
|
|
126
|
+
},
|
|
127
|
+
shape: {
|
|
128
|
+
classPropertyName: "shape",
|
|
129
|
+
publicName: "shape",
|
|
130
|
+
isSignal: true,
|
|
131
|
+
isRequired: false,
|
|
132
|
+
transformFunction: null
|
|
133
|
+
},
|
|
134
|
+
design: {
|
|
135
|
+
classPropertyName: "design",
|
|
136
|
+
publicName: "design",
|
|
137
|
+
isSignal: true,
|
|
138
|
+
isRequired: false,
|
|
139
|
+
transformFunction: null
|
|
140
|
+
},
|
|
141
|
+
majorStep: {
|
|
142
|
+
classPropertyName: "majorStep",
|
|
143
|
+
publicName: "majorStep",
|
|
144
|
+
isSignal: true,
|
|
145
|
+
isRequired: false,
|
|
146
|
+
transformFunction: null
|
|
147
|
+
},
|
|
148
|
+
minorTicks: {
|
|
149
|
+
classPropertyName: "minorTicks",
|
|
150
|
+
publicName: "minorTicks",
|
|
151
|
+
isSignal: true,
|
|
152
|
+
isRequired: false,
|
|
153
|
+
transformFunction: null
|
|
154
|
+
},
|
|
155
|
+
zones: {
|
|
156
|
+
classPropertyName: "zones",
|
|
157
|
+
publicName: "zones",
|
|
158
|
+
isSignal: true,
|
|
159
|
+
isRequired: false,
|
|
160
|
+
transformFunction: null
|
|
161
|
+
},
|
|
162
|
+
size: {
|
|
163
|
+
classPropertyName: "size",
|
|
164
|
+
publicName: "size",
|
|
165
|
+
isSignal: true,
|
|
166
|
+
isRequired: false,
|
|
167
|
+
transformFunction: null
|
|
168
|
+
},
|
|
169
|
+
showNumbers: {
|
|
170
|
+
classPropertyName: "showNumbers",
|
|
171
|
+
publicName: "showNumbers",
|
|
172
|
+
isSignal: true,
|
|
173
|
+
isRequired: false,
|
|
174
|
+
transformFunction: null
|
|
175
|
+
},
|
|
176
|
+
showReadout: {
|
|
177
|
+
classPropertyName: "showReadout",
|
|
178
|
+
publicName: "showReadout",
|
|
179
|
+
isSignal: true,
|
|
180
|
+
isRequired: false,
|
|
181
|
+
transformFunction: null
|
|
182
|
+
},
|
|
183
|
+
animated: {
|
|
184
|
+
classPropertyName: "animated",
|
|
185
|
+
publicName: "animated",
|
|
186
|
+
isSignal: true,
|
|
187
|
+
isRequired: false,
|
|
188
|
+
transformFunction: null
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
host: {
|
|
192
|
+
attributes: { "role": "meter" },
|
|
193
|
+
properties: {
|
|
194
|
+
"attr.aria-valuenow": "clamped()",
|
|
195
|
+
"attr.aria-valuemin": "min()",
|
|
196
|
+
"attr.aria-valuemax": "max()",
|
|
197
|
+
"attr.aria-label": "label() || null",
|
|
198
|
+
"style.--size": "size()",
|
|
199
|
+
"style.--angle.deg": "angle()",
|
|
200
|
+
"class.classic": "design() === \"classic\"",
|
|
201
|
+
"class.minimal": "design() === \"minimal\""
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
ngImport: i0,
|
|
205
|
+
template: "<svg [attr.viewBox]=\"viewBox()\" aria-hidden=\"true\">\n @if (classic()) {\n @if (shape() === 'half') {\n <path class=\"face\" d=\"M 1 50 A 49 49 0 0 1 99 50 L 99 66 Q 99 69 96 69 L 4 69 Q 1 69 1 66 Z\" />\n } @else {\n <circle class=\"face\" cx=\"50\" cy=\"50\" r=\"49\" />\n }\n } @else {\n <circle class=\"scale-track\" cx=\"50\" cy=\"50\" pathLength=\"100\" [attr.r]=\"bandRadius()\" [attr.stroke-width]=\"bandWidth()\" [attr.transform]=\"'rotate(' + rotation() + ' 50 50)'\" [attr.stroke-dasharray]=\"sweepLength() + ' 100'\" />\n }\n\n @for (band of bands(); track $index) {\n <circle\n class=\"band\"\n cx=\"50\"\n cy=\"50\"\n pathLength=\"100\"\n [attr.r]=\"bandRadius()\"\n [attr.stroke]=\"band.color\"\n [attr.stroke-width]=\"bandWidth()\"\n [attr.stroke-dasharray]=\"band.length + ' 100'\"\n [attr.stroke-dashoffset]=\"band.offset\"\n [attr.transform]=\"'rotate(' + rotation() + ' 50 50)'\"\n />\n }\n\n @for (tick of scale(); track $index) {\n <line class=\"tick\" [class.major]=\"tick.major\" [attr.x1]=\"tick.from.x\" [attr.y1]=\"tick.from.y\" [attr.x2]=\"tick.to.x\" [attr.y2]=\"tick.to.y\" />\n @if (tick.major && showNumbers()) {\n <text class=\"number\" [attr.x]=\"tick.label.x\" [attr.y]=\"tick.label.y\" text-anchor=\"middle\" dominant-baseline=\"central\">{{ tick.value }}</text>\n }\n }\n\n <g class=\"needle\" [class.animated]=\"animated()\" [style.--start.deg]=\"startAngle()\">\n @if (classic()) {\n <polygon class=\"blade\" [attr.points]=\"'48.4,50 51.6,50 50.35,' + (50 - needleLength()) + ' 49.65,' + (50 - needleLength())\" />\n <line class=\"tail\" x1=\"50\" y1=\"50\" x2=\"50\" y2=\"57\" />\n <circle class=\"hub\" cx=\"50\" cy=\"50\" r=\"3.6\" />\n } @else {\n <line class=\"blade\" x1=\"50\" y1=\"54\" x2=\"50\" [attr.y2]=\"50 - needleLength()\" />\n <circle class=\"hub\" cx=\"50\" cy=\"50\" r=\"2.2\" />\n }\n </g>\n\n @if (showReadout()) {\n <text class=\"readout\" x=\"50\" [attr.y]=\"readoutY()\" text-anchor=\"middle\">{{ text() }}@if (unit() && shape() === 'half') {<tspan class=\"unit\"> {{ unit() }}</tspan>}</text>\n }\n @if (caption()) {\n <text class=\"caption\" x=\"50\" [attr.y]=\"labelY()\" text-anchor=\"middle\">{{ caption() }}</text>\n }\n</svg>\n",
|
|
206
|
+
styles: [":host{--size: 14rem;--angle: 0deg;display:inline-block;width:var(--size)}:host svg{display:block;width:100%;fill:none;overflow:visible}:host svg .scale-track{stroke:var(--color-layer)}:host svg .needle{transform-box:view-box;transform-origin:50px 50px;transform:rotate(var(--angle));transition:transform .7s cubic-bezier(.25,1.15,.4,1)}:host svg .needle.animated{animation:sweep 1.1s cubic-bezier(.25,1.15,.4,1) both}:host(.classic) svg .face{fill:var(--color-dark);stroke:var(--color-border);stroke-width:1.5;filter:drop-shadow(0 1px 1.5px rgba(0,0,0,.4))}:host(.classic) svg .tick{stroke:color-mix(in srgb,var(--color-darkText) 60%,transparent);stroke-width:.5}:host(.classic) svg .tick.major{stroke:var(--color-darkText);stroke-width:1}:host(.classic) svg .number{fill:var(--color-darkText)}:host(.classic) svg .blade{fill:var(--color-status-red)}:host(.classic) svg .tail{stroke:var(--color-status-red);stroke-width:2;stroke-linecap:round}:host(.classic) svg .hub{fill:var(--color-blackish);stroke:var(--color-status-red);stroke-width:1}:host(.classic) svg .readout{fill:var(--color-darkText);font-weight:700;font-variant-numeric:tabular-nums}:host(.classic) svg .readout .unit{font-weight:400}:host(.classic) svg .caption{fill:color-mix(in srgb,var(--color-darkText) 65%,transparent)}:host(.minimal) svg .tick{stroke:var(--color-subtitle);stroke-width:.4}:host(.minimal) svg .tick.major{stroke:var(--color-text);stroke-width:.7}:host(.minimal) svg .number{fill:var(--color-subtitle)}:host(.minimal) svg .blade{stroke:var(--color-text);stroke-width:1.1;stroke-linecap:round}:host(.minimal) svg .hub{fill:var(--color-text)}:host(.minimal) svg .readout{fill:var(--color-text);font-weight:700;font-variant-numeric:tabular-nums}:host(.minimal) svg .readout .unit{font-weight:400;fill:var(--color-subtitle)}:host(.minimal) svg .caption{fill:var(--color-subtitle)}@keyframes sweep{0%{transform:rotate(var(--start))}}@media(prefers-reduced-motion:reduce){:host svg .needle,:host svg .needle.animated{transition:none;animation:none}}\n"],
|
|
207
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
208
|
+
});
|
|
209
|
+
};
|
|
210
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
211
|
+
minVersion: "12.0.0",
|
|
212
|
+
version: "22.2.1",
|
|
213
|
+
ngImport: i0,
|
|
214
|
+
type: Speedometer,
|
|
215
|
+
decorators: [{
|
|
216
|
+
type: Component,
|
|
217
|
+
args: [{
|
|
218
|
+
selector: "lib-speedometer",
|
|
219
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
220
|
+
host: {
|
|
221
|
+
role: "meter",
|
|
222
|
+
"[attr.aria-valuenow]": "clamped()",
|
|
223
|
+
"[attr.aria-valuemin]": "min()",
|
|
224
|
+
"[attr.aria-valuemax]": "max()",
|
|
225
|
+
"[attr.aria-label]": "label() || null",
|
|
226
|
+
"[style.--size]": "size()",
|
|
227
|
+
"[style.--angle.deg]": "angle()",
|
|
228
|
+
"[class.classic]": "design() === \"classic\"",
|
|
229
|
+
"[class.minimal]": "design() === \"minimal\""
|
|
230
|
+
},
|
|
231
|
+
template: "<svg [attr.viewBox]=\"viewBox()\" aria-hidden=\"true\">\n @if (classic()) {\n @if (shape() === 'half') {\n <path class=\"face\" d=\"M 1 50 A 49 49 0 0 1 99 50 L 99 66 Q 99 69 96 69 L 4 69 Q 1 69 1 66 Z\" />\n } @else {\n <circle class=\"face\" cx=\"50\" cy=\"50\" r=\"49\" />\n }\n } @else {\n <circle class=\"scale-track\" cx=\"50\" cy=\"50\" pathLength=\"100\" [attr.r]=\"bandRadius()\" [attr.stroke-width]=\"bandWidth()\" [attr.transform]=\"'rotate(' + rotation() + ' 50 50)'\" [attr.stroke-dasharray]=\"sweepLength() + ' 100'\" />\n }\n\n @for (band of bands(); track $index) {\n <circle\n class=\"band\"\n cx=\"50\"\n cy=\"50\"\n pathLength=\"100\"\n [attr.r]=\"bandRadius()\"\n [attr.stroke]=\"band.color\"\n [attr.stroke-width]=\"bandWidth()\"\n [attr.stroke-dasharray]=\"band.length + ' 100'\"\n [attr.stroke-dashoffset]=\"band.offset\"\n [attr.transform]=\"'rotate(' + rotation() + ' 50 50)'\"\n />\n }\n\n @for (tick of scale(); track $index) {\n <line class=\"tick\" [class.major]=\"tick.major\" [attr.x1]=\"tick.from.x\" [attr.y1]=\"tick.from.y\" [attr.x2]=\"tick.to.x\" [attr.y2]=\"tick.to.y\" />\n @if (tick.major && showNumbers()) {\n <text class=\"number\" [attr.x]=\"tick.label.x\" [attr.y]=\"tick.label.y\" text-anchor=\"middle\" dominant-baseline=\"central\">{{ tick.value }}</text>\n }\n }\n\n <g class=\"needle\" [class.animated]=\"animated()\" [style.--start.deg]=\"startAngle()\">\n @if (classic()) {\n <polygon class=\"blade\" [attr.points]=\"'48.4,50 51.6,50 50.35,' + (50 - needleLength()) + ' 49.65,' + (50 - needleLength())\" />\n <line class=\"tail\" x1=\"50\" y1=\"50\" x2=\"50\" y2=\"57\" />\n <circle class=\"hub\" cx=\"50\" cy=\"50\" r=\"3.6\" />\n } @else {\n <line class=\"blade\" x1=\"50\" y1=\"54\" x2=\"50\" [attr.y2]=\"50 - needleLength()\" />\n <circle class=\"hub\" cx=\"50\" cy=\"50\" r=\"2.2\" />\n }\n </g>\n\n @if (showReadout()) {\n <text class=\"readout\" x=\"50\" [attr.y]=\"readoutY()\" text-anchor=\"middle\">{{ text() }}@if (unit() && shape() === 'half') {<tspan class=\"unit\"> {{ unit() }}</tspan>}</text>\n }\n @if (caption()) {\n <text class=\"caption\" x=\"50\" [attr.y]=\"labelY()\" text-anchor=\"middle\">{{ caption() }}</text>\n }\n</svg>\n",
|
|
232
|
+
styles: [":host{--size: 14rem;--angle: 0deg;display:inline-block;width:var(--size)}:host svg{display:block;width:100%;fill:none;overflow:visible}:host svg .scale-track{stroke:var(--color-layer)}:host svg .needle{transform-box:view-box;transform-origin:50px 50px;transform:rotate(var(--angle));transition:transform .7s cubic-bezier(.25,1.15,.4,1)}:host svg .needle.animated{animation:sweep 1.1s cubic-bezier(.25,1.15,.4,1) both}:host(.classic) svg .face{fill:var(--color-dark);stroke:var(--color-border);stroke-width:1.5;filter:drop-shadow(0 1px 1.5px rgba(0,0,0,.4))}:host(.classic) svg .tick{stroke:color-mix(in srgb,var(--color-darkText) 60%,transparent);stroke-width:.5}:host(.classic) svg .tick.major{stroke:var(--color-darkText);stroke-width:1}:host(.classic) svg .number{fill:var(--color-darkText)}:host(.classic) svg .blade{fill:var(--color-status-red)}:host(.classic) svg .tail{stroke:var(--color-status-red);stroke-width:2;stroke-linecap:round}:host(.classic) svg .hub{fill:var(--color-blackish);stroke:var(--color-status-red);stroke-width:1}:host(.classic) svg .readout{fill:var(--color-darkText);font-weight:700;font-variant-numeric:tabular-nums}:host(.classic) svg .readout .unit{font-weight:400}:host(.classic) svg .caption{fill:color-mix(in srgb,var(--color-darkText) 65%,transparent)}:host(.minimal) svg .tick{stroke:var(--color-subtitle);stroke-width:.4}:host(.minimal) svg .tick.major{stroke:var(--color-text);stroke-width:.7}:host(.minimal) svg .number{fill:var(--color-subtitle)}:host(.minimal) svg .blade{stroke:var(--color-text);stroke-width:1.1;stroke-linecap:round}:host(.minimal) svg .hub{fill:var(--color-text)}:host(.minimal) svg .readout{fill:var(--color-text);font-weight:700;font-variant-numeric:tabular-nums}:host(.minimal) svg .readout .unit{font-weight:400;fill:var(--color-subtitle)}:host(.minimal) svg .caption{fill:var(--color-subtitle)}@keyframes sweep{0%{transform:rotate(var(--start))}}@media(prefers-reduced-motion:reduce){:host svg .needle,:host svg .needle.animated{transition:none;animation:none}}\n"]
|
|
233
|
+
}]
|
|
234
|
+
}],
|
|
235
|
+
propDecorators: {
|
|
236
|
+
value: [{
|
|
237
|
+
type: i0.Input,
|
|
238
|
+
args: [{
|
|
239
|
+
isSignal: true,
|
|
240
|
+
alias: "value",
|
|
241
|
+
required: false
|
|
242
|
+
}]
|
|
243
|
+
}],
|
|
244
|
+
min: [{
|
|
245
|
+
type: i0.Input,
|
|
246
|
+
args: [{
|
|
247
|
+
isSignal: true,
|
|
248
|
+
alias: "min",
|
|
249
|
+
required: false
|
|
250
|
+
}]
|
|
251
|
+
}],
|
|
252
|
+
max: [{
|
|
253
|
+
type: i0.Input,
|
|
254
|
+
args: [{
|
|
255
|
+
isSignal: true,
|
|
256
|
+
alias: "max",
|
|
257
|
+
required: false
|
|
258
|
+
}]
|
|
259
|
+
}],
|
|
260
|
+
unit: [{
|
|
261
|
+
type: i0.Input,
|
|
262
|
+
args: [{
|
|
263
|
+
isSignal: true,
|
|
264
|
+
alias: "unit",
|
|
265
|
+
required: false
|
|
266
|
+
}]
|
|
267
|
+
}],
|
|
268
|
+
label: [{
|
|
269
|
+
type: i0.Input,
|
|
270
|
+
args: [{
|
|
271
|
+
isSignal: true,
|
|
272
|
+
alias: "label",
|
|
273
|
+
required: false
|
|
274
|
+
}]
|
|
275
|
+
}],
|
|
276
|
+
shape: [{
|
|
277
|
+
type: i0.Input,
|
|
278
|
+
args: [{
|
|
279
|
+
isSignal: true,
|
|
280
|
+
alias: "shape",
|
|
281
|
+
required: false
|
|
282
|
+
}]
|
|
283
|
+
}],
|
|
284
|
+
design: [{
|
|
285
|
+
type: i0.Input,
|
|
286
|
+
args: [{
|
|
287
|
+
isSignal: true,
|
|
288
|
+
alias: "design",
|
|
289
|
+
required: false
|
|
290
|
+
}]
|
|
291
|
+
}],
|
|
292
|
+
majorStep: [{
|
|
293
|
+
type: i0.Input,
|
|
294
|
+
args: [{
|
|
295
|
+
isSignal: true,
|
|
296
|
+
alias: "majorStep",
|
|
297
|
+
required: false
|
|
298
|
+
}]
|
|
299
|
+
}],
|
|
300
|
+
minorTicks: [{
|
|
301
|
+
type: i0.Input,
|
|
302
|
+
args: [{
|
|
303
|
+
isSignal: true,
|
|
304
|
+
alias: "minorTicks",
|
|
305
|
+
required: false
|
|
306
|
+
}]
|
|
307
|
+
}],
|
|
308
|
+
zones: [{
|
|
309
|
+
type: i0.Input,
|
|
310
|
+
args: [{
|
|
311
|
+
isSignal: true,
|
|
312
|
+
alias: "zones",
|
|
313
|
+
required: false
|
|
314
|
+
}]
|
|
315
|
+
}],
|
|
316
|
+
size: [{
|
|
317
|
+
type: i0.Input,
|
|
318
|
+
args: [{
|
|
319
|
+
isSignal: true,
|
|
320
|
+
alias: "size",
|
|
321
|
+
required: false
|
|
322
|
+
}]
|
|
323
|
+
}],
|
|
324
|
+
showNumbers: [{
|
|
325
|
+
type: i0.Input,
|
|
326
|
+
args: [{
|
|
327
|
+
isSignal: true,
|
|
328
|
+
alias: "showNumbers",
|
|
329
|
+
required: false
|
|
330
|
+
}]
|
|
331
|
+
}],
|
|
332
|
+
showReadout: [{
|
|
333
|
+
type: i0.Input,
|
|
334
|
+
args: [{
|
|
335
|
+
isSignal: true,
|
|
336
|
+
alias: "showReadout",
|
|
337
|
+
required: false
|
|
338
|
+
}]
|
|
339
|
+
}],
|
|
340
|
+
animated: [{
|
|
341
|
+
type: i0.Input,
|
|
342
|
+
args: [{
|
|
343
|
+
isSignal: true,
|
|
344
|
+
alias: "animated",
|
|
345
|
+
required: false
|
|
346
|
+
}]
|
|
347
|
+
}]
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
export { Speedometer };
|
|
351
|
+
|
|
352
|
+
//# sourceMappingURL=andi1986-angular-skeuomorphism-lib.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"andi1986-angular-skeuomorphism-lib.mjs","names":[],"sources":["../../../projects/angular-skeuomorphism-lib/src/lib/speedometer/speedometer.ts","../../../projects/angular-skeuomorphism-lib/src/lib/speedometer/speedometer.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, LOCALE_ID, computed, inject, input } from '@angular/core';\nimport { GAUGE_SWEEP, GaugeShape, GaugeZone, angleAt, buildTicks, pickMajorStep, startRotation } from '@andi1986/angular-ui-lib';\n\nexport type SpeedometerDesign = 'classic' | 'minimal';\n\n/**\n * Speedometer / tachometer: a needle over a numbered scale, with an optional colored band (`zones`) and a digital\n * readout. `classic` is a dark dial with a bezel, `minimal` a thin scale without a face. The shape is a half circle,\n * three quarters like a car dashboard (`wide`) or the full circle.\n */\n@Component({\n selector: 'lib-speedometer',\n templateUrl: './speedometer.html',\n styleUrl: './speedometer.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n role: 'meter',\n '[attr.aria-valuenow]': 'clamped()',\n '[attr.aria-valuemin]': 'min()',\n '[attr.aria-valuemax]': 'max()',\n '[attr.aria-label]': 'label() || null',\n '[style.--size]': 'size()',\n '[style.--angle.deg]': 'angle()',\n '[class.classic]': 'design() === \"classic\"',\n '[class.minimal]': 'design() === \"minimal\"',\n },\n})\nexport class Speedometer {\n readonly value = input(0);\n readonly min = input(0);\n readonly max = input(100);\n readonly unit = input('');\n /** Text under the readout, also the accessible name */\n readonly label = input('');\n readonly shape = input<GaugeShape>('wide');\n readonly design = input<SpeedometerDesign>('classic');\n /** Distance between the numbered ticks; by default a step that divides the scale into about ten parts */\n readonly majorStep = input<number>();\n /** Small ticks between two numbered ones */\n readonly minorTicks = input(4);\n /** Colored band along the scale: each zone runs up to its `to` */\n readonly zones = input<GaugeZone[]>([]);\n readonly size = input('14rem');\n readonly showNumbers = input(true);\n readonly showReadout = input(true);\n /** Sweeps the needle from the start of the scale when it appears */\n readonly animated = input(false);\n\n private readonly locale = inject(LOCALE_ID);\n\n protected readonly sweep = computed(() => GAUGE_SWEEP[this.shape()]);\n protected readonly classic = computed(() => this.design() === 'classic');\n protected readonly viewBox = computed(() => (this.shape() === 'half' ? '0 0 100 70' : '0 0 100 100'));\n protected readonly rotation = computed(() => startRotation(this.sweep()));\n protected readonly sweepLength = computed(() => (this.sweep() / 360) * 100);\n\n protected readonly clamped = computed(() => Math.min(Math.max(this.value(), this.min()), this.max()));\n protected readonly fraction = computed(() => {\n const range = this.max() - this.min();\n return range > 0 ? (this.clamped() - this.min()) / range : 0;\n });\n protected readonly angle = computed(() => angleAt(this.fraction(), this.sweep()));\n protected readonly startAngle = computed(() => angleAt(0, this.sweep()));\n\n protected readonly scale = computed(() => {\n // A half circle is narrow, so it gets fewer numbers\n const step = this.majorStep() ?? pickMajorStep(this.max() - this.min(), this.shape() === 'half' ? 6 : 10);\n return buildTicks({\n min: this.min(),\n max: this.max(),\n majorStep: step,\n minorPerMajor: this.minorTicks(),\n sweep: this.sweep(),\n outerRadius: 44,\n majorLength: this.classic() ? 6 : 4,\n minorLength: this.classic() ? 3 : 2,\n labelRadius: this.classic() ? 31 : 34,\n });\n });\n\n /** The colored band as pieces of one circle: a dash each, moved to where its zone starts. */\n protected readonly bands = computed(() => {\n const range = this.max() - this.min();\n if (range <= 0) return [];\n let from = this.min();\n return [...this.zones()]\n .sort((a, b) => a.to - b.to)\n .flatMap((zone) => {\n const to = Math.min(zone.to, this.max());\n const start = (from - this.min()) / range;\n const end = (to - this.min()) / range;\n from = Math.max(from, to);\n return end > start ? [{ color: zone.color, length: (end - start) * this.sweepLength(), offset: -start * this.sweepLength() }] : [];\n });\n });\n\n protected readonly bandRadius = computed(() => (this.classic() ? 46.5 : 47));\n protected readonly bandWidth = computed(() => (this.classic() ? 3 : 1.6));\n\n protected readonly needleLength = computed(() => (this.classic() ? 37 : 41));\n\n protected readonly readoutY = computed(() => ({ half: 58, wide: 72, full: 68 })[this.shape()]);\n protected readonly labelY = computed(() => ({ half: 66, wide: 79, full: 75 })[this.shape()]);\n\n /** Below the readout; on a half circle the unit stays next to the number, where there is more room */\n protected readonly caption = computed(() =>\n [this.shape() === 'half' ? '' : this.unit(), this.label()].filter(Boolean).join(' · '),\n );\n\n protected readonly text = computed(() => new Intl.NumberFormat(this.locale, { maximumFractionDigits: 1 }).format(this.clamped()));\n}\n","<svg [attr.viewBox]=\"viewBox()\" aria-hidden=\"true\">\n @if (classic()) {\n @if (shape() === 'half') {\n <path class=\"face\" d=\"M 1 50 A 49 49 0 0 1 99 50 L 99 66 Q 99 69 96 69 L 4 69 Q 1 69 1 66 Z\" />\n } @else {\n <circle class=\"face\" cx=\"50\" cy=\"50\" r=\"49\" />\n }\n } @else {\n <circle class=\"scale-track\" cx=\"50\" cy=\"50\" pathLength=\"100\" [attr.r]=\"bandRadius()\" [attr.stroke-width]=\"bandWidth()\" [attr.transform]=\"'rotate(' + rotation() + ' 50 50)'\" [attr.stroke-dasharray]=\"sweepLength() + ' 100'\" />\n }\n\n @for (band of bands(); track $index) {\n <circle\n class=\"band\"\n cx=\"50\"\n cy=\"50\"\n pathLength=\"100\"\n [attr.r]=\"bandRadius()\"\n [attr.stroke]=\"band.color\"\n [attr.stroke-width]=\"bandWidth()\"\n [attr.stroke-dasharray]=\"band.length + ' 100'\"\n [attr.stroke-dashoffset]=\"band.offset\"\n [attr.transform]=\"'rotate(' + rotation() + ' 50 50)'\"\n />\n }\n\n @for (tick of scale(); track $index) {\n <line class=\"tick\" [class.major]=\"tick.major\" [attr.x1]=\"tick.from.x\" [attr.y1]=\"tick.from.y\" [attr.x2]=\"tick.to.x\" [attr.y2]=\"tick.to.y\" />\n @if (tick.major && showNumbers()) {\n <text class=\"number\" [attr.x]=\"tick.label.x\" [attr.y]=\"tick.label.y\" text-anchor=\"middle\" dominant-baseline=\"central\">{{ tick.value }}</text>\n }\n }\n\n <g class=\"needle\" [class.animated]=\"animated()\" [style.--start.deg]=\"startAngle()\">\n @if (classic()) {\n <polygon class=\"blade\" [attr.points]=\"'48.4,50 51.6,50 50.35,' + (50 - needleLength()) + ' 49.65,' + (50 - needleLength())\" />\n <line class=\"tail\" x1=\"50\" y1=\"50\" x2=\"50\" y2=\"57\" />\n <circle class=\"hub\" cx=\"50\" cy=\"50\" r=\"3.6\" />\n } @else {\n <line class=\"blade\" x1=\"50\" y1=\"54\" x2=\"50\" [attr.y2]=\"50 - needleLength()\" />\n <circle class=\"hub\" cx=\"50\" cy=\"50\" r=\"2.2\" />\n }\n </g>\n\n @if (showReadout()) {\n <text class=\"readout\" x=\"50\" [attr.y]=\"readoutY()\" text-anchor=\"middle\">{{ text() }}@if (unit() && shape() === 'half') {<tspan class=\"unit\"> {{ unit() }}</tspan>}</text>\n }\n @if (caption()) {\n <text class=\"caption\" x=\"50\" [attr.y]=\"labelY()\" text-anchor=\"middle\">{{ caption() }}</text>\n }\n</svg>\n"],"mappings":";;;AA2BA,IAAa,cAAb,MAAa,YAAW;CACb,QAAQ,MAAM,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,QAA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AAA;;ADxBa,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAW,YAAA,CAAA;EAjBvB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAiB,iBAGV,wBAAwB;GAAM,MACzC;IACJ,MAAM;IACN,wBAAwB;IACxB,wBAAwB;IACxB,wBAAwB;IACxB,qBAAqB;IACrB,kBAAkB;IAClB,uBAAuB;IACvB,mBAAmB;IACnB,mBAAmB;GACpB;GAAA,UAAA;GAAA,QAAA,CAAA,i/DAAA;EAAA,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andi1986/angular-skeuomorphism-lib",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@andi1986/angular-ui-lib": "^0.0.13",
|
|
6
|
+
"@angular/common": "^22.1.0",
|
|
7
|
+
"@angular/core": "^22.1.0"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"tslib": "^2.3.0"
|
|
11
|
+
},
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"module": "fesm2022/andi1986-angular-skeuomorphism-lib.mjs",
|
|
14
|
+
"typings": "types/andi1986-angular-skeuomorphism-lib.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
"./package.json": {
|
|
17
|
+
"default": "./package.json"
|
|
18
|
+
},
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./types/andi1986-angular-skeuomorphism-lib.d.ts",
|
|
21
|
+
"default": "./fesm2022/andi1986-angular-skeuomorphism-lib.mjs"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"type": "module"
|
|
6
25
|
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { GaugeShape, GaugeZone } from "@andi1986/angular-ui-lib";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export type SpeedometerDesign = 'classic' | 'minimal';
|
|
4
|
+
/**
|
|
5
|
+
* Speedometer / tachometer: a needle over a numbered scale, with an optional colored band (`zones`) and a digital
|
|
6
|
+
* readout. `classic` is a dark dial with a bezel, `minimal` a thin scale without a face. The shape is a half circle,
|
|
7
|
+
* three quarters like a car dashboard (`wide`) or the full circle.
|
|
8
|
+
*/
|
|
9
|
+
export declare class Speedometer {
|
|
10
|
+
readonly value: import("@angular/core").InputSignal<number>;
|
|
11
|
+
readonly min: import("@angular/core").InputSignal<number>;
|
|
12
|
+
readonly max: import("@angular/core").InputSignal<number>;
|
|
13
|
+
readonly unit: import("@angular/core").InputSignal<string>;
|
|
14
|
+
/** Text under the readout, also the accessible name */
|
|
15
|
+
readonly label: import("@angular/core").InputSignal<string>;
|
|
16
|
+
readonly shape: import("@angular/core").InputSignal<GaugeShape>;
|
|
17
|
+
readonly design: import("@angular/core").InputSignal<SpeedometerDesign>;
|
|
18
|
+
/** Distance between the numbered ticks; by default a step that divides the scale into about ten parts */
|
|
19
|
+
readonly majorStep: import("@angular/core").InputSignal<number | undefined>;
|
|
20
|
+
/** Small ticks between two numbered ones */
|
|
21
|
+
readonly minorTicks: import("@angular/core").InputSignal<number>;
|
|
22
|
+
/** Colored band along the scale: each zone runs up to its `to` */
|
|
23
|
+
readonly zones: import("@angular/core").InputSignal<GaugeZone[]>;
|
|
24
|
+
readonly size: import("@angular/core").InputSignal<string>;
|
|
25
|
+
readonly showNumbers: import("@angular/core").InputSignal<boolean>;
|
|
26
|
+
readonly showReadout: import("@angular/core").InputSignal<boolean>;
|
|
27
|
+
/** Sweeps the needle from the start of the scale when it appears */
|
|
28
|
+
readonly animated: import("@angular/core").InputSignal<boolean>;
|
|
29
|
+
private readonly locale;
|
|
30
|
+
protected readonly sweep: import("@angular/core").Signal<number>;
|
|
31
|
+
protected readonly classic: import("@angular/core").Signal<boolean>;
|
|
32
|
+
protected readonly viewBox: import("@angular/core").Signal<"0 0 100 70" | "0 0 100 100">;
|
|
33
|
+
protected readonly rotation: import("@angular/core").Signal<number>;
|
|
34
|
+
protected readonly sweepLength: import("@angular/core").Signal<number>;
|
|
35
|
+
protected readonly clamped: import("@angular/core").Signal<number>;
|
|
36
|
+
protected readonly fraction: import("@angular/core").Signal<number>;
|
|
37
|
+
protected readonly angle: import("@angular/core").Signal<number>;
|
|
38
|
+
protected readonly startAngle: import("@angular/core").Signal<number>;
|
|
39
|
+
protected readonly scale: import("@angular/core").Signal<import("@andi1986/angular-ui-lib").GaugeTick[]>;
|
|
40
|
+
/** The colored band as pieces of one circle: a dash each, moved to where its zone starts. */
|
|
41
|
+
protected readonly bands: import("@angular/core").Signal<{
|
|
42
|
+
color: string;
|
|
43
|
+
length: number;
|
|
44
|
+
offset: number;
|
|
45
|
+
}[]>;
|
|
46
|
+
protected readonly bandRadius: import("@angular/core").Signal<46.5 | 47>;
|
|
47
|
+
protected readonly bandWidth: import("@angular/core").Signal<3 | 1.6>;
|
|
48
|
+
protected readonly needleLength: import("@angular/core").Signal<37 | 41>;
|
|
49
|
+
protected readonly readoutY: import("@angular/core").Signal<number>;
|
|
50
|
+
protected readonly labelY: import("@angular/core").Signal<number>;
|
|
51
|
+
/** Below the readout; on a half circle the unit stays next to the number, where there is more room */
|
|
52
|
+
protected readonly caption: import("@angular/core").Signal<string>;
|
|
53
|
+
protected readonly text: import("@angular/core").Signal<string>;
|
|
54
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<Speedometer, never>;
|
|
55
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<Speedometer, "lib-speedometer", never, {
|
|
56
|
+
"value": {
|
|
57
|
+
"alias": "value";
|
|
58
|
+
"required": false;
|
|
59
|
+
"isSignal": true;
|
|
60
|
+
};
|
|
61
|
+
"min": {
|
|
62
|
+
"alias": "min";
|
|
63
|
+
"required": false;
|
|
64
|
+
"isSignal": true;
|
|
65
|
+
};
|
|
66
|
+
"max": {
|
|
67
|
+
"alias": "max";
|
|
68
|
+
"required": false;
|
|
69
|
+
"isSignal": true;
|
|
70
|
+
};
|
|
71
|
+
"unit": {
|
|
72
|
+
"alias": "unit";
|
|
73
|
+
"required": false;
|
|
74
|
+
"isSignal": true;
|
|
75
|
+
};
|
|
76
|
+
"label": {
|
|
77
|
+
"alias": "label";
|
|
78
|
+
"required": false;
|
|
79
|
+
"isSignal": true;
|
|
80
|
+
};
|
|
81
|
+
"shape": {
|
|
82
|
+
"alias": "shape";
|
|
83
|
+
"required": false;
|
|
84
|
+
"isSignal": true;
|
|
85
|
+
};
|
|
86
|
+
"design": {
|
|
87
|
+
"alias": "design";
|
|
88
|
+
"required": false;
|
|
89
|
+
"isSignal": true;
|
|
90
|
+
};
|
|
91
|
+
"majorStep": {
|
|
92
|
+
"alias": "majorStep";
|
|
93
|
+
"required": false;
|
|
94
|
+
"isSignal": true;
|
|
95
|
+
};
|
|
96
|
+
"minorTicks": {
|
|
97
|
+
"alias": "minorTicks";
|
|
98
|
+
"required": false;
|
|
99
|
+
"isSignal": true;
|
|
100
|
+
};
|
|
101
|
+
"zones": {
|
|
102
|
+
"alias": "zones";
|
|
103
|
+
"required": false;
|
|
104
|
+
"isSignal": true;
|
|
105
|
+
};
|
|
106
|
+
"size": {
|
|
107
|
+
"alias": "size";
|
|
108
|
+
"required": false;
|
|
109
|
+
"isSignal": true;
|
|
110
|
+
};
|
|
111
|
+
"showNumbers": {
|
|
112
|
+
"alias": "showNumbers";
|
|
113
|
+
"required": false;
|
|
114
|
+
"isSignal": true;
|
|
115
|
+
};
|
|
116
|
+
"showReadout": {
|
|
117
|
+
"alias": "showReadout";
|
|
118
|
+
"required": false;
|
|
119
|
+
"isSignal": true;
|
|
120
|
+
};
|
|
121
|
+
"animated": {
|
|
122
|
+
"alias": "animated";
|
|
123
|
+
"required": false;
|
|
124
|
+
"isSignal": true;
|
|
125
|
+
};
|
|
126
|
+
}, {}, never, never, true, never>;
|
|
127
|
+
}
|
package/README.md
DELETED