@bbki.ng/site 5.4.17 → 5.4.18
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 +17 -0
- package/eslint.config.js +17 -0
- package/package.json +18 -5
- package/src/blog/app.tsx +21 -21
- package/src/blog/hooks/use_clipboard_content.ts +5 -7
- package/src/blog/pages/cover/index.tsx +9 -10
- package/src/blog/pages/streaming/index.tsx +34 -35
- package/tsconfig.json +2 -13
- package/.prettierrc.json +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @bbki.ng/site
|
|
2
2
|
|
|
3
|
+
## 5.4.18
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f12873e: update config
|
|
8
|
+
- 152ba35: update config
|
|
9
|
+
- 04c87c5: update config
|
|
10
|
+
- 74bdf37: update config
|
|
11
|
+
- 9142b64: update mono repo config
|
|
12
|
+
- Updated dependencies [f12873e]
|
|
13
|
+
- Updated dependencies [152ba35]
|
|
14
|
+
- Updated dependencies [04c87c5]
|
|
15
|
+
- Updated dependencies [74bdf37]
|
|
16
|
+
- Updated dependencies [9142b64]
|
|
17
|
+
- @bbki.ng/components@5.2.9
|
|
18
|
+
- @bbki.ng/stylebase@3.1.2
|
|
19
|
+
|
|
3
20
|
## 5.4.17
|
|
4
21
|
|
|
5
22
|
## 5.4.16
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import webConfig from '@bbki.ng/config/eslint/web';
|
|
2
|
+
import { includeIgnoreFile } from '@eslint/compat';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = path.dirname(__filename);
|
|
8
|
+
|
|
9
|
+
export default [
|
|
10
|
+
includeIgnoreFile(path.resolve(__dirname, '.gitignore')),
|
|
11
|
+
...webConfig,
|
|
12
|
+
{
|
|
13
|
+
rules: {
|
|
14
|
+
// Site specific overrides
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bbki.ng/site",
|
|
3
|
-
"version": "5.4.
|
|
3
|
+
"version": "5.4.18",
|
|
4
4
|
"description": "code behind bbki.ng",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -20,10 +20,12 @@
|
|
|
20
20
|
"sonner": "1.4.0",
|
|
21
21
|
"swr": "^2.2.5",
|
|
22
22
|
"vaul": "1.1.2",
|
|
23
|
-
"@bbki.ng/components": "5.2.
|
|
24
|
-
"@bbki.ng/stylebase": "3.1.
|
|
23
|
+
"@bbki.ng/components": "5.2.9",
|
|
24
|
+
"@bbki.ng/stylebase": "3.1.2"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
+
"@eslint/compat": "^1.0.0",
|
|
28
|
+
"@eslint/js": "^8.57.0",
|
|
27
29
|
"@mdx-js/mdx": "2.0.0-next.9",
|
|
28
30
|
"@mdx-js/react": "^1.6.22",
|
|
29
31
|
"@mdx-js/rollup": "3.0.0",
|
|
@@ -33,12 +35,21 @@
|
|
|
33
35
|
"@types/node": "^16.11.1",
|
|
34
36
|
"@types/react": "^18.0.15",
|
|
35
37
|
"@types/react-dom": "^18.0.6",
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
|
39
|
+
"@typescript-eslint/parser": "^7.0.0",
|
|
36
40
|
"@vitejs/plugin-react": "^1.0.0",
|
|
41
|
+
"eslint": "^8.57.0",
|
|
42
|
+
"eslint-plugin-import": "^2.29.0",
|
|
43
|
+
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
44
|
+
"eslint-plugin-react": "^7.33.0",
|
|
45
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
46
|
+
"eslint-plugin-unicorn": "^51.0.0",
|
|
47
|
+
"globals": "^14.0.0",
|
|
37
48
|
"husky": "^7.0.0",
|
|
38
49
|
"jest": "^27.4.5",
|
|
39
50
|
"lint-staged": "^11.2.1",
|
|
40
51
|
"postcss": "^8.3.9",
|
|
41
|
-
"prettier": "^2.
|
|
52
|
+
"prettier": "^3.2.0",
|
|
42
53
|
"pretty-quick": "^3.1.1",
|
|
43
54
|
"rehype-autolink-headings": "^6.1.1",
|
|
44
55
|
"rehype-highlight": "^5.0.0",
|
|
@@ -59,13 +70,15 @@
|
|
|
59
70
|
"vite-plugin-mdx": "^3.5.8",
|
|
60
71
|
"vite-plugin-pwa": "0.19",
|
|
61
72
|
"workbox-window": "^6.3.0",
|
|
62
|
-
"@bbki.ng/
|
|
73
|
+
"@bbki.ng/config": "1.0.1",
|
|
74
|
+
"@bbki.ng/stylebase": "3.1.2"
|
|
63
75
|
},
|
|
64
76
|
"author": "bbbottle",
|
|
65
77
|
"license": "MIT",
|
|
66
78
|
"bugs": {
|
|
67
79
|
"url": "https://github.com/bbbottle/bbki.ng/issues"
|
|
68
80
|
},
|
|
81
|
+
"prettier": "@bbki.ng/config/prettier",
|
|
69
82
|
"homepage": "https://github.com/bbbottle/bbki.ng#readme",
|
|
70
83
|
"scripts": {
|
|
71
84
|
"test": "jest",
|
package/src/blog/app.tsx
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import React, { useContext } from
|
|
2
|
-
import { Outlet, Route, Routes } from
|
|
3
|
-
import { Nav, NotFound, Page } from
|
|
4
|
-
import { HotKeyNav } from
|
|
5
|
-
import { Cover, Streaming } from
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { Outlet, Route, Routes } from 'react-router-dom';
|
|
3
|
+
import { Nav, NotFound, Page } from '@bbki.ng/components';
|
|
4
|
+
import { HotKeyNav } from './components';
|
|
5
|
+
import { Cover, Streaming } from './pages';
|
|
6
6
|
|
|
7
|
-
import ArticlePage from
|
|
8
|
-
import Tags from
|
|
9
|
-
import TagsResult from
|
|
10
|
-
import Txt from
|
|
7
|
+
import ArticlePage from '@/pages/extensions/txt/article';
|
|
8
|
+
import Tags from '@/pages/tags';
|
|
9
|
+
import TagsResult from '@/pages/tags/tag_result';
|
|
10
|
+
import Txt from '@/pages/extensions/txt';
|
|
11
11
|
|
|
12
|
-
import { usePaths } from
|
|
13
|
-
import { Login } from
|
|
14
|
-
import { SWR } from
|
|
15
|
-
import { GlobalLoadingContext } from
|
|
16
|
-
import { AppCtxMenu } from
|
|
17
|
-
import { BotRedirect } from
|
|
18
|
-
import { BBContext } from
|
|
19
|
-
import { useClipboardToPost } from
|
|
20
|
-
import { useSharedStringToPost } from
|
|
21
|
-
import { ThreeColLayout, ErrorBoundary } from
|
|
22
|
-
import { useDynamicLogo } from
|
|
12
|
+
import { usePaths } from '@/hooks';
|
|
13
|
+
import { Login } from '@/pages/login';
|
|
14
|
+
import { SWR } from '@/swr';
|
|
15
|
+
import { GlobalLoadingContext } from '@/context/global_loading_state_provider';
|
|
16
|
+
import { AppCtxMenu } from '@/components/app_ctx_menu';
|
|
17
|
+
import { BotRedirect } from '@/pages/bot';
|
|
18
|
+
import { BBContext } from '@/context/bbcontext';
|
|
19
|
+
import { useClipboardToPost } from '@/hooks/use_clipboard_to_post';
|
|
20
|
+
import { useSharedStringToPost } from '@/hooks/use_shared_string_to_post';
|
|
21
|
+
import { ThreeColLayout, ErrorBoundary } from '@bbki.ng/components';
|
|
22
|
+
import { useDynamicLogo } from './hooks/use_dynamic_logo';
|
|
23
23
|
|
|
24
24
|
const Layout = () => {
|
|
25
25
|
const { isLoading } = useContext(GlobalLoadingContext);
|
|
@@ -74,7 +74,7 @@ export const App = () => {
|
|
|
74
74
|
|
|
75
75
|
<Route path="bot" element={<BotRedirect />} />
|
|
76
76
|
<Route path="login" element={<Login />} />
|
|
77
|
-
<Route path="
|
|
77
|
+
<Route path="now" element={<Streaming />} />
|
|
78
78
|
</Route>
|
|
79
79
|
<Route path="*" element={<NotFound />} />
|
|
80
80
|
</Routes>
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from 'react';
|
|
2
2
|
|
|
3
3
|
export const useClipboardContent = () => {
|
|
4
|
-
const [clipboardContent, setClipboardContent] = React.useState<string | null>(
|
|
5
|
-
null
|
|
6
|
-
);
|
|
4
|
+
const [clipboardContent, setClipboardContent] = React.useState<string | null>(null);
|
|
7
5
|
|
|
8
6
|
React.useEffect(() => {
|
|
9
7
|
const handlePaste = (event: ClipboardEvent) => {
|
|
10
8
|
if (event.clipboardData) {
|
|
11
|
-
setClipboardContent(event.clipboardData.getData(
|
|
9
|
+
setClipboardContent(event.clipboardData.getData('text/plain'));
|
|
12
10
|
}
|
|
13
11
|
};
|
|
14
12
|
|
|
15
|
-
document.addEventListener(
|
|
13
|
+
document.addEventListener('paste', handlePaste);
|
|
16
14
|
|
|
17
15
|
return () => {
|
|
18
|
-
document.removeEventListener(
|
|
16
|
+
document.removeEventListener('paste', handlePaste);
|
|
19
17
|
};
|
|
20
18
|
}, []);
|
|
21
19
|
|
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import React, { useContext } from
|
|
2
|
-
import { CenterLinkList } from
|
|
3
|
-
import { GlobalRoutesContext } from
|
|
4
|
-
import { Version } from
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { CenterLinkList } from '@/components';
|
|
3
|
+
import { GlobalRoutesContext } from '@/context/global_routes_provider';
|
|
4
|
+
import { Version } from '@/components/Version';
|
|
5
5
|
|
|
6
6
|
export const Cover = (props: { className?: string }) => {
|
|
7
7
|
const globalRouteCtx = useContext(GlobalRoutesContext);
|
|
8
8
|
const routes = globalRouteCtx.globalRoutes;
|
|
9
|
-
const pluginEntry =
|
|
10
|
-
routes.length > 0 ? [{ to: "/plugins", name: "cd ./plugins" }] : [];
|
|
9
|
+
const pluginEntry = routes.length > 0 ? [{ to: '/plugins', name: 'cd ./plugins' }] : [];
|
|
11
10
|
return (
|
|
12
11
|
<>
|
|
13
12
|
<CenterLinkList
|
|
14
13
|
className="select-none"
|
|
15
14
|
links={[
|
|
16
15
|
{
|
|
17
|
-
to:
|
|
18
|
-
name:
|
|
16
|
+
to: '/blog',
|
|
17
|
+
name: 'cd ./blog',
|
|
19
18
|
},
|
|
20
19
|
{
|
|
21
|
-
to:
|
|
22
|
-
name:
|
|
20
|
+
to: '/now',
|
|
21
|
+
name: 'cd ./now',
|
|
23
22
|
},
|
|
24
23
|
...pluginEntry,
|
|
25
24
|
]}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from
|
|
2
|
-
import { useStreaming, StreamingItem } from
|
|
3
|
-
import { formatStreamingData } from
|
|
4
|
-
import { Article, Button, ButtonType, Panel } from
|
|
5
|
-
import { useScrollBtnVisibility } from
|
|
6
|
-
import classNames from
|
|
7
|
-
import { ArrowDownIcon } from
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { useStreaming, StreamingItem } from '@/hooks/use_streaming';
|
|
3
|
+
import { formatStreamingData } from '@/utils/streaming';
|
|
4
|
+
import { Article, Button, ButtonType, Panel } from '@bbki.ng/components';
|
|
5
|
+
import { useScrollBtnVisibility } from './useScrollBtnVisibility';
|
|
6
|
+
import classNames from 'classnames';
|
|
7
|
+
import { ArrowDownIcon } from './arrow-down';
|
|
8
8
|
|
|
9
9
|
// Extend JSX IntrinsicElements for the web component
|
|
10
10
|
declare global {
|
|
11
11
|
namespace JSX {
|
|
12
12
|
interface IntrinsicElements {
|
|
13
|
-
|
|
13
|
+
'bb-msg-history': React.DetailedHTMLProps<
|
|
14
14
|
React.HTMLAttributes<HTMLElement>,
|
|
15
15
|
BbMsgHistoryElement
|
|
16
16
|
> & {
|
|
@@ -60,40 +60,39 @@ const Streaming = () => {
|
|
|
60
60
|
return () => {
|
|
61
61
|
clearTimeout(timer);
|
|
62
62
|
};
|
|
63
|
-
}, [isLoading, formattedData])
|
|
63
|
+
}, [isLoading, formattedData]);
|
|
64
64
|
|
|
65
65
|
if (isError) {
|
|
66
66
|
return <div className="p-8 text-center text-gray-500">加载失败</div>;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
return (
|
|
70
|
-
<Article title="
|
|
70
|
+
<Article title="" loading={isLoading}>
|
|
71
71
|
{isLoading ? null : (
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
</>
|
|
72
|
+
<>
|
|
73
|
+
<Panel className="!p-[10px]">
|
|
74
|
+
<bb-msg-history
|
|
75
|
+
// infinite
|
|
76
|
+
hide-scroll-bar
|
|
77
|
+
hide-scroll-button
|
|
78
|
+
ref={bbMsgHistoryRef}
|
|
79
|
+
style={{ height: '100%', '--bb-max-height': '200px' } as React.CSSProperties}
|
|
80
|
+
>
|
|
81
|
+
{formattedData}
|
|
82
|
+
</bb-msg-history>
|
|
83
|
+
</Panel>
|
|
84
|
+
{scrolled ? (
|
|
85
|
+
<Button
|
|
86
|
+
className="mt-64"
|
|
87
|
+
transparent={!showScrollBtn}
|
|
88
|
+
onClick={() => {
|
|
89
|
+
bbMsgHistoryRef.current?.scrollToBottom();
|
|
90
|
+
}}
|
|
91
|
+
>
|
|
92
|
+
<ArrowDownIcon show={showScrollBtn} />
|
|
93
|
+
</Button>
|
|
94
|
+
) : null}
|
|
95
|
+
</>
|
|
97
96
|
)}
|
|
98
97
|
</Article>
|
|
99
98
|
);
|
package/tsconfig.json
CHANGED
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
+
"extends": "../../tsconfig.base.json",
|
|
2
3
|
"compilerOptions": {
|
|
3
|
-
"target": "ESNext",
|
|
4
|
-
"useDefineForClassFields": true,
|
|
5
4
|
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
6
|
-
"allowJs": false,
|
|
7
|
-
"skipLibCheck": true,
|
|
8
|
-
"esModuleInterop": false,
|
|
9
|
-
"allowSyntheticDefaultImports": true,
|
|
10
|
-
"strict": true,
|
|
11
|
-
"forceConsistentCasingInFileNames": true,
|
|
12
|
-
"module": "ESNext",
|
|
13
|
-
"moduleResolution": "Node",
|
|
14
|
-
"resolveJsonModule": true,
|
|
15
|
-
"isolatedModules": true,
|
|
16
|
-
"noEmit": true,
|
|
17
5
|
"jsx": "react",
|
|
6
|
+
"noEmit": true,
|
|
18
7
|
"baseUrl": ".",
|
|
19
8
|
"paths": {
|
|
20
9
|
"@/*": ["src/blog/*"]
|
package/.prettierrc.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|