mtxuilib 0.1.218 → 0.1.219

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 (145) hide show
  1. package/dist/components/ShowError.d.ts +6 -0
  2. package/dist/components/ShowError.js +6 -0
  3. package/dist/{common/theme → components}/theme-toggle.d.ts +1 -1
  4. package/dist/components/theme-toggle.js +22 -0
  5. package/dist/components/themes/ThemeProvider.d.ts +2 -0
  6. package/dist/components/themes/ThemeProvider.js +6 -0
  7. package/dist/components/themes/theme-toggle.d.ts +1 -0
  8. package/dist/{common/theme → components/themes}/theme-toggle.js +8 -0
  9. package/dist/components/themes/useTheme.d.ts +0 -0
  10. package/dist/components/themes/useTheme.js +1 -0
  11. package/dist/fonts.d.ts +18 -0
  12. package/dist/fonts.js +46 -0
  13. package/dist/form/EditFormToolbar.js +7 -7
  14. package/dist/hooks/use-can-back.d.ts +1 -0
  15. package/dist/hooks/use-can-back.js +11 -0
  16. package/dist/hooks/use-mounted.d.ts +1 -0
  17. package/dist/hooks/use-mounted.js +8 -0
  18. package/dist/hooks/use-router.d.ts +1 -1
  19. package/dist/hooks/use-router.js +11 -8
  20. package/dist/hooks/useAgentEventStream.d.ts +6 -0
  21. package/dist/hooks/useAgentEventStream.js +45 -0
  22. package/dist/icons/DotsHorizontalIcon.d.ts +1 -0
  23. package/dist/icons/DotsHorizontalIcon.js +1 -0
  24. package/dist/icons/DotsVerticalIcon.d.ts +0 -0
  25. package/dist/icons/DotsVerticalIcon.js +1 -0
  26. package/dist/icons/icons.d.ts +2 -4
  27. package/dist/icons/icons.js +1 -3
  28. package/dist/lib/clientlib.d.ts +1 -1
  29. package/dist/lib/clientlib.js +8 -4
  30. package/dist/lib/render.js +6 -6
  31. package/dist/lib/utils.d.ts +2 -0
  32. package/dist/lib/utils.js +10 -0
  33. package/dist/styles/CalSans-SemiBold.otf +0 -0
  34. package/dist/styles/globals.css +8 -11
  35. package/dist/ui/mt/NavTag.js +2 -4
  36. package/dist/ui/mt/ScreenPanel.d.ts +5 -3
  37. package/dist/ui/mt/ScreenPanel.js +13 -4
  38. package/dist/ui/mt/skeleton/SkeletonLayout.d.ts +7 -1
  39. package/dist/ui/mt/skeleton/SkeletonLayout.js +3 -3
  40. package/dist/ui/mt/skeleton/SkeletonLoading.d.ts +0 -2
  41. package/dist/ui/mt/skeleton/SkeletonLoading.js +0 -5
  42. package/dist/ui/mt/skeleton/skeleton-card.d.ts +1 -3
  43. package/dist/ui/mt/skeleton/skeleton-card.js +4 -4
  44. package/dist/ui/mt/skeleton/skeletons.d.ts +5 -4
  45. package/dist/ui/mt/skeleton/skeletons.js +18 -2
  46. package/dist/ui/mt/spinner/Spinner1.d.ts +1 -0
  47. package/dist/ui/mt/spinner/Spinner1.js +5 -0
  48. package/dist/ui/sonner.d.ts +1 -1
  49. package/dist/ui/sonner.js +8 -0
  50. package/package.json +33 -65
  51. package/dist/common/theme/mode-toggle.d.ts +0 -1
  52. package/dist/common/theme/mode-toggle.js +0 -10
  53. package/dist/hooks/useLayoutPath.d.ts +0 -2
  54. package/dist/hooks/useLayoutPath.js +0 -19
  55. package/dist/misc/MtErrorBoundary.stories.d.ts +0 -15
  56. package/dist/misc/MtErrorBoundary.stories.js +0 -27
  57. package/dist/misc/MtErrorBoundaryV2.stories.d.ts +0 -14
  58. package/dist/misc/MtErrorBoundaryV2.stories.js +0 -25
  59. package/dist/mtedtior/LzMtEditor.d.ts +0 -6
  60. package/dist/mtedtior/LzMtEditor.js +0 -7
  61. package/dist/mtedtior/MtEditor.d.ts +0 -29
  62. package/dist/mtedtior/MtEditor.js +0 -106
  63. package/dist/mtedtior/components/editor-bubble-item.d.ts +0 -9
  64. package/dist/mtedtior/components/editor-bubble-item.js +0 -14
  65. package/dist/mtedtior/components/editor-bubble.d.ts +0 -7
  66. package/dist/mtedtior/components/editor-bubble.js +0 -43
  67. package/dist/mtedtior/components/editor-command-item.d.ts +0 -19
  68. package/dist/mtedtior/components/editor-command-item.js +0 -16
  69. package/dist/mtedtior/components/editor-command.d.ts +0 -29
  70. package/dist/mtedtior/components/editor-command.js +0 -46
  71. package/dist/mtedtior/components/editor.d.ts +0 -21
  72. package/dist/mtedtior/components/editor.js +0 -12
  73. package/dist/mtedtior/components/index.d.ts +0 -8
  74. package/dist/mtedtior/components/index.js +0 -6
  75. package/dist/mtedtior/content.d.ts +0 -132
  76. package/dist/mtedtior/content.js +0 -248
  77. package/dist/mtedtior/extensions/ai-highlight.d.ts +0 -22
  78. package/dist/mtedtior/extensions/ai-highlight.js +0 -88
  79. package/dist/mtedtior/extensions/custom-keymap.d.ts +0 -10
  80. package/dist/mtedtior/extensions/custom-keymap.js +0 -38
  81. package/dist/mtedtior/extensions/drag-and-drop.d.ts +0 -6
  82. package/dist/mtedtior/extensions/drag-and-drop.js +0 -165
  83. package/dist/mtedtior/extensions/image-resizer.d.ts +0 -2
  84. package/dist/mtedtior/extensions/image-resizer.js +0 -31
  85. package/dist/mtedtior/extensions/index.d.ts +0 -23
  86. package/dist/mtedtior/extensions/index.js +0 -73
  87. package/dist/mtedtior/extensions/mathematics.d.ts +0 -20
  88. package/dist/mtedtior/extensions/mathematics.js +0 -110
  89. package/dist/mtedtior/extensions/slash-command.d.ts +0 -33
  90. package/dist/mtedtior/extensions/slash-command.js +0 -224
  91. package/dist/mtedtior/extensions/twitter.d.ts +0 -22
  92. package/dist/mtedtior/extensions/twitter.js +0 -84
  93. package/dist/mtedtior/extensions/updated-image.d.ts +0 -2
  94. package/dist/mtedtior/extensions/updated-image.js +0 -17
  95. package/dist/mtedtior/generative/ai-completion-command.d.ts +0 -5
  96. package/dist/mtedtior/generative/ai-completion-command.js +0 -30
  97. package/dist/mtedtior/generative/ai-selector-commands.d.ts +0 -5
  98. package/dist/mtedtior/generative/ai-selector-commands.js +0 -42
  99. package/dist/mtedtior/generative/ai-selector.d.ts +0 -6
  100. package/dist/mtedtior/generative/ai-selector.js +0 -50
  101. package/dist/mtedtior/generative/generative-menu-switch.d.ts +0 -8
  102. package/dist/mtedtior/generative/generative-menu-switch.js +0 -26
  103. package/dist/mtedtior/mtextesions/DemoComponent.d.ts +0 -2
  104. package/dist/mtedtior/mtextesions/DemoComponent.js +0 -32
  105. package/dist/mtedtior/mtextesions/image-upload.d.ts +0 -1
  106. package/dist/mtedtior/mtextesions/image-upload.js +0 -52
  107. package/dist/mtedtior/mtextesions/slash-command.d.ts +0 -2
  108. package/dist/mtedtior/mtextesions/slash-command.js +0 -194
  109. package/dist/mtedtior/mtextesions/tw_extensions.d.ts +0 -1
  110. package/dist/mtedtior/mtextesions/tw_extensions.js +0 -137
  111. package/dist/mtedtior/plugins/index.d.ts +0 -1
  112. package/dist/mtedtior/plugins/index.js +0 -1
  113. package/dist/mtedtior/plugins/upload-images.d.ts +0 -13
  114. package/dist/mtedtior/plugins/upload-images.js +0 -98
  115. package/dist/mtedtior/selectors/color-selector.d.ts +0 -8
  116. package/dist/mtedtior/selectors/color-selector.js +0 -104
  117. package/dist/mtedtior/selectors/link-selector.d.ts +0 -8
  118. package/dist/mtedtior/selectors/link-selector.js +0 -50
  119. package/dist/mtedtior/selectors/math-selector.d.ts +0 -1
  120. package/dist/mtedtior/selectors/math-selector.js +0 -22
  121. package/dist/mtedtior/selectors/node-selector.d.ts +0 -14
  122. package/dist/mtedtior/selectors/node-selector.js +0 -77
  123. package/dist/mtedtior/selectors/text-buttons.d.ts +0 -1
  124. package/dist/mtedtior/selectors/text-buttons.js +0 -44
  125. package/dist/mtedtior/utils/summary.d.ts +0 -1
  126. package/dist/mtedtior/utils/summary.js +0 -8
  127. package/dist/mtedtior/utils/utils.d.ts +0 -9
  128. package/dist/mtedtior/utils/utils.js +0 -32
  129. package/dist/mtedtior/utils.d.ts +0 -9
  130. package/dist/mtedtior/utils.js +0 -33
  131. package/dist/providers/History.d.ts +0 -23
  132. package/dist/providers/History.js +0 -58
  133. package/dist/styles/prosemirror.css +0 -171
  134. package/dist/tools/rag/RagHello.d.ts +0 -8
  135. package/dist/tools/rag/RagHello.js +0 -14
  136. package/dist/tools/rag/ui/RagInput.d.ts +0 -2
  137. package/dist/tools/rag/ui/RagInput.js +0 -29
  138. package/dist/ui/mt/MtDialog.d.ts +0 -19
  139. package/dist/ui/mt/MtDialog.js +0 -38
  140. package/dist/ui/mt/SimpleModel.d.ts +0 -3
  141. package/dist/ui/mt/SimpleModel.js +0 -27
  142. package/dist/ui/mt/modal/MtModal.d.ts +0 -29
  143. package/dist/ui/mt/modal/MtModal.js +0 -52
  144. /package/dist/styles/{index.css → index.css--} +0 -0
  145. /package/dist/styles/{main.css → main.css--} +0 -0
@@ -0,0 +1,6 @@
1
+ export interface ShowErrorProps {
2
+ error?: any;
3
+ reset: () => void;
4
+ variants?: "default" | "card" | "toast";
5
+ }
6
+ export declare const ShowError: (props: ShowErrorProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { MtButton } from "../ui/mt/Button";
4
+ export const ShowError = (props) => {
5
+ return (_jsxs("div", { className: "bg-orange-400 p-4 flex items-center justify-center flex-col", children: [_jsx("h3", { children: "\u5185\u90E8\u51FA\u9519" }), _jsx(MtButton, { type: "button", onClick: () => props.reset(), children: "\u91CD\u8BD5" })] }));
6
+ };
@@ -1 +1 @@
1
- export declare function ThemeToggle(): import("react/jsx-runtime").JSX.Element;
1
+ export declare function ThemeToggle(): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,22 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useTheme } from "next-themes";
4
+ import * as React from "react";
5
+ import { IconMoon, IconSun } from "../icons/icons-ai";
6
+ import { Button } from "../ui/button";
7
+ export function ThemeToggle() {
8
+ const { setTheme, theme } = useTheme();
9
+ const [_, startTransition] = React.useTransition();
10
+ const [mounted, setMounted] = React.useState(false);
11
+ React.useEffect(() => {
12
+ setMounted(true);
13
+ }, []);
14
+ if (!mounted) {
15
+ return null;
16
+ }
17
+ return (_jsxs(Button, { variant: "ghost", size: "icon", onClick: () => {
18
+ startTransition(() => {
19
+ setTheme(theme === "light" ? "dark" : "light");
20
+ });
21
+ }, children: [!theme ? null : theme === "dark" ? (_jsx(IconMoon, { className: "transition-all" })) : (_jsx(IconSun, { className: "transition-all" })), _jsx("span", { className: "sr-only", children: "Toggle theme" })] }));
22
+ }
@@ -0,0 +1,2 @@
1
+ import type { ThemeProviderProps } from "next-themes/dist/types";
2
+ export declare const MtThemeProvider: (props: ThemeProviderProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { ThemeProvider as NextThemesProvider } from "next-themes";
4
+ export const MtThemeProvider = (props) => {
5
+ return (_jsx(NextThemesProvider, { attribute: "class", defaultTheme: "system", enableSystem: true, disableTransitionOnChange: true, ...props, children: props.children }));
6
+ };
@@ -0,0 +1 @@
1
+ export declare function ThemeToggle(): import("react/jsx-runtime").JSX.Element | null;
@@ -2,8 +2,16 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { Moon, Sun } from "lucide-react";
4
4
  import { useTheme } from "next-themes";
5
+ import { useEffect, useState } from "react";
5
6
  import { Button } from "../../ui/button";
6
7
  export function ThemeToggle() {
7
8
  const { setTheme, theme } = useTheme();
9
+ const [mounted, setMounted] = useState(false);
10
+ useEffect(() => {
11
+ setMounted(true);
12
+ }, []);
13
+ if (!mounted) {
14
+ return null;
15
+ }
8
16
  return (_jsxs(Button, { variant: "ghost", size: "icon", onClick: () => setTheme(theme === "light" ? "dark" : "light"), children: [_jsx(Sun, { className: "h-6 w-[1.3rem] dark:hidden" }), _jsx(Moon, { className: "hidden h-5 w-5 dark:block" }), _jsx("span", { className: "sr-only", children: "Toggle theme" })] }));
9
17
  }
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,18 @@
1
+ export declare const fontSans: import("next/dist/compiled/@next/font").NextFontWithVariable;
2
+ export declare const fontMono: import("next/dist/compiled/@next/font").NextFontWithVariable;
3
+ export declare const cal: import("next/dist/compiled/@next/font").NextFontWithVariable;
4
+ export declare const crimsonBold: import("next/dist/compiled/@next/font").NextFontWithVariable;
5
+ export declare const inter: import("next/dist/compiled/@next/font").NextFontWithVariable;
6
+ export declare const inconsolataBold: import("next/dist/compiled/@next/font").NextFontWithVariable;
7
+ export declare const crimson: import("next/dist/compiled/@next/font").NextFontWithVariable;
8
+ export declare const inconsolata: import("next/dist/compiled/@next/font").NextFontWithVariable;
9
+ export declare const titleFontMapper: {
10
+ Default: string;
11
+ Serif: string;
12
+ Mono: string;
13
+ };
14
+ export declare const defaultFontMapper: {
15
+ Default: string;
16
+ Serif: string;
17
+ Mono: string;
18
+ };
package/dist/fonts.js ADDED
@@ -0,0 +1,46 @@
1
+ import { JetBrains_Mono as FontMono } from "next/font/google";
2
+ import { Crimson_Text, Inconsolata, Inter } from "next/font/google";
3
+ import localFont from "next/font/local";
4
+ import { GeistSans } from "geist/font/sans";
5
+ export const fontSans = GeistSans;
6
+ export const fontMono = FontMono({
7
+ subsets: ["latin"],
8
+ variable: "--font-mono",
9
+ });
10
+ export const cal = localFont({
11
+ src: "./styles/CalSans-SemiBold.otf",
12
+ variable: "--font-title",
13
+ });
14
+ export const crimsonBold = Crimson_Text({
15
+ weight: "700",
16
+ variable: "--font-title",
17
+ subsets: ["latin"],
18
+ });
19
+ export const inter = Inter({
20
+ variable: "--font-default",
21
+ subsets: ["latin"],
22
+ });
23
+ export const inconsolataBold = Inconsolata({
24
+ weight: "700",
25
+ variable: "--font-title",
26
+ subsets: ["latin"],
27
+ });
28
+ export const crimson = Crimson_Text({
29
+ weight: "400",
30
+ variable: "--font-default",
31
+ subsets: ["latin"],
32
+ });
33
+ export const inconsolata = Inconsolata({
34
+ variable: "--font-default",
35
+ subsets: ["latin"],
36
+ });
37
+ export const titleFontMapper = {
38
+ Default: cal.variable,
39
+ Serif: crimsonBold.variable,
40
+ Mono: inconsolataBold.variable,
41
+ };
42
+ export const defaultFontMapper = {
43
+ Default: inter.variable,
44
+ Serif: crimson.variable,
45
+ Mono: inconsolata.variable,
46
+ };
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { forwardRef, useMemo, useState } from "react";
4
4
  import { useFormContext } from "react-hook-form";
5
5
  import { cn } from "../lib/utils";
@@ -18,7 +18,7 @@ export const EditFormToolbar = forwardRef((props, forwardedRef) => {
18
18
  values: form.getValues(),
19
19
  });
20
20
  }
21
- }, [form.formState.errors]);
21
+ }, [form]);
22
22
  if (!form) {
23
23
  throw new Error("SubmitButton must be used within a Form or have a form prop");
24
24
  }
@@ -28,14 +28,14 @@ export const EditFormToolbar = forwardRef((props, forwardedRef) => {
28
28
  setOpenConform(true);
29
29
  }
30
30
  else {
31
- onCancel && onCancel();
31
+ onCancel?.();
32
32
  }
33
- }, children: "cancel" }), _jsx(MtButton, { form: props.form?.id, type: "submit", disabled: formState.isSubmitting, children: _jsx(_Fragment, { children: formState.isSubmitting ? "Loading" : submitText || "submit" }) }), enableDeleteButton && (_jsx(ConformDeleteBtn, { callback: async () => {
34
- onDelete && onDelete();
35
- }, disabled: form.formState.isSubmitting, variant: "destructive", children: "delete" }))] })), openConform && (_jsx(ComformCancel, { onBack: () => {
33
+ }, children: "\u53D6\u6D88" }), _jsx(MtButton, { form: props.form?.id, type: "submit", disabled: formState.isSubmitting, className: "min-w-24", children: formState.isSubmitting ? "Loading" : submitText || "确定" }), enableDeleteButton && (_jsx(ConformDeleteBtn, { callback: async () => {
34
+ onDelete?.();
35
+ }, disabled: form.formState.isSubmitting, variant: "destructive", children: "\u5220\u9664" }))] })), openConform && (_jsx(ComformCancel, { onBack: () => {
36
36
  setOpenConform(false);
37
37
  }, onContinue: () => {
38
- onCancel && onCancel();
38
+ onCancel?.();
39
39
  } }))] }));
40
40
  });
41
41
  EditFormToolbar.displayName = "EditFormToolbar";
@@ -0,0 +1 @@
1
+ export declare function useCanBack(): boolean;
@@ -0,0 +1,11 @@
1
+ "use client";
2
+ import { useEffect, useState } from "react";
3
+ export function useCanBack() {
4
+ const [canGoBack, setCanGoBack] = useState(false);
5
+ useEffect(() => {
6
+ if (typeof window !== "undefined") {
7
+ setCanGoBack(window.history.length > 1);
8
+ }
9
+ }, []);
10
+ return canGoBack;
11
+ }
@@ -0,0 +1 @@
1
+ export declare function useMounted(): boolean;
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ export function useMounted() {
3
+ const [mounted, setMounted] = React.useState(false);
4
+ React.useEffect(() => {
5
+ setMounted(true);
6
+ }, []);
7
+ return mounted;
8
+ }
@@ -9,7 +9,7 @@ export declare const useMtRouter: () => {
9
9
  export declare const useGo: () => {
10
10
  goParent: () => void;
11
11
  };
12
- export declare const useMtSearchParams: () => {
12
+ export declare const useMtSearchs: () => {
13
13
  params: {
14
14
  [k: string]: string;
15
15
  };
@@ -22,29 +22,32 @@ export const useGo = () => {
22
22
  goParent,
23
23
  };
24
24
  };
25
- export const useMtSearchParams = () => {
25
+ export const useMtSearchs = () => {
26
26
  const searchParamsFromNextjs = useSearchParams();
27
- const finnalParams = useMemo(() => {
27
+ const finalParams = useMemo(() => {
28
28
  return Object.fromEntries(searchParamsFromNextjs);
29
29
  }, [searchParamsFromNextjs]);
30
30
  const router = useMtRouter();
31
31
  const pathName = usePathname();
32
32
  const pushUrl = useDebouncedCallback(router.push, 300);
33
33
  const patchSearchs = useCallback((values) => {
34
- const params = { ...finnalParams, ...values };
34
+ const params = { ...finalParams, ...values };
35
35
  Object.keys(params).forEach((k) => {
36
36
  if (!params[k]) {
37
37
  delete params[k];
38
38
  }
39
39
  });
40
- if (typeof window != "undefined") {
41
- pushUrl(`${pathName}?${new URLSearchParams(params).toString()}`);
40
+ const newSearchString = new URLSearchParams(params).toString();
41
+ const newUrl = `${pathName}?${newSearchString}`;
42
+ const currentUrl = `${pathName}?${searchParamsFromNextjs.toString()}`;
43
+ if (newUrl !== currentUrl) {
44
+ pushUrl(newUrl);
42
45
  }
43
- }, [finnalParams, pathName, pushUrl]);
46
+ }, [finalParams, pathName, searchParamsFromNextjs, pushUrl]);
44
47
  return {
45
- params: finnalParams,
48
+ params: finalParams,
46
49
  get: (name) => {
47
- return finnalParams && finnalParams[name];
50
+ return finalParams?.[name];
48
51
  },
49
52
  patchSearchs,
50
53
  };
@@ -0,0 +1,6 @@
1
+ export interface EventStreamProps {
2
+ endpoint_url: string;
3
+ onData: (data: any) => void;
4
+ onError?: (error: any) => void;
5
+ }
6
+ export declare const useAgentEventStream: (props: EventStreamProps) => null;
@@ -0,0 +1,45 @@
1
+ import { useEffect } from "react";
2
+ export const useAgentEventStream = (props) => {
3
+ const { endpoint_url: apiUrl, onData, onError } = props;
4
+ useEffect(() => {
5
+ const controller = new AbortController();
6
+ const run = async (controller) => {
7
+ try {
8
+ const response = await fetch(apiUrl, {
9
+ signal: controller.signal,
10
+ });
11
+ if (!response.body) {
12
+ throw new Error("ReadableStream not supported");
13
+ }
14
+ const reader = response.body.getReader();
15
+ const decoder = new TextDecoder();
16
+ let done = false;
17
+ while (!done) {
18
+ const { value, done: readerDone } = await reader.read();
19
+ done = readerDone;
20
+ const line = decoder.decode(value, { stream: true });
21
+ if (line?.trim()) {
22
+ const strval = decoder.decode(value, { stream: true });
23
+ if (strval) {
24
+ const colonIndex = strval.indexOf(":");
25
+ if (colonIndex > 0) {
26
+ const jsonString = strval.slice(colonIndex + 1).trim();
27
+ try {
28
+ const parsedItem = JSON.parse(jsonString);
29
+ onData?.(parsedItem);
30
+ }
31
+ catch (parseError) {
32
+ console.error("Failed to parse item:", parseError);
33
+ }
34
+ }
35
+ }
36
+ }
37
+ }
38
+ }
39
+ catch (error) { }
40
+ };
41
+ run(controller);
42
+ return () => controller.abort();
43
+ }, [apiUrl, onData]);
44
+ return null;
45
+ };
@@ -1 +1,2 @@
1
1
  export { DotsHorizontalIcon } from "@radix-ui/react-icons";
2
+ export { DotsVerticalIcon } from "@radix-ui/react-icons";
@@ -1 +1,2 @@
1
1
  export { DotsHorizontalIcon } from "@radix-ui/react-icons";
2
+ export { DotsVerticalIcon } from "@radix-ui/react-icons";
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
@@ -1,5 +1,5 @@
1
1
  type IconProps = React.HTMLAttributes<SVGElement>;
2
- import { LucideProps } from "lucide-react";
2
+ import { type LucideProps } from "lucide-react";
3
3
  import type { LucideIcon } from "lucide-react";
4
4
  export type Icon = LucideIcon;
5
5
  export declare const iconVariants: (props?: ({
@@ -7,7 +7,7 @@ export declare const iconVariants: (props?: ({
7
7
  size?: "md" | "sm" | null | undefined;
8
8
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
9
9
  export declare const Icons: {
10
- x: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
10
+ X: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
11
11
  add: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
12
12
  alignCenter: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
13
13
  alignJustify: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
@@ -27,8 +27,6 @@ export declare const Icons: {
27
27
  chevronRight: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
28
28
  spinner: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
29
29
  chevronsUpDown: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
30
- clear: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
31
- close: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
32
30
  code: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
33
31
  codeblock: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
34
32
  color: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
@@ -21,7 +21,7 @@ const borderNone = (props) => (_jsx("svg", { viewBox: "0 0 24 24", height: "48",
21
21
  const borderRight = (props) => (_jsx("svg", { viewBox: "0 0 24 24", height: "48", width: "48", focusable: "false", role: "img", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props, children: _jsx("path", { d: "M13 5a1 1 0 1 0 0-2h-2a1 1 0 1 0 0 2h2zm-8 6a1 1 0 1 0-2 0v2a1 1 0 1 0 2 0v-2zm9 9a1 1 0 0 1-1 1h-2a1 1 0 1 1 0-2h2a1 1 0 0 1 1 1zM6 3a1 1 0 0 1 0 2 1 1 0 0 0-1 1 1 1 0 0 1-2 0 3 3 0 0 1 3-3zm1 17a1 1 0 0 1-1 1 3 3 0 0 1-3-3 1 1 0 1 1 2 0 1 1 0 0 0 1 1 1 1 0 0 1 1 1zm11 1a1 1 0 1 1 0-2 1 1 0 0 0 1-1V6a1 1 0 0 0-1-1 1 1 0 1 1 0-2 3 3 0 0 1 3 3v12a3 3 0 0 1-3 3z" }) }));
22
22
  const borderTop = (props) => (_jsx("svg", { viewBox: "0 0 24 24", height: "48", width: "48", focusable: "false", role: "img", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props, children: _jsx("path", { d: "M3 6a1 1 0 0 0 2 0 1 1 0 0 1 1-1h12a1 1 0 0 1 1 1 1 1 0 1 0 2 0 3 3 0 0 0-3-3H6a3 3 0 0 0-3 3zm2 5a1 1 0 1 0-2 0v2a1 1 0 1 0 2 0v-2zm14 0a1 1 0 1 1 2 0v2a1 1 0 1 1-2 0v-2zm-5 9a1 1 0 0 1-1 1h-2a1 1 0 1 1 0-2h2a1 1 0 0 1 1 1zm-8 1a1 1 0 1 0 0-2 1 1 0 0 1-1-1 1 1 0 1 0-2 0 3 3 0 0 0 3 3zm11-1a1 1 0 0 0 1 1 3 3 0 0 0 3-3 1 1 0 1 0-2 0 1 1 0 0 1-1 1 1 1 0 0 0-1 1z" }) }));
23
23
  export const Icons = {
24
- x: X,
24
+ X,
25
25
  add: Plus,
26
26
  alignCenter: AlignCenter,
27
27
  alignJustify: AlignJustify,
@@ -41,8 +41,6 @@ export const Icons = {
41
41
  chevronRight: ChevronRight,
42
42
  spinner: Loader2,
43
43
  chevronsUpDown: ChevronsUpDown,
44
- clear: X,
45
- close: X,
46
44
  code: Code2,
47
45
  codeblock: FileCode,
48
46
  color: Baseline,
@@ -1,5 +1,5 @@
1
1
  export declare function mergeRefs<T>(refs: Array<React.MutableRefObject<T> | React.LegacyRef<T>>): React.RefCallback<T>;
2
2
  export declare function getCookie(name: string): string | undefined;
3
- export declare function deleteCookie(name: string): void;
4
3
  export declare function deleteAllCookies(): void;
5
4
  export declare function setCookie(name: string, value: any): void;
5
+ export declare function deleteCookie(name: string, path?: string, domain?: string): void;
@@ -20,18 +20,22 @@ export function getCookie(name) {
20
20
  }
21
21
  }
22
22
  }
23
- export function deleteCookie(name) {
24
- document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 GMT`;
25
- }
26
23
  export function deleteAllCookies() {
27
24
  const cookies = document.cookie.split(";");
28
25
  for (let i = 0; i < cookies.length; i++) {
29
26
  const cookie = cookies[i];
30
27
  const eqPos = cookie.indexOf("=");
31
28
  const name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
32
- document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 GMT`;
29
+ document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/`;
33
30
  }
34
31
  }
35
32
  export function setCookie(name, value) {
36
33
  document.cookie = `${name}=${value}`;
37
34
  }
35
+ export function deleteCookie(name, path = "/", domain) {
36
+ let cookieString = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=${path}`;
37
+ if (domain) {
38
+ cookieString += `;domain=${domain}`;
39
+ }
40
+ document.cookie = cookieString;
41
+ }
@@ -4,18 +4,18 @@ export function flexRender(Comp, props) {
4
4
  }
5
5
  export function isReactComponent(component) {
6
6
  return (isClassComponent(component) ||
7
- typeof component === 'function' ||
7
+ typeof component === "function" ||
8
8
  isExoticComponent(component));
9
9
  }
10
10
  function isClassComponent(component) {
11
- return (typeof component === 'function' &&
11
+ return (typeof component === "function" &&
12
12
  (() => {
13
13
  const proto = Object.getPrototypeOf(component);
14
- return proto.prototype && proto.prototype.isReactComponent;
14
+ return proto.prototype?.isReactComponent;
15
15
  })());
16
16
  }
17
17
  function isExoticComponent(component) {
18
- return (typeof component === 'object' &&
19
- typeof component.$$typeof === 'symbol' &&
20
- ['react.memo', 'react.forward_ref'].includes(component.$$typeof.description));
18
+ return (typeof component === "object" &&
19
+ typeof component.$$typeof === "symbol" &&
20
+ ["react.memo", "react.forward_ref"].includes(component.$$typeof.description));
21
21
  }
@@ -1,5 +1,6 @@
1
1
  import { type ClassValue } from "clsx";
2
2
  export declare function cn(...inputs: ClassValue[]): string;
3
+ export declare function newUniqueId(): string;
3
4
  export declare function formatDate(input: string | number): string;
4
5
  export declare const randomString: (length: number) => string;
5
6
  export declare function absoluteUrl(path: string): string;
@@ -36,3 +37,4 @@ export declare enum ResultCode {
36
37
  UserLoggedIn = "USER_LOGGED_IN"
37
38
  }
38
39
  export declare const getMessageFromCode: (resultCode: string) => "Invalid credentials!" | "Invalid submission, please try again!" | "User already exists, please log in!" | "User created, welcome!" | "Something went wrong, please try again!" | "Logged in!" | undefined;
40
+ export declare const copyClipboard: (obj: any) => void;
package/dist/lib/utils.js CHANGED
@@ -4,6 +4,9 @@ import { twMerge } from "tailwind-merge";
4
4
  export function cn(...inputs) {
5
5
  return twMerge(clsx(inputs));
6
6
  }
7
+ export function newUniqueId() {
8
+ return randomString(10);
9
+ }
7
10
  export function formatDate(input) {
8
11
  const date = new Date(input);
9
12
  return date.toLocaleDateString("en-US", {
@@ -204,3 +207,10 @@ export const getMessageFromCode = (resultCode) => {
204
207
  return "Logged in!";
205
208
  }
206
209
  };
210
+ export const copyClipboard = (obj) => {
211
+ if (typeof obj === "object") {
212
+ navigator.clipboard.writeText(JSON.stringify(obj, null, 2));
213
+ return;
214
+ }
215
+ navigator.clipboard.writeText(obj);
216
+ };
Binary file
@@ -134,7 +134,7 @@
134
134
  /* vamp 样式开始 ***********************************************************************************************/
135
135
 
136
136
  @layer utilities {
137
- .red-glow {
137
+ /* .red-glow {
138
138
  text-shadow: 0px 0px 8px hsla(352, 98%, 60%, 0.6);
139
139
  }
140
140
 
@@ -153,14 +153,11 @@
153
153
  }
154
154
 
155
155
  .dropdown {
156
- /* backdrop-filter: blur(10px) saturate(190%) contrast(70%) brightness(80%);
157
- background-color: rgba(29, 30, 43, 0.498);
158
- border: 0.5px solid rgba(82, 82, 111, 0.44); */
159
156
  box-shadow: rgb(0 0 0 / 20%) 0px 4px 24px;
160
157
  backdrop-filter: blur(20px) saturate(190%) contrast(70%) brightness(80%);
161
158
  background-color: rgba(29, 30, 43, 0.498);
162
159
  border: 0.5px solid rgba(82, 82, 111, 0.44);
163
- }
160
+ } */
164
161
  }
165
162
 
166
163
  /* clears the ‘X’ from Internet Explorer */
@@ -182,18 +179,18 @@ input[type="search"]::-webkit-search-results-decoration {
182
179
  display: none;
183
180
  }
184
181
 
185
- .is-editor-empty {
182
+ /* .is-editor-empty {
186
183
  @apply text-white;
187
- }
184
+ } */
188
185
 
189
- .ProseMirror p.is-editor-empty:first-child::before {
186
+ /* .ProseMirror p.is-editor-empty:first-child::before {
190
187
  color: #adb5bd;
191
188
  content: attr(data-placeholder);
192
189
  float: left;
193
190
  height: 0;
194
191
  opacity: 0.3;
195
192
  pointer-events: none;
196
- }
193
+ } */
197
194
 
198
195
  ::-webkit-scrollbar {
199
196
  width: 8px;
@@ -211,9 +208,9 @@ input[type="search"]::-webkit-search-results-decoration {
211
208
  background-color: transparent;
212
209
  }
213
210
 
214
- mux-player {
211
+ /* mux-player {
215
212
  --controls: none;
216
213
  --media-object-fit: cover;
217
214
  height: 100%;
218
- }
215
+ } */
219
216
  /* vamp 结束 ***********************************************************************************************/
@@ -4,7 +4,6 @@ import { ChevronLeft } from "lucide-react";
4
4
  import { urlJoinPaths } from "mtxlib/http/url";
5
5
  import { usePathname, useSelectedLayoutSegment, useSelectedLayoutSegments, } from "next/navigation";
6
6
  import { useGo } from "../../hooks/use-router";
7
- import { useLayoutPath } from "../../hooks/useLayoutPath";
8
7
  import { cn } from "../../lib/utils";
9
8
  import { MtButton } from "./Button";
10
9
  import { MtLink } from "./mtlink";
@@ -12,13 +11,12 @@ export const NavTabs = ({ items, enableGobackBtn }) => {
12
11
  const segment = useSelectedLayoutSegment();
13
12
  const segments = useSelectedLayoutSegments();
14
13
  const pathname = usePathname();
15
- const segmentsPaths = urlJoinPaths(...segments);
16
- const layoutBasePath = useLayoutPath();
14
+ const seg = useSelectedLayoutSegment();
17
15
  const go = useGo();
18
16
  return (_jsxs("div", { className: "flex", children: [enableGobackBtn && (_jsx(MtButton, { variant: "ghost", onClick: () => {
19
17
  go.goParent();
20
18
  }, children: _jsx(ChevronLeft, { className: "mr-2 size-4" }) })), items?.map((item, i) => {
21
- const href = `${urlJoinPaths(layoutBasePath, item.routeName)}`;
19
+ const href = `${urlJoinPaths(seg || "", item.routeName)}`;
22
20
  return (_jsx(TabItem, { activate: (segment || "") === item.routeName, children: _jsx(MtLink, { href: href, children: item.label }) }, i));
23
21
  })] }));
24
22
  };
@@ -1,4 +1,6 @@
1
- import { type PropsWithChildren } from "react";
2
- export declare const ScreenPanel: (props: {
1
+ import { type ComponentProps, type PropsWithChildren } from "react";
2
+ import type { Dialog } from "../dialog";
3
+ export interface ScreenPanelProps extends ComponentProps<typeof Dialog> {
3
4
  className?: string;
4
- } & PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
5
+ }
6
+ export declare const ScreenPanel: (props: PropsWithChildren<ScreenPanelProps>) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,9 +1,18 @@
1
1
  "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useRef } from "react";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useRef, } from "react";
4
4
  import { cn } from "../../lib/utils";
5
+ import { MtButton } from "./Button";
5
6
  export const ScreenPanel = (props) => {
6
- const { className, children } = props;
7
+ const { className, children, open, onOpenChange } = props;
7
8
  const scrollRef = useRef(null);
8
- return (_jsx("div", { ref: scrollRef, className: cn("fixed left-0 top-0 z-30 mx-auto max-h-full min-h-full w-full overflow-auto ", "bg-background/95 supports-[backdrop-filter]:bg-background/60 backdrop-blur", className), children: _jsx("div", { className: cn("relative mx-auto p-2 md:p-4 lg:p-6"), children: children }) }));
9
+ if (!open) {
10
+ return null;
11
+ }
12
+ useEffect(() => {
13
+ document.body.style.overflow = open ? "auto" : "hidden";
14
+ }, [open]);
15
+ return (_jsxs("div", { ref: scrollRef, className: cn("fixed left-0 top-0 z-30 mx-auto max-h-full min-h-full w-full overflow-auto ", "bg-background/95 supports-[backdrop-filter]:bg-background/60 backdrop-blur", className), children: [onOpenChange && (_jsx("div", { className: "flex justify-end gap-2", children: _jsx(MtButton, { variant: "ghost", onClick: () => {
16
+ onOpenChange(false);
17
+ }, children: "X" }) })), _jsx("div", { className: cn("relative mx-auto p-2 md:p-4 lg:p-6"), children: children })] }));
9
18
  };
@@ -1 +1,7 @@
1
- export declare const SkeletonLayout: () => import("react/jsx-runtime").JSX.Element;
1
+ import type { PropsWithChildren } from "react";
2
+ export type SkeletonLayoutProps = {
3
+ forceFullScreen?: boolean;
4
+ className?: string;
5
+ text?: string;
6
+ };
7
+ export declare const SkeletonLayout: ({ forceFullScreen, className, text, children, }: PropsWithChildren<SkeletonLayoutProps>) => import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { Skeleton } from "../../skeleton";
4
- export const SkeletonLayout = () => {
5
- return (_jsxs("div", { className: "mx-auto flex h-full min-h-24 w-full flex-col items-center justify-center bg-blue-50 p-8", children: [_jsx(Skeleton, { className: "h-full w-full rounded-md border px-3 py-1 shadow-sm" }), _jsx("div", { className: "w-full flex-1 text-center", children: "loading layout" })] }));
3
+ import { cn } from "../../../lib/utils";
4
+ export const SkeletonLayout = ({ forceFullScreen, className, text, children, }) => {
5
+ return (_jsxs("div", { className: cn("flex flex-col items-center justify-center p-8", forceFullScreen ? "fixed inset-0 z-50" : "min-h-screen", className), children: [_jsx("div", { className: "relative", children: children && _jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: children }) }), text && _jsx("div", { className: "mt-4 text-center text-gray-700", children: text })] }));
6
6
  };
@@ -1,3 +1 @@
1
- import { type PropsWithChildren } from "react";
2
1
  export declare function SkeletonLoading(): import("react/jsx-runtime").JSX.Element;
3
- export declare function SuspenseWithLoading(props: PropsWithChildren): import("react/jsx-runtime").JSX.Element;