diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..4769d2e --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,40 @@ +on: + push: + +jobs: + deploy: + name: "Deploy lastest (v4000) Docs on Cloudflare Workers" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup PNPM + uses: pnpm/action-setup@v4 + - name: Deploy app + uses: cloudflare/wrangler-action@v3 + with: + packageManager: pnpm + apiToken: ${{ secrets.CLOUDFLARE_WORKERS_KEY }} + command: pages deploy dist --project-name=kaplay4000 + preCommands: "pnpm i && pnpm build" + + deploylegacy: + name: "Deploy legacy (v3001) Docs on Cloudflare Workers" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - name: Setup PNPM + uses: pnpm/action-setup@v4 + - name: Checkout submodule to v3001 + run: | + cd kaplay + git checkout v3001 + cd .. + - name: Deploy app + uses: cloudflare/wrangler-action@v3 + with: + packageManager: pnpm + apiToken: ${{ secrets.CLOUDFLARE_WORKERS_KEY }} + command: pages deploy dist --project-name=kaplay3001 + preCommands: "pnpm i && pnpm build" diff --git a/.gitignore b/.gitignore index 81fa694..91b1730 100644 --- a/.gitignore +++ b/.gitignore @@ -26,4 +26,5 @@ pnpm-debug.log* doc.json kaplay/ -.wrangler/ \ No newline at end of file +.wrangler/ +public/pagefind \ No newline at end of file diff --git a/assets/api_icon.png b/assets/api_icon.png new file mode 100644 index 0000000..3211e99 Binary files /dev/null and b/assets/api_icon.png differ diff --git a/assets/blog_icon.png b/assets/blog_icon.png new file mode 100644 index 0000000..14089c3 Binary files /dev/null and b/assets/blog_icon.png differ diff --git a/assets/controller_icon.png b/assets/controller_icon.png new file mode 100644 index 0000000..21bad45 Binary files /dev/null and b/assets/controller_icon.png differ diff --git a/assets/discord_icon.png b/assets/discord_icon.png new file mode 100644 index 0000000..be8796d Binary files /dev/null and b/assets/discord_icon.png differ diff --git a/assets/donate_icon.png b/assets/donate_icon.png new file mode 100644 index 0000000..f943b5d Binary files /dev/null and b/assets/donate_icon.png differ diff --git a/assets/gh_icon.png b/assets/gh_icon.png new file mode 100644 index 0000000..b64de68 Binary files /dev/null and b/assets/gh_icon.png differ diff --git a/assets/guides_icon.png b/assets/guides_icon.png new file mode 100644 index 0000000..4ebd5bd Binary files /dev/null and b/assets/guides_icon.png differ diff --git a/assets/home_icon.png b/assets/home_icon.png new file mode 100644 index 0000000..8b581d2 Binary files /dev/null and b/assets/home_icon.png differ diff --git a/assets/pog_icon.aseprite b/assets/pog_icon.aseprite new file mode 100644 index 0000000..2923183 Binary files /dev/null and b/assets/pog_icon.aseprite differ diff --git a/assets/pog_icon.png b/assets/pog_icon.png new file mode 100644 index 0000000..9ffdfeb Binary files /dev/null and b/assets/pog_icon.png differ diff --git a/assets/src/api_icon.aseprite b/assets/src/api_icon.aseprite new file mode 100644 index 0000000..ce2f7d3 Binary files /dev/null and b/assets/src/api_icon.aseprite differ diff --git a/assets/src/blog_icon.aseprite b/assets/src/blog_icon.aseprite new file mode 100644 index 0000000..6e0e046 Binary files /dev/null and b/assets/src/blog_icon.aseprite differ diff --git a/assets/src/controller_icon.aseprite b/assets/src/controller_icon.aseprite new file mode 100644 index 0000000..75fd6e7 Binary files /dev/null and b/assets/src/controller_icon.aseprite differ diff --git a/assets/src/discord_icon.aseprite b/assets/src/discord_icon.aseprite new file mode 100644 index 0000000..27161b9 Binary files /dev/null and b/assets/src/discord_icon.aseprite differ diff --git a/assets/src/donate_icon.aseprite b/assets/src/donate_icon.aseprite new file mode 100644 index 0000000..33de3a3 Binary files /dev/null and b/assets/src/donate_icon.aseprite differ diff --git a/assets/src/gh_icon.aseprite b/assets/src/gh_icon.aseprite new file mode 100644 index 0000000..3e590b1 Binary files /dev/null and b/assets/src/gh_icon.aseprite differ diff --git a/assets/src/guides_icon.aseprite b/assets/src/guides_icon.aseprite new file mode 100644 index 0000000..973497e Binary files /dev/null and b/assets/src/guides_icon.aseprite differ diff --git a/assets/src/home_icon.aseprite b/assets/src/home_icon.aseprite new file mode 100644 index 0000000..92e6595 Binary files /dev/null and b/assets/src/home_icon.aseprite differ diff --git a/assets/src/pog_icon.aseprite b/assets/src/pog_icon.aseprite new file mode 100644 index 0000000..2923183 Binary files /dev/null and b/assets/src/pog_icon.aseprite differ diff --git a/package.json b/package.json index 543d4a7..03d64f3 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "install": "git submodule init && git submodule update && cd kaplay && pnpm i", "dev": "npm run doc && astro dev", "start": "npm run doc && astro dev", - "build": "npm run doc && astro check && astro build && npm run lunaria:build", + "build": "npm run doc && astro check && astro build && pnpm run pagefind:build && npm run lunaria:build", "preview": "astro preview", "astro": "astro", "doc": "node scripts/buildDoc.js", @@ -18,7 +18,8 @@ "cf:deploy": "npm run build && wrangler pages deploy dist", "cf:preview": "wrangler pages dev dist", "f:dev": "astro dev", - "f:build": "NODE_ENV=fastproduction astro build" + "f:build": "NODE_ENV=fastproduction astro build", + "pagefind:build": "pagefind --site dist" }, "dependencies": { "@astrojs/check": "^0.7.0", @@ -34,6 +35,7 @@ "@types/node": "20", "astro": "^4.10.3", "astro-meta-tags": "^0.3.0", + "astro-pagefind": "^1.6.0", "astro-robots-txt": "^1.0.0", "dprint": "^0.47.2", "marked": "^13.0.0", @@ -48,6 +50,7 @@ "clsx": "^2.1.1", "daisyui": "^4.12.2", "dts-bundle-generator": "^9.5.1", + "pagefind": "^1.1.0", "shiki": "^1.9.0", "tailwind-merge": "^2.3.0", "wrangler": "^3.58.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 38e2238..5b0287f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -47,6 +47,9 @@ importers: astro-meta-tags: specifier: ^0.3.0 version: 0.3.0(astro@4.10.3(@types/node@20.14.8)(typescript@5.5.2)) + astro-pagefind: + specifier: ^1.6.0 + version: 1.6.0(astro@4.10.3(@types/node@20.14.8)(typescript@5.5.2)) astro-robots-txt: specifier: ^1.0.0 version: 1.0.0 @@ -84,6 +87,9 @@ importers: dts-bundle-generator: specifier: ^9.5.1 version: 9.5.1 + pagefind: + specifier: ^1.1.0 + version: 1.1.0 shiki: specifier: ^1.9.0 version: 1.9.0 @@ -996,10 +1002,41 @@ packages: resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} engines: {node: '>= 8'} + '@pagefind/darwin-arm64@1.1.0': + resolution: {integrity: sha512-SLsXNLtSilGZjvqis8sX42fBWsWAVkcDh1oerxwqbac84HbiwxpxOC2jm8hRwcR0Z55HPZPWO77XeRix/8GwTg==} + cpu: [arm64] + os: [darwin] + + '@pagefind/darwin-x64@1.1.0': + resolution: {integrity: sha512-QjQSE/L5oS1C8N8GdljGaWtjCBMgMtfrPAoiCmINTu9Y9dp0ggAyXvF8K7Qg3VyIMYJ6v8vg2PN7Z3b+AaAqUA==} + cpu: [x64] + os: [darwin] + + '@pagefind/default-ui@1.1.0': + resolution: {integrity: sha512-+XiAJAK++C64nQcD7s3Prdmd5S92lT05fwjOxm0L1jj80jbL+tmvcqkkFnPpoqhnicIPgcAX/Y5W0HRZnBt35w==} + + '@pagefind/linux-arm64@1.1.0': + resolution: {integrity: sha512-8zjYCa2BtNEL7KnXtysPtBELCyv5DSQ4yHeK/nsEq6w4ToAMTBl0K06khqxdSGgjMSwwrxvLzq3so0LC5Q14dA==} + cpu: [arm64] + os: [linux] + + '@pagefind/linux-x64@1.1.0': + resolution: {integrity: sha512-4lsg6VB7A6PWTwaP8oSmXV4O9H0IHX7AlwTDcfyT+YJo/sPXOVjqycD5cdBgqNLfUk8B9bkWcTDCRmJbHrKeCw==} + cpu: [x64] + os: [linux] + + '@pagefind/windows-x64@1.1.0': + resolution: {integrity: sha512-OboCM76BcMKT9IoSfZuFhiqMRgTde8x4qDDvKulFmycgiJrlL5WnIqBHJLQxZq+o2KyZpoHF97iwsGAm8c32sQ==} + cpu: [x64] + os: [win32] + '@pkgjs/parseargs@0.11.0': resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} + '@polka/url@1.0.0-next.25': + resolution: {integrity: sha512-j7P6Rgr3mmtdkeDGTe0E/aYyWEWVtc5yFXtHCRHs28/jptDEWfaVOc5T7cblqy1XKPPfCxJc/8DwQ5YgLOZOVQ==} + '@qwikdev/astro@0.5.16': resolution: {integrity: sha512-eGpieVOLdO9H96+d/OY684GPYPjhyuSupsPeM829EA/Giwtbb1zXoLC+sUNYhqlyA/bSFjdUv/fwryOPpPfChw==} peerDependencies: @@ -1279,6 +1316,11 @@ packages: peerDependencies: astro: ^4.0.0 + astro-pagefind@1.6.0: + resolution: {integrity: sha512-U/WuE0ktkZkoFJf6yopWO4DjIJ3+wrnopE2L3kUYiyqNTJpqmp13bFLR8gir6B+KzQ5dsXQtJZYTQtKJg1FxIA==} + peerDependencies: + astro: ^2.0.4 || ^3.0.0 || ^4.0.0 + astro-robots-txt@1.0.0: resolution: {integrity: sha512-6JQSLid4gMhoWjOm85UHLkgrw0+hHIjnJVIUqxjU2D6feKlVyYukMNYjH44ZDZBK1P8hNxd33PgWlHzCASvedA==} @@ -2337,6 +2379,10 @@ packages: resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==} engines: {node: '>=6'} + pagefind@1.1.0: + resolution: {integrity: sha512-1nmj0/vfYcMxNEQj0YDRp6bTVv9hI7HLdPhK/vBBYlrnwjATndQvHyicj5Y7pUHrpCFZpFnLVQXIF829tpFmaw==} + hasBin: true + parse-entities@4.0.1: resolution: {integrity: sha512-SWzvYcSJh4d/SGLIOQfZ/CoNv6BTlI6YEQ7Nj82oDVnRpwe/Z/F1EMx42x3JAOwGBlCjeCH0BRJQbQ/opHL17w==} @@ -2666,6 +2712,10 @@ packages: simple-swizzle@0.2.2: resolution: {integrity: sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==} + sirv@2.0.4: + resolution: {integrity: sha512-94Bdh3cC2PKrbgSOUqTiGPWVZeSiXfKOVZNJniWoqrWrRkB1CJzBU3NEbiTsPcYy1lDsANA/THzS+9WBiy5nfQ==} + engines: {node: '>= 10'} + sisteransi@1.0.5: resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} @@ -2793,6 +2843,10 @@ packages: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} + totalist@3.0.1: + resolution: {integrity: sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==} + engines: {node: '>=6'} + trim-lines@3.0.1: resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==} @@ -3970,9 +4024,28 @@ snapshots: '@nodelib/fs.scandir': 2.1.5 fastq: 1.17.1 + '@pagefind/darwin-arm64@1.1.0': + optional: true + + '@pagefind/darwin-x64@1.1.0': + optional: true + + '@pagefind/default-ui@1.1.0': {} + + '@pagefind/linux-arm64@1.1.0': + optional: true + + '@pagefind/linux-x64@1.1.0': + optional: true + + '@pagefind/windows-x64@1.1.0': + optional: true + '@pkgjs/parseargs@0.11.0': optional: true + '@polka/url@1.0.0-next.25': {} + '@qwikdev/astro@0.5.16(@builder.io/qwik@1.5.6(@types/node@20.14.8)(undici@5.28.4))(astro@4.10.3(@types/node@20.14.8)(typescript@5.5.2))(typescript@5.5.2)(vite@5.3.1(@types/node@20.14.8))': dependencies: '@builder.io/qwik': 1.5.6(@types/node@20.14.8)(undici@5.28.4) @@ -4251,6 +4324,13 @@ snapshots: dependencies: astro: 4.10.3(@types/node@20.14.8)(typescript@5.5.2) + astro-pagefind@1.6.0(astro@4.10.3(@types/node@20.14.8)(typescript@5.5.2)): + dependencies: + '@pagefind/default-ui': 1.1.0 + astro: 4.10.3(@types/node@20.14.8)(typescript@5.5.2) + pagefind: 1.1.0 + sirv: 2.0.4 + astro-robots-txt@1.0.0: dependencies: valid-filename: 4.0.0 @@ -5742,6 +5822,14 @@ snapshots: p-try@2.2.0: {} + pagefind@1.1.0: + optionalDependencies: + '@pagefind/darwin-arm64': 1.1.0 + '@pagefind/darwin-x64': 1.1.0 + '@pagefind/linux-arm64': 1.1.0 + '@pagefind/linux-x64': 1.1.0 + '@pagefind/windows-x64': 1.1.0 + parse-entities@4.0.1: dependencies: '@types/unist': 2.0.10 @@ -6179,6 +6267,12 @@ snapshots: is-arrayish: 0.3.2 optional: true + sirv@2.0.4: + dependencies: + '@polka/url': 1.0.0-next.25 + mrmime: 2.0.0 + totalist: 3.0.1 + sisteransi@1.0.5: {} sitemap@7.1.2: @@ -6327,6 +6421,8 @@ snapshots: dependencies: is-number: 7.0.0 + totalist@3.0.1: {} + trim-lines@3.0.1: {} trough@2.2.0: {} diff --git a/src/components/Search/SearchDialog.astro b/src/components/Search/SearchDialog.astro new file mode 100644 index 0000000..c6278fb --- /dev/null +++ b/src/components/Search/SearchDialog.astro @@ -0,0 +1,19 @@ + + + + + + diff --git a/src/components/Sidebar/Sidebar.astro b/src/components/Sidebar/Sidebar.astro index 7e9d989..797d7a6 100644 --- a/src/components/Sidebar/Sidebar.astro +++ b/src/components/Sidebar/Sidebar.astro @@ -1,12 +1,10 @@ --- -import kaplayPackageJson from "@/../kaplay/package.json"; import kaplayOutlined from "@/assets/kaplay-o.webp"; import { $lang } from "@/stores"; import { t } from "@/util/i18n"; import { getLangedRoute } from "@/util/path"; import Image from "astro/components/Image.astro"; import { getBlogEntries, getDocEntries, getGuidesEntries } from "./entries"; -import SidebarChangeLink from "./SidebarChangeLink.astro"; import { SidebarLink } from "./SidebarLink"; import { SidebarList } from "./SidebarList"; import VersionSelector from "./VersionSelector.astro"; @@ -71,11 +69,19 @@ else if (sidebarMode === "blog") { /> +
+
+
- - - - diff --git a/src/components/Sidebar/SidebarLink.tsx b/src/components/Sidebar/SidebarLink.tsx index 6992b6e..9fc19e2 100644 --- a/src/components/Sidebar/SidebarLink.tsx +++ b/src/components/Sidebar/SidebarLink.tsx @@ -1,12 +1,15 @@ +import apiIcon from "@/../assets/api_icon.png"; +import blogIcon from "@/../assets/blog_icon.png"; +import controllerIcon from "@/../assets/controller_icon.png"; +import discordIcon from "@/../assets/discord_icon.png"; +import donateIcon from "@/../assets/donate_icon.png"; +import githubIcon from "@/../assets/gh_icon.png"; +import guidesIcon from "@/../assets/guides_icon.png"; +import homeIcon from "@/../assets/home_icon.png"; +import pogIcon from "@/../assets/pog_icon.png"; import type { Locale } from "@/util/i18n"; import { getLangedRoute } from "@/util/path"; -import { - $, - component$, - Slot, - useSignal, - useVisibleTask$, -} from "@builder.io/qwik"; +import { component$, Slot } from "@builder.io/qwik"; type SidebarLinkProps = { href: string; @@ -14,6 +17,23 @@ type SidebarLinkProps = { lang?: Locale; noTranslate?: boolean; reloadAll?: boolean; + icon?: keyof typeof icons; +}; + +const icons = { + "home": homeIcon, + "github": githubIcon, + "discord": discordIcon, + "pog": pogIcon, + "donate": donateIcon, + "controller": controllerIcon, + "blog": blogIcon, + "guides": guidesIcon, + "api": apiIcon, +}; + +const dataReload = { + "data-astro-reload": undefined, }; export const SidebarLink = component$((props: SidebarLinkProps) => { @@ -29,7 +49,15 @@ export const SidebarLink = component$((props: SidebarLinkProps) => { target={props.target} data-link={props.href} aria-current="false" + data-astro-reload={props.reloadAll ? "all" : undefined} > + {props.icon && ( + Home Icon + )} diff --git a/src/components/Sidebar/SidebarList.tsx b/src/components/Sidebar/SidebarList.tsx index 0c5c299..ad7ed32 100644 --- a/src/components/Sidebar/SidebarList.tsx +++ b/src/components/Sidebar/SidebarList.tsx @@ -48,7 +48,7 @@ export const SidebarList = component$( class="input input-primary w-full my-2" placeholder={sidebarMode === "reference" ? "Search for API..." - : "Search for Rguides..."} + : "Search for Guides..."} bind:value={filter} ref={searchInputRef} onKeyPress$={(e) => { diff --git a/src/components/Sidebar/VersionSelector.astro b/src/components/Sidebar/VersionSelector.astro index 3efd596..5f89202 100644 --- a/src/components/Sidebar/VersionSelector.astro +++ b/src/components/Sidebar/VersionSelector.astro @@ -6,7 +6,7 @@ const selectedByDefault = kaplayPackageJson.version.startsWith("4") : "v3001"; --- -