From 99c21c01c75c4a3d9377a29e5d8f2accbbc99e16 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Mon, 2 Jun 2025 23:04:08 +0300 Subject: [PATCH 01/28] headers: link it up --- site.ts | 68 +++++++++++++++++++++++++------------ site/assets/css/default.css | 28 +++++++++++---- site/contact.md | 2 +- 3 files changed, 69 insertions(+), 29 deletions(-) diff --git a/site.ts b/site.ts index 89c4035..0f1a397 100644 --- a/site.ts +++ b/site.ts @@ -1,25 +1,25 @@ import lume from "lume/mod.ts"; -import extract_date from "lume/plugins/extract_date.ts"; -import code_highlight from "lume/plugins/code_highlight.ts"; +import extractDate from "lume/plugins/extract_date.ts"; +import codeHighlight from "lume/plugins/code_highlight.ts"; import redirects from "lume/plugins/redirects.ts"; import tailwindcss from "lume/plugins/tailwindcss.ts"; import lightningcss from "lume/plugins/lightningcss.ts"; -import resolve_urls from "lume/plugins/resolve_urls.ts"; -import slugify_urls from "lume/plugins/slugify_urls.ts"; -import check_urls from "lume/plugins/check_urls.ts"; +import resolveUrls from "lume/plugins/resolve_urls.ts"; +import slugifyUrls from "lume/plugins/slugify_urls.ts"; +import checkUrls from "lume/plugins/check_urls.ts"; import inline from "lume/plugins/inline.ts"; import feed from "lume/plugins/feed.ts"; import sitemap from "lume/plugins/sitemap.ts"; -import minify_html from "lume/plugins/minify_html.ts"; +import minifyHtml from "lume/plugins/minify_html.ts"; -const site_name = "RGBCube"; -const site_description = +const siteName = "RGBCube"; +const siteDescription = "The home directory and journal of RGBCube and his work."; const author = "RGBCube"; const color = "#00FFFF"; -const path_assets = "/assets"; +const pathAssets = "/assets"; const site = lume({ src: "./site", @@ -31,9 +31,9 @@ const site = lume({ site.data("layout", "default.vto"); -site.data("site_name", site_name); -site.data("title", site_name); -site.data("description", site_description); +site.data("site_name", siteName); +site.data("title", siteName); +site.data("description", siteDescription); site.data("author", author); site.data("color", color); @@ -69,20 +69,44 @@ site.process([".html"], (pages) => { element.parentNode!.insertBefore(wrapper, element); wrapper.appendChild(element); }); + + document + .querySelectorAll(".text-content :where(h1, h2, h3, h4, h5, h6)") + .forEach((header) => { + if (header.id || header.closest("a") || header.querySelector("a")) { + return; + } + + const textNormalized = header + .textContent! + .toLowerCase() + .replace(/[^a-z0-9\s-]/g, "") + .replace(/\s+/g, "-") + .replace(/-+/g, "-") + .trim(); + + header.id = textNormalized; + + const link = document.createElement("a"); + link.href = "#" + textNormalized; + + header.parentNode!.insertBefore(link, header); + link.appendChild(header); + }); }); }); -site.use(extract_date()); +site.use(extractDate()); site.use(redirects()); site.use(tailwindcss()); -site.use(code_highlight()); +site.use(codeHighlight()); -site.use(resolve_urls()); -site.use(slugify_urls({ +site.use(resolveUrls()); +site.use(slugifyUrls({ extensions: "*", })); -site.use(check_urls({ +site.use(checkUrls({ strict: true, throw: true, })); @@ -95,12 +119,12 @@ site.use(feed({ limit: Infinity, info: { - title: site_name, - description: site_description, + title: siteName, + description: siteDescription, authorName: author, - image: `${path_assets}/icons/icon.webp`, - icon: `${path_assets}/icons/icon.webp`, + image: `${pathAssets}/icons/icon.webp`, + icon: `${pathAssets}/icons/icon.webp`, color, @@ -122,7 +146,7 @@ site.use(sitemap({ site.use(lightningcss()); // TODO: LightningCSS doesn't handle inline styles. site.use(inline()); -site.use(minify_html({ +site.use(minifyHtml({ options: { // TODO: This breaks tailwind. // minify_css: true, diff --git a/site/assets/css/default.css b/site/assets/css/default.css index 92eaf27..21dd8b4 100644 --- a/site/assets/css/default.css +++ b/site/assets/css/default.css @@ -160,19 +160,35 @@ } a { - @apply inline-block wrap-anywhere text-[red] dark:text-[yellow] px-1 pb-0.75 - border-2 border-[transparent] border-dashed; + @apply px-1 pb-0.75; * { @apply wrap-anywhere; } - &:hover { - @apply border-[red] dark:border-[yellow]; + & :where(h1, h2, h3, h4, h5, h6) { + @apply before:underline before:underline-offset-4; + + * { + @apply inline-block; + } + + &:hover::before { + @apply italic text-[red] dark:text-[yellow]; + } } - &:active { - @apply border-[fuchsia] dark:border-[springgreen] animate-to-the-future; + &:not(:has(h1, h2, h3, h4, h5, h6)) { + @apply inline-block wrap-anywhere text-[red] dark:text-[yellow] border-2 + border-[transparent] border-dashed; + + &:hover { + @apply border-[red] dark:border-[yellow]; + } + + &:active { + @apply border-[fuchsia] dark:border-[springgreen] animate-to-the-future; + } } } diff --git a/site/contact.md b/site/contact.md index 7cdd895..6e48916 100644 --- a/site/contact.md +++ b/site/contact.md @@ -35,5 +35,5 @@ Here are some other useful links as well: const element = document.getElementById("bot-block"); element.href = real; - element.children[0].innerHTML = real.substring(7); + element.children[0].textContent = real.substring(7); From a01188e89243f143199b97b3676319314105abac Mon Sep 17 00:00:00 2001 From: RGBCube Date: Mon, 2 Jun 2025 23:07:48 +0300 Subject: [PATCH 02/28] headers: fix generated links --- site.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site.ts b/site.ts index 0f1a397..5e204d7 100644 --- a/site.ts +++ b/site.ts @@ -88,7 +88,7 @@ site.process([".html"], (pages) => { header.id = textNormalized; const link = document.createElement("a"); - link.href = "#" + textNormalized; + link.setAttribute("href", "#" + textNormalized); header.parentNode!.insertBefore(link, header); link.appendChild(header); From e799cc1c4519be40413e64e3d1243761362e9227 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Mon, 2 Jun 2025 23:18:15 +0300 Subject: [PATCH 03/28] headers: make anchors truly unique --- deno.lock | 23 ++--------------------- site.ts | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/deno.lock b/deno.lock index 1d63253..9c9de3e 100644 --- a/deno.lock +++ b/deno.lock @@ -19,7 +19,6 @@ "jsr:@std/html@1.0.3": "1.0.3", "jsr:@std/html@^1.0.4": "1.0.4", "jsr:@std/http@1.0.16": "1.0.16", - "jsr:@std/json@^1.0.2": "1.0.2", "jsr:@std/jsonc@1.0.2": "1.0.2", "jsr:@std/media-types@1.1.0": "1.1.0", "jsr:@std/media-types@^1.1.0": "1.1.0", @@ -35,7 +34,6 @@ "jsr:@std/yaml@^1.0.5": "1.0.6", "npm:@tailwindcss/node@4.1.7": "4.1.7", "npm:@tailwindcss/oxide@4.1.7": "4.1.7", - "npm:@types/estree@1.0.6": "1.0.6", "npm:estree-walker@3.0.3": "3.0.3", "npm:highlight.js@11.11.1": "11.11.1", "npm:lightningcss-wasm@1.30.1": "1.30.1", @@ -111,14 +109,8 @@ "jsr:@std/streams" ] }, - "@std/json@1.0.2": { - "integrity": "d9e5497801c15fb679f55a2c01c7794ad7a5dfda4dd1bebab5e409cb5e0d34d4" - }, "@std/jsonc@1.0.2": { - "integrity": "909605dae3af22bd75b1cbda8d64a32cf1fd2cf6efa3f9e224aba6d22c0f44c7", - "dependencies": [ - "jsr:@std/json" - ] + "integrity": "909605dae3af22bd75b1cbda8d64a32cf1fd2cf6efa3f9e224aba6d22c0f44c7" }, "@std/media-types@1.1.0": { "integrity": "c9d093f0c05c3512932b330e3cc1fe1d627b301db33a4c2c2185c02471d6eaa4" @@ -291,9 +283,6 @@ "tslib" ] }, - "@types/estree@1.0.6": { - "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==" - }, "@types/estree@1.0.7": { "integrity": "sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==" }, @@ -319,7 +308,7 @@ "estree-walker@3.0.3": { "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", "dependencies": [ - "@types/estree@1.0.7" + "@types/estree" ] }, "graceful-fs@4.2.11": { @@ -473,7 +462,6 @@ } }, "remote": { - "https://cdn.jsdelivr.net/gh/lumeland/bar@0.1.4/types.ts": "89d131290feb5c6781bf752525bc35d21a49612f9b3cd6b5e3a44dca15a996d6", "https://deno.land/std@0.170.0/_util/asserts.ts": "d0844e9b62510f89ce1f9878b046f6a57bf88f208a10304aab50efcb48365272", "https://deno.land/std@0.170.0/_util/os.ts": "8a33345f74990e627b9dfe2de9b040004b08ea5146c7c9e8fe9a29070d193934", "https://deno.land/std@0.170.0/encoding/base64.ts": "8605e018e49211efc767686f6f687827d7f5fd5217163e981d8d693105640d7a", @@ -666,7 +654,6 @@ "https://deno.land/x/lume@v3.0.2/deps/hex.ts": "828718f24a780ff3ade8d0a8a5b57497cb31c257560ef12af99b6eb1a31e3bbd", "https://deno.land/x/lume@v3.0.2/deps/highlight.ts": "e8f830a1137ff7e8246ce21518452b8cbf8089db409458c6d9c31040c11d8428", "https://deno.land/x/lume@v3.0.2/deps/http.ts": "6d9add7c6fe0c0381050aa773ae8590166ccc84c5115d2cde271320c315a110d", - "https://deno.land/x/lume@v3.0.2/deps/icons.ts": "4379e1443d982ab4f85237342d165ae54c981cdb7e06480c222d208999e21f15", "https://deno.land/x/lume@v3.0.2/deps/init.ts": "05d45af66ebdfe63e43540618f51ece8f99d98dc49de890f10eeb43abe9ed0f3", "https://deno.land/x/lume@v3.0.2/deps/jsonc.ts": "79f0eddc3c9e593310eb8e5918eb1506b1c7d7816e4ecb96894f634ecbe626ff", "https://deno.land/x/lume@v3.0.2/deps/lightningcss.ts": "5f5167c6eb306ef759f0043f8f33f2eaf63c69210aa1aa837505e990ee619c46", @@ -680,7 +667,6 @@ "https://deno.land/x/lume@v3.0.2/deps/vento.ts": "56cfaa39bc2bc8d67f4460a46e29f9174df223dffcb815bda0d8a8cd1cd19f75", "https://deno.land/x/lume@v3.0.2/deps/xml.ts": "a2171f6ed75576354faa685ebd62b63cf1d4ee518477f295604526416dd27e2f", "https://deno.land/x/lume@v3.0.2/deps/yaml.ts": "d0f41ff80ce1eee045a87bf055c199b5c6f316571dcad0fff99fba17e34990a2", - "https://deno.land/x/lume@v3.0.2/lint.ts": "4b369361e0cff20a8dfd9e3ff8cb642aa805e7532825ea3a5378eb1f80901fc6", "https://deno.land/x/lume@v3.0.2/middlewares/logger.ts": "c96f1a9f9d5757555b6f141865ce8551ac176f90c8ee3e9ad797b2b400a9a567", "https://deno.land/x/lume@v3.0.2/middlewares/no_cache.ts": "0119e3ae3a596ab12c42df693b93e5b03dd9608e289d862242751a9739438f35", "https://deno.land/x/lume@v3.0.2/middlewares/no_cors.ts": "4d24619b5373c98bcc3baf404db47ba088c87ac8538ea1784e58d197b81d4d02", @@ -692,7 +678,6 @@ "https://deno.land/x/lume@v3.0.2/plugins/code_highlight.ts": "ac6327e688e9e8fbd7798bdcc5f76b46d27db3e22ea3b74f545dc3296e8a1261", "https://deno.land/x/lume@v3.0.2/plugins/extract_date.ts": "38af8e5960d66a74a72977eb19521da4353ab32d3941e97c1526aa3b91175a9e", "https://deno.land/x/lume@v3.0.2/plugins/feed.ts": "b07aed4cda270cfaacb26f9974dbb962f936dbfde4d770c53e478e4682c791e1", - "https://deno.land/x/lume@v3.0.2/plugins/icons.ts": "c69428254024d694eca34f9b5c4888aedf83d2d9b38f860533952c28cc814333", "https://deno.land/x/lume@v3.0.2/plugins/inline.ts": "737d7de09d196476b55ecbe7ddb0e651ba2d5d39ca5a418cb15ff48e124907c1", "https://deno.land/x/lume@v3.0.2/plugins/json.ts": "5c49499e56b919ec848d4118ec97dd4fe0a323a6cc4c648dc45ab55297614c12", "https://deno.land/x/lume@v3.0.2/plugins/lightningcss.ts": "6b5236cc78c1ae4af5b4a0037a0345797381f5043c667ae1ddeb4f67e445c7c4", @@ -712,10 +697,6 @@ "https://deno.land/x/lume@v3.0.2/plugins/url.ts": "15f2e80b6fcbf86f8795a3676b8d533bab003ac016ff127e58165a6ac3bffc1a", "https://deno.land/x/lume@v3.0.2/plugins/vento.ts": "908ffbf31864507afa72c506584f2d28c2449b57a339ddfe8a7220eecf082766", "https://deno.land/x/lume@v3.0.2/plugins/yaml.ts": "d0ebf37c38648172c6b95c502753a3edf60278ab4f6a063f3ca00f31e0dd90cc", - "https://deno.land/x/lume@v3.0.2/types.ts": "5f580502f366b9b25106eb72d49b30d9af7715c8a304fe6e21f382d3c2a4cc38", - "https://deno.land/x/ssx@v0.1.10/css.ts": "39972fa9e375465b82e4fbf735dcc727acc89fdd836f93a395cfb3ccab54e7f0", - "https://deno.land/x/ssx@v0.1.10/html.ts": "5ad7bfd7a6a5b676b2686d406c105bbb02bea537183d95e0c04e76853a9ee155", - "https://deno.land/x/ssx@v0.1.10/jsx-runtime.ts": "f3d37c172698f0b0d7510c2023119264057cbc64a5602d4ca9091e80199a2abe", "https://deno.land/x/vento@v1.13.0/bare.ts": "b6cdcc245d4626832ab3a7fb4f2885541e997d2806334d8048d39401fa63d50e", "https://deno.land/x/vento@v1.13.0/deps.ts": "155958dfada8d8cb3c8a001413c759928647b23e0e9db25195614549b58d085f", "https://deno.land/x/vento@v1.13.0/mod.ts": "53262793b5e0176acdec84aa9c34ed3ecb0c45cc9d396bf34a06ed4ad3d9930a", diff --git a/site.ts b/site.ts index 5e204d7..f307451 100644 --- a/site.ts +++ b/site.ts @@ -70,6 +70,8 @@ site.process([".html"], (pages) => { wrapper.appendChild(element); }); + const encountered: Record = {}; + document .querySelectorAll(".text-content :where(h1, h2, h3, h4, h5, h6)") .forEach((header) => { @@ -85,10 +87,20 @@ site.process([".html"], (pages) => { .replace(/-+/g, "-") .trim(); - header.id = textNormalized; + let textUnique = textNormalized; + let counter = 1; + + while (encountered[textUnique]) { + counter++; + textUnique = `${textNormalized}-${counter}`; + } + + encountered[textUnique] = true; + + header.id = textUnique; const link = document.createElement("a"); - link.setAttribute("href", "#" + textNormalized); + link.setAttribute("href", "#" + textUnique); header.parentNode!.insertBefore(link, header); link.appendChild(header); From c96c59ecf5475ebbbc37d0ec5ad614ebd37f953c Mon Sep 17 00:00:00 2001 From: RGBCube Date: Mon, 2 Jun 2025 23:20:57 +0300 Subject: [PATCH 04/28] headers: make them actually have unique IDs --- site.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/site.ts b/site.ts index f307451..7b59c63 100644 --- a/site.ts +++ b/site.ts @@ -70,8 +70,6 @@ site.process([".html"], (pages) => { wrapper.appendChild(element); }); - const encountered: Record = {}; - document .querySelectorAll(".text-content :where(h1, h2, h3, h4, h5, h6)") .forEach((header) => { @@ -90,13 +88,11 @@ site.process([".html"], (pages) => { let textUnique = textNormalized; let counter = 1; - while (encountered[textUnique]) { + while (document.getElementById(textUnique)) { counter++; textUnique = `${textNormalized}-${counter}`; } - encountered[textUnique] = true; - header.id = textUnique; const link = document.createElement("a"); From ab09647f76baecd69fb0fc05a331889660a03086 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Mon, 2 Jun 2025 23:46:18 +0300 Subject: [PATCH 05/28] code: better link styling --- site/assets/css/default.css | 50 ++++++++++++++++++++++++++----------- site/blog.vto | 5 +--- 2 files changed, 36 insertions(+), 19 deletions(-) diff --git a/site/assets/css/default.css b/site/assets/css/default.css index 21dd8b4..181e89a 100644 --- a/site/assets/css/default.css +++ b/site/assets/css/default.css @@ -160,12 +160,37 @@ } a { - @apply px-1 pb-0.75; + @apply m-0; * { @apply wrap-anywhere; } + &:not(:has(> code:only-child)) { + @apply px-1; + + &:not(.font-mono) { + @apply pb-0.75; + } + } + + &:not(:has(h1, h2, h3, h4, h5, h6)) { + @apply inline-block wrap-anywhere text-[red] dark:text-[yellow] border-2 + border-[transparent] border-dashed; + + &:has(> code:only-child) { + @apply border-dotted; + } + + &:hover { + @apply border-[red] dark:border-[yellow]; + } + + &:active { + @apply border-[fuchsia] dark:border-[springgreen] animate-to-the-future; + } + } + & :where(h1, h2, h3, h4, h5, h6) { @apply before:underline before:underline-offset-4; @@ -177,19 +202,6 @@ @apply italic text-[red] dark:text-[yellow]; } } - - &:not(:has(h1, h2, h3, h4, h5, h6)) { - @apply inline-block wrap-anywhere text-[red] dark:text-[yellow] border-2 - border-[transparent] border-dashed; - - &:hover { - @apply border-[red] dark:border-[yellow]; - } - - &:active { - @apply border-[fuchsia] dark:border-[springgreen] animate-to-the-future; - } - } } /* TODO: Make it better. */ @@ -210,12 +222,20 @@ @apply border-black dark:border-white; } + code:not(pre > code) { + @apply border-1 border-dotted px-2 py-0.5 border-black dark:border-white; + + a:hover & { + @apply border-transparent; + } + } + pre code, pre code * { @apply whitespace-pre; } div:has(> pre code) { - @apply outline-1 outline-dotted outline-offset-1 outline-[#444] border-1 + @apply outline outline-dotted outline-offset-1 outline-[#444] border-1 border-black p-2 bg-[#eee] dark:outline-[#bbb] dark:border-white dark:bg-[#111]; } diff --git a/site/blog.vto b/site/blog.vto index 9f7465c..86ddfc6 100644 --- a/site/blog.vto +++ b/site/blog.vto @@ -20,12 +20,9 @@ Blog Articles
    {{ for article of search.pages("type=article", "order=asc date=desc")}}
  • - - - + {{ article.date.toISOString().slice(2, 10).replaceAll("-", " ") }} - {{ article.title |> md }}
  • From 6564bd61c72869b849cc37025db5999b58cf545a Mon Sep 17 00:00:00 2001 From: RGBCube Date: Tue, 3 Jun 2025 00:43:29 +0300 Subject: [PATCH 06/28] blog: ??? --- deno.lock | 21 +++++++++++++++-- site/blog.vto | 62 ++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 78 insertions(+), 5 deletions(-) diff --git a/deno.lock b/deno.lock index 9c9de3e..e736f75 100644 --- a/deno.lock +++ b/deno.lock @@ -19,6 +19,7 @@ "jsr:@std/html@1.0.3": "1.0.3", "jsr:@std/html@^1.0.4": "1.0.4", "jsr:@std/http@1.0.16": "1.0.16", + "jsr:@std/json@^1.0.2": "1.0.2", "jsr:@std/jsonc@1.0.2": "1.0.2", "jsr:@std/media-types@1.1.0": "1.1.0", "jsr:@std/media-types@^1.1.0": "1.1.0", @@ -34,6 +35,7 @@ "jsr:@std/yaml@^1.0.5": "1.0.6", "npm:@tailwindcss/node@4.1.7": "4.1.7", "npm:@tailwindcss/oxide@4.1.7": "4.1.7", + "npm:@types/estree@1.0.6": "1.0.6", "npm:estree-walker@3.0.3": "3.0.3", "npm:highlight.js@11.11.1": "11.11.1", "npm:lightningcss-wasm@1.30.1": "1.30.1", @@ -109,8 +111,14 @@ "jsr:@std/streams" ] }, + "@std/json@1.0.2": { + "integrity": "d9e5497801c15fb679f55a2c01c7794ad7a5dfda4dd1bebab5e409cb5e0d34d4" + }, "@std/jsonc@1.0.2": { - "integrity": "909605dae3af22bd75b1cbda8d64a32cf1fd2cf6efa3f9e224aba6d22c0f44c7" + "integrity": "909605dae3af22bd75b1cbda8d64a32cf1fd2cf6efa3f9e224aba6d22c0f44c7", + "dependencies": [ + "jsr:@std/json" + ] }, "@std/media-types@1.1.0": { "integrity": "c9d093f0c05c3512932b330e3cc1fe1d627b301db33a4c2c2185c02471d6eaa4" @@ -283,6 +291,9 @@ "tslib" ] }, + "@types/estree@1.0.6": { + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==" + }, "@types/estree@1.0.7": { "integrity": "sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==" }, @@ -308,7 +319,7 @@ "estree-walker@3.0.3": { "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", "dependencies": [ - "@types/estree" + "@types/estree@1.0.7" ] }, "graceful-fs@4.2.11": { @@ -462,6 +473,7 @@ } }, "remote": { + "https://cdn.jsdelivr.net/gh/lumeland/bar@0.1.4/types.ts": "89d131290feb5c6781bf752525bc35d21a49612f9b3cd6b5e3a44dca15a996d6", "https://deno.land/std@0.170.0/_util/asserts.ts": "d0844e9b62510f89ce1f9878b046f6a57bf88f208a10304aab50efcb48365272", "https://deno.land/std@0.170.0/_util/os.ts": "8a33345f74990e627b9dfe2de9b040004b08ea5146c7c9e8fe9a29070d193934", "https://deno.land/std@0.170.0/encoding/base64.ts": "8605e018e49211efc767686f6f687827d7f5fd5217163e981d8d693105640d7a", @@ -667,6 +679,7 @@ "https://deno.land/x/lume@v3.0.2/deps/vento.ts": "56cfaa39bc2bc8d67f4460a46e29f9174df223dffcb815bda0d8a8cd1cd19f75", "https://deno.land/x/lume@v3.0.2/deps/xml.ts": "a2171f6ed75576354faa685ebd62b63cf1d4ee518477f295604526416dd27e2f", "https://deno.land/x/lume@v3.0.2/deps/yaml.ts": "d0f41ff80ce1eee045a87bf055c199b5c6f316571dcad0fff99fba17e34990a2", + "https://deno.land/x/lume@v3.0.2/lint.ts": "4b369361e0cff20a8dfd9e3ff8cb642aa805e7532825ea3a5378eb1f80901fc6", "https://deno.land/x/lume@v3.0.2/middlewares/logger.ts": "c96f1a9f9d5757555b6f141865ce8551ac176f90c8ee3e9ad797b2b400a9a567", "https://deno.land/x/lume@v3.0.2/middlewares/no_cache.ts": "0119e3ae3a596ab12c42df693b93e5b03dd9608e289d862242751a9739438f35", "https://deno.land/x/lume@v3.0.2/middlewares/no_cors.ts": "4d24619b5373c98bcc3baf404db47ba088c87ac8538ea1784e58d197b81d4d02", @@ -697,6 +710,10 @@ "https://deno.land/x/lume@v3.0.2/plugins/url.ts": "15f2e80b6fcbf86f8795a3676b8d533bab003ac016ff127e58165a6ac3bffc1a", "https://deno.land/x/lume@v3.0.2/plugins/vento.ts": "908ffbf31864507afa72c506584f2d28c2449b57a339ddfe8a7220eecf082766", "https://deno.land/x/lume@v3.0.2/plugins/yaml.ts": "d0ebf37c38648172c6b95c502753a3edf60278ab4f6a063f3ca00f31e0dd90cc", + "https://deno.land/x/lume@v3.0.2/types.ts": "5f580502f366b9b25106eb72d49b30d9af7715c8a304fe6e21f382d3c2a4cc38", + "https://deno.land/x/ssx@v0.1.10/css.ts": "39972fa9e375465b82e4fbf735dcc727acc89fdd836f93a395cfb3ccab54e7f0", + "https://deno.land/x/ssx@v0.1.10/html.ts": "5ad7bfd7a6a5b676b2686d406c105bbb02bea537183d95e0c04e76853a9ee155", + "https://deno.land/x/ssx@v0.1.10/jsx-runtime.ts": "f3d37c172698f0b0d7510c2023119264057cbc64a5602d4ca9091e80199a2abe", "https://deno.land/x/vento@v1.13.0/bare.ts": "b6cdcc245d4626832ab3a7fb4f2885541e997d2806334d8048d39401fa63d50e", "https://deno.land/x/vento@v1.13.0/deps.ts": "155958dfada8d8cb3c8a001413c759928647b23e0e9db25195614549b58d085f", "https://deno.land/x/vento@v1.13.0/mod.ts": "53262793b5e0176acdec84aa9c34ed3ecb0c45cc9d396bf34a06ed4ad3d9930a", diff --git a/site/blog.vto b/site/blog.vto index 86ddfc6..20d6287 100644 --- a/site/blog.vto +++ b/site/blog.vto @@ -9,8 +9,8 @@ title: about:blog Blog Articles - rss - json + rss + json @@ -20,7 +20,7 @@ Blog Articles + + From 5efa81ca2a6f3158a0807bae2aef6d92cfb377a9 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Tue, 3 Jun 2025 01:57:41 +0300 Subject: [PATCH 07/28] blog: ???? --- site/blog.vto | 187 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 150 insertions(+), 37 deletions(-) diff --git a/site/blog.vto b/site/blog.vto index 20d6287..108495e 100644 --- a/site/blog.vto +++ b/site/blog.vto @@ -30,57 +30,170 @@ Blog Articles
- matrix = {}; - return; - } + From 3732704d74b0af4f4857e7f50faa264fd9119954 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Tue, 3 Jun 2025 02:45:54 +0300 Subject: [PATCH 08/28] blog: fix animation --- site/blog.vto | 107 ++++++++++++++++++++++++++------------------------ 1 file changed, 55 insertions(+), 52 deletions(-) diff --git a/site/blog.vto b/site/blog.vto index 108495e..b114ae3 100644 --- a/site/blog.vto +++ b/site/blog.vto @@ -90,7 +90,7 @@ Blog Articles From 1bb9d9c541af8f041788295bd134dd219dd77dd3 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Tue, 3 Jun 2025 02:53:00 +0300 Subject: [PATCH 09/28] css: hide border of links when active too --- site/assets/css/default.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/assets/css/default.css b/site/assets/css/default.css index 181e89a..c7fc64d 100644 --- a/site/assets/css/default.css +++ b/site/assets/css/default.css @@ -225,7 +225,7 @@ code:not(pre > code) { @apply border-1 border-dotted px-2 py-0.5 border-black dark:border-white; - a:hover & { + a:hover &, a:active & { @apply border-transparent; } } From dcca24e7cc413d5d51a8e4920ce8c7dfee5900ba Mon Sep 17 00:00:00 2001 From: RGBCube Date: Tue, 3 Jun 2025 02:56:13 +0300 Subject: [PATCH 10/28] cube: make cube-face a class --- site/404.vto | 2 +- site/_includes/cube.vto | 12 ++++++------ site/index.vto | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/site/404.vto b/site/404.vto index 209b2ad..7d3c016 100644 --- a/site/404.vto +++ b/site/404.vto @@ -4,7 +4,7 @@ prevent_zoom: true --- diff --git a/site/_includes/rgbcube.vto b/site/_includes/rgbcube.vto new file mode 100644 index 0000000..9752f98 --- /dev/null +++ b/site/_includes/rgbcube.vto @@ -0,0 +1,72 @@ + + +{{ include "cube.vto" }} + diff --git a/site/index.vto b/site/index.vto index b7a565b..207b526 100644 --- a/site/index.vto +++ b/site/index.vto @@ -4,73 +4,8 @@ prevent_zoom: true @@ -97,4 +32,4 @@ prevent_zoom: true blog {{ /set }} -{{ include "cube.vto" }} +{{ include "rgbcube.vto" }} From e25d198cc96c071e2b70d48c175a5c85d25c6009 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Tue, 3 Jun 2025 03:32:37 +0300 Subject: [PATCH 16/28] cube: make cube size a template parameter --- site/404.vto | 1 + site/_includes/cube.vto | 26 +++++++++++--------------- site/index.vto | 1 + 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/site/404.vto b/site/404.vto index 4b2bb0a..92af0d0 100644 --- a/site/404.vto +++ b/site/404.vto @@ -29,4 +29,5 @@ prevent_zoom: true {{ set cube_face_top = cube_face }} {{ set cube_face_bottom = cube_face }} +{{ set cube_size = "5rem" }} {{ include "cube.vto" }} diff --git a/site/_includes/cube.vto b/site/_includes/cube.vto index de9eeb6..aaccde4 100644 --- a/site/_includes/cube.vto +++ b/site/_includes/cube.vto @@ -1,37 +1,33 @@ {{ cube_face_front }} {{ cube_face_back }} diff --git a/site/index.vto b/site/index.vto index 207b526..d5fe22b 100644 --- a/site/index.vto +++ b/site/index.vto @@ -32,4 +32,5 @@ prevent_zoom: true blog {{ /set }} +{{ set cube_size = "5rem" }} {{ include "rgbcube.vto" }} From 23bdfef6cc6b67cb064e1f7d8043721840ea4378 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Tue, 3 Jun 2025 03:35:30 +0300 Subject: [PATCH 17/28] cube: unfix size --- site/404.vto | 9 +++++++++ site/_includes/cube.vto | 7 +------ site/index.vto | 9 +++++++++ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/site/404.vto b/site/404.vto index 92af0d0..ec2edba 100644 --- a/site/404.vto +++ b/site/404.vto @@ -4,6 +4,15 @@ prevent_zoom: true --- cube-face { height: {{ cube_size }}; @@ -14,6 +15,7 @@ .cube-face-right { transform: rotateY( 89.99999999999999deg) translateZ(calc({{ cube_size }} / 2 - 1px)); } .cube-face-left { transform: rotateY(-89.99999999999999deg) translateZ(calc({{ cube_size }} / 2 - 1px)); } +{{ /if }} +{{ /if }} diff --git a/site/index.vto b/site/index.vto index 1e32257..576b2ef 100644 --- a/site/index.vto +++ b/site/index.vto @@ -42,4 +42,5 @@ prevent_zoom: true {{ /set }} {{ set cube_size = "5rem" }} +{{ set cube_last = true }} {{ include "rgbcube.vto" }} From 217f19841f3c5e9986115018bb22476cede3906f Mon Sep 17 00:00:00 2001 From: RGBCube Date: Tue, 3 Jun 2025 03:51:05 +0300 Subject: [PATCH 19/28] text: replace cube gif with real cube --- site/_includes/cube.vto | 16 +++++++++------- site/_includes/text.vto | 8 +++++++- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/site/_includes/cube.vto b/site/_includes/cube.vto index fd4c4ed..fbf322f 100644 --- a/site/_includes/cube.vto +++ b/site/_includes/cube.vto @@ -1,3 +1,5 @@ +{{ set cube_minus_px = cube_small ? "" : "- 1px" }} + {{ if cube_last }} {{ /if }} @@ -24,7 +26,7 @@ "> {{ cube_face_front }} {{ cube_face_back }} diff --git a/site/_includes/text.vto b/site/_includes/text.vto index 554506e..eb9f638 100644 --- a/site/_includes/text.vto +++ b/site/_includes/text.vto @@ -37,7 +37,13 @@ layout: default.vto From 2ccbbf3a17048ece5d7d484b282018a5949edb6e Mon Sep 17 00:00:00 2001 From: RGBCube Date: Tue, 3 Jun 2025 04:02:33 +0300 Subject: [PATCH 20/28] cube: make impulseIdle a global --- site/_includes/cube.vto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/_includes/cube.vto b/site/_includes/cube.vto index fbf322f..c8e2965 100644 --- a/site/_includes/cube.vto +++ b/site/_includes/cube.vto @@ -141,6 +141,7 @@ let velocity = Vec.ZERO; let impulseThisFrame = Vec.ZERO; + let impulseIdle = Vec(0.7, 0.7, -0.7); const handleUp = () => { mouse.down = false; @@ -254,8 +255,7 @@ } if (globalThis.performance.now() - mouse.lastMove > screensaverTimeoutMs) { - const impulse = Vec(0.7, 0.7, -0.7); - velocity = Vec.sum(impulse.scale(effectiveDelta * 3), velocity); + velocity = Vec.sum(impulseIdle.scale(effectiveDelta * 3), velocity); } const axis = Vec(velocity.x, velocity.y, velocity.z) From 5c35c3b73d52f570e1d38592efb9c6bf2d6840d5 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Tue, 3 Jun 2025 04:17:45 +0300 Subject: [PATCH 21/28] cube: make script operators methods --- site/_includes/cube.vto | 60 ++++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/site/_includes/cube.vto b/site/_includes/cube.vto index c8e2965..bf2b290 100644 --- a/site/_includes/cube.vto +++ b/site/_includes/cube.vto @@ -60,27 +60,40 @@ return Vec(this.x / length, this.y / length, this.z / length); }, + + sum(that) { + return Vec( + this.x + that.x, + this.y + that.y, + this.z + that.z, + ); + }, + + sub(that) { + return Vec( + this.x - that.x, + this.y - that.y, + this.z - that.z, + ); + }, }); Vec.ZERO = Vec(0, 0, 0); - Vec.sum = (a, b) => Vec( - a.x + b.x, - a.y + b.y, - a.z + b.z, - ); - - Vec.sub = (a, b) => Vec( - a.x - b.x, - a.y - b.y, - a.z - b.z, - ); - const Quat = (x, y, z, w) => ({ x, y, z, w, + + mul(that) { + return Quat( + this.w * that.x + this.x * that.w + this.y * that.z - this.z * that.y, + this.w * that.y - this.x * that.z + this.y * that.w + this.z * that.x, + this.w * that.z + this.x * that.y - this.y * that.x + this.z * that.w, + this.w * that.w - this.x * that.x - this.y * that.y - this.z * that.z, + ); + } }); Quat.fromAxis = (axis) => { @@ -101,13 +114,6 @@ return Quat(x, y, z, w); }; - Quat.mul = (a, b) => Quat( - a.w * b.x + a.x * b.w + a.y * b.z - a.z * b.y, - a.w * b.y - a.x * b.z + a.y * b.w + a.z * b.x, - a.w * b.z + a.x * b.y - a.y * b.x + a.z * b.w, - a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z, - ); - const friction = 3; const sensitivityMouse = 0.01; const sensitivityWheel = 0.006; @@ -141,7 +147,7 @@ let velocity = Vec.ZERO; let impulseThisFrame = Vec.ZERO; - let impulseIdle = Vec(0.7, 0.7, -0.7); + let impulseIdle = Vec(2, 2, -2); const handleUp = () => { mouse.down = false; @@ -172,7 +178,7 @@ mouse.previous = newMouse; } - const delta = Vec.sub(newMouse, mouse.previous); + const delta = newMouse.sub(mouse.previous); mouse.previous = newMouse; mouse.lastMove = globalThis.performance.now(); @@ -182,10 +188,10 @@ .scale(delta.length()) .scale(sensitivityMouse); - impulseThisFrame = Vec.sum(impulseThisFrame, axis); + impulseThisFrame = impulseThisFrame.sum(axis); const rotation = Quat.fromAxis(axis); - orient.set(Quat.mul(rotation, orient.get())); + orient.set(rotation.mul(orient.get())); }; document.addEventListener("mousemove", handleMove); @@ -212,10 +218,10 @@ const axis = Vec(event.deltaY, -event.deltaX, 0) .scale(sensitivityWheel); - impulseThisFrame = Vec.sum(impulseThisFrame, axis); + impulseThisFrame = impulseThisFrame.sum(axis); const rotation = Quat.fromAxis(axis); - orient.set(Quat.mul(rotation, orient.get())); + orient.set(rotation.mul(orient.get())); }; document.addEventListener("wheel", handleWheel, { passive: false }); @@ -255,7 +261,7 @@ } if (globalThis.performance.now() - mouse.lastMove > screensaverTimeoutMs) { - velocity = Vec.sum(impulseIdle.scale(effectiveDelta * 3), velocity); + velocity = velocity.sum(impulseIdle.scale(effectiveDelta)); } const axis = Vec(velocity.x, velocity.y, velocity.z) @@ -264,7 +270,7 @@ const rotation = Quat.fromAxis(axis); - orient.set(Quat.mul(rotation, orient.get())); + orient.set(rotation.mul(orient.get())); requestAnimationFrame(updateFrame); }; From 490886b5f4f964c30f0b1934cbfbc5a9c83bc2d2 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Tue, 3 Jun 2025 04:25:21 +0300 Subject: [PATCH 22/28] text: draggable=false on tiny cube --- site/_includes/text.vto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/_includes/text.vto b/site/_includes/text.vto index eb9f638..7ae428a 100644 --- a/site/_includes/text.vto +++ b/site/_includes/text.vto @@ -38,7 +38,7 @@ layout: default.vto