Compare commits

...

10 commits

42 changed files with 1574 additions and 261 deletions

View file

@ -1,8 +1,36 @@
import { defineConfig } from 'astro/config';
import compress from "astro-compress";
import remarkPostMeta from './remark-post-meta.mjs';
import remarkUnwrapImages from 'remark-unwrap-images';
import { rehypeHeadingIds } from '@astrojs/markdown-remark';
import rehypeSlug from 'rehype-slug';
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
import rehypeFigure from 'rehype-figure';
// https://astro.build/config
export default defineConfig({
integrations: [compress()]
integrations: [compress()],
build: {
format: "directory"
},
markdown: {
syntaxHighlight: "shiki",
remarkPlugins: [
remarkPostMeta,
remarkUnwrapImages,
],
rehypePlugins: [
rehypeSlug,
rehypeHeadingIds,
[
rehypeAutolinkHeadings,
{ behavior: "append" },
],
[
rehypeFigure,
{ className: "rehype-figure" },
],
],
},
});

9
dc09.js Normal file
View file

@ -0,0 +1,9 @@
/*
* If you are looking for the `dc09.js` script
* that was used to minify sources of
* my old website, see
* https://git.dc09.ru/DarkCat09/dc09.ru-old/src/branch/main/dc09.js
*
* Recently the website was rewritten in Astro,
* so I don't use that script anymore
*/

399
package-lock.json generated
View file

@ -9,7 +9,13 @@
"dependencies": {
"astro": "^2.3.0",
"astro-compress": "^1.1.42",
"less": "^4.1.3"
"less": "^4.1.3",
"mdast-util-to-string": "^3.2.0",
"reading-time": "^1.5.0",
"rehype-autolink-headings": "^6.1.1",
"rehype-figure": "^1.0.1",
"rehype-slug": "^5.1.0",
"remark-unwrap-images": "^3.0.1"
}
},
"node_modules/@ampproject/remapping": {
@ -2507,6 +2513,40 @@
"url": "https://opencollective.com/unified"
}
},
"node_modules/hast-util-has-property": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/hast-util-has-property/-/hast-util-has-property-2.0.1.tgz",
"integrity": "sha512-X2+RwZIMTMKpXUzlotatPzWj8bspCymtXH3cfG3iQKV+wPF53Vgaqxi/eLqGck0wKq1kS9nvoB1wchbCPEL8sg==",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/hast-util-heading-rank": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/hast-util-heading-rank/-/hast-util-heading-rank-2.1.1.tgz",
"integrity": "sha512-iAuRp+ESgJoRFJbSyaqsfvJDY6zzmFoEnL1gtz1+U8gKtGGj1p0CVlysuUAUjq95qlZESHINLThwJzNGmgGZxA==",
"dependencies": {
"@types/hast": "^2.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/hast-util-is-element": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/hast-util-is-element/-/hast-util-is-element-2.1.3.tgz",
"integrity": "sha512-O1bKah6mhgEq2WtVMk+Ta5K7pPMqsBBlmzysLdcwKVrqzZQ0CHqUPiIVspNhAG1rvxpvJjtGee17XfauZYKqVA==",
"dependencies": {
"@types/hast": "^2.0.0",
"@types/unist": "^2.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/hast-util-parse-selector": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-3.1.1.tgz",
@ -2580,6 +2620,18 @@
"url": "https://opencollective.com/unified"
}
},
"node_modules/hast-util-to-string": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/hast-util-to-string/-/hast-util-to-string-2.0.0.tgz",
"integrity": "sha512-02AQ3vLhuH3FisaMM+i/9sm4OXGSq1UhOOCpTLLQtHdL3tZt7qil69r8M8iDkZYyC0HCFylcYoP+8IO7ddta1A==",
"dependencies": {
"@types/hast": "^2.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/hast-util-whitespace": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-2.0.1.tgz",
@ -4589,6 +4641,11 @@
"node": ">=8.10.0"
}
},
"node_modules/reading-time": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/reading-time/-/reading-time-1.5.0.tgz",
"integrity": "sha512-onYyVhBNr4CmAxFsKS7bz+uTLRakypIe4R+5A824vBSkQy/hB3fZepoVEf8OVAxzLvK+H/jm9TzpI3ETSm64Kg=="
},
"node_modules/rehype": {
"version": "12.0.1",
"resolved": "https://registry.npmjs.org/rehype/-/rehype-12.0.1.tgz",
@ -4604,6 +4661,124 @@
"url": "https://opencollective.com/unified"
}
},
"node_modules/rehype-autolink-headings": {
"version": "6.1.1",
"resolved": "https://registry.npmjs.org/rehype-autolink-headings/-/rehype-autolink-headings-6.1.1.tgz",
"integrity": "sha512-NMYzZIsHM3sA14nC5rAFuUPIOfg+DFmf9EY1YMhaNlB7+3kK/ZlE6kqPfuxr1tsJ1XWkTrMtMoyHosU70d35mA==",
"dependencies": {
"@types/hast": "^2.0.0",
"extend": "^3.0.0",
"hast-util-has-property": "^2.0.0",
"hast-util-heading-rank": "^2.0.0",
"hast-util-is-element": "^2.0.0",
"unified": "^10.0.0",
"unist-util-visit": "^4.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/rehype-figure": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/rehype-figure/-/rehype-figure-1.0.1.tgz",
"integrity": "sha512-g7DJuK8R8xHIaPI3QJ6/OoWiKepn92RF2CV3z4dO7lRO6ZHo48Tu9X3KgnZUKK035srFHqWQx93AybBy12XqmQ==",
"dependencies": {
"hastscript": "^6.0.0",
"unist-util-visit": "^2.0.3"
}
},
"node_modules/rehype-figure/node_modules/comma-separated-tokens": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-1.0.8.tgz",
"integrity": "sha512-GHuDRO12Sypu2cV70d1dkA2EUmXHgntrzbpvOB+Qy+49ypNfGgFQIC2fhhXbnyrJRynDCAARsT7Ou0M6hirpfw==",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
},
"node_modules/rehype-figure/node_modules/hast-util-parse-selector": {
"version": "2.2.5",
"resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-2.2.5.tgz",
"integrity": "sha512-7j6mrk/qqkSehsM92wQjdIgWM2/BW61u/53G6xmC8i1OmEdKLHbk419QKQUjz6LglWsfqoiHmyMRkP1BGjecNQ==",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/rehype-figure/node_modules/hastscript": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/hastscript/-/hastscript-6.0.0.tgz",
"integrity": "sha512-nDM6bvd7lIqDUiYEiu5Sl/+6ReP0BMk/2f4U/Rooccxkj0P5nm+acM5PrGJ/t5I8qPGiqZSE6hVAwZEdZIvP4w==",
"dependencies": {
"@types/hast": "^2.0.0",
"comma-separated-tokens": "^1.0.0",
"hast-util-parse-selector": "^2.0.0",
"property-information": "^5.0.0",
"space-separated-tokens": "^1.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/rehype-figure/node_modules/property-information": {
"version": "5.6.0",
"resolved": "https://registry.npmjs.org/property-information/-/property-information-5.6.0.tgz",
"integrity": "sha512-YUHSPk+A30YPv+0Qf8i9Mbfe/C0hdPXk1s1jPVToV8pk8BQtpw10ct89Eo7OWkutrwqvT0eicAxlOg3dOAu8JA==",
"dependencies": {
"xtend": "^4.0.0"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
},
"node_modules/rehype-figure/node_modules/space-separated-tokens": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-1.1.5.tgz",
"integrity": "sha512-q/JSVd1Lptzhf5bkYm4ob4iWPjx0KiRe3sRFBNrVqbJkFaBm5vbbowy1mymoPNLRa52+oadOhJ+K49wsSeSjTA==",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
},
"node_modules/rehype-figure/node_modules/unist-util-is": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.1.0.tgz",
"integrity": "sha512-ZOQSsnce92GrxSqlnEEseX0gi7GH9zTJZ0p9dtu87WRb/37mMPO2Ilx1s/t9vBHrFhbgweUwb+t7cIn5dxPhZg==",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/rehype-figure/node_modules/unist-util-visit": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-2.0.3.tgz",
"integrity": "sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==",
"dependencies": {
"@types/unist": "^2.0.0",
"unist-util-is": "^4.0.0",
"unist-util-visit-parents": "^3.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/rehype-figure/node_modules/unist-util-visit-parents": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.1.tgz",
"integrity": "sha512-1KROIZWo6bcMrZEwiH2UrXDyalAa0uqzWCxCJj6lPOvTve2WkfgCytoDTPaMnodXh1WrXOq0haVYHj99ynJlsg==",
"dependencies": {
"@types/unist": "^2.0.0",
"unist-util-is": "^4.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/rehype-parse": {
"version": "8.0.4",
"resolved": "https://registry.npmjs.org/rehype-parse/-/rehype-parse-8.0.4.tgz",
@ -4633,6 +4808,24 @@
"url": "https://opencollective.com/unified"
}
},
"node_modules/rehype-slug": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/rehype-slug/-/rehype-slug-5.1.0.tgz",
"integrity": "sha512-Gf91dJoXneiorNEnn+Phx97CO7oRMrpi+6r155tTxzGuLtm+QrI4cTwCa9e1rtePdL4i9tSO58PeSS6HWfgsiw==",
"dependencies": {
"@types/hast": "^2.0.0",
"github-slugger": "^2.0.0",
"hast-util-has-property": "^2.0.0",
"hast-util-heading-rank": "^2.0.0",
"hast-util-to-string": "^2.0.0",
"unified": "^10.0.0",
"unist-util-visit": "^4.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/rehype-stringify": {
"version": "9.0.3",
"resolved": "https://registry.npmjs.org/rehype-stringify/-/rehype-stringify-9.0.3.tgz",
@ -4712,6 +4905,21 @@
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
}
},
"node_modules/remark-unwrap-images": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/remark-unwrap-images/-/remark-unwrap-images-3.0.1.tgz",
"integrity": "sha512-5VUY0n+J9lPTPfkct5S3/SbutryBjp8J/4mbgtlkDrOk3h8jde0hyqdYUJOoJKherZezS08tjd6i4+nnQ+wl5w==",
"dependencies": {
"@types/mdast": "^3.0.0",
"hast-util-whitespace": "^2.0.0",
"unified": "^10.0.0",
"unist-util-visit": "^4.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/resolve": {
"version": "1.22.2",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz",
@ -4834,9 +5042,9 @@
}
},
"node_modules/rollup": {
"version": "3.20.6",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-3.20.6.tgz",
"integrity": "sha512-2yEB3nQXp/tBQDN0hJScJQheXdvU2wFhh6ld7K/aiZ1vYcak6N/BKjY1QrU6BvO2JWYS8bEs14FRaxXosxy2zw==",
"version": "3.25.1",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-3.25.1.tgz",
"integrity": "sha512-tywOR+rwIt5m2ZAWSe5AIJcTat8vGlnPFAv15ycCrw33t6iFsXZ6mzHVFh2psSjxQPmI+xgzMZZizUAukBI4aQ==",
"bin": {
"rollup": "dist/bin/rollup"
},
@ -5762,13 +5970,13 @@
}
},
"node_modules/vite": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/vite/-/vite-4.3.0.tgz",
"integrity": "sha512-JTGFgDh3dVxeGBpuQX04Up+JZmuG6wu9414Ei36vQzaEruY/M4K0AgwtuB2b4HaBgB7R8l+LHxjB0jcgz4d2qQ==",
"version": "4.3.9",
"resolved": "https://registry.npmjs.org/vite/-/vite-4.3.9.tgz",
"integrity": "sha512-qsTNZjO9NoJNW7KnOrgYwczm0WctJ8m/yqYAMAK9Lxt4SoySUfS5S8ia9K7JHpa3KEeMfyF8LoJ3c5NeBJy6pg==",
"dependencies": {
"esbuild": "^0.17.5",
"postcss": "^8.4.21",
"rollup": "^3.20.2"
"postcss": "^8.4.23",
"rollup": "^3.21.0"
},
"bin": {
"vite": "bin/vite.js"
@ -5993,6 +6201,14 @@
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
},
"node_modules/xtend": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==",
"engines": {
"node": ">=0.4"
}
},
"node_modules/yallist": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
@ -7792,6 +8008,28 @@
"web-namespaces": "^2.0.0"
}
},
"hast-util-has-property": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/hast-util-has-property/-/hast-util-has-property-2.0.1.tgz",
"integrity": "sha512-X2+RwZIMTMKpXUzlotatPzWj8bspCymtXH3cfG3iQKV+wPF53Vgaqxi/eLqGck0wKq1kS9nvoB1wchbCPEL8sg=="
},
"hast-util-heading-rank": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/hast-util-heading-rank/-/hast-util-heading-rank-2.1.1.tgz",
"integrity": "sha512-iAuRp+ESgJoRFJbSyaqsfvJDY6zzmFoEnL1gtz1+U8gKtGGj1p0CVlysuUAUjq95qlZESHINLThwJzNGmgGZxA==",
"requires": {
"@types/hast": "^2.0.0"
}
},
"hast-util-is-element": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/hast-util-is-element/-/hast-util-is-element-2.1.3.tgz",
"integrity": "sha512-O1bKah6mhgEq2WtVMk+Ta5K7pPMqsBBlmzysLdcwKVrqzZQ0CHqUPiIVspNhAG1rvxpvJjtGee17XfauZYKqVA==",
"requires": {
"@types/hast": "^2.0.0",
"@types/unist": "^2.0.0"
}
},
"hast-util-parse-selector": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-3.1.1.tgz",
@ -7849,6 +8087,14 @@
"zwitch": "^2.0.0"
}
},
"hast-util-to-string": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/hast-util-to-string/-/hast-util-to-string-2.0.0.tgz",
"integrity": "sha512-02AQ3vLhuH3FisaMM+i/9sm4OXGSq1UhOOCpTLLQtHdL3tZt7qil69r8M8iDkZYyC0HCFylcYoP+8IO7ddta1A==",
"requires": {
"@types/hast": "^2.0.0"
}
},
"hast-util-whitespace": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-2.0.1.tgz",
@ -9142,6 +9388,11 @@
"picomatch": "^2.2.1"
}
},
"reading-time": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/reading-time/-/reading-time-1.5.0.tgz",
"integrity": "sha512-onYyVhBNr4CmAxFsKS7bz+uTLRakypIe4R+5A824vBSkQy/hB3fZepoVEf8OVAxzLvK+H/jm9TzpI3ETSm64Kg=="
},
"rehype": {
"version": "12.0.1",
"resolved": "https://registry.npmjs.org/rehype/-/rehype-12.0.1.tgz",
@ -9153,6 +9404,90 @@
"unified": "^10.0.0"
}
},
"rehype-autolink-headings": {
"version": "6.1.1",
"resolved": "https://registry.npmjs.org/rehype-autolink-headings/-/rehype-autolink-headings-6.1.1.tgz",
"integrity": "sha512-NMYzZIsHM3sA14nC5rAFuUPIOfg+DFmf9EY1YMhaNlB7+3kK/ZlE6kqPfuxr1tsJ1XWkTrMtMoyHosU70d35mA==",
"requires": {
"@types/hast": "^2.0.0",
"extend": "^3.0.0",
"hast-util-has-property": "^2.0.0",
"hast-util-heading-rank": "^2.0.0",
"hast-util-is-element": "^2.0.0",
"unified": "^10.0.0",
"unist-util-visit": "^4.0.0"
}
},
"rehype-figure": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/rehype-figure/-/rehype-figure-1.0.1.tgz",
"integrity": "sha512-g7DJuK8R8xHIaPI3QJ6/OoWiKepn92RF2CV3z4dO7lRO6ZHo48Tu9X3KgnZUKK035srFHqWQx93AybBy12XqmQ==",
"requires": {
"hastscript": "^6.0.0",
"unist-util-visit": "^2.0.3"
},
"dependencies": {
"comma-separated-tokens": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-1.0.8.tgz",
"integrity": "sha512-GHuDRO12Sypu2cV70d1dkA2EUmXHgntrzbpvOB+Qy+49ypNfGgFQIC2fhhXbnyrJRynDCAARsT7Ou0M6hirpfw=="
},
"hast-util-parse-selector": {
"version": "2.2.5",
"resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-2.2.5.tgz",
"integrity": "sha512-7j6mrk/qqkSehsM92wQjdIgWM2/BW61u/53G6xmC8i1OmEdKLHbk419QKQUjz6LglWsfqoiHmyMRkP1BGjecNQ=="
},
"hastscript": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/hastscript/-/hastscript-6.0.0.tgz",
"integrity": "sha512-nDM6bvd7lIqDUiYEiu5Sl/+6ReP0BMk/2f4U/Rooccxkj0P5nm+acM5PrGJ/t5I8qPGiqZSE6hVAwZEdZIvP4w==",
"requires": {
"@types/hast": "^2.0.0",
"comma-separated-tokens": "^1.0.0",
"hast-util-parse-selector": "^2.0.0",
"property-information": "^5.0.0",
"space-separated-tokens": "^1.0.0"
}
},
"property-information": {
"version": "5.6.0",
"resolved": "https://registry.npmjs.org/property-information/-/property-information-5.6.0.tgz",
"integrity": "sha512-YUHSPk+A30YPv+0Qf8i9Mbfe/C0hdPXk1s1jPVToV8pk8BQtpw10ct89Eo7OWkutrwqvT0eicAxlOg3dOAu8JA==",
"requires": {
"xtend": "^4.0.0"
}
},
"space-separated-tokens": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-1.1.5.tgz",
"integrity": "sha512-q/JSVd1Lptzhf5bkYm4ob4iWPjx0KiRe3sRFBNrVqbJkFaBm5vbbowy1mymoPNLRa52+oadOhJ+K49wsSeSjTA=="
},
"unist-util-is": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.1.0.tgz",
"integrity": "sha512-ZOQSsnce92GrxSqlnEEseX0gi7GH9zTJZ0p9dtu87WRb/37mMPO2Ilx1s/t9vBHrFhbgweUwb+t7cIn5dxPhZg=="
},
"unist-util-visit": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-2.0.3.tgz",
"integrity": "sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==",
"requires": {
"@types/unist": "^2.0.0",
"unist-util-is": "^4.0.0",
"unist-util-visit-parents": "^3.0.0"
}
},
"unist-util-visit-parents": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.1.tgz",
"integrity": "sha512-1KROIZWo6bcMrZEwiH2UrXDyalAa0uqzWCxCJj6lPOvTve2WkfgCytoDTPaMnodXh1WrXOq0haVYHj99ynJlsg==",
"requires": {
"@types/unist": "^2.0.0",
"unist-util-is": "^4.0.0"
}
}
}
},
"rehype-parse": {
"version": "8.0.4",
"resolved": "https://registry.npmjs.org/rehype-parse/-/rehype-parse-8.0.4.tgz",
@ -9174,6 +9509,20 @@
"unified": "^10.0.0"
}
},
"rehype-slug": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/rehype-slug/-/rehype-slug-5.1.0.tgz",
"integrity": "sha512-Gf91dJoXneiorNEnn+Phx97CO7oRMrpi+6r155tTxzGuLtm+QrI4cTwCa9e1rtePdL4i9tSO58PeSS6HWfgsiw==",
"requires": {
"@types/hast": "^2.0.0",
"github-slugger": "^2.0.0",
"hast-util-has-property": "^2.0.0",
"hast-util-heading-rank": "^2.0.0",
"hast-util-to-string": "^2.0.0",
"unified": "^10.0.0",
"unist-util-visit": "^4.0.0"
}
},
"rehype-stringify": {
"version": "9.0.3",
"resolved": "https://registry.npmjs.org/rehype-stringify/-/rehype-stringify-9.0.3.tgz",
@ -9231,6 +9580,17 @@
"unist-util-visit": "^4.1.0"
}
},
"remark-unwrap-images": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/remark-unwrap-images/-/remark-unwrap-images-3.0.1.tgz",
"integrity": "sha512-5VUY0n+J9lPTPfkct5S3/SbutryBjp8J/4mbgtlkDrOk3h8jde0hyqdYUJOoJKherZezS08tjd6i4+nnQ+wl5w==",
"requires": {
"@types/mdast": "^3.0.0",
"hast-util-whitespace": "^2.0.0",
"unified": "^10.0.0",
"unist-util-visit": "^4.0.0"
}
},
"resolve": {
"version": "1.22.2",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz",
@ -9314,9 +9674,9 @@
"integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw=="
},
"rollup": {
"version": "3.20.6",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-3.20.6.tgz",
"integrity": "sha512-2yEB3nQXp/tBQDN0hJScJQheXdvU2wFhh6ld7K/aiZ1vYcak6N/BKjY1QrU6BvO2JWYS8bEs14FRaxXosxy2zw==",
"version": "3.25.1",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-3.25.1.tgz",
"integrity": "sha512-tywOR+rwIt5m2ZAWSe5AIJcTat8vGlnPFAv15ycCrw33t6iFsXZ6mzHVFh2psSjxQPmI+xgzMZZizUAukBI4aQ==",
"requires": {
"fsevents": "~2.3.2"
}
@ -9935,14 +10295,14 @@
}
},
"vite": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/vite/-/vite-4.3.0.tgz",
"integrity": "sha512-JTGFgDh3dVxeGBpuQX04Up+JZmuG6wu9414Ei36vQzaEruY/M4K0AgwtuB2b4HaBgB7R8l+LHxjB0jcgz4d2qQ==",
"version": "4.3.9",
"resolved": "https://registry.npmjs.org/vite/-/vite-4.3.9.tgz",
"integrity": "sha512-qsTNZjO9NoJNW7KnOrgYwczm0WctJ8m/yqYAMAK9Lxt4SoySUfS5S8ia9K7JHpa3KEeMfyF8LoJ3c5NeBJy6pg==",
"requires": {
"esbuild": "^0.17.5",
"fsevents": "~2.3.2",
"postcss": "^8.4.21",
"rollup": "^3.20.2"
"postcss": "^8.4.23",
"rollup": "^3.21.0"
}
},
"vitefu": {
@ -10085,6 +10445,11 @@
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
},
"xtend": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="
},
"yallist": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",

View file

@ -12,6 +12,12 @@
"dependencies": {
"astro": "^2.3.0",
"astro-compress": "^1.1.42",
"less": "^4.1.3"
"less": "^4.1.3",
"mdast-util-to-string": "^3.2.0",
"reading-time": "^1.5.0",
"rehype-autolink-headings": "^6.1.1",
"rehype-figure": "^1.0.1",
"rehype-slug": "^5.1.0",
"remark-unwrap-images": "^3.0.1"
}
}

BIN
public/forest.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

11
public/less.min.js vendored Normal file

File diff suppressed because one or more lines are too long

1
public/less.min.js.map Normal file

File diff suppressed because one or more lines are too long

1
public/theme.less Symbolic link
View file

@ -0,0 +1 @@
../src/styles/theme.less

5
public/theme_dyn.less Normal file
View file

@ -0,0 +1,5 @@
@import url(/theme.less);
@accent: #6570d6;
@bdrs: 2rem;
@purebg: false;
body { .theme-mixin(@accent, @bdrs, @purebg) !important; }

16
remark-post-meta.mjs Normal file
View file

@ -0,0 +1,16 @@
import getReadingTime from 'reading-time';
import { toString as mdToString } from 'mdast-util-to-string';
const ELLIPSIS = '\u2026';
export default function() {
return function (tree, { data }) {
const textOnPage = mdToString(tree);
const readingTime = getReadingTime(textOnPage);
data.astro.frontmatter.readingTime = readingTime.text;
const description = textOnPage.slice(0, 100) + ELLIPSIS;
data.astro.frontmatter.description = description;
};
}

View file

@ -0,0 +1,67 @@
---
import TextBox from "./TextBox.astro";
import Icon from "./Icon.astro";
export interface Props {
method: "get" | "post";
}
const { method } = Astro.props;
---
<form method={method} action="https://searx.dc09.ru/search">
<span slot="label" id="method-and-submit">
<span>
Method:
{method == "get" ? <b>GET</b> : <a href="/blog/search">GET</a>}
{method == "post" ? <b>POST</b> : <a href="/blog/search_post">POST</a>}
</span>
<span>
<label id="search-btn">
<span>
Search
</span>
<input type="submit" value="Search">
</label>
</span>
</span>
<TextBox id="q" label="Query" size={27} value="<write here> site:https://dc09.ru/blog" />
<input type="hidden" name="engines" value="google,yahoo">
</form>
<style lang="less">
#method-and-submit {
width: 100%;
display: inline-flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
#search-btn {
input[type=submit] {
display: none;
}
span {
cursor: pointer;
display: inline-flex;
justify-content: center;
align-items: center;
padding: 0 0.625rem;
font-size: 1.1rem;
background-color: var(--bg);
border: 0.125rem dashed var(--bg-sec);
border-radius: var(--bdrs);
transition: background-color 0.2s ease 0s;
&:hover {
background-color: var(--bg-sec);
}
}
}
</style>

View file

@ -0,0 +1,46 @@
---
export interface Props {
name: string;
hex: string;
}
const { name, hex } = Astro.props;
---
<a href="javascript:void(0)" class="color-button" data-hex={hex}>
<span>{name}</span>
</a>
<style lang="less" define:vars={{ hex }}>
.color-button {
padding: 0.15rem 0.3rem;
display: inline-flex;
flex-direction: column;
justify-content: center;
align-items: center;
border-radius: var(--bdrs);
background: var(--hex);
color: #fff;
transition: filter 0.2s ease 0s;
&:hover {
color: #fff;
filter: brightness(80%);
}
}
</style>
<script>
const accentInput = document.getElementById('accent') as HTMLInputElement
const btns = document.querySelectorAll('.color-button')
for (let btn of btns) {
btn.addEventListener('click', ev => {
const elem = ev.currentTarget as HTMLAnchorElement
accentInput.value = elem.dataset.hex
accentInput.dispatchEvent(new Event('input'))
})
}
</script>

View file

@ -10,26 +10,26 @@ const { code } = Astro.props;
<span class="icon">{code}</span>
<style lang="less">
<style lang="less" is:global>
@font-face {
font-family: 'Line Awesome Regular';
font-style: normal;
font-weight: 400;
font-display: auto;
font-display: swap;
src: url("/fonts/la-regular-400.eot?#iefix") format("embedded-opentype"), url("/fonts/la-regular-400.woff2") format("woff2"), url("/fonts/la-regular-400.woff") format("woff"), url("/fonts/la-regular-400.ttf") format("truetype");
}
@font-face {
font-family: 'Line Awesome Solid';
font-style: normal;
font-weight: 900;
font-display: auto;
font-display: swap;
src: url("/fonts/la-solid-900.eot?#iefix") format("embedded-opentype"), url("/fonts/la-solid-900.woff2") format("woff2"), url("/fonts/la-solid-900.woff") format("woff"), url("/fonts/la-solid-900.ttf") format("truetype");
}
@font-face {
font-family: 'Line Awesome Brands';
font-style: normal;
font-weight: normal;
font-display: auto;
font-weight: 400;
font-display: swap;
src: url("/fonts/la-brands-400.eot?#iefix") format("embedded-opentype"), url("/fonts/la-brands-400.woff2") format("woff2"), url("/fonts/la-brands-400.woff") format("woff"), url("/fonts/la-brands-400.ttf") format("truetype");
}

View file

@ -0,0 +1,33 @@
---
import Icon from './Icon.astro';
export interface Props {
icon: string;
}
const { icon } = Astro.props;
---
<li>
<span class="icon-wrapper">
<Icon code={icon} />
</span>
<span class="content">
<slot />
</span>
</li>
<style lang="less">
li {
display: flex;
flex-direction: row;
align-items: center;
}
.icon-wrapper {
margin-right: 0.375rem;
width: 1.6rem;
font-size: 1.5rem;
text-align: center;
}
</style>

View file

@ -1,66 +0,0 @@
---
import Icon from "./Icon.astro";
import ThemeModal from "./ThemeModal.astro";
---
<ThemeModal />
<nav>
<ul>
<li>
<a href="#">
<Icon code="&#xf015;" />
Homepage
</a>
</li>
<li>
<a href="#skills">
Skills
</a>
</li>
<li>
<a href="#projects">
Projects
</a>
</li>
</ul>
<ul>
<li>
<a href="#theme">
Theme
</a>
</li>
<li>
<a href="#dc09ru">
Services
</a>
</li>
<li>
<a href="https://blog.dc09.ru">
Blog
</a>
</li>
</ul>
</nav>
<style lang="less">
nav {
margin: 0.4rem;
display: flex;
flex-direction: row;
justify-content: space-between;
}
ul {
margin: 0;
padding: 0;
list-style: none;
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
li {
padding: 0 0.6rem;
font-size: 1.1rem;
}
</style>

View file

@ -0,0 +1,48 @@
---
import Icon from './Icon.astro';
export interface Props {
name: string;
link: string;
icon: string;
}
const { name, link, icon } = Astro.props;
---
<li>
<a href={link}>
<span class="icon-wrapper">
<Icon code={icon} />
</span>
{name}
</a>
</li>
<style lang="less">
li {
// 0.6rem = horizontal padding
padding: 0 0.6rem;
font-size: 1.15rem;
&:first-child {
padding-left: 0;
}
&:last-child {
padding-right: 0;
}
}
a {
display: flex;
flex-direction: row;
align-items: center;
}
.icon-wrapper {
margin-right: 0.25rem;
font-size: 1.5rem;
color: var(--fg-sec);
}
</style>

View file

@ -43,14 +43,18 @@ const { app, url, name, icon, copyName = false } = Astro.props;
</script>
<style lang="less">
@import "/src/styles/profile_calc.less";
.profile {
padding: 0.4rem 0.6rem;
// vertical horizontal
padding: 0.4rem @profile-horiz-padding;
display: flex;
flex-direction: row;
align-items: center;
border-radius: 2rem;
width: @profile-width;
border-radius: var(--bdrs);
&:hover {
background: var(--accent-bg);
@ -58,8 +62,6 @@ const { app, url, name, icon, copyName = false } = Astro.props;
}
a.profile-main {
@icon-size: 2.3rem;
flex-grow: 1;
display: flex;
@ -70,13 +72,12 @@ const { app, url, name, icon, copyName = false } = Astro.props;
text-decoration: none;
.icon-wrapper {
font-size: @icon-size;
margin-right: 0.4rem;
font-size: @profile-icon-app;
margin-right: @profile-icon-margin;
}
}
a.copy {
@icon-size: 1.8rem;
position: relative;
font-size: 1.1rem;
@ -86,8 +87,8 @@ const { app, url, name, icon, copyName = false } = Astro.props;
align-items: center;
.icon-wrapper {
font-size: @icon-size;
margin-left: 0.4rem;
font-size: @profile-icon-copy;
margin-left: @profile-icon-margin;
}
}
@ -95,6 +96,9 @@ const { app, url, name, icon, copyName = false } = Astro.props;
display: flex;
flex-direction: column;
width: @profile-text-width;
overflow: hidden;
.app {
font-weight: 600;
}

View file

@ -0,0 +1,82 @@
---
import Input from "../layouts/Input.astro";
export interface Props {
id: string;
label: string;
min: number;
max: number;
value: number;
}
const { id, label, min, max, value } = Astro.props;
---
<Input label="" column>
<span slot="label">
{label}:
<span class="range-value">2</span>
rem
</span>
<span slot="after">
<input type="range" name={id} id={id} min={min} max={max} value={value}>
</span>
</Input>
<style lang="less">
input {
-webkit-appearance: none;
appearance: none;
border: none;
outline: 0;
background: var(--bg);
&:focus {
outline: 0;
}
@track-height: 0.4rem;
@thumb-size: 1.05rem;
@thumb-shadow-blur: @thumb-size * 0.5;
// line
&::-webkit-slider-runnable-track,
&::-moz-range-track {
height: @track-height;
background: var(--bg-sec);
border-radius: @track-height * 0.5;
}
// circle
&::-webkit-slider-thumb,
&::-moz-range-thumb {
-webkit-appearance: none;
appearance: none;
width: @thumb-size;
height: @thumb-size;
border-radius: @thumb-size;
border: none;
//background: var(--bg);
background: #fff;
// x-offset y-offset blur color
box-shadow: 0 0 @thumb-shadow-blur var(--fg);
}
}
</style>
<script>
const ranges = document.querySelectorAll('input[type="range"]')
const handler = (ev: Event) => {
const input = ev.currentTarget as HTMLInputElement
const container = input.parentElement.parentElement
const valueSpan = container.querySelector('.range-value') as HTMLSpanElement
valueSpan.innerText = input.value
}
for (let elem of ranges) {
elem.addEventListener('input', handler)
elem.addEventListener('updatedByJavascript', handler)
elem.dispatchEvent(new Event('updatedByJavascript'))
}
</script>

View file

@ -26,9 +26,14 @@ const { id, label, checked = false } = Astro.props;
@switch-width: 2.5rem;
@switch-height: @switch-width * 0.5;
@switch-padding: @switch-width * 0.08;
@switch-bdrs: @switch-width * 0.4;
@circle-size: @switch-width * 0.4;
@circle-margin: @switch-width * 0.04;
@circle-margin: @switch-width * 0.05;
.input-wrapper {
padding-top: @switch-padding;
}
.switch {
display: inline-flex;

View file

@ -1,22 +1,48 @@
---
import Input from '../layouts/Input.astro';
export interface Props {
id: string;
label: string;
value?: string;
placeholder?: string;
regex?: string | null;
regex?: string;
size?: number;
}
const { id, label, placeholder = "", regex = null } = Astro.props;
const { id, label, value = "", placeholder = "", regex = ".*", size = 15 } = Astro.props;
---
<label>
<span class="label">{label}</span>
<input type="text" name={id} id={id} placeholder={placeholder} pattern={regex}>
</label>
<Input label={label}>
<span slot="after">
<input type="text" name={id} id={id} value={value} placeholder={placeholder} pattern={regex} size={size}>
</span>
</Input>
<style lang="less">
input {
margin-left: 0.5rem;
padding: 0.2rem;
background: var(--sec-bg);
color: var(--fg);
font-size: 0.9rem;
outline: 0;
border: none;
border-bottom: 0.125rem solid var(--bg-sec);
transition: border-bottom-color 0.2s ease 0s;
&:focus {
border-bottom-color: var(--accent);
}
&:hover {
border-bottom-color: var(--accent-hl);
}
&::placeholder {
color: var(--fg-sec);
}
}
</style>

View file

@ -1,21 +1,42 @@
---
import Input from "../layouts/Input.astro";
import Modal from "../layouts/Modal.astro";
import ColorBtn from "./ColorBtn.astro";
import Slider from "./Slider.astro";
import Switch from "./Switch.astro";
import TextBox from "./TextBox.astro";
---
<Modal id="theme">
<noscript>
<noscript class="hint">
These options will <b>not</b> work without JavaScript
</noscript>
<fieldset class="first">
<Switch id="dark" label="Dark theme" checked />
<Switch id="custom-theme" label="Set custom colors" />
<Switch id="custom-theme" label="Advanced (&beta;eta)" />
</fieldset>
<section id="custom-colors">
<TextBox id="accent" label="Accent color" placeholder="HEX (#fff)" regex="#?(?:[A-Fa-f0-9]{3}|[A-Fa-f0-9]{6})" />
<label>
<span class="label">Accent color</span>
<input type="color" name="accent" id="accent">
<label class="hint">
You may need to reload the page
after enabling/disabling "Advanced"
</label>
<fieldset>
<Switch id="purebg" label="Pure background" />
</fieldset>
<fieldset>
<TextBox id="accent" label="Accent color" placeholder="HEX (#fff)" regex="#?(?:[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})" size={7} />
<Input label="">
<span class="color-btns" slot="after">
<ColorBtn name="red" hex="#ba505a" />
<ColorBtn name="yellow" hex="#b9aa50" />
<ColorBtn name="green" hex="#5bab65" />
<ColorBtn name="blue" hex="#6570d6" />
</span>
</Input>
</fieldset>
<fieldset>
<Slider id="bdrs" label="Border radius" min={0} max={4} value={2} />
</fieldset>
</section>
</Modal>
@ -28,137 +49,189 @@ import TextBox from "./TextBox.astro";
flex-direction: column;
}
}
.color-btns {
margin-top: 0.2rem;
}
.hint {
width: 18rem;
font-size: 0.9rem;
color: var(--fg-sec);
}
</style>
<script>
const colorsSection = document.getElementById('custom-colors')
var lessLoaded = false
class ThemingOption {
private cookieKey: string
private cookieSwitch: Array<string | RegExp>
private callback: (input: HTMLInputElement, state: boolean) => any
private getval: (input: HTMLInputElement) => any
private media: string | null
private _input: HTMLInputElement | null
get input() { return this._input }
input: HTMLInputElement | undefined
onchange:
(opt: ThemingOption, upd: boolean) => any =
(_opt, _upd) => {}
constructor (
cookieKey: string,
cookieSwitch: Array<string | RegExp> | null,
callback: (input: HTMLInputElement, state: boolean) => any,
getval: (input: HTMLInputElement) => any,
input: HTMLInputElement | null = null,
media: string | null = null,
inputId: string,
onchange: (opt: ThemingOption, upd: boolean) => any
) {
this.cookieKey = cookieKey
this.cookieSwitch = cookieSwitch
this.callback = callback
this.getval = getval
this._input = input
this.media = media
}
this.input = document.getElementById(inputId) as HTMLInputElement
this.onchange = onchange
/*
function themeCheck() {
if (
document.cookie.includes('dc09_dark=1') || (
matchMedia('(prefers-color-scheme: dark)') &&
!document.cookie.includes('dc09_dark=0')
this.onchange(this, false)
if (!this.input) return
this.input.addEventListener(
'input',
() => this.onchange(this, true),
)
) {
document.body.dataset.dark = '1'
switchDark.checked = true
}
else {
document.body.dataset.dark = '0'
switchDark.checked = false
}
}
Here is the rewritten themeCheck:
/** Converts string to boolean, mainly for localStorage.
* Returned `null` means that the key was unset.
*/
check() {
const match = this.cookieSwitch.map(
value => document.cookie.match(
`${this.cookieKey}=${value}`
const toBool = (val: string | null) => {
switch (val) {
case undefined:
case null:
case '':
return null
case 'false':
case '0':
return false
default:
return true
}
}
const colorRegex = /#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/
/** Parses color-like string and
* returns the color in the general format.
* Returned `undefined` means that it's not a color.
* If `val` is `null`, returns `null`.
*/
const toColor = (val: string | null) => {
if (!val) return null
return (val.match(colorRegex) || [])[1]
}
new ThemingOption(
'dark',
(opt, upd) => {
if (upd) {
const state = opt.input.checked
localStorage.setItem('dc09_dark', state ? '1' : '0')
return opt.onchange(opt, false)
}
const stored = toBool(localStorage.getItem('dc09_dark'))
const media = matchMedia('(prefers-color-scheme: dark)')
const state = (
stored || (
stored === null &&
media.matches
)
)
opt.input.checked = state
document.body.dataset.dark = state ? '1' : '0'
}
)
if (
match[1] || (
this.media && !match[0] &&
matchMedia(this.media).matches
const purebgOpt = new ThemingOption(
'purebg', // pure background
(opt, upd) => {
if (upd) {
const state = opt.input.checked
localStorage.setItem('dc09_purebg', state ? '1' : '0')
reloadTheme()
return opt.onchange(opt, false)
}
opt.input.checked = toBool(localStorage.getItem('dc09_purebg'))
}
)
) {
if (this.callback)
this.callback(this._input, true)
const accentOpt = new ThemingOption(
'accent',
(opt, upd) => {
if (upd) {
if (!opt.input.validity.valid) return
const color = toColor(opt.input.value)
if (!color) return
localStorage.setItem('dc09_accent', color)
reloadTheme()
return
}
if (this.callback)
this.callback(this._input, false)
const color = localStorage.getItem('dc09_accent') || '6570d6'
opt.input.value = color
}
update() {
const value = this.getval(this._input)
const localhost = window.location.hostname == 'localhost'
const domain = localhost ? 'localhost' : 'dc09.ru'
const cookie = `${this.cookieKey}=${value};domain=${domain};samesite=lax`
document.cookie = cookie
this.check()
}
}
const opts = {
dark: new ThemingOption(
'dc09_dark', ['0', '1'],
(input: HTMLInputElement, state: boolean) => {
input.checked = state
document.body.dataset.dark = state ? '1' : '0'
},
(input: HTMLInputElement) => input.checked ? 1 : 0,
document.getElementById('dark') as HTMLInputElement,
'(prefers-color-scheme: dark)',
),
custom: new ThemingOption(
'dc09_custom', ['0', '1'],
(input: HTMLInputElement, state: boolean) => {
input.checked = state
colorsSection.dataset.show = state ? '1' : '0'
if (state)
loadCustomTheme()
},
(input: HTMLInputElement) => input.checked ? 1 : 0,
document.getElementById('custom-theme') as HTMLInputElement,
)
const bdrsOpt = new ThemingOption(
'bdrs', // border-radius, as in Emmet
(opt, upd) => {
if (upd) {
const value = opt.input.value
localStorage.setItem('dc09_bdrs', value)
reloadTheme()
return
}
for (let optObj of Object.values(opts)) {
((opt) => {
opt.check()
opt.input.addEventListener('input', () => opt.update())
})(optObj)
let value = Number(localStorage.getItem('dc09_bdrs'))
value = isNaN(value) ? 2 : value
opt.input.value = String(value)
opt.input.dispatchEvent(new Event('updatedByJavascript'))
}
)
const colorsSection = document.getElementById('custom-colors')
new ThemingOption(
'custom-theme',
(opt, upd) => {
if (upd) {
const state = opt.input.checked
localStorage.setItem('dc09_custom', state ? '1' : '0')
return opt.onchange(opt, false)
}
function loadCustomTheme() {
// Load `theme.less`
const state = toBool(localStorage.getItem('dc09_custom'))
opt.input.checked = state
colorsSection.dataset.show = state ? '1' : '0'
if (state)
reloadLess()
}
)
function reloadLess() {
if (!lessLoaded) {
// Load `theme_dyn.less`
const lessStyles = document.createElement('link')
lessStyles.rel = 'stylesheet/less'
lessStyles.type = 'text/css'
lessStyles.href = '/src/styles/theme.less'
lessStyles.href = '/theme_dyn.less'
document.head.append(lessStyles)
// Load LessCSS script element
// Create LessCSS script element
const lessScript = document.createElement('script')
lessScript.src = 'https://cdn.jsdelivr.net/npm/less'
// Replace variables
lessScript.onload = () => {
eval('less').modifyVars({
'accent': '#50aa70',
})
}
// Load LessCSS
lessScript.src = '/less.min.js'
// Modify variables when less is loaded
lessScript.addEventListener('load', reloadTheme)
// Load LessCSS script
document.head.append(lessScript)
}
else
reloadTheme()
}
function reloadTheme() {
const accent = '#' + toColor(accentOpt.input.value)
const bdrs = Number(bdrsOpt.input.value)
const purebg = purebgOpt.input.checked
eval('less').modifyVars({
accent: accent,
bdrs: `${bdrs}rem`,
purebg: purebg,
})
}
</script>

View file

@ -0,0 +1,27 @@
# H1
## H2
### H3
#### H4
##### H5
###### H6
```
123
```
_Hello_
**world**
|Col1|Col2|Col3|
|:--:|:---|---:|
|Some|cool|data|
|12345678|11|00|
```js
console.log(Object.keys({a:'a',b:'b'}))
```
> Quotation
![Forest](https://dc09.ru/forest.jpg)
123

View file

@ -0,0 +1,15 @@
The standard Lorem Ipsum passage, used since the 1500s
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
Section 1.10.32 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC
"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"
1914 translation by H. Rackham
"But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?"
Section 1.10.33 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC
"At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat."
1914 translation by H. Rackham
"On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains."

1
src/env.d.ts vendored
View file

@ -1 +1,2 @@
/// <reference path="../.astro/types.d.ts" />
/// <reference types="astro/client" />

View file

@ -0,0 +1,25 @@
---
import Layout from "./Layout.astro";
import Menu from "./Menu.astro";
import MenuItem from "../components/MenuItem.astro";
export interface Props {
title: string;
description: string;
}
const { title, description } = Astro.props;
---
<Layout title={"Blog | " + title} description={description}>
<slot name="metadata" slot="metadata" />
<Menu>
<MenuItem name="All articles" icon="&#xf015;" link="/blog" />
<MenuItem name="Shorts" icon="&#xf0e7;" link="/blog/shorts" />
<MenuItem name="Random post" icon="&#xf522;" link="/blog/random" />
<MenuItem name="Search" icon="&#xf002;" link="/blog/search" />
</Menu>
<main>
<slot />
</main>
</Layout>

View file

@ -1,26 +1,47 @@
---
export interface Props {
label: string;
column?: boolean;
}
const { label } = Astro.props;
const { label, column = false } = Astro.props;
const flexDirection = column ? "column" : "row";
const flexAlign = column ? "start" : "center";
const cursor = column ? "normal" : "pointer";
---
<label>
<slot name="before" />
<span class="label">{label}</span>
<slot name="label">
<span class="label">
{label}
</span>
</slot>
<slot name="after" />
</label>
<style lang="less">
<style lang="less" define:vars={{ flexDirection, flexAlign, cursor }}>
label {
display: flex;
flex-direction: row;
align-items: center;
cursor: pointer;
flex-direction: var(--flexDirection);
align-items: var(--flexAlign);
cursor: var(--cursor);
&:not(:first-of-type) {
margin-top: 0.25rem;
margin-top: 0.5rem;
}
:global(fieldset) {
margin: 0;
padding: 0;
border: none;
&.first > label:first-of-type {
margin-top: 0;
}
& > label:not(:first-of-type) {
margin-top: 0;
}
}
</style>

View file

@ -1,11 +1,10 @@
---
import Menu from '../components/Menu.astro';
export interface Props {
title: string;
description: string;
}
const { title } = Astro.props;
const { title, description } = Astro.props;
---
<!DOCTYPE html>
@ -14,21 +13,23 @@ const { title } = Astro.props;
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<meta name="generator" content={Astro.generator} />
<meta name="description" content="Hi! I'm Andrew aka DarkCat09, a 13-years-old fullstack developer from Russia" />
<meta name="description" content={description} />
<slot name="metadata" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<title>{title}</title>
</head>
<body>
<Menu />
<slot />
</body>
</html>
<style lang="less" is:global>
@import "/src/styles/theme.less";
@import "/src/styles/max_width.less";
body {
.theme-mixin();
margin: 0;
padding: 0;
@ -43,13 +44,25 @@ const { title } = Astro.props;
main {
margin: auto;
padding: 0.25rem;
max-width: 300rem;
max-width: @max-width;
}
article {
max-width: 100vw;
width: fit-content;
margin: auto;
}
section {
margin: 0.5rem 0;
}
.card {
border: 0.125rem dashed var(--bg-sec);
border-radius: var(--bdrs);
padding: 0.625rem;
}
hgroup > * {
margin: 0;
@ -60,10 +73,19 @@ const { title } = Astro.props;
font-weight: 500;
}
}
h1 { font-size: 2.4rem; }
h1 { font-size: 2.50rem; }
h2 { font-size: 2.00rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.40rem; }
h5 { font-size: 1.20rem; }
h6 {
color: var(--fg-sec);
font-size: 1.1rem;
}
a, .link {
color: var(--accent);
color: var(--accent-fg);
text-decoration: none;
&:hover {

View file

@ -0,0 +1,24 @@
---
import Layout from "./Layout.astro";
import Menu from "./Menu.astro";
import MenuItem from "../components/MenuItem.astro";
export interface Props {
page: string;
description: string;
}
const { page, description } = Astro.props;
---
<Layout title={"DarkCat09 | " + page} description={description}>
<Menu>
<MenuItem name="Homepage" icon="&#xf015;" link="/" />
<MenuItem name="Projects" icon="&#xf121;" link="/projects" />
<MenuItem name="Services" icon="&#xf233;" link="/services" />
<MenuItem name="Blog" icon="&#xf1ea;" link="/blog" />
</Menu>
<main>
<slot />
</main>
</Layout>

37
src/layouts/Menu.astro Normal file
View file

@ -0,0 +1,37 @@
---
import MenuItem from "../components/MenuItem.astro";
import ThemeModal from "../components/ThemeModal.astro";
---
<ThemeModal />
<nav>
<ul>
<slot />
</ul>
<ul>
<MenuItem name="Theme" icon="&#xf53f;" link="#theme" />
</ul>
</nav>
<style lang="less">
@import "/src/styles/max_width.less";
nav {
margin: 0.4rem auto;
max-width: @max-width;
width: 100%;
display: flex;
flex-direction: row;
justify-content: space-between;
}
ul {
margin: 0;
padding: 0;
list-style: none;
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
</style>

View file

@ -56,7 +56,7 @@ const { id } = Astro.props;
padding: 1rem;
z-index: 102;
border-radius: 2rem;
border-radius: var(--bdrs);
background: var(--bg);
}

178
src/pages/blog/[slug].astro Normal file
View file

@ -0,0 +1,178 @@
---
import BlogLayout from "../../layouts/BlogLayout.astro";
import { getCollection } from "astro:content";
import { AstroComponentFactory } from "astro/dist/runtime/server";
import { MarkdownHeading } from "astro";
type postType = {
id: string;
slug: string;
body: string;
collection: "blog";
data: any;
} & {
render(): Promise<{
Content: AstroComponentFactory;
headings: MarkdownHeading[];
remarkPluginFrontmatter: Record<string, any>;
}>;
};
export async function getStaticPaths() {
const posts = await getCollection("blog");
return posts.map((post) => ({
params: {
slug: post.slug,
},
props: { post },
}));
}
const { slug } = Astro.params;
const post: postType = Astro.props.post;
const postObj = await post.render();
const fm = postObj.remarkPluginFrontmatter;
const title = postObj.headings[0]?.text || '';
const description = fm.description;
const readingTime = fm.readingTime;
let dateStr = slug.split("-", 1)[0];
let date: Date | undefined;
if (isNaN(Number(dateStr))) {
dateStr = undefined;
}
else {
date = new Date(
`${dateStr.slice(0,4)}-` +
`${dateStr.slice(4,6)}-` +
`${dateStr.slice(6,8)}`
)
}
const image = (post.body.match(/(?:\s|^)!\[.*\]\((.*?)\)/) || [])[1];
---
<BlogLayout title={title} description={description}>
<Fragment slot="metadata">
<meta property="og:type" content="article" />
<meta property="og:title" content={title} />
<meta property="og:description" content={description} />
<meta property="og:image" content={image} />
<meta property="article:published_time" content={date?.toISOString()} />
<meta property="article:author" content="DarkCat09" />
<meta property="twitter:card" content="summary" />
<meta property="twitter:title" content={title} />
<meta property="twitter:description" content={description} />
<meta property="twitter:image" content={image} />
</Fragment>
<header>
<h1>{title}</h1>
<address>
on
<time datetime={date?.toISOString()}>{date?.toLocaleDateString()}</time>
by
<a href="https://t.me/dcat09" rel="author">DarkCat09</a>
//
<span id="reading-time">
{readingTime}
</span>
</address>
</header>
<article>
<postObj.Content />
</article>
</BlogLayout>
<style lang="less" is:global>
article {
//padding: 0 0.75rem;
& > h1:first-of-type {
display: none;
}
}
h1, h2, h3, h4, h5, h6 {
margin: 0;
span.icon::before {
content: "\f0c1";
font-size: 1.1rem;
display: none;
}
&:hover span.icon::before {
display: inline-block;
}
}
.heading-link {
display: inline-block;
font-size: 1rem;
}
blockquote {
margin: 0;
padding: 0;
padding-left: 1.2rem;
border-left: 0.25rem solid var(--bg-sec);
}
pre {
padding: 1rem;
border-radius: var(--bdrs);
font-size: 1rem;
font-family:
"JetBrains Mono", "Fira Code", "Iosevka", "Source Code Pro",
"Liberation Mono", "Lucida Console", monospace;
}
img {
display: block;
max-width: 90%;
margin: auto;
}
figcaption {
width: fit-content;
margin: auto;
font-size: 0.9rem;
color: var(--fg-sec);
}
table {
max-width: 90%;
margin: auto;
border-collapse: collapse;
border-bottom: 0.125rem dashed var(--bg-sec);
th, td {
padding: 0.125rem 1rem;
}
th {
background: var(--bg-sec);
&:first-child {
border-top-left-radius: var(--bdrs);
border-bottom-left-radius: var(--bdrs);
}
&:last-child {
border-top-right-radius: var(--bdrs);
border-bottom-right-radius: var(--bdrs);
}
}
tbody > tr {
&:hover {
color: var(--accent-hl);
}
}
}
</style>

View file

@ -0,0 +1,14 @@
---
import BlogLayout from "../../layouts/BlogLayout.astro";
const description =
"DarkCat09's blog about IT. " +
"Reading a QR code without smartphone, " +
"breaking a password on Windows, " +
"coding your own browser... " +
"The simpliest things!";
---
<BlogLayout title="Homepage" description={description}>
//
</BlogLayout>

View file

@ -0,0 +1,47 @@
---
import { getCollection } from "astro:content";
const posts = await getCollection('blog');
const encodedArray =
'["' + posts.map(post => post.slug).join('","') + '"]';
---
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<meta name="generator" content={Astro.generator} />
<meta name="robots" content="noindex, nofollow" />
<meta id="posts" data-posts={encodedArray} />
<title>Random post</title>
</head>
<body>
<noscript>
"Random post" feature does not work without JavaScript
</noscript>
</body>
</html>
<style lang="less">
@import "/src/styles/theme.less";
body {
.theme-mixin();
background: var(--bg);
color: var(--fg);
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Liberation Sans', 'Helvetica Neue', sans-serif;
}
noscript {
font-size: 2rem;
}
</style>
<script>
const data = document.getElementById('posts').dataset.posts || "[]"
const arr: Array<string> = JSON.parse(data)
const rand = Math.floor(Math.random() * arr.length)
window.location.href = window.location.origin + '/blog/' + arr[rand]
</script>

View file

@ -0,0 +1,8 @@
---
import BlogLayout from "../../layouts/BlogLayout.astro";
import BlogSearch from "../../components/BlogSearch.astro";
---
<BlogLayout title="Search" description="Search through the blog">
<BlogSearch method={"get"} />
</BlogLayout>

View file

@ -0,0 +1,8 @@
---
import BlogLayout from "../../layouts/BlogLayout.astro";
import BlogSearch from "../../components/BlogSearch.astro";
---
<BlogLayout title="Blog | Search" description="Search through the blog">
<BlogSearch method={"post"} />
</BlogLayout>

View file

@ -0,0 +1,11 @@
---
import BlogLayout from "../../layouts/BlogLayout.astro";
const description =
"Short stories from my life " +
"on the topic of IT";
---
<BlogLayout title="Blog | Shorts" description={description}>
//
</BlogLayout>

View file

@ -1,36 +1,103 @@
---
import Layout from '../layouts/Layout.astro';
import MainLayout from '../layouts/MainLayout.astro';
import Profile from '../components/Profile.astro';
import ListItem from '../components/ListItem.astro';
const description =
"Hi! I'm Andrew aka DarkCat09, " +
"a 13-years-old fullstack developer from Russia";
---
<Layout title="DarkCat09 | Homepage">
<main>
<MainLayout page="Homepage" description={description}>
<article class="centered">
<hgroup>
<h1>Hi! I'm Andrew.</h1>
<h2>13-years-old fullstack dev</h2>
<h2><span id="age">13</span>-years-old fullstack dev</h2>
</hgroup>
<section id="profiles">
<Profile app="Gitea" icon="&#xf1d3;" name="DarkCat09" url="https://git.dc09.ru/DarkCat09" />
<Profile app="GitHub" icon="&#xf09b;" name="DarkCat09" url="https://github.com/DarkCat09" />
<Profile app="E-mail" icon="&#xf0e0;" name="darkcat09@vivaldi.net" url="mailto:darkcat09@vivaldi.net" copyName />
<Profile app="Telegram" icon="&#xf2c6;" name="@darkcat09" url="https://t.me/darkcat09" />
<Profile app="Matrix" icon="&#xf4ad;" name="darkcat09@dc09.ru" url="https://matrix.to/#/@darkcat09:dc09.ru" copyName />
<Profile app="Matrix" icon="&#xf4ad;" name="darkcat09:dc09.ru" url="https://matrix.to/#/@darkcat09:dc09.ru" copyName />
<Profile app="Discord" icon="&#xf392;" name="DarkCat09#5587" url="https://discord.com/app" copyName />
</section>
</main>
</Layout>
</article>
<article class="card" id="about">
<ul>
<ListItem icon="&#xf05a;">
<a href="https://t.me/dc09about" target="_blank">
https://t.me/dc09about
</a>
</ListItem>
<ListItem icon="&#xf5a0;">
Russia, Ulyanovsk
</ListItem>
<ListItem icon="&#xf025;">
Favorite music bands:
</ListItem>
<ListItem icon="">
<ul>
<li>Linkin Park</li>
<li>One Direction</li>
<li>Set It Off</li>
<li>Дайте танк (!)</li>
<li>Научно-технический рэп</li>
<li>Imagine Dragons</li>
</ul>
</ListItem>
<ListItem icon="&#xf108;">
Favorite OS: Manjaro Linux
</ListItem>
<ListItem icon="">
<code>
<b>CPU:</b> 6-core Intel Core i5-10400 (-MT MCP-) <b>speed/min/max:</b> 2725/800/4300 MHz<br />
<b>Kernel:</b> 6.3.4-1-MANJARO x86_64 <b>Up:</b> 3h 32m <b>Mem:</b> 6763.3/30935.8 MiB (21.9%)<br />
<b>Storage:</b> 1.36 TiB (15.8% used) <b>Procs:</b> 303 <b>Shell:</b> Zsh <b>inxi:</b> 3.3.27
</code>
</ListItem>
</ul>
</article>
</MainLayout>
<style lang="less">
@import "/src/styles/profile_calc.less";
#profiles {
display: grid;
grid-template-columns: repeat(1, auto);
@media (min-width: 450px) {
@media (min-width: @profile-width * 2) {
grid-template-columns: repeat(2, auto);
}
@media (min-width: 670px) {
@media (min-width: @profile-width * 3) {
grid-template-columns: repeat(3, auto);
}
}
#about > ul {
list-style: none;
margin: 0;
padding: 0;
}
code {
font-family: 'Hack', 'Liberation Mono', 'Source Code Pro', monospace;
font-size: 0.9rem;
}
</style>
<script>
// in milliseconds
const ageMs = Date.now() - 1247481000000
// in years
let age = ageMs / (1000 * 60 * 60 * 24 * 365.25)
// fallback to default value
// + rounding
age = (age < 13 ? 13 : Math.floor(age))
document.getElementById('age').innerText = String(age)
</script>

7
src/pages/projects.astro Normal file
View file

@ -0,0 +1,7 @@
---
import MainLayout from "../layouts/MainLayout.astro";
---
<MainLayout page="Projects & Skills" description="">
//
</MainLayout>

11
src/pages/services.astro Normal file
View file

@ -0,0 +1,11 @@
---
import MainLayout from "../layouts/MainLayout.astro";
const description =
"Status and description of services " +
"hosted on my VPS on *.dc09.ru";
---
<MainLayout page="Services" description={description}>
//
</MainLayout>

View file

@ -0,0 +1 @@
@max-width: 800px;

View file

@ -0,0 +1,9 @@
@profile-icon-app: 2.3rem;
@profile-icon-copy: 1.8rem;
@profile-text-width: 9.5rem;
@profile-icon-margin: 0.4rem;
@profile-horiz-padding: 0.6rem;
@profile-width: @profile-horiz-padding + @profile-icon-app + @profile-icon-margin + @profile-text-width + @profile-icon-margin + @profile-icon-copy + @profile-horiz-padding;

View file

@ -1,30 +1,50 @@
@accent: #5070ca;
.theme-mixin(@accent: #6570d6, @bdrs: 2rem, @purebg: false) {
body {
@bg-light: #fff;
@fg-light: #202020;
@bg-pure-light: #fff;
@bg-colored-light: hsl(
hue(@accent),
15%, 95%,
);
@bg-dark: #222229;
@fg-dark: #eee;
@bg-light: if(@purebg, @bg-pure-light, @bg-colored-light); // background
@fg-light: #202020; // foreground
@bg-pure-dark: #222;
@bg-colored-dark: hsl(
hue(@accent),
5%, 15%,
);
@bg-dark: if(@purebg, @bg-pure-dark, @bg-colored-dark); // background
@fg-dark: #eee; // foreground
--accent: @accent;
--bdrs: @bdrs;
.light-mixin() {
--bg: @bg-light;
--fg: @fg-light;
--bg-sec: darken(@bg-light, 30%);
--fg-sec: lighten(@fg-light, 15%);
--accent-bg: darken(@bg-light, 10%);
--accent-hl: darken(@accent, 15%);
--fg-sec: lighten(@fg-light, 25%);
@accent-fg: darken(@accent, 7%);
--accent-bg: darken(@bg-light, 8%);
--accent-fg: @accent-fg;
--accent-hl: darken(@accent-fg, 15%);
}
.dark-mixin() {
--bg: @bg-dark;
--fg: @fg-dark;
--bg-sec: lighten(@bg-dark, 15%);
--fg-sec: darken(@bg-light, 25%);
--fg-sec: darken(@fg-dark, 30%);
@accent-fg: lighten(@accent, 7%);
--accent-bg: lighten(@bg-dark, 5%);
--accent-hl: lighten(@accent, 15%);
--accent-fg: @accent-fg;
--accent-hl: lighten(@accent-fg, 15%);
}
.dark-mixin();