Add more stuff.

pull/1/head
Atul Varma 2021-02-02 20:09:49 -05:00
rodzic 06dcf5fcfc
commit a4a1013a8c
7 zmienionych plików z 5072 dodań i 7 usunięć

2
.gitignore vendored
Wyświetl plik

@ -1 +1,3 @@
node_modules
dist
.cache

Wyświetl plik

@ -1,5 +1,5 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Mythic Symbolic</title>
<img src="svg/Cloud.svg">
<img src="svg/Crown.svg">
<h1>Mythic Symbolic</h1>
<script src="lib/browser-main.ts"></script>

Wyświetl plik

@ -0,0 +1 @@
console.log("SUP");

Wyświetl plik

@ -0,0 +1,38 @@
[
{
"name": "cloud",
"svg": "\n<path fill-rule=\"evenodd\" stroke-width=\"4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M 530.127 378.396 C 530.127 362.910 541.870 350.237 556.866 348.782 C 555.019 344.628 553.939 339.814 553.939 334.741 C 553.939 315.521 569.486 301.285 588.664 300.015 C 599.222 299.317 609.104 302.430 615.968 309.627 C 619.886 291.389 636.606 279.453 655.635 280.172 C 676.877 280.975 695.525 296.257 694.806 318.032 C 697.865 316.684 701.465 315.673 705.242 315.890 C 719.725 316.723 732.966 332.170 726.945 348.736 C 738.769 352.509 748.826 362.397 749.873 375.420 C 751.347 393.748 734.860 406.077 716.653 408.640 C 706.113 410.124 695.894 408.328 689.488 400.888 C 685.351 405.185 679.808 409.419 673.183 409.523 C 668.877 409.590 664.985 407.515 661.649 405.432 C 652.690 419.185 636.339 423.005 619.421 421.059 C 603.967 419.280 590.052 413.503 582.972 400.447 C 576.931 406.107 568.701 408.669 559.892 408.160 C 543.445 407.212 530.127 394.871 530.127 378.396 Z\"></path>\n"
},
{
"name": "crown",
"svg": "\n<path stroke-width=\"4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M 544.119 349.835 C 544.128 349.834 601.152 341.549 640.422 341.567 C 679.350 341.585 704.062 347.079 735.881 349.835 C 735.872 349.836 685.414 358.558 642.014 358.658 C 596.767 358.762 544.128 349.836 544.119 349.835 C 544.117 349.828 526.264 281.958 526.262 281.952 C 526.267 281.955 569.630 319.496 569.635 319.500 C 569.636 319.495 583.130 271.345 583.131 271.340 C 583.134 271.344 614.714 310.517 614.717 310.521 C 614.720 310.515 639.997 250.940 640.000 250.934 C 640.003 250.940 665.280 310.515 665.283 310.521 C 665.286 310.517 696.866 271.344 696.869 271.340 C 696.870 271.345 710.364 319.495 710.365 319.500 C 710.370 319.496 753.733 281.955 753.738 281.952 C 753.736 281.958 735.883 349.828 735.881 349.835 \"></path>\n"
},
{
"name": "eye",
"svg": "\n<path fill-rule=\"evenodd\" stroke-width=\"4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M 640.000 320.941 C 706.103 320.941 731.127 359.996 731.136 360.000 C 731.127 360.004 706.103 399.059 640.000 399.059 C 573.898 399.059 548.873 360.004 548.864 360.000 C 548.873 359.996 573.898 320.941 640.000 320.941 Z\"></path>\n<path fill-rule=\"evenodd\" stroke-width=\"4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M 640.000 327.761 C 657.844 327.761 672.239 342.156 672.239 360.000 C 672.239 377.844 657.844 392.239 640.000 392.239 C 622.156 392.239 607.761 377.844 607.761 360.000 C 607.761 342.156 622.156 327.761 640.000 327.761 Z\"></path>\n<path fill-rule=\"evenodd\" stroke-width=\"4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M 640.000 339.602 C 651.290 339.602 660.398 348.710 660.398 360.000 C 660.398 371.290 651.290 380.398 640.000 380.398 C 628.710 380.398 619.602 371.290 619.602 360.000 C 619.602 348.710 628.710 339.602 640.000 339.602 Z\"></path>\n"
},
{
"name": "fire",
"svg": "\n<path fill-rule=\"evenodd\" stroke-width=\"4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M 640.094 360.248 C 608.659 360.360 582.818 326.776 617.211 297.890 C 610.936 320.093 617.878 330.180 622.932 326.495 C 633.297 318.936 628.575 292.722 619.499 281.300 C 613.373 273.589 618.901 258.092 626.936 254.984 C 618.456 265.415 625.796 273.942 629.797 283.016 C 629.769 268.721 637.315 269.608 639.522 261.849 C 642.989 249.667 641.286 240.859 634.374 231.528 C 652.118 236.818 652.325 258.699 648.676 276.723 C 647.310 283.467 643.606 293.607 650.964 299.034 C 656.801 303.340 665.310 285.953 660.118 279.584 C 688.372 293.762 644.201 317.985 658.973 327.639 C 669.592 334.578 669.221 316.127 676.708 309.904 C 686.558 335.536 676.322 360.119 640.094 360.248 Z\"></path>\n"
},
{
"name": "hand",
"svg": "\n<path fill-rule=\"evenodd\" stroke-width=\"4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M 640.817 437.258 C 625.637 437.793 600.842 431.925 591.680 424.908 C 576.050 412.938 559.603 391.465 556.245 385.438 C 553.357 380.257 539.630 350.903 534.401 341.243 C 528.618 330.561 511.419 314.145 512.560 308.094 C 513.411 303.587 524.914 300.975 529.820 303.148 C 537.162 306.402 544.867 314.778 546.846 316.465 C 554.631 323.101 571.223 355.190 576.919 354.113 C 583.492 352.870 587.210 341.535 589.449 335.318 C 591.289 330.210 590.953 295.633 590.702 290.210 C 590.419 284.080 585.041 244.224 584.490 239.588 C 584.011 235.563 577.665 200.635 579.425 195.608 C 580.000 193.966 582.188 185.093 588.746 184.552 C 594.314 184.093 597.406 189.517 598.220 190.596 C 601.582 195.048 605.803 232.031 606.744 236.170 C 607.695 240.354 613.766 279.093 618.895 281.439 C 619.661 281.789 625.153 280.741 625.786 280.186 C 629.938 276.547 629.565 238.673 629.815 234.480 C 630.102 229.666 628.184 187.272 631.425 181.825 C 632.150 180.606 634.955 174.420 640.815 174.700 C 645.949 174.945 648.919 180.643 649.593 181.825 C 652.661 187.203 650.907 228.559 651.180 233.262 C 651.434 237.624 650.873 277.075 655.232 280.812 C 655.985 281.458 662.501 282.531 663.377 282.065 C 667.844 279.688 670.227 244.469 670.892 240.676 C 671.545 236.955 674.772 203.938 677.786 199.993 C 678.652 198.860 682.816 192.592 687.980 193.935 C 692.822 195.194 695.498 203.991 695.954 205.632 C 697.272 210.364 690.988 242.396 690.698 246.122 C 690.326 250.896 686.264 292.991 689.462 298.411 C 689.925 299.196 694.653 303.035 695.556 302.911 C 700.718 302.199 705.376 264.811 706.214 260.936 C 706.914 257.699 710.329 229.607 712.642 225.338 C 713.273 224.174 718.046 219.232 722.421 220.300 C 726.564 221.311 729.345 228.662 729.786 230.066 C 731.471 235.430 724.120 272.145 723.564 276.387 C 722.498 284.531 715.336 355.048 712.244 365.390 C 710.092 372.585 702.846 407.644 685.480 421.775 C 669.336 434.912 651.892 436.867 640.817 437.258 Z\"></path>\n"
},
{
"name": "heart",
"svg": "\n<path fill-rule=\"evenodd\" stroke-width=\"4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M 639.403 420.455 C 639.399 420.452 617.344 400.043 605.844 388.922 C 591.949 375.484 575.619 360.694 575.279 339.776 C 575.009 323.237 582.378 303.711 597.082 299.545 C 629.348 290.402 639.399 321.498 639.403 321.501 C 639.407 321.498 650.006 289.943 682.918 299.545 C 697.590 303.825 704.991 323.237 704.722 339.776 C 704.381 360.694 688.878 376.396 674.156 388.922 C 661.008 400.108 639.406 420.452 639.403 420.455 Z\"></path>\n"
},
{
"name": "lightning",
"svg": "\n<path fill-rule=\"evenodd\" stroke-width=\"4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M 638.518 312.089 C 638.516 312.094 613.331 362.958 613.328 362.964 C 613.330 362.964 632.589 362.964 632.591 362.964 C 632.589 362.969 608.885 413.339 608.883 413.344 C 608.888 413.338 658.764 349.634 658.769 349.628 C 658.767 349.628 637.533 348.640 637.530 348.640 C 637.534 348.636 671.114 306.660 671.117 306.656 C 671.114 306.656 638.522 312.089 638.518 312.089 Z\"></path>\n"
},
{
"name": "teardrop",
"svg": "\n<path fill-rule=\"evenodd\" stroke-width=\"4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M 640.000 359.270 C 640.002 359.275 642.649 382.543 656.579 413.707 C 669.780 443.240 656.575 459.999 640.000 459.926 C 625.212 459.861 610.271 444.383 623.421 413.707 C 636.756 382.598 639.998 359.275 640.000 359.270 Z\"></path>\n"
},
{
"name": "wingR",
"svg": "\n<path fill-rule=\"evenodd\" stroke-width=\"4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M 640.000 358.901 C 640.003 358.899 657.890 352.150 667.846 337.664 C 681.541 317.736 669.339 307.572 677.231 295.680 C 681.849 288.721 693.143 286.097 709.590 276.753 C 737.402 260.951 756.702 250.269 759.312 253.837 C 761.768 257.195 754.036 272.125 746.074 278.213 C 737.396 284.849 719.862 291.836 719.860 291.838 C 719.862 291.837 746.872 281.684 749.049 285.596 C 750.587 288.359 744.437 298.064 737.236 303.056 C 731.051 307.343 715.670 312.179 715.668 312.180 C 715.671 312.180 741.849 306.421 743.337 310.306 C 744.404 313.094 736.856 322.705 729.869 324.964 C 717.977 328.809 707.042 330.632 707.039 330.633 C 707.042 330.633 731.300 330.063 732.177 333.761 C 732.791 336.349 726.320 344.500 719.101 345.744 C 711.626 347.032 698.483 346.544 698.481 346.544 C 698.483 346.545 719.423 348.202 721.463 352.848 C 722.173 354.467 717.723 359.673 708.353 362.356 C 698.039 365.309 690.075 360.385 690.073 360.384 C 690.074 360.386 705.679 368.161 704.891 370.757 C 703.888 374.063 697.042 375.948 689.579 375.202 C 684.115 374.657 673.775 368.782 673.773 368.781 C 673.775 368.783 692.128 379.048 688.591 383.105 C 686.981 384.951 676.630 384.516 672.291 382.117 C 669.277 380.451 657.969 372.240 657.968 372.239 C 657.968 372.240 666.419 385.592 663.895 386.069 C 657.469 387.282 651.992 384.252 647.595 380.636 C 644.743 378.290 640.001 370.263 640.000 370.261 C 640.000 370.260 640.000 358.902 640.000 358.901 Z\"></path>\n"
}
]

Wyświetl plik

@ -2,18 +2,27 @@ import fs from "fs";
import path from "path";
import cheerio from "cheerio";
export type Symbol = {
name: string;
svg: string;
};
export type SerializedVocabulary = Symbol[];
const MY_DIR = __dirname;
const SVG_DIR = path.join(MY_DIR, "..", "svg");
const VOCAB_PATH = path.join(MY_DIR, "svg-vocabulary.json");
function removeAttr(attr: string, $: cheerio.Root, g: cheerio.Cheerio) {
const items = g.find(`[${attr}]`);
items.each(function (this: any, i, el) {
$((this)).removeAttr(attr);
$(this).removeAttr(attr);
});
}
export function build() {
const filenames = fs.readdirSync(SVG_DIR);
const vocab: SerializedVocabulary = [];
for (let filename of filenames) {
if (path.extname(filename) === ".svg") {
const svgMarkup = fs.readFileSync(path.join(SVG_DIR, filename), {
@ -21,9 +30,24 @@ export function build() {
});
const $ = cheerio.load(svgMarkup);
const g = $("svg > g");
removeAttr('fill', $, g);
removeAttr('stroke', $, g);
console.log(filename, g.html());
removeAttr("fill", $, g);
removeAttr("stroke", $, g);
const name = g.attr('id');
if (!name) {
throw new Error(`${filename} has no <g> with an 'id' attribute!`);
}
const svg = g.html();
if (!svg) {
throw new Error(`${filename} has no <g> with child elements!`);
}
const symbol: Symbol = {
name,
svg,
};
vocab.push(symbol);
}
}
console.log(`Writing ${VOCAB_PATH}.`);
fs.writeFileSync(VOCAB_PATH, JSON.stringify(vocab, null, 2));
}

4999
package-lock.json wygenerowano

Plik diff jest za duży Load Diff

Wyświetl plik

@ -4,7 +4,7 @@
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"parcel": "parcel index.html"
},
"author": "",
"license": "ISC",
@ -16,6 +16,7 @@
"@types/cheerio": "^0.22.23",
"@types/node": "^14.14.22",
"cheerio": "^1.0.0-rc.5",
"parcel-bundler": "^1.12.4",
"prettier": "^2.2.1",
"typescript": "^4.1.3"
}