@jannchie/icons 0.3.0 → 0.4.0
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.
- package/dist/all.js +30 -0
- package/dist/icons/c.js +8 -0
- package/dist/icons/cpp.js +8 -0
- package/dist/icons/csharp.js +8 -0
- package/dist/icons/golang.js +8 -0
- package/dist/icons/haskell.js +8 -0
- package/dist/icons/java.js +8 -0
- package/dist/icons/javascript.js +8 -0
- package/dist/icons/kotlin.js +8 -0
- package/dist/icons/lua.js +8 -0
- package/dist/icons/php.js +8 -0
- package/dist/icons/python.js +8 -0
- package/dist/icons/ruby.js +8 -0
- package/dist/icons/rust.js +8 -0
- package/dist/icons/swift.js +8 -0
- package/dist/icons/typescript.js +8 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +16 -1
- package/dist/src/battery.js +22 -1
- package/dist/src/cc.js +2 -1
- package/dist/src/controller.js +5 -2
- package/dist/src/icons/api.js +2 -2
- package/dist/src/icons/battery-full.js +1 -1
- package/dist/src/icons/battery-low.js +1 -1
- package/dist/src/icons/battery-medium.js +1 -1
- package/dist/src/icons/bee.js +3 -2
- package/dist/src/icons/bike.js +5 -13
- package/dist/src/icons/billiards.js +2 -2
- package/dist/src/icons/bingo.js +2 -2
- package/dist/src/icons/c.js +12 -0
- package/dist/src/icons/card-plus-four.js +2 -2
- package/dist/src/icons/card-plus-two.js +2 -2
- package/dist/src/icons/cat.js +4 -3
- package/dist/src/icons/cpp.js +21 -0
- package/dist/src/icons/csharp.js +17 -0
- package/dist/src/icons/element.js +3 -3
- package/dist/src/icons/fog.js +2 -2
- package/dist/src/icons/golang.js +10 -0
- package/dist/src/icons/haskell.js +10 -0
- package/dist/src/icons/html.js +6 -2
- package/dist/src/icons/java.js +10 -0
- package/dist/src/icons/javascript.js +14 -0
- package/dist/src/icons/json.js +2 -2
- package/dist/src/icons/kotlin.js +15 -0
- package/dist/src/icons/list-ordered.js +4 -3
- package/dist/src/icons/lua.js +9 -0
- package/dist/src/icons/medal-1.js +2 -2
- package/dist/src/icons/medal-2.js +2 -2
- package/dist/src/icons/medal-3.js +2 -2
- package/dist/src/icons/microscope.js +10 -10
- package/dist/src/icons/mushroom.js +5 -5
- package/dist/src/icons/php.js +8 -0
- package/dist/src/icons/pig.js +4 -3
- package/dist/src/icons/python.js +25 -0
- package/dist/src/icons/ruby.js +16 -0
- package/dist/src/icons/rust.js +16 -0
- package/dist/src/icons/scooter.js +3 -8
- package/dist/src/icons/sudoku.js +2 -2
- package/dist/src/icons/swift.js +4 -0
- package/dist/src/icons/tag-0.js +2 -2
- package/dist/src/icons/tag-1.js +2 -2
- package/dist/src/icons/tag-2.js +2 -2
- package/dist/src/icons/tag-3.js +2 -2
- package/dist/src/icons/tag-4.js +2 -2
- package/dist/src/icons/tag-5.js +2 -2
- package/dist/src/icons/tag-6.js +2 -2
- package/dist/src/icons/tag-7.js +2 -2
- package/dist/src/icons/tag-8.js +2 -2
- package/dist/src/icons/tag-9.js +2 -2
- package/dist/src/icons/tag-a.js +2 -2
- package/dist/src/icons/tag-b.js +2 -2
- package/dist/src/icons/tag-c.js +2 -2
- package/dist/src/icons/tag-d.js +2 -2
- package/dist/src/icons/tag-e.js +2 -2
- package/dist/src/icons/tag-f.js +2 -2
- package/dist/src/icons/tag-g.js +2 -2
- package/dist/src/icons/tag-h.js +2 -2
- package/dist/src/icons/tag-i.js +2 -2
- package/dist/src/icons/tag-j.js +2 -2
- package/dist/src/icons/tag-k.js +2 -2
- package/dist/src/icons/tag-l.js +2 -2
- package/dist/src/icons/tag-m.js +2 -2
- package/dist/src/icons/tag-n.js +2 -2
- package/dist/src/icons/tag-o.js +2 -2
- package/dist/src/icons/tag-p.js +2 -2
- package/dist/src/icons/tag-q.js +2 -2
- package/dist/src/icons/tag-r.js +2 -2
- package/dist/src/icons/tag-s.js +2 -2
- package/dist/src/icons/tag-t.js +2 -2
- package/dist/src/icons/tag-u.js +2 -2
- package/dist/src/icons/tag-v.js +2 -2
- package/dist/src/icons/tag-w.js +2 -2
- package/dist/src/icons/tag-x.js +2 -2
- package/dist/src/icons/tag-y.js +2 -2
- package/dist/src/icons/tag-z.js +2 -2
- package/dist/src/icons/taxi.js +1 -1
- package/dist/src/icons/traffic-cone.js +9 -8
- package/dist/src/icons/typescript.js +14 -0
- package/dist/src/laundry.js +3 -3
- package/dist/src/letters.js +35 -16
- package/dist/src/license.js +3 -3
- package/dist/src/loading.js +3 -3
- package/dist/src/quality.js +3 -3
- package/dist/src/rate.js +3 -3
- package/dist/src/rating.js +15 -12
- package/dist/src/resin.js +3 -3
- package/dist/src/scene.js +5 -1
- package/dist/src/sensor.js +7 -6
- package/dist/src/symbols.js +35 -22
- package/dist/src/unit.js +2 -2
- package/package.json +1 -1
package/dist/src/quality.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { rounded } from "./geometry.js";
|
|
2
|
-
import { line } from "./letters.js";
|
|
2
|
+
import { LABEL, line, snap } from "./letters.js";
|
|
3
3
|
//#region src/quality.js
|
|
4
4
|
var H = 1.2;
|
|
5
5
|
var widthOf = (n) => n > 2 ? .85 : 1.2;
|
|
@@ -48,9 +48,9 @@ function quality(text, radius) {
|
|
|
48
48
|
[21.5, 5.5],
|
|
49
49
|
[21.5, 18.5],
|
|
50
50
|
[2.5, 18.5]
|
|
51
|
-
], Math.min(radius, 2.5)), ...line(text, [12, 12], widthOf(text.length), GAP, H).map((d) => ({
|
|
51
|
+
], Math.min(radius, 2.5)), ...snap(line(text, [12, 12], widthOf(text.length), GAP, H, LABEL)).map((d) => ({
|
|
52
52
|
d,
|
|
53
|
-
|
|
53
|
+
thin: true
|
|
54
54
|
}))];
|
|
55
55
|
}
|
|
56
56
|
//#endregion
|
package/dist/src/rate.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { dot } from "./scene.js";
|
|
2
|
-
import { advance, glyph, shift, snap } from "./letters.js";
|
|
2
|
+
import { LABEL, advance, glyph, shift, snap } from "./letters.js";
|
|
3
3
|
//#region src/rate.js
|
|
4
4
|
var H = 7;
|
|
5
5
|
var TOP = 12 - H / 2;
|
|
@@ -31,8 +31,8 @@ function rate(text) {
|
|
|
31
31
|
out.push(dot(x + POINT / 2, 15.25));
|
|
32
32
|
x += POINT;
|
|
33
33
|
} else {
|
|
34
|
-
out.push(glyph(c, x - shift(c) * sx, TOP, sx, sy));
|
|
35
|
-
x += advance(c) * sx;
|
|
34
|
+
out.push(glyph(c, x - shift(c, LABEL) * sx, TOP, sx, sy, LABEL));
|
|
35
|
+
x += advance(c, LABEL) * sx;
|
|
36
36
|
}
|
|
37
37
|
x += gapAfter(i);
|
|
38
38
|
});
|
package/dist/src/rating.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { circle, rounded } from "./geometry.js";
|
|
2
|
-
import { line, textWidth } from "./letters.js";
|
|
2
|
+
import { LABEL, line, snap, textWidth } from "./letters.js";
|
|
3
3
|
import { tagShape } from "./marks.js";
|
|
4
4
|
//#region src/rating.js
|
|
5
5
|
var sq = (x0, y0, x1, y1) => [
|
|
@@ -21,9 +21,9 @@ var FRAMES = {
|
|
|
21
21
|
tall: {
|
|
22
22
|
shape: (r) => rounded(sq(3.5, 2.5, 20.5, 21.5), Math.min(r, 2.5)),
|
|
23
23
|
box: [
|
|
24
|
-
|
|
24
|
+
6.5,
|
|
25
25
|
5,
|
|
26
|
-
17,
|
|
26
|
+
17.5,
|
|
27
27
|
19
|
|
28
28
|
]
|
|
29
29
|
},
|
|
@@ -265,26 +265,29 @@ var SYSTEMS = {
|
|
|
265
265
|
}
|
|
266
266
|
};
|
|
267
267
|
var GAP = 2;
|
|
268
|
+
var ROW_GAP = 3;
|
|
268
269
|
var PLUS = 3;
|
|
269
270
|
var PLUS_GAP = 2;
|
|
270
271
|
var MAX_SY = 1.2;
|
|
271
272
|
var ASPECT = .95;
|
|
272
273
|
function layout(rows, [x0, y0, x1, y1]) {
|
|
273
274
|
const extra = (r) => r.plus ? 5 : 0;
|
|
274
|
-
const sy = Math.min(MAX_SY, (y1 - y0 -
|
|
275
|
-
const sx = Math.min(sy * ASPECT, ...rows.map((r) => (x1 - x0 - extra(r) - GAP * (r.chars.length - 1)) / textWidth(r.chars, 1, 0)));
|
|
275
|
+
const sy = Math.min(MAX_SY, (y1 - y0 - ROW_GAP * (rows.length - 1)) / (6 * rows.length));
|
|
276
|
+
const sx = Math.min(sy * ASPECT, ...rows.map((r) => (x1 - x0 - extra(r) - GAP * (r.chars.length - 1)) / textWidth(r.chars, 1, 0, LABEL)));
|
|
276
277
|
const h = 6 * sy;
|
|
277
|
-
const top = (y0 + y1) / 2 - (h * rows.length +
|
|
278
|
+
const top = (y0 + y1) / 2 - (h * rows.length + ROW_GAP * (rows.length - 1)) / 2;
|
|
278
279
|
return rows.flatMap((r, i) => {
|
|
279
|
-
const width = textWidth(r.chars, sx, GAP);
|
|
280
|
+
const width = textWidth(r.chars, sx, GAP, LABEL);
|
|
280
281
|
const left = (x0 + x1) / 2 - (width + extra(r)) / 2;
|
|
281
|
-
const y = top + i * (h +
|
|
282
|
-
const out = line(r.chars, [left + width / 2, y + h / 2], sx, GAP, sy);
|
|
282
|
+
const y = top + i * (h + ROW_GAP);
|
|
283
|
+
const out = line(r.chars, [left + width / 2, y + h / 2], sx, GAP, sy, LABEL);
|
|
284
|
+
const row = snap(out);
|
|
283
285
|
if (r.plus) {
|
|
284
|
-
const
|
|
285
|
-
|
|
286
|
+
const half = (v) => Math.round(v - .5) + .5;
|
|
287
|
+
const [px, py] = [half(left + width + PLUS_GAP + PLUS / 2), half(y + PLUS / 2)];
|
|
288
|
+
row.push(`M${px - PLUS / 2} ${py}H${px + PLUS / 2}M${px} ${py - PLUS / 2}V${py + PLUS / 2}`);
|
|
286
289
|
}
|
|
287
|
-
return
|
|
290
|
+
return row;
|
|
288
291
|
});
|
|
289
292
|
}
|
|
290
293
|
function rating(system, text, radius) {
|
package/dist/src/resin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { crisp, rounded } from "./geometry.js";
|
|
2
|
-
import { line } from "./letters.js";
|
|
2
|
+
import { LABEL, line, snap } from "./letters.js";
|
|
3
3
|
//#region src/resin.js
|
|
4
4
|
var V = [
|
|
5
5
|
[12, 3],
|
|
@@ -44,9 +44,9 @@ var RESIN = Object.fromEntries([
|
|
|
44
44
|
0,
|
|
45
45
|
1,
|
|
46
46
|
2
|
|
47
|
-
].flatMap((k) => arrow(k, radius)), ...line(n, [12, 14]).map((d) => ({
|
|
47
|
+
].flatMap((k) => arrow(k, radius)), ...snap(line(n, [12, 14], 1, 1.5, 1, LABEL)).map((d) => ({
|
|
48
48
|
d,
|
|
49
|
-
|
|
49
|
+
thin: true
|
|
50
50
|
}))]
|
|
51
51
|
}]));
|
|
52
52
|
//#endregion
|
package/dist/src/scene.js
CHANGED
|
@@ -17,5 +17,9 @@ var opening = (cx, w, h) => [
|
|
|
17
17
|
[cx + w / 2, 20 - h],
|
|
18
18
|
[cx + w / 2, GROUND]
|
|
19
19
|
];
|
|
20
|
+
var softEar = (a, t, b, k = 1.3) => {
|
|
21
|
+
const c = (p) => [p[0] + (t[0] - p[0]) * k, p[1] + (t[1] - p[1]) * k].map((v) => +v.toFixed(3)).join(" ");
|
|
22
|
+
return `C${c(a)} ${c(b)} ${b.map((v) => +v.toFixed(3)).join(" ")}`;
|
|
23
|
+
};
|
|
20
24
|
//#endregion
|
|
21
|
-
export { GROUND, dot, eye, groundLine, opening };
|
|
25
|
+
export { GROUND, dot, eye, groundLine, opening, softEar };
|
package/dist/src/sensor.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { line, textWidth } from "./letters.js";
|
|
1
|
+
import { LABEL, line, snap, textWidth } from "./letters.js";
|
|
2
2
|
//#region src/sensor.js
|
|
3
3
|
var L = 2.5;
|
|
4
4
|
var [X0, Y0, X1, Y1] = [
|
|
@@ -13,11 +13,12 @@ var cropMarks = () => [
|
|
|
13
13
|
`M${X1} ${Y1 - L}V${Y1}H${X1 - L}`,
|
|
14
14
|
`M${X0 + L} ${Y1}H${X0}V${Y1 - L}`
|
|
15
15
|
];
|
|
16
|
-
var SPAN =
|
|
17
|
-
var GAP =
|
|
16
|
+
var SPAN = 14;
|
|
17
|
+
var GAP = 2;
|
|
18
|
+
var SY = 5 / 6;
|
|
18
19
|
var label = (text) => {
|
|
19
|
-
const sx = Math.min(1, (SPAN - GAP * (text.length - 1)) / textWidth(text, 1, 0));
|
|
20
|
-
return line(text, [12, 12], sx, GAP,
|
|
20
|
+
const sx = Math.min(1, (SPAN - GAP * (text.length - 1)) / textWidth(text, 1, 0, LABEL));
|
|
21
|
+
return snap(line(text, [12, 12], sx, GAP, SY, LABEL)).map((d) => ({
|
|
21
22
|
d,
|
|
22
23
|
thin: true
|
|
23
24
|
}));
|
|
@@ -41,7 +42,7 @@ var SENSORS = {
|
|
|
41
42
|
},
|
|
42
43
|
"one-inch": {
|
|
43
44
|
zh: "1 英寸",
|
|
44
|
-
paths: () => [...line("1", [10.5, 12], 1, GAP,
|
|
45
|
+
paths: () => snap([...line("1", [10.5, 12], 1, GAP, SY, LABEL), "M13.5 9.5V11.5M15.5 9.5V11.5"]).map((d) => ({
|
|
45
46
|
d,
|
|
46
47
|
thin: true
|
|
47
48
|
}))
|
package/dist/src/symbols.js
CHANGED
|
@@ -31,7 +31,7 @@ var cornerScale = Object.fromEntries(Object.entries({
|
|
|
31
31
|
gauge: 1,
|
|
32
32
|
lock: 1,
|
|
33
33
|
code: 1,
|
|
34
|
-
search:
|
|
34
|
+
search: .85,
|
|
35
35
|
heart: 1,
|
|
36
36
|
question: 1,
|
|
37
37
|
exclaim: 1,
|
|
@@ -91,10 +91,10 @@ var outlines = {
|
|
|
91
91
|
ring: { circle: 3 },
|
|
92
92
|
star: { circle: 3.45 },
|
|
93
93
|
cloud: { box: [
|
|
94
|
-
-3.
|
|
95
|
-
-
|
|
94
|
+
-3.66,
|
|
95
|
+
-1.66,
|
|
96
96
|
3.6,
|
|
97
|
-
2.
|
|
97
|
+
2.67
|
|
98
98
|
] },
|
|
99
99
|
shield: { box: [
|
|
100
100
|
-3.01,
|
|
@@ -334,19 +334,24 @@ var drawStar = ([x, y], k = 1, radius = 0) => {
|
|
|
334
334
|
};
|
|
335
335
|
var cloudCircles = [
|
|
336
336
|
[
|
|
337
|
-
-
|
|
338
|
-
.
|
|
339
|
-
|
|
337
|
+
-2.68,
|
|
338
|
+
1.67,
|
|
339
|
+
.98
|
|
340
340
|
],
|
|
341
341
|
[
|
|
342
|
-
.
|
|
343
|
-
|
|
344
|
-
|
|
342
|
+
-1.11,
|
|
343
|
+
.29,
|
|
344
|
+
1.57
|
|
345
345
|
],
|
|
346
346
|
[
|
|
347
|
-
2,
|
|
348
347
|
1.05,
|
|
349
|
-
1
|
|
348
|
+
.1,
|
|
349
|
+
1.76
|
|
350
|
+
],
|
|
351
|
+
[
|
|
352
|
+
2.42,
|
|
353
|
+
1.49,
|
|
354
|
+
1.18
|
|
350
355
|
]
|
|
351
356
|
];
|
|
352
357
|
var cloudFillet = .5;
|
|
@@ -366,23 +371,31 @@ function arcTo([cx, cy, r], from, to) {
|
|
|
366
371
|
return `A${r} ${r} 0 ${((Math.atan2(to[1] - cy, to[0] - cx) - a0) % (2 * Math.PI) + 2 * Math.PI) % (2 * Math.PI) > Math.PI ? 1 : 0} 1 ${to[0]} ${to[1]}`;
|
|
367
372
|
}
|
|
368
373
|
function cloudTop([x, y], k) {
|
|
369
|
-
const
|
|
374
|
+
const cs = cloudCircles.map(([cx, cy, r]) => [
|
|
370
375
|
x + cx * k,
|
|
371
376
|
y + cy * k,
|
|
372
377
|
r * k
|
|
373
378
|
]);
|
|
374
379
|
const f = cloudFillet * k;
|
|
375
|
-
const p1 = upperIntersection(left, mid);
|
|
376
|
-
const p2 = upperIntersection(mid, right);
|
|
377
|
-
const l1 = pointOn(left, angleOn(left, p1) - f / left[2]);
|
|
378
|
-
const m1 = pointOn(mid, angleOn(mid, p1) + f / mid[2]);
|
|
379
|
-
const m2 = pointOn(mid, angleOn(mid, p2) - f / mid[2]);
|
|
380
|
-
const r1 = pointOn(right, angleOn(right, p2) + f / right[2]);
|
|
381
|
-
const start = [left[0], left[1] + left[2]];
|
|
382
|
-
const end = [right[0], right[1] + right[2]];
|
|
383
380
|
const pt = (p) => `${p[0]} ${p[1]}`;
|
|
381
|
+
const start = [cs[0][0], cs[0][1] + cs[0][2]];
|
|
382
|
+
const end = [cs.at(-1)[0], cs.at(-1)[1] + cs.at(-1)[2]];
|
|
383
|
+
let arcs = "";
|
|
384
|
+
let from = start;
|
|
385
|
+
cs.forEach((c, i) => {
|
|
386
|
+
const next = cs[i + 1];
|
|
387
|
+
if (!next) {
|
|
388
|
+
arcs += arcTo(c, from, end);
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
const p = upperIntersection(c, next);
|
|
392
|
+
const out = pointOn(c, angleOn(c, p) - f / c[2]);
|
|
393
|
+
const into = pointOn(next, angleOn(next, p) + f / next[2]);
|
|
394
|
+
arcs += `${arcTo(c, from, out)}Q${pt(p)} ${pt(into)}`;
|
|
395
|
+
from = into;
|
|
396
|
+
});
|
|
384
397
|
return {
|
|
385
|
-
arcs
|
|
398
|
+
arcs,
|
|
386
399
|
start,
|
|
387
400
|
end
|
|
388
401
|
};
|
package/dist/src/unit.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { dot } from "./scene.js";
|
|
2
2
|
import { circle, crisp, rounded } from "./geometry.js";
|
|
3
|
-
import { line, snap } from "./letters.js";
|
|
3
|
+
import { LABEL, line, snap } from "./letters.js";
|
|
4
4
|
//#region src/unit.js
|
|
5
5
|
var [X0, Y0, X1, Y1] = [
|
|
6
6
|
3.5,
|
|
@@ -17,7 +17,7 @@ var cross = [`M${X0} ${Y0}L${X1} ${Y1}`, `M${X1} ${Y0}L${X0} ${Y1}`];
|
|
|
17
17
|
var track = `M9.5 9.5H15.5A3 3 0 0 1 15.5 15.5H9.5A3 3 0 0 1 9.5 9.5Z`;
|
|
18
18
|
var wings = `M9.5 ${Y1}A1.5 1.5 0 0 1 ${CX} ${Y1}A1.5 1.5 0 0 1 15.5 ${Y1}`;
|
|
19
19
|
var slash = `M${X0} ${Y1}L${X1} ${Y0}`;
|
|
20
|
-
var text = (str) => [snap(line(str, [CX, CY], 1, 2, 1))].flat().map((d) => ({
|
|
20
|
+
var text = (str) => [snap(line(str, [CX, CY], 1, 2, 1, LABEL))].flat().map((d) => ({
|
|
21
21
|
d,
|
|
22
22
|
thin: true
|
|
23
23
|
}));
|
package/package.json
CHANGED