@bbki.ng/site 2.0.52 → 4.0.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.
Files changed (42) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/index.html +1 -1
  3. package/package.json +19 -17
  4. package/src/blog/app.tsx +0 -2
  5. package/src/blog/articles/index.ts +2 -2
  6. package/src/blog/articles/travel.mdx +1 -0
  7. package/src/blog/components/Img_ctx_menu/index.tsx +1 -1
  8. package/src/blog/components/app_ctx_menu/index.tsx +3 -15
  9. package/src/blog/components/article/index.tsx +4 -4
  10. package/src/blog/components/article_ctx_menu/index.tsx +1 -1
  11. package/src/blog/components/effect-layer/EffectLayer.tsx +1 -1
  12. package/src/blog/components/reaction/oh_reaction.tsx +1 -1
  13. package/src/blog/global/mdx.d.ts +1 -0
  14. package/src/blog/hooks/useTransitionCls.ts +1 -1
  15. package/src/blog/index.tsx +1 -1
  16. package/src/blog/main.css +40 -3
  17. package/src/blog/pages/extensions/txt/article.tsx +5 -1
  18. package/tailwind.config.cjs +1 -3
  19. package/vite.config.js +19 -12
  20. package/postcss.config.cjs +0 -6
  21. package/src/blog/components/plugin/PluginContentPage.tsx +0 -52
  22. package/src/blog/components/plugin/PluginDrawer.tsx +0 -39
  23. package/src/blog/components/plugin/PluginInit.tsx +0 -59
  24. package/src/blog/components/plugin/PluginInputForm.tsx +0 -117
  25. package/src/blog/components/plugin/PluginMenuItem.tsx +0 -70
  26. package/src/blog/components/plugin/PluginRoutes.tsx +0 -23
  27. package/src/blog/components/plugin/PluginsMenuItem.tsx +0 -70
  28. package/src/blog/components/plugin/hooks/useDependencies.ts +0 -80
  29. package/src/blog/components/plugin/hooks/usePluginOutput.tsx +0 -17
  30. package/src/blog/components/plugin/pluginUI/PluginUI.tsx +0 -34
  31. package/src/blog/demo/DemoBox.tsx +0 -15
  32. package/src/blog/demo/DemoMenu.tsx +0 -66
  33. package/src/blog/demo/ImgDemo.tsx +0 -34
  34. package/src/blog/demo/PluginDemo.ts +0 -24
  35. package/src/blog/demo/SpinnerDemo.tsx +0 -13
  36. package/src/blog/demo/Xwy.tsx +0 -13
  37. package/src/blog/plugin/Dependencies.ts +0 -14
  38. package/src/blog/plugin/HostFuncAdapter.ts +0 -28
  39. package/src/blog/plugin/Plugin.ts +0 -125
  40. package/src/blog/plugin/PluginEvent.ts +0 -50
  41. package/src/blog/plugin/PluginManager.ts +0 -166
  42. package/src/blog/plugin/PluginManagerPayload.ts +0 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @bbki.ng/site
2
2
 
3
+ ## 4.0.0
4
+
5
+ ## 3.0.0
6
+
3
7
  ## 2.0.52
4
8
 
5
9
  ## 2.0.51
package/index.html CHANGED
@@ -49,7 +49,7 @@
49
49
  </head>
50
50
 
51
51
  <body class="h-full m-0 flex flex-col font-mono">
52
- <div id="blog" class="flex-grow noto-serif no-scrollbar"></div>
52
+ <div id="blog" class="grow noto-serif no-scrollbar"></div>
53
53
  <script type="module" src="/src/index.tsx"></script>
54
54
  <script type="module">
55
55
  // Import the functions you need from the SDKs you need
package/package.json CHANGED
@@ -1,24 +1,16 @@
1
1
  {
2
2
  "name": "@bbki.ng/site",
3
- "version": "2.0.52",
3
+ "version": "4.0.0",
4
4
  "description": "code behind bbki.ng",
5
5
  "main": "index.js",
6
- "scripts": {
7
- "test": "jest",
8
- "test:cov": "jest --coverage",
9
- "dev": "vite --host",
10
- "build": "tsc && vite build",
11
- "serve": "vite preview"
12
- },
13
6
  "type": "module",
14
7
  "repository": {
15
8
  "type": "git",
16
9
  "url": "git+https://github.com/bbbottle/bbki.ng.git"
17
10
  },
18
11
  "dependencies": {
19
- "@extism/extism": "2.0.0-rc11",
20
- "@bbki.ng/components": "workspace:2.6.16",
21
12
  "@supabase/supabase-js": "^1.35.4",
13
+ "@tailwindcss/vite": "4.1.17",
22
14
  "classnames": "2.3.1",
23
15
  "react": "^18.0.0",
24
16
  "react-cusdis": "^2.1.3",
@@ -27,20 +19,21 @@
27
19
  "react-router-dom": "6",
28
20
  "sonner": "1.4.0",
29
21
  "swr": "^2.2.5",
30
- "vaul": "1.1.2"
22
+ "vaul": "1.1.2",
23
+ "@bbki.ng/components": "4.0.0",
24
+ "@bbki.ng/stylebase": "2.0.0"
31
25
  },
32
26
  "devDependencies": {
33
- "@bbki.ng/stylebase": "workspace:0.4.11",
34
27
  "@mdx-js/mdx": "2.0.0-next.9",
35
28
  "@mdx-js/react": "^1.6.22",
36
29
  "@mdx-js/rollup": "3.0.0",
30
+ "@tailwindcss/postcss": "4.1.17",
37
31
  "@tailwindcss/typography": "^0.5.0",
38
32
  "@types/jest": "^27.0.3",
39
33
  "@types/node": "^16.11.1",
40
34
  "@types/react": "^18.0.15",
41
35
  "@types/react-dom": "^18.0.6",
42
36
  "@vitejs/plugin-react": "^1.0.0",
43
- "autoprefixer": "^10.3.7",
44
37
  "husky": "^7.0.0",
45
38
  "jest": "^27.4.5",
46
39
  "lint-staged": "^11.2.1",
@@ -55,8 +48,9 @@
55
48
  "remark-mdx-frontmatter": "^1.0.1",
56
49
  "remark-parse": "^10.0.0",
57
50
  "remark-toc": "^8.0.1",
51
+ "rollup-plugin-visualizer": "6.0.5",
58
52
  "sass": "^1.42.1",
59
- "tailwindcss": "^3.0.7",
53
+ "tailwindcss": "^4.1.17",
60
54
  "ts-jest": "^27.1.1",
61
55
  "typescript": "^4.5.4",
62
56
  "vite": "5.0.0",
@@ -64,12 +58,20 @@
64
58
  "vite-plugin-glsl": "1.2.1",
65
59
  "vite-plugin-mdx": "^3.5.8",
66
60
  "vite-plugin-pwa": "0.19",
67
- "workbox-window": "^6.3.0"
61
+ "workbox-window": "^6.3.0",
62
+ "@bbki.ng/stylebase": "2.0.0"
68
63
  },
69
64
  "author": "bbbottle",
70
65
  "license": "MIT",
71
66
  "bugs": {
72
67
  "url": "https://github.com/bbbottle/bbki.ng/issues"
73
68
  },
74
- "homepage": "https://github.com/bbbottle/bbki.ng#readme"
75
- }
69
+ "homepage": "https://github.com/bbbottle/bbki.ng#readme",
70
+ "scripts": {
71
+ "test": "jest",
72
+ "test:cov": "jest --coverage",
73
+ "dev": "NODE_ENV=development && vite --host",
74
+ "build": "tsc && vite build",
75
+ "serve": "vite preview"
76
+ }
77
+ }
package/src/blog/app.tsx CHANGED
@@ -22,8 +22,6 @@ import { Pochacco, PochaccoPose } from "@/components/Pochacco/Pochacco";
22
22
  import { Role, useRole } from "@/hooks/use_role";
23
23
  import { BotRedirect } from "@/pages/bot";
24
24
  import { BBContext } from "@/context/bbcontext";
25
- import { PluginContentPage } from "@/components/plugin/PluginContentPage";
26
- import { PluginRoutes } from "@/components/plugin/PluginRoutes";
27
25
  import { useClipboardToPost } from "@/hooks/use_clipboard_to_post";
28
26
  import { useSharedStringToPost } from "@/hooks/use_shared_string_to_post";
29
27
  import { ThreeColLayout, ErrorBoundary } from "@bbki.ng/components";
@@ -9,7 +9,7 @@ import * as 入夏 from "./web-burnning.mdx";
9
9
  import * as 六月 from "./black-river.mdx";
10
10
  import * as 立秋 from "./liqiu.mdx";
11
11
  import * as 照片 from "./photos.mdx";
12
- import * as 小乌鸦 from "./xwy.mdx";
12
+ // import * as 小乌鸦 from "./xwy.mdx";
13
13
  import * as 我要看雪 from "./xwy-and-snowing.mdx";
14
14
  import * as 做饭 from "./cooking.mdx";
15
15
  import * as 堂兄 from "./cousin.mdx";
@@ -33,7 +33,7 @@ export const MdxArticleList = [
33
33
  六月,
34
34
  立秋,
35
35
  照片,
36
- 小乌鸦,
36
+ // 小乌鸦,
37
37
  做饭,
38
38
  堂兄,
39
39
  红色的枪,
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  title: 离开
3
+ created_at: 2023-05-11
3
4
  tags:
4
5
  - 随笔
5
6
  ---
@@ -38,7 +38,7 @@ export const ImgCtxMenu = (props: {
38
38
  {props.children}
39
39
  </ContextMenuTrigger>
40
40
  <Auth role={role}>
41
- <ContextMenuContent className="w-256">
41
+ <ContextMenuContent className="w-5xl">
42
42
  <ContextMenuLabel>{props.name}</ContextMenuLabel>
43
43
  <ContextMenuItem disabled>
44
44
  {props.width} * {props.height}
@@ -8,13 +8,9 @@ import {
8
8
  ContextMenuItem,
9
9
  } from "@bbki.ng/components";
10
10
  import { LoginMenuItem } from "@/components/app_ctx_menu/LoginMenuItem";
11
- import { VersionMenuItem } from "@/components/app_ctx_menu/VersionMenuItem";
12
11
  import { ViewSourceMenuItem } from "@/components/app_ctx_menu/ViewSourceMenuItem";
13
- import { PluginsMenuItem } from "@/components/plugin/PluginsMenuItem";
14
- import { PluginManager } from "@/plugin/PluginManager";
15
- import { PluginEvent } from "@/plugin/PluginEvent";
16
- import {PostMenuItem} from "@/components/app_ctx_menu/PostMenuItem";
17
- import {useAuthed} from "@/hooks/use_authed";
12
+ import { PostMenuItem } from "@/components/app_ctx_menu/PostMenuItem";
13
+ import { useAuthed } from "@/hooks/use_authed";
18
14
 
19
15
  export const AppCtxMenu = (props: { children: ReactElement }) => {
20
16
  const [showPluginEntry, setShowPluginEntry] = React.useState(false);
@@ -23,20 +19,12 @@ export const AppCtxMenu = (props: { children: ReactElement }) => {
23
19
  setShowPluginEntry(true);
24
20
  };
25
21
 
26
- useEffect(() => {
27
- PluginManager.addEventListener(PluginEvent.INIT, showEntry);
28
-
29
- return () => {
30
- PluginManager.removeEventListener(PluginEvent.INIT, showEntry);
31
- };
32
- }, []);
33
-
34
22
  const isKing = useAuthed();
35
23
 
36
24
  return (
37
25
  <ContextMenu>
38
26
  <ContextMenuTrigger>{props.children}</ContextMenuTrigger>
39
- <ContextMenuContent className="w-256">
27
+ <ContextMenuContent className="w-5xl">
40
28
  <LoginMenuItem />
41
29
  <ViewSourceMenuItem />
42
30
  {isKing && <PostMenuItem />}
@@ -32,7 +32,7 @@ export const ArticlePage = (props: ArticlePageProps) => {
32
32
  return props.children;
33
33
  }
34
34
 
35
- const articleCls = classNames("prose");
35
+ const articleCls = classNames("prose", "mb-32");
36
36
 
37
37
  return (
38
38
  <>
@@ -44,12 +44,12 @@ export const ArticlePage = (props: ArticlePageProps) => {
44
44
  loading={loading}
45
45
  >
46
46
  <article className={articleCls}>{props.children}</article>
47
- <div className="mt-[1.25em] relative left-[-4px]">
48
- {allTags.length ? <Tags tags={allTags} /> : null}
47
+ <div className="relative left-[-4px]">
48
+ {allTags.length ? <Tags tags={allTags} className="mb-32" /> : null}
49
49
  <Reaction title={title} />
50
50
  </div>
51
51
  </Article>
52
- <div className="px-16">
52
+ <div className="">
53
53
  <Button
54
54
  className=""
55
55
  btnType="button"
@@ -44,7 +44,7 @@ export const ArticleCtxMenu = (props: { children: ReactElement }) => {
44
44
  return (
45
45
  <ContextMenu>
46
46
  <ContextMenuTrigger>{props.children}</ContextMenuTrigger>
47
- <ContextMenuContent className="w-128">
47
+ <ContextMenuContent className="w-lg">
48
48
  <ContextMenuItem
49
49
  onClick={() => {
50
50
  confirm("确认删除?", doDel);
@@ -14,7 +14,7 @@ export const EffectLayer = () => {
14
14
  "h-full",
15
15
  "pointer-events-none",
16
16
  "w-full",
17
- "z-[999]"
17
+ "z-999"
18
18
  );
19
19
 
20
20
  const { onRender } = useRender();
@@ -88,7 +88,7 @@ export const OpenHeartReaction = (props: {
88
88
 
89
89
  export const Reaction = (props: { title: string }) => {
90
90
  return (
91
- <div className="pt-32">
91
+ <div>
92
92
  <OpenHeartReaction title={props.title} emojiPair={hearts} />
93
93
  <OpenHeartReaction title={props.title} emojiPair={faces} />
94
94
  <OpenHeartReaction title={props.title} emojiPair={sadFaces} />
@@ -4,5 +4,6 @@ declare module "*.mdx" {
4
4
  export const meta: {
5
5
  tags?: string[];
6
6
  title: string;
7
+ created_at?: string;
7
8
  };
8
9
  }
@@ -20,7 +20,7 @@ export const useTransitionCls = (options: TransOption = defaultOpt) => {
20
20
  const { originCls, opacity, offset, blur } = options;
21
21
 
22
22
  const cls = classnames(originCls, "transition-all", "duration-500", {
23
- "blur-sm": !visible && blur,
23
+ "blur-xs": !visible && blur,
24
24
  "blur-none": visible && blur,
25
25
  "translate-y-0": visible && offset,
26
26
  "translate-y-8": !visible && offset,
@@ -3,7 +3,7 @@ import { createRoot } from "react-dom/client";
3
3
  import { Toaster } from "sonner";
4
4
  import { BrowserRouter as Router } from "react-router-dom";
5
5
  import { ReloadPrompt } from "@/components";
6
- import "@bbki.ng/components/style";
6
+ // import "@bbki.ng/components/style";
7
7
  import App from "./app";
8
8
  import "./main.css";
9
9
  import Logger from "@/components/Logger";
package/src/blog/main.css CHANGED
@@ -1,6 +1,43 @@
1
- @tailwind base;
2
- @tailwind components;
3
- @tailwind utilities;
1
+ @import "tailwindcss";
2
+ @import "@bbki.ng/stylebase";
3
+
4
+ @config '../../tailwind.config.cjs';
5
+
6
+ /*
7
+ The default border color has changed to `currentcolor` in Tailwind CSS v4,
8
+ so we've added these compatibility styles to make sure everything still
9
+ looks the same as it did with Tailwind CSS v3.
10
+
11
+ If we ever want to remove these styles, we need to add an explicit border
12
+ color utility to any element that depends on these defaults.
13
+ */
14
+ @layer base {
15
+ *,
16
+ ::after,
17
+ ::before,
18
+ ::backdrop,
19
+ ::file-selector-button {
20
+ border-color: var(--color-gray-200, currentcolor);
21
+ }
22
+ }
23
+
24
+ /*
25
+ The default border color has changed to `currentcolor` in Tailwind CSS v4,
26
+ so we've added these compatibility styles to make sure everything still
27
+ looks the same as it did with Tailwind CSS v3.
28
+
29
+ If we ever want to remove these styles, we need to add an explicit border
30
+ color utility to any element that depends on these defaults.
31
+ */
32
+ @layer base {
33
+ *,
34
+ ::after,
35
+ ::before,
36
+ ::backdrop,
37
+ ::file-selector-button {
38
+ border-color: var(--color-gray-200, currentcolor);
39
+ }
40
+ }
4
41
 
5
42
  * {
6
43
  -webkit-user-drag: none;
@@ -20,8 +20,12 @@ const ArticleMap: TArticleMap = {};
20
20
 
21
21
  MdxArticleList.forEach((article: unknown) => {
22
22
  const { meta, default: component } = article as MdxArticle;
23
+ console.log(meta);
24
+ const dateStr = meta.created_at
25
+ ? meta.created_at.toISOString().split("T")[0]
26
+ : "";
23
27
  const Article = withArticleWrapper(component);
24
- ArticleMap[meta.title] = <Article {...meta} />;
28
+ ArticleMap[meta.title] = <Article {...meta} date={dateStr} />;
25
29
  });
26
30
 
27
31
  export default () => {
@@ -3,8 +3,6 @@ module.exports = {
3
3
  content: [
4
4
  "./index.html",
5
5
  "./src/**/*.{js,ts,jsx,tsx, mdx}",
6
- ],
7
- presets: [
8
- require('@bbki.ng/stylebase')
6
+ "./node_modules/@bbki.ng/components/**/*.{js,ts,jsx,tsx, mdx}",
9
7
  ],
10
8
  };
package/vite.config.js CHANGED
@@ -6,6 +6,7 @@ import remarkGfm from "remark-gfm";
6
6
  import remarkParse from "remark-parse";
7
7
  import remarkToc from "remark-toc";
8
8
  import crossOriginIsolation from "vite-plugin-cross-origin-isolation";
9
+ import tailwindcss from "@tailwindcss/vite";
9
10
  import remarkFrontMatter from "remark-frontmatter";
10
11
  import { remarkMdxFrontmatter } from "remark-mdx-frontmatter";
11
12
  import rehypeSlug from "rehype-slug";
@@ -13,6 +14,7 @@ import rehypeHighlight from "rehype-highlight";
13
14
  import rehypeAutolinkHeadings from "rehype-autolink-headings";
14
15
  import react from "@vitejs/plugin-react";
15
16
  import glsl from "vite-plugin-glsl";
17
+ import { visualizer } from "rollup-plugin-visualizer";
16
18
 
17
19
  const options = {
18
20
  remarkPlugins: [
@@ -30,13 +32,17 @@ export default defineConfig({
30
32
  resolve: {
31
33
  alias: {
32
34
  "@": path.resolve(__dirname, "./src/blog"),
35
+ // "@bbki.ng/commponents": path.resolve(__dirname, "../components/lib"),
33
36
  },
37
+ // preserveSymlinks: true,
34
38
  },
35
39
  // build.rollupOptions.output.manualChunks
36
40
  build: {
41
+ sourcemap: true,
37
42
  rollupOptions: {
38
43
  output: {
39
- manualChunks: (id) => {
44
+ manualChunks: (id, meta) => {
45
+ console.log(id);
40
46
  if (id.includes("node_modules")) {
41
47
  return "vendor";
42
48
  }
@@ -44,7 +50,6 @@ export default defineConfig({
44
50
  },
45
51
  },
46
52
  },
47
- server: {},
48
53
  define: {
49
54
  GLOBAL_BBKING_VERSION: JSON.stringify(process.env.npm_package_version),
50
55
  },
@@ -55,6 +60,7 @@ export default defineConfig({
55
60
  react(),
56
61
  mdx(options),
57
62
  glsl(),
63
+ tailwindcss(),
58
64
  VitePWA({
59
65
  injectRegister: "auto",
60
66
  includeAssets: [
@@ -92,9 +98,9 @@ export default defineConfig({
92
98
  const sharedContent = url.searchParams.get("text");
93
99
 
94
100
  // post the shared content to the main thread
95
- if (sharedContent) {
96
- window.postMessage(sharedContent, {})
97
- }
101
+ if (sharedContent) {
102
+ window.postMessage(sharedContent, {});
103
+ }
98
104
  },
99
105
  },
100
106
  {
@@ -120,13 +126,13 @@ export default defineConfig({
120
126
  display: "fullscreen",
121
127
  start_url: "/",
122
128
  share_target: {
123
- "action": "/new-content-handler/",
124
- "method": "GET",
125
- "params": {
126
- "title": "title",
127
- "text": "text",
128
- "url": "url"
129
- }
129
+ action: "/new-content-handler/",
130
+ method: "GET",
131
+ params: {
132
+ title: "title",
133
+ text: "text",
134
+ url: "url",
135
+ },
130
136
  },
131
137
  icons: [
132
138
  {
@@ -149,5 +155,6 @@ export default defineConfig({
149
155
  },
150
156
  }),
151
157
  crossOriginIsolation(),
158
+ visualizer({ open: true, gzipSize: true }),
152
159
  ],
153
160
  });
@@ -1,6 +0,0 @@
1
- module.exports = {
2
- plugins: {
3
- tailwindcss: {},
4
- autoprefixer: {},
5
- },
6
- };
@@ -1,52 +0,0 @@
1
- import { ArticlePage, ArticlePageProps } from "@/components/article";
2
- import React, { useCallback, useEffect } from "react";
3
- import { threeColWrapper } from "@/components/with_wrapper";
4
- import { useParams } from "react-router-dom";
5
- import { usePluginOutput } from "@/components/plugin/hooks/usePluginOutput";
6
- import { PluginManager } from "@/plugin/PluginManager";
7
- import { PluginConfig } from "@extism/extism";
8
- import { PluginEvent } from "@/plugin/PluginEvent";
9
-
10
- type PluginContentPageProps = Omit<ArticlePageProps, "children">;
11
-
12
- const ContentPage = (props: PluginContentPageProps) => {
13
- const { pluginRoute } = useParams();
14
-
15
- const [c, setC] = React.useState<string>("");
16
-
17
- const onInstall = useCallback((plugin: PluginConfig) => {
18
- if (plugin.route !== pluginRoute) {
19
- return;
20
- }
21
-
22
- PluginManager.instance.run(plugin.id).then((result) => {
23
- setC(result);
24
- });
25
- }, []);
26
-
27
- useEffect(() => {
28
- PluginManager.addEventListener<PluginConfig>(
29
- PluginEvent.INSTALL,
30
- onInstall
31
- );
32
-
33
- return () => {
34
- PluginManager.removeEventListener<PluginConfig>(
35
- PluginEvent.INSTALL,
36
- onInstall
37
- );
38
- };
39
- }, []);
40
-
41
- const plugin = PluginManager.instance?.getPluginByRoute(pluginRoute || "");
42
-
43
- const content = usePluginOutput(plugin?.config.id) || c;
44
-
45
- return (
46
- <ArticlePage {...props} title={plugin?.config.route || ""}>
47
- <div dangerouslySetInnerHTML={{ __html: content }} />
48
- </ArticlePage>
49
- );
50
- };
51
-
52
- export const PluginContentPage = ContentPage;
@@ -1,39 +0,0 @@
1
- import { DialogProps, Drawer } from "vaul";
2
- import React, { ReactNode } from "react";
3
-
4
- type PluginDrawerProps = {
5
- children: ReactNode;
6
- title?: string;
7
- description?: string;
8
- } & Pick<DialogProps, "open"> &
9
- Pick<DialogProps, "onOpenChange">;
10
-
11
- export const PluginDrawer = (props: PluginDrawerProps) => {
12
- const { children, title, description, open, onOpenChange } = props;
13
-
14
- return (
15
- <Drawer.Root
16
- direction="bottom"
17
- open={open}
18
- onOpenChange={onOpenChange}
19
- modal={false}
20
- >
21
- <Drawer.Portal>
22
- <Drawer.Content className="bg-gray-100 flex flex-col {/*rounded-t-[10px]*/} mt-24 h-fit fixed bottom-0 left-0 right-0 outline-none border-t border-gray-200">
23
- <div className="p-4 bg-white {/*rounded-t-[10px]*/} flex-1">
24
- <div className="mx-auto w-12 h-1.5 flex-shrink-0 rounded-full bg-gray-300 mb-8" />
25
- <div className="max-w-md mx-auto my-32 p-16">
26
- <Drawer.Title className="font-medium mb-2 text-zinc-900">
27
- {title}
28
- </Drawer.Title>
29
- <Drawer.Description className="text-zinc-600 mb-2">
30
- {description}
31
- </Drawer.Description>
32
- {children}
33
- </div>
34
- </div>
35
- </Drawer.Content>
36
- </Drawer.Portal>
37
- </Drawer.Root>
38
- );
39
- };
@@ -1,59 +0,0 @@
1
- import React, { useCallback, useEffect } from "react";
2
- import { ReactNode } from "react";
3
- import { PluginInputForm } from "@/components/plugin/PluginInputForm";
4
- import { useDependencies } from "@/components/plugin/hooks/useDependencies";
5
- import { PluginManager } from "@/plugin/PluginManager";
6
- import PluginUI from "./pluginUI/PluginUI";
7
-
8
- export const PluginInit = (props: { children: ReactNode }) => {
9
- const {
10
- isPluginFormInputOpen,
11
- setPluginFormInputOpen,
12
- pluginInputFormConf,
13
- formDataResolver,
14
-
15
- pluginUIRef,
16
-
17
- ...dep
18
- } = useDependencies();
19
-
20
- useEffect(() => {
21
- PluginManager.init(dep)
22
- .then()
23
- .catch((e: any) => {
24
- dep.toast("Failed to initialize plugin manager: " + e?.message);
25
- dep.loading(false);
26
- });
27
- }, []);
28
-
29
- const onSubmit = useCallback(
30
- (formData: string) => {
31
- formDataResolver(formData);
32
- setPluginFormInputOpen(false);
33
- },
34
- [formDataResolver]
35
- );
36
-
37
- const onOpenChange = useCallback(
38
- (o: boolean) => {
39
- setPluginFormInputOpen(o);
40
- if (!o) {
41
- formDataResolver("");
42
- }
43
- },
44
- [formDataResolver]
45
- );
46
-
47
- return (
48
- <>
49
- {props.children}
50
- <PluginInputForm
51
- open={isPluginFormInputOpen}
52
- onOpenChange={onOpenChange}
53
- input={pluginInputFormConf}
54
- onSubmit={onSubmit}
55
- />
56
- <PluginUI ref={pluginUIRef} />
57
- </>
58
- );
59
- };