@bbki.ng/site 5.1.2 → 5.1.4
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/package.json +4 -4
- package/public/xwy.svg +4 -0
- package/src/blog/app.tsx +4 -6
- package/src/blog/components/Pochacco/Pochacco.tsx +6 -0
- package/src/blog/components/Pochacco/xwy.tsx +19 -0
- package/src/blog/hooks/use_dynamic_logo.tsx +20 -0
- package/dev-dist/sw.js +0 -128
- package/dev-dist/workbox-baccbcc1.js +0 -5343
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bbki.ng/site",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.4",
|
|
4
4
|
"description": "code behind bbki.ng",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"sonner": "1.4.0",
|
|
21
21
|
"swr": "^2.2.5",
|
|
22
22
|
"vaul": "1.1.2",
|
|
23
|
-
"@bbki.ng/components": "5.1.
|
|
24
|
-
"@bbki.ng/stylebase": "3.0.
|
|
23
|
+
"@bbki.ng/components": "5.1.3",
|
|
24
|
+
"@bbki.ng/stylebase": "3.0.2"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@mdx-js/mdx": "2.0.0-next.9",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"vite-plugin-mdx": "^3.5.8",
|
|
60
60
|
"vite-plugin-pwa": "0.19",
|
|
61
61
|
"workbox-window": "^6.3.0",
|
|
62
|
-
"@bbki.ng/stylebase": "3.0.
|
|
62
|
+
"@bbki.ng/stylebase": "3.0.2"
|
|
63
63
|
},
|
|
64
64
|
"author": "bbbottle",
|
|
65
65
|
"license": "MIT",
|
package/public/xwy.svg
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M12.821 17.5305C10.709 18.17 9.68345 19.4423 9.22624 20.1359C9.11159 20.3099 9.21615 20.5428 9.42038 20.5839L12.67 21.2381C12.8291 21.2702 12.9328 21.4275 12.9084 21.5879C11.3004 32.1653 21.5275 36.7547 28.6638 33.0597C28.7443 33.018 28.8408 33.0139 28.9245 33.0487C32.8032 34.6598 35.967 34.5662 37.8217 34.3099C38.131 34.2671 38.1505 33.841 37.855 33.7401C29.1343 30.7633 26.0152 24.5245 25.5144 18.8022C25.3835 17.3066 23.8172 13.2016 19.2675 13.0058C15.7934 12.8563 13.6137 15.6103 13.0319 17.325C12.9986 17.4231 12.9201 17.5004 12.821 17.5305Z" fill="#FBD1D2"/>
|
|
3
|
+
<circle cx="17.6178" cy="18.2688" r="0.995689" fill="white"/>
|
|
4
|
+
</svg>
|
package/src/blog/app.tsx
CHANGED
|
@@ -21,11 +21,11 @@ import { BBContext } from "@/context/bbcontext";
|
|
|
21
21
|
import { useClipboardToPost } from "@/hooks/use_clipboard_to_post";
|
|
22
22
|
import { useSharedStringToPost } from "@/hooks/use_shared_string_to_post";
|
|
23
23
|
import { ThreeColLayout, ErrorBoundary } from "@bbki.ng/components";
|
|
24
|
+
import { useDynamicLogo } from "./hooks/use_dynamic_logo";
|
|
24
25
|
|
|
25
26
|
const Layout = () => {
|
|
26
|
-
const { isLoading
|
|
27
|
-
const
|
|
28
|
-
const isQueen = role === Role.QUEEN;
|
|
27
|
+
const { isLoading } = useContext(GlobalLoadingContext);
|
|
28
|
+
const logo = useDynamicLogo();
|
|
29
29
|
return (
|
|
30
30
|
<Page
|
|
31
31
|
nav={
|
|
@@ -34,9 +34,7 @@ const Layout = () => {
|
|
|
34
34
|
paths={usePaths()}
|
|
35
35
|
className="gradient-blur-cover select-none"
|
|
36
36
|
loading={isLoading}
|
|
37
|
-
customLogo={
|
|
38
|
-
isQueen ? <Pochacco pose={PochaccoPose.Watching} /> : null
|
|
39
|
-
}
|
|
37
|
+
customLogo={logo}
|
|
40
38
|
/>
|
|
41
39
|
</AppCtxMenu>
|
|
42
40
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Watch } from "@/components/Pochacco/watch";
|
|
3
3
|
import { Idle } from "@/components/Pochacco/idle";
|
|
4
|
+
import { Crows } from "./xwy";
|
|
4
5
|
|
|
5
6
|
export enum PochaccoPose {
|
|
6
7
|
Idle = "idle",
|
|
7
8
|
Watching = "watching",
|
|
9
|
+
Crows = "crows",
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
export type PochaccoProps = {
|
|
@@ -19,5 +21,9 @@ export const Pochacco = (props: PochaccoProps) => {
|
|
|
19
21
|
return <Watch {...props} />;
|
|
20
22
|
}
|
|
21
23
|
|
|
24
|
+
if (pose === PochaccoPose.Crows) {
|
|
25
|
+
return <Crows />;
|
|
26
|
+
}
|
|
27
|
+
|
|
22
28
|
return <Idle {...props} />;
|
|
23
29
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
export const Crows = () => {
|
|
4
|
+
return (
|
|
5
|
+
<svg
|
|
6
|
+
width="48"
|
|
7
|
+
height="48"
|
|
8
|
+
viewBox="0 0 48 48"
|
|
9
|
+
fill="none"
|
|
10
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
+
>
|
|
12
|
+
<path
|
|
13
|
+
d="M12.821 17.5305C10.709 18.17 9.68345 19.4423 9.22624 20.1359C9.11159 20.3099 9.21615 20.5428 9.42038 20.5839L12.67 21.2381C12.8291 21.2702 12.9328 21.4275 12.9084 21.5879C11.3004 32.1653 21.5275 36.7547 28.6638 33.0597C28.7443 33.018 28.8408 33.0139 28.9245 33.0487C32.8032 34.6598 35.967 34.5662 37.8217 34.3099C38.131 34.2671 38.1505 33.841 37.855 33.7401C29.1343 30.7633 26.0152 24.5245 25.5144 18.8022C25.3835 17.3066 23.8172 13.2016 19.2675 13.0058C15.7934 12.8563 13.6137 15.6103 13.0319 17.325C12.9986 17.4231 12.9201 17.5004 12.821 17.5305Z"
|
|
14
|
+
fill="#FBD1D2"
|
|
15
|
+
/>
|
|
16
|
+
<circle cx="17.6178" cy="18.2688" r="0.995689" fill="white" />
|
|
17
|
+
</svg>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Role, useRole } from "./use_role";
|
|
3
|
+
import { Pochacco, PochaccoPose } from "@/components/Pochacco/Pochacco";
|
|
4
|
+
import { useLocation } from "react-router-dom";
|
|
5
|
+
|
|
6
|
+
export const useDynamicLogo = () => {
|
|
7
|
+
const role = useRole();
|
|
8
|
+
const isQueen = role === Role.QUEEN;
|
|
9
|
+
const location = useLocation();
|
|
10
|
+
|
|
11
|
+
if (decodeURIComponent(location.pathname).includes("小乌鸦")) {
|
|
12
|
+
return <Pochacco pose={PochaccoPose.Crows} />;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (isQueen) {
|
|
16
|
+
return <Pochacco pose={PochaccoPose.Watching} />;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return null;
|
|
20
|
+
};
|
package/dev-dist/sw.js
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2018 Google Inc. All Rights Reserved.
|
|
3
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License.
|
|
5
|
-
* You may obtain a copy of the License at
|
|
6
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
8
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
9
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
10
|
-
* See the License for the specific language governing permissions and
|
|
11
|
-
* limitations under the License.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
// If the loader is already loaded, just stop.
|
|
15
|
-
if (!self.define) {
|
|
16
|
-
let registry = {};
|
|
17
|
-
|
|
18
|
-
// Used for `eval` and `importScripts` where we can't get script URL by other means.
|
|
19
|
-
// In both cases, it's safe to use a global var because those functions are synchronous.
|
|
20
|
-
let nextDefineUri;
|
|
21
|
-
|
|
22
|
-
const singleRequire = (uri, parentUri) => {
|
|
23
|
-
uri = new URL(uri + ".js", parentUri).href;
|
|
24
|
-
return (
|
|
25
|
-
registry[uri] ||
|
|
26
|
-
new Promise((resolve) => {
|
|
27
|
-
if ("document" in self) {
|
|
28
|
-
const script = document.createElement("script");
|
|
29
|
-
script.src = uri;
|
|
30
|
-
script.onload = resolve;
|
|
31
|
-
document.head.appendChild(script);
|
|
32
|
-
} else {
|
|
33
|
-
nextDefineUri = uri;
|
|
34
|
-
importScripts(uri);
|
|
35
|
-
resolve();
|
|
36
|
-
}
|
|
37
|
-
}).then(() => {
|
|
38
|
-
let promise = registry[uri];
|
|
39
|
-
if (!promise) {
|
|
40
|
-
throw new Error(`Module ${uri} didn’t register its module`);
|
|
41
|
-
}
|
|
42
|
-
return promise;
|
|
43
|
-
})
|
|
44
|
-
);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
self.define = (depsNames, factory) => {
|
|
48
|
-
const uri =
|
|
49
|
-
nextDefineUri ||
|
|
50
|
-
("document" in self ? document.currentScript.src : "") ||
|
|
51
|
-
location.href;
|
|
52
|
-
if (registry[uri]) {
|
|
53
|
-
// Module is already loading or loaded.
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
let exports = {};
|
|
57
|
-
const require = (depUri) => singleRequire(depUri, uri);
|
|
58
|
-
const specialDeps = {
|
|
59
|
-
module: { uri },
|
|
60
|
-
exports,
|
|
61
|
-
require,
|
|
62
|
-
};
|
|
63
|
-
registry[uri] = Promise.all(
|
|
64
|
-
depsNames.map((depName) => specialDeps[depName] || require(depName))
|
|
65
|
-
).then((deps) => {
|
|
66
|
-
factory(...deps);
|
|
67
|
-
return exports;
|
|
68
|
-
});
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
define(["./workbox-baccbcc1"], function (workbox) {
|
|
72
|
-
"use strict";
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Welcome to your Workbox-powered service worker!
|
|
76
|
-
*
|
|
77
|
-
* You'll need to register this file in your web app.
|
|
78
|
-
* See https://goo.gl/nhQhGp
|
|
79
|
-
*
|
|
80
|
-
* The rest of the code is auto-generated. Please don't update this file
|
|
81
|
-
* directly; instead, make changes to your Workbox build configuration
|
|
82
|
-
* and re-run your build process.
|
|
83
|
-
* See https://goo.gl/2aRDsh
|
|
84
|
-
*/
|
|
85
|
-
|
|
86
|
-
self.addEventListener("message", (event) => {
|
|
87
|
-
if (event.data && event.data.type === "SKIP_WAITING") {
|
|
88
|
-
self.skipWaiting();
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
/**
|
|
92
|
-
* The precacheAndRoute() method efficiently caches and responds to
|
|
93
|
-
* requests for URLs in the manifest.
|
|
94
|
-
* See https://goo.gl/S9QRab
|
|
95
|
-
*/
|
|
96
|
-
|
|
97
|
-
workbox.precacheAndRoute(
|
|
98
|
-
[
|
|
99
|
-
{
|
|
100
|
-
url: "index.html",
|
|
101
|
-
revision: "0.c6h700f53m8",
|
|
102
|
-
},
|
|
103
|
-
],
|
|
104
|
-
{}
|
|
105
|
-
);
|
|
106
|
-
workbox.cleanupOutdatedCaches();
|
|
107
|
-
workbox.registerRoute(
|
|
108
|
-
new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
|
|
109
|
-
allowlist: [/^\/$/],
|
|
110
|
-
})
|
|
111
|
-
);
|
|
112
|
-
workbox.registerRoute(
|
|
113
|
-
/^https:\/\/zjh-im-res\.oss-cn-shenzhen\.aliyuncs\.com\/.*/i,
|
|
114
|
-
new workbox.CacheFirst({
|
|
115
|
-
cacheName: "oss-resource-cache",
|
|
116
|
-
plugins: [
|
|
117
|
-
new workbox.ExpirationPlugin({
|
|
118
|
-
maxEntries: 100,
|
|
119
|
-
maxAgeSeconds: 31536000,
|
|
120
|
-
}),
|
|
121
|
-
new workbox.CacheableResponsePlugin({
|
|
122
|
-
statuses: [0, 200],
|
|
123
|
-
}),
|
|
124
|
-
],
|
|
125
|
-
}),
|
|
126
|
-
"GET"
|
|
127
|
-
);
|
|
128
|
-
});
|