@bbki.ng/site 1.6.3 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/index.d.ts +0 -0
- package/package.json +4 -3
- package/src/app.tsx +0 -1
- package/src/components/article/index.tsx +6 -1
- package/src/components/effect-layer/EffectLayer.tsx +27 -0
- package/src/components/effect-layer/attributes.ts +15 -0
- package/src/components/effect-layer/shader.frag +37 -0
- package/src/components/effect-layer/shader.vert +9 -0
- package/src/components/effect-layer/uniforms.ts +14 -0
- package/src/components/effect-layer/useRenderHandler.ts +6 -0
- package/src/hooks/use_mouse_position.ts +14 -0
- package/src/main.tsx +2 -0
- package/src/pages/cover/index.tsx +21 -18
- package/src/pages/extensions/png/png_projects.tsx +1 -0
- package/src/types/glsl.d.ts +8 -0
- package/vite.config.js +2 -0
package/CHANGELOG.md
CHANGED
package/index.d.ts
ADDED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bbki.ng/site",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "code behind bbki.ng",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"url": "git+https://github.com/bbbottle/bbki.ng.git"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@bbki.ng/components": "workspace:2.5.
|
|
19
|
+
"@bbki.ng/components": "workspace:2.5.4",
|
|
20
20
|
"@supabase/supabase-js": "^1.35.4",
|
|
21
21
|
"classnames": "2.3.1",
|
|
22
22
|
"react": "^18.0.0",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"swr": "^2.2.5"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@bbki.ng/stylebase": "workspace:0.4.
|
|
31
|
+
"@bbki.ng/stylebase": "workspace:0.4.4",
|
|
32
32
|
"@mdx-js/mdx": "2.0.0-next.9",
|
|
33
33
|
"@mdx-js/react": "^1.6.22",
|
|
34
34
|
"@mdx-js/rollup": "3.0.0",
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"ts-jest": "^27.1.1",
|
|
59
59
|
"typescript": "^4.5.4",
|
|
60
60
|
"vite": "5.0.0",
|
|
61
|
+
"vite-plugin-glsl": "1.2.1",
|
|
61
62
|
"vite-plugin-mdx": "^3.5.8",
|
|
62
63
|
"vite-plugin-pwa": "0.19",
|
|
63
64
|
"workbox-window": "^6.3.0"
|
package/src/app.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import React, { ReactElement } from "react";
|
|
|
2
2
|
import { Tags, Article } from "@bbki.ng/components";
|
|
3
3
|
import { ROUTES } from "@/constants";
|
|
4
4
|
import { DelayFadeIn } from "@/components/DelayFadeIn/DelayFadeIn";
|
|
5
|
+
import classNames from "classnames";
|
|
5
6
|
|
|
6
7
|
type ArticlePageProps = {
|
|
7
8
|
tags?: string[];
|
|
@@ -22,6 +23,10 @@ export const ArticlePage = (props: ArticlePageProps) => {
|
|
|
22
23
|
return props.children;
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
const articleCls = classNames("prose", {
|
|
27
|
+
"mb-20": tagNames,
|
|
28
|
+
});
|
|
29
|
+
|
|
25
30
|
return (
|
|
26
31
|
<DelayFadeIn delay={200}>
|
|
27
32
|
<Article
|
|
@@ -29,7 +34,7 @@ export const ArticlePage = (props: ArticlePageProps) => {
|
|
|
29
34
|
description={description}
|
|
30
35
|
className={props.className}
|
|
31
36
|
>
|
|
32
|
-
<article className=
|
|
37
|
+
<article className={articleCls}>{props.children}</article>
|
|
33
38
|
</Article>
|
|
34
39
|
{tagNames && <Tags tags={tags} />}
|
|
35
40
|
</DelayFadeIn>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Canvas } from "@bbki.ng/components";
|
|
3
|
+
import frag from "./shader.frag";
|
|
4
|
+
import vert from "./shader.vert";
|
|
5
|
+
import cls from "classnames";
|
|
6
|
+
import uniforms from "./uniforms";
|
|
7
|
+
|
|
8
|
+
const canvasDefaultCls = cls(
|
|
9
|
+
"fixed",
|
|
10
|
+
"top-0",
|
|
11
|
+
"left-0",
|
|
12
|
+
"h-full",
|
|
13
|
+
"pointer-events-none",
|
|
14
|
+
"w-full",
|
|
15
|
+
"z-[999]"
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
export const EffectLayer = () => {
|
|
19
|
+
return (
|
|
20
|
+
<Canvas
|
|
21
|
+
className={canvasDefaultCls}
|
|
22
|
+
uniforms={uniforms}
|
|
23
|
+
fragment={frag}
|
|
24
|
+
vertex={vert}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
precision mediump float;
|
|
2
|
+
|
|
3
|
+
uniform vec2 uResolution;
|
|
4
|
+
uniform float uProgress;
|
|
5
|
+
uniform float uDevicePixelRatio;
|
|
6
|
+
|
|
7
|
+
float rand(vec2 co){
|
|
8
|
+
return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
vec4 grain(vec4 fragColor, vec2 uv){
|
|
12
|
+
vec4 color = fragColor;
|
|
13
|
+
float diff = (rand(uv) - 0.0) * 0.09;
|
|
14
|
+
color.r += diff;
|
|
15
|
+
color.g += diff;
|
|
16
|
+
color.b += diff;
|
|
17
|
+
return color;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
vec4 randGrain(vec2 uv) {
|
|
21
|
+
vec4 color = vec4(0.0, 0.0, 0.0, 0.1);
|
|
22
|
+
color.a = rand(uv + uProgress) * 0.1;
|
|
23
|
+
return grain(color, uv);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
void main() {
|
|
27
|
+
vec2 uv = gl_FragCoord.xy/uResolution;
|
|
28
|
+
|
|
29
|
+
float navHeight = 64. * uDevicePixelRatio / uResolution.y;
|
|
30
|
+
|
|
31
|
+
if (uv.y <= navHeight) {
|
|
32
|
+
gl_FragColor = randGrain(uv);
|
|
33
|
+
} else {
|
|
34
|
+
gl_FragColor = vec4(0., 0., 0., 0.);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {useEffect, useState} from "react";
|
|
2
|
+
|
|
3
|
+
export const useMousePosition = () => {
|
|
4
|
+
const [mousePosition, setMousePosition] = useState({ x: 0, y: 0 });
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
const updateMousePosition = (e: MouseEvent) => {
|
|
7
|
+
setMousePosition({ x: e.clientX, y: e.clientY });
|
|
8
|
+
};
|
|
9
|
+
window.addEventListener("mousemove", updateMousePosition);
|
|
10
|
+
return () => window.removeEventListener("mousemove", updateMousePosition);
|
|
11
|
+
}, []);
|
|
12
|
+
|
|
13
|
+
return mousePosition;
|
|
14
|
+
}
|
package/src/main.tsx
CHANGED
|
@@ -7,6 +7,7 @@ import "@bbki.ng/components/style";
|
|
|
7
7
|
import App from "./app";
|
|
8
8
|
import "./main.css";
|
|
9
9
|
import Logger from "@/components/Logger";
|
|
10
|
+
import {EffectLayer} from "@/components/effect-layer/EffectLayer";
|
|
10
11
|
|
|
11
12
|
const container = document.getElementById("root") as Element;
|
|
12
13
|
const root = createRoot(container);
|
|
@@ -18,6 +19,7 @@ root.render(
|
|
|
18
19
|
<Toaster />
|
|
19
20
|
<Logger />
|
|
20
21
|
<ReloadPrompt />
|
|
22
|
+
<EffectLayer />
|
|
21
23
|
</Router>
|
|
22
24
|
</React.StrictMode>
|
|
23
25
|
);
|
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { CenterLinkList } from "@/components";
|
|
3
|
+
import {EffectLayer} from "@/components/effect-layer/EffectLayer";
|
|
3
4
|
|
|
4
5
|
export const Cover = (props: { className: string }) => {
|
|
5
6
|
return (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
{
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
7
|
+
<>
|
|
8
|
+
<CenterLinkList
|
|
9
|
+
className="select-none"
|
|
10
|
+
links={[
|
|
11
|
+
{
|
|
12
|
+
to: "/projects",
|
|
13
|
+
name: "cd ./projects",
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
to: "/blog",
|
|
17
|
+
name: "cd ./blog",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
to: "/now",
|
|
21
|
+
name: "cd ./now",
|
|
22
|
+
},
|
|
23
|
+
]}
|
|
24
|
+
title=""
|
|
25
|
+
/>
|
|
26
|
+
</>
|
|
24
27
|
);
|
|
25
28
|
};
|
|
@@ -8,6 +8,7 @@ import { ImageUploader } from "@/components/ImageUploader";
|
|
|
8
8
|
import classnames from "classnames";
|
|
9
9
|
import { ImageRenderer } from "@bbki.ng/components/lib";
|
|
10
10
|
import { ImgCtxMenu } from "@/components/Img_ctx_menu";
|
|
11
|
+
import {EffectLayer} from "@/components/effect-layer/EffectLayer";
|
|
11
12
|
|
|
12
13
|
const ProjectDetail = () => {
|
|
13
14
|
const { id } = useParams();
|
package/vite.config.js
CHANGED
|
@@ -11,6 +11,7 @@ import rehypeSlug from "rehype-slug";
|
|
|
11
11
|
import rehypeHighlight from "rehype-highlight";
|
|
12
12
|
import rehypeAutolinkHeadings from "rehype-autolink-headings";
|
|
13
13
|
import react from "@vitejs/plugin-react";
|
|
14
|
+
import glsl from 'vite-plugin-glsl';
|
|
14
15
|
|
|
15
16
|
const options = {
|
|
16
17
|
remarkPlugins: [
|
|
@@ -51,6 +52,7 @@ export default defineConfig({
|
|
|
51
52
|
plugins: [
|
|
52
53
|
react(),
|
|
53
54
|
mdx(options),
|
|
55
|
+
glsl(),
|
|
54
56
|
VitePWA({
|
|
55
57
|
injectRegister: "auto",
|
|
56
58
|
includeAssets: [
|