@bbki.ng/site 5.5.18 → 5.5.20
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 +14 -0
- package/index.d.ts +7 -6
- package/package.json +3 -3
- package/src/blog/app.tsx +18 -54
- package/src/blog/components/BaseLayout.tsx +55 -0
- package/src/blog/components/index.tsx +2 -4
- package/src/blog/context/global_loading_state_provider.tsx +3 -9
- package/src/blog/hooks/use_loading.ts +1 -1
- package/src/blog/hooks/use_plugin_entries.ts +48 -0
- package/src/blog/hooks/use_posts.ts +16 -9
- package/src/blog/index.tsx +1 -0
- package/src/blog/pages/cover/index.tsx +33 -24
- package/src/blog/pages/extensions/txt/article.tsx +6 -3
- package/src/blog/pages/extensions/txt/index.tsx +29 -25
- package/src/blog/swr.tsx +3 -2
- package/src/blog/types/path.ts +0 -7
- package/src/blog/utils/index.ts +0 -21
- package/src/core/context/createPluginCtx.tsx +12 -7
- package/src/core/hooks/index.ts +1 -1
- package/src/core/hooks/useMiddlewareTransData.ts +32 -46
- package/src/core/hooks/useSlotComp.ts +7 -3
- package/src/core/hooks/use_plugins.ts +16 -5
- package/src/core/pluginManager.ts +15 -6
- package/src/core/registry.ts +45 -11
- package/src/plugins/extra-entry/components/page.tsx +14 -0
- package/src/plugins/extra-entry/index.ts +32 -0
- package/src/plugins/manifest.ts +6 -0
- package/src/plugins/sticker/components/StickerCom.tsx +6 -8
- package/src/plugins/xwy/components/logo.tsx +6 -2
- package/src/plugins/xwy/const/index.ts +1 -1
- package/src/types/hostApi.ts +3 -3
- package/src/types/plugin.ts +11 -1
- package/src/types/posts.ts +9 -0
- package/src/types/slots.ts +12 -2
- package/src/utils/index.tsx +52 -0
- package/tsconfig.json +2 -4
- package/src/blog/components/Auth.tsx +0 -13
- package/src/blog/components/DelayFadeIn/DelayFadeIn.tsx +0 -28
- package/src/blog/components/Spinner.tsx +0 -10
- package/src/blog/components/my_suspense.tsx +0 -11
- package/src/blog/components/share/share-btn.tsx +0 -28
- package/src/blog/components/share/share-icon.tsx +0 -19
- package/src/blog/hooks/use_font_loading.ts +0 -41
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Button } from '@bbki.ng/ui';
|
|
3
|
-
import { ShareIcon } from './share-icon';
|
|
4
|
-
|
|
5
|
-
export const ShareBtn = ({ shareInfo }: { shareInfo: ShareData }) => {
|
|
6
|
-
const handleShare = async () => {
|
|
7
|
-
try {
|
|
8
|
-
await navigator.share(shareInfo);
|
|
9
|
-
} catch (error) {
|
|
10
|
-
const isAbortError = (error as Error).name === 'AbortError';
|
|
11
|
-
if (isAbortError) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
console.error('Share failed:', (error as Error).message);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<Button
|
|
20
|
-
size="sm"
|
|
21
|
-
className="text-gray-400 hover:text-gray-600 transition-colors ease-in duration-200"
|
|
22
|
-
variant="ghost"
|
|
23
|
-
onClick={handleShare}
|
|
24
|
-
>
|
|
25
|
-
<ShareIcon />
|
|
26
|
-
</Button>
|
|
27
|
-
);
|
|
28
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
export const ShareIcon = () => (
|
|
4
|
-
<svg
|
|
5
|
-
data-testid="geist-icon"
|
|
6
|
-
height="12"
|
|
7
|
-
stroke-linejoin="round"
|
|
8
|
-
// style="color:currentColor"
|
|
9
|
-
viewBox="0 0 16 16"
|
|
10
|
-
width="12"
|
|
11
|
-
>
|
|
12
|
-
<path
|
|
13
|
-
fill-rule="evenodd"
|
|
14
|
-
clip-rule="evenodd"
|
|
15
|
-
d="M7.29289 1.39644C7.68342 1.00592 8.31658 1.00592 8.70711 1.39644L11.7803 4.46966L12.3107 4.99999L11.25 6.06065L10.7197 5.53032L8.75 3.56065V10.25V11H7.25V10.25V3.56065L5.28033 5.53032L4.75 6.06065L3.68934 4.99999L4.21967 4.46966L7.29289 1.39644ZM13.5 9.24999V13.5H2.5V9.24999V8.49999H1V9.24999V14C1 14.5523 1.44771 15 2 15H14C14.5523 15 15 14.5523 15 14V9.24999V8.49999H13.5V9.24999Z"
|
|
16
|
-
fill="currentColor"
|
|
17
|
-
></path>
|
|
18
|
-
</svg>
|
|
19
|
-
);
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
2
|
-
import { changeFont } from '@/utils';
|
|
3
|
-
import { FontType } from '@/types/font';
|
|
4
|
-
|
|
5
|
-
export const useFontLoading = () => {
|
|
6
|
-
const [isFontLoading, setIsFontLoading] = useState(false);
|
|
7
|
-
|
|
8
|
-
const handleFontLoading = () => {
|
|
9
|
-
setIsFontLoading(true);
|
|
10
|
-
document.fonts.ready.then(() => {
|
|
11
|
-
handleFontLoadingDone();
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const handleFontLoadingDone = () => {
|
|
16
|
-
setIsFontLoading(false);
|
|
17
|
-
// setTimeout(() => {
|
|
18
|
-
// }, 500);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const handleFontLoadingError = () => {
|
|
22
|
-
setIsFontLoading(false);
|
|
23
|
-
changeFont(FontType.Mono);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
document.fonts.onloadingerror = handleFontLoadingError;
|
|
28
|
-
document.fonts.onloading = handleFontLoading;
|
|
29
|
-
|
|
30
|
-
document.fonts.ready.then(() => {
|
|
31
|
-
handleFontLoadingDone();
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
return () => {
|
|
35
|
-
document.fonts.onloadingerror = null;
|
|
36
|
-
document.fonts.onloading = null;
|
|
37
|
-
};
|
|
38
|
-
}, []);
|
|
39
|
-
|
|
40
|
-
return isFontLoading;
|
|
41
|
-
};
|