mtxuilib 0.1.190 → 0.1.192

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 (77) hide show
  1. package/dist/common/HtmlChangesObserver.d.ts +0 -1
  2. package/dist/common/schema-form/SchemaFormView.d.ts +4 -19
  3. package/dist/common/schema-form/schema-form.z.d.ts +2 -2
  4. package/dist/common/table/cells/ExpenderCell.js +1 -3
  5. package/dist/common/tiptap/TiptapEditor.d.ts +2 -2
  6. package/dist/components/external-link.d.ts +0 -1
  7. package/dist/components/message.d.ts +0 -1
  8. package/dist/form/EditFormToolbar.d.ts +8 -8
  9. package/dist/form/ZodForm.d.ts +0 -1
  10. package/dist/hooks/use-router.d.ts +3 -3
  11. package/dist/hooks/use-scroll-anchor.d.ts +0 -1
  12. package/dist/icons/icons.d.ts +0 -1
  13. package/dist/lib/clientlib.d.ts +0 -1
  14. package/dist/lib/render.d.ts +0 -1
  15. package/dist/lib/utils.d.ts +1 -1
  16. package/dist/misc/ExampleErrorDemo.d.ts +0 -1
  17. package/dist/misc/MtErrorBoundaryV2.stories.d.ts +1 -4
  18. package/dist/mtedtior/LzMtEditor.d.ts +3 -4
  19. package/dist/mtedtior/components/editor-command-item.d.ts +4 -5
  20. package/dist/mtedtior/components/editor-command.d.ts +8 -8
  21. package/dist/mtedtior/components/editor.d.ts +2 -2
  22. package/dist/mtedtior/utils/utils.d.ts +1 -1
  23. package/dist/mtedtior/utils.d.ts +1 -1
  24. package/dist/providers/History.d.ts +0 -1
  25. package/dist/providers/MtAppProvider.d.ts +1 -2
  26. package/dist/types/common.d.ts +0 -1
  27. package/dist/ui/aspect-ratio.d.ts +0 -1
  28. package/dist/ui/breadcrumb.d.ts +1 -1
  29. package/dist/ui/collapsible.d.ts +0 -1
  30. package/dist/ui/command.d.ts +17 -17
  31. package/dist/ui/context-menu.d.ts +3 -3
  32. package/dist/ui/drawer.d.ts +1 -1
  33. package/dist/ui/dropdown-menu.d.ts +3 -3
  34. package/dist/ui/form.d.ts +1 -1
  35. package/dist/ui/menubar.d.ts +3 -3
  36. package/dist/ui/mt/Button.d.ts +0 -1
  37. package/dist/ui/mt/MtForm.d.ts +0 -1
  38. package/dist/ui/mt/Separator.d.ts +0 -1
  39. package/dist/ui/mt/SimpleModel.d.ts +0 -1
  40. package/dist/ui/mt/Tree.d.ts +5 -5
  41. package/dist/ui/mt/headline.d.ts +0 -1
  42. package/dist/ui/mt/inputs/input.d.ts +0 -1
  43. package/dist/ui/mt/modal/MtModal.d.ts +0 -1
  44. package/dist/ui/mt/mt-tree-view/mt-tree-view-api.d.ts +11 -11
  45. package/dist/ui/mt/mt-tree-view/mt-treeview.d.ts +2 -2
  46. package/dist/ui/mt/skeleton/skeleton-card.d.ts +1 -1
  47. package/dist/ui/mt/types.d.ts +0 -1
  48. package/dist/ui/resizable.d.ts +2 -16
  49. package/dist/ui/skeleton.d.ts +0 -1
  50. package/dist/ui/sonner.d.ts +0 -1
  51. package/package.json +1 -1
  52. package/dist/components/auth/LoginDlg.d.ts +0 -0
  53. package/dist/components/auth/LoginDlg.js +0 -1
  54. package/dist/demos/bigcode/BigCode.d.ts +0 -4
  55. package/dist/demos/bigcode/BigCode.js +0 -11
  56. package/dist/demos/condition-type/serialize.d.ts +0 -3
  57. package/dist/demos/condition-type/serialize.js +0 -31
  58. package/dist/demos/lib.d.ts +0 -3
  59. package/dist/demos/lib.js +0 -20
  60. package/dist/demos/scrollarea/LongListDemo.d.ts +0 -1
  61. package/dist/demos/scrollarea/LongListDemo.js +0 -7
  62. package/dist/demos/scrollarea/ScrollAreaDemo.d.ts +0 -1
  63. package/dist/demos/scrollarea/ScrollAreaDemo.js +0 -14
  64. package/dist/demos/suspense-ssr/ExampleOg.d.ts +0 -4
  65. package/dist/demos/suspense-ssr/ExampleOg.js +0 -7
  66. package/dist/demos/suspense-ssr/ExamplePage.d.ts +0 -3
  67. package/dist/demos/suspense-ssr/ExamplePage.js +0 -13
  68. package/dist/demos/suspense-ssr/ExampleProviderProviders.d.ts +0 -4
  69. package/dist/demos/suspense-ssr/ExampleProviderProviders.js +0 -9
  70. package/dist/demos/suspense-ssr/ReadMe.d.ts +0 -1
  71. package/dist/demos/suspense-ssr/ReadMe.js +0 -6
  72. package/dist/demos/suspense-ssr/examplesPostDetail.d.ts +0 -3
  73. package/dist/demos/suspense-ssr/examplesPostDetail.js +0 -20
  74. package/dist/demos/suspense-ssr/examplesPosts.d.ts +0 -1
  75. package/dist/demos/suspense-ssr/examplesPosts.js +0 -17
  76. package/dist/tools/rag/addResoure.d.ts +0 -18
  77. package/dist/tools/rag/addResoure.js +0 -27
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare function HtmlChangesObserver({ children }: React.PropsWithChildren): import("react/jsx-runtime").JSX.Element;
@@ -2,26 +2,11 @@ import type { MaybePromise } from "../../types/common";
2
2
  import type { SchemaForm } from "./schema-form.z";
3
3
  type SchemaFormViewVaranit = "auto" | "modal" | "card";
4
4
  export declare const SchemaFormView: (props: {
5
- formSchema?: {
6
- fields: {
7
- name: string;
8
- type?: string | undefined;
9
- label?: string | undefined;
10
- defaultValue?: any;
11
- placeholder?: string | undefined;
12
- valueType?: "string" | "number" | "email" | "date" | undefined;
13
- description?: string | undefined;
14
- }[];
15
- title?: string | undefined;
16
- description?: string | undefined;
17
- action?: string | undefined;
18
- loadingDetailDataProcedure?: string | undefined;
19
- loadingDetailDataParams?: any;
20
- } | undefined;
5
+ formSchema?: SchemaForm;
21
6
  defaultValues?: any;
22
7
  onSubmit: (values: any) => MaybePromise<void>;
23
- onCancel?: (() => void) | undefined;
24
- isLoading?: boolean | undefined;
25
- variants?: SchemaFormViewVaranit | undefined;
8
+ onCancel?: () => void;
9
+ isLoading?: boolean;
10
+ variants?: SchemaFormViewVaranit;
26
11
  }) => import("react/jsx-runtime").JSX.Element;
27
12
  export {};
@@ -67,8 +67,8 @@ export declare const schemaFormSchema: z.ZodObject<{
67
67
  description?: string | undefined;
68
68
  }[];
69
69
  title?: string | undefined;
70
- description?: string | undefined;
71
70
  action?: string | undefined;
71
+ description?: string | undefined;
72
72
  loadingDetailDataProcedure?: string | undefined;
73
73
  loadingDetailDataParams?: any;
74
74
  }, {
@@ -82,8 +82,8 @@ export declare const schemaFormSchema: z.ZodObject<{
82
82
  description?: string | undefined;
83
83
  }[];
84
84
  title?: string | undefined;
85
- description?: string | undefined;
86
85
  action?: string | undefined;
86
+ description?: string | undefined;
87
87
  loadingDetailDataProcedure?: string | undefined;
88
88
  loadingDetailDataParams?: any;
89
89
  }>;
@@ -3,7 +3,5 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { ChevronRight } from 'lucide-react';
4
4
  import { cn } from "../../../lib/utils";
5
5
  export const ExpenderCell = (info) => {
6
- return info.row.getCanExpand() ? (_jsx("button", { className: "pointer", ...{
7
- onClick: info.row.getToggleExpandedHandler(),
8
- }, children: _jsx(ChevronRight, { className: cn(info.row.getIsExpanded() && "rotate-90") }) })) : ('🔵');
6
+ return info.row.getCanExpand() ? (_jsx("button", { className: "pointer", onClick: info.row.getToggleExpandedHandler(), children: _jsx(ChevronRight, { className: cn(info.row.getIsExpanded() && "rotate-90") }) })) : ('🔵');
9
7
  };
@@ -1,5 +1,5 @@
1
1
  import { type EditorEvents } from "@tiptap/react";
2
2
  export declare const TiptapEditorV1: (props: {
3
- value?: string | undefined;
4
- onUpdate?: ((props: EditorEvents["update"]) => void) | undefined;
3
+ value?: string;
4
+ onUpdate?: (props: EditorEvents["update"]) => void;
5
5
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare function ExternalLink({ href, children, }: {
3
2
  href: string;
4
3
  children: React.ReactNode;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type StreamableValue } from "ai/rsc";
3
2
  export declare function UserMessage({ children }: {
4
3
  children: React.ReactNode;
@@ -1,13 +1,13 @@
1
1
  import type React from "react";
2
2
  import type { AnyZodForm } from "./ZodForm";
3
3
  export declare const EditFormToolbar: React.ForwardRefExoticComponent<{
4
- onCancel?: (() => void) | undefined;
5
- form?: AnyZodForm | undefined;
6
- submitText?: string | undefined;
7
- enableCancelConform?: boolean | undefined;
8
- enableDeleteButton?: boolean | undefined;
9
- onDelete?: (() => void) | undefined;
10
- onSubmit?: ((values: any) => void) | undefined;
4
+ onCancel?: () => void;
5
+ form?: AnyZodForm;
6
+ submitText?: string;
7
+ enableCancelConform?: boolean;
8
+ enableDeleteButton?: boolean;
9
+ onDelete?: () => void;
10
+ onSubmit?: (values: any) => void;
11
11
  } & {
12
- children?: React.ReactNode;
12
+ children?: React.ReactNode | undefined;
13
13
  } & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type FieldValues, type SubmitHandler, type UseFormProps, type UseFormReturn } from "react-hook-form";
3
2
  import { z } from "zod";
4
3
  export type UseZodForm<TInput extends FieldValues> = UseFormReturn<TInput> & {
@@ -1,7 +1,7 @@
1
1
  export declare const useMtRouter: () => {
2
- push: (href: string, options?: import("next/dist/shared/lib/app-router-context.shared-runtime").NavigateOptions | undefined, NProgressOptions?: import("next-nprogress-bar").RouterNProgressOptions | undefined) => void;
3
- replace: (href: string, options?: import("next/dist/shared/lib/app-router-context.shared-runtime").NavigateOptions | undefined, NProgressOptions?: import("next-nprogress-bar").RouterNProgressOptions | undefined) => void;
4
- back: (NProgressOptions?: import("next-nprogress-bar").RouterNProgressOptions | undefined) => void;
2
+ push: (href: string, options?: import("next/dist/shared/lib/app-router-context.shared-runtime").NavigateOptions, NProgressOptions?: import("next-nprogress-bar").RouterNProgressOptions) => void;
3
+ replace: (href: string, options?: import("next/dist/shared/lib/app-router-context.shared-runtime").NavigateOptions, NProgressOptions?: import("next-nprogress-bar").RouterNProgressOptions) => void;
4
+ back: (NProgressOptions?: import("next-nprogress-bar").RouterNProgressOptions) => void;
5
5
  forward(): void;
6
6
  refresh(): void;
7
7
  prefetch(href: string, options?: import("next/dist/shared/lib/app-router-context.shared-runtime").PrefetchOptions | undefined): void;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const useScrollAnchor: () => {
3
2
  messagesRef: import("react").RefObject<HTMLDivElement>;
4
3
  scrollRef: import("react").RefObject<HTMLDivElement>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type IconProps = React.HTMLAttributes<SVGElement>;
3
2
  import { LucideProps } from "lucide-react";
4
3
  import type { LucideIcon } from "lucide-react";
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare function mergeRefs<T>(refs: Array<React.MutableRefObject<T> | React.LegacyRef<T>>): React.RefCallback<T>;
3
2
  export declare function getCookie(name: string): string | undefined;
4
3
  export declare function deleteCookie(name: string): void;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export type Renderable<TProps> = React.ReactNode | React.ComponentType<TProps>;
3
2
  export declare function flexRender<TProps extends object>(Comp: Renderable<TProps>, props: TProps): React.ReactNode | JSX.Element;
4
3
  export declare function isReactComponent<TProps>(component: unknown): component is React.ComponentType<TProps>;
@@ -25,7 +25,7 @@ export declare function humanize(input: string): string;
25
25
  export declare function stringsRemovePrefix(inputString: string, prefix: string): string;
26
26
  export declare function fetcher<JSON>(input: RequestInfo, init?: RequestInit): Promise<JSON>;
27
27
  export declare const formatNumber: (value: number) => string;
28
- export declare const runAsyncFnWithoutBlocking: (fn: (...args: any[]) => any) => void;
28
+ export declare const runAsyncFnWithoutBlocking: (fn: (...args: any) => Promise) => void;
29
29
  export declare const getStringFromBuffer: (buffer: ArrayBuffer) => string;
30
30
  export declare enum ResultCode {
31
31
  InvalidCredentials = "INVALID_CREDENTIALS",
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const ExampleError2: () => import("react/jsx-runtime").JSX.Element;
3
2
  export declare const ExampleError1: () => never;
4
3
  export declare const WiehErrorExample: import("react").ForwardRefExoticComponent<object & import("react").RefAttributes<any>>;
@@ -1,10 +1,7 @@
1
- /// <reference types="react" />
2
1
  import type { StoryObj } from '@storybook/react';
3
2
  declare const meta: {
4
3
  title: string;
5
- component: (props: {
6
- children?: import("react").ReactNode;
7
- }) => import("react/jsx-runtime").JSX.Element;
4
+ component: (props: {} & import("react").PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
8
5
  parameters: {
9
6
  layout: string;
10
7
  };
@@ -1,7 +1,6 @@
1
- /// <reference types="react" />
2
1
  export declare const LzMtEditor: import("react").ComponentType<(import("./MtEditor").MtEditorProps & {
3
- onValueChange?: ((content: any) => void) | undefined;
4
- content?: import("@tiptap/core").JSONContent | null | undefined;
2
+ onValueChange?: (content: any) => void;
3
+ content?: import("@tiptap/core").JSONContent | null;
5
4
  }) | {
6
- content?: string | undefined;
5
+ content?: string;
7
6
  }>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { Editor, Range } from "@tiptap/core";
3
2
  interface EditorCommandItemProps {
4
3
  readonly onCommand: ({ editor, range, }: {
@@ -9,10 +8,10 @@ interface EditorCommandItemProps {
9
8
  export declare const EditorCommandItem: import("react").ForwardRefExoticComponent<EditorCommandItemProps & Omit<Omit<{
10
9
  children?: import("react").ReactNode;
11
10
  } & Omit<import("react").HTMLAttributes<HTMLDivElement>, "disabled" | "value" | "onSelect"> & {
12
- disabled?: boolean | undefined;
13
- onSelect?: ((value: string) => void) | undefined;
14
- value?: string | undefined;
15
- forceMount?: boolean | undefined;
11
+ disabled?: boolean;
12
+ onSelect?: (value: string) => void;
13
+ value?: string;
14
+ forceMount?: boolean;
16
15
  } & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
17
16
  export declare const EditorCommandEmpty: import("react").ForwardRefExoticComponent<Omit<{
18
17
  children?: import("react").ReactNode;
@@ -14,14 +14,14 @@ export declare const EditorCommandOut: FC<EditorCommandOutProps>;
14
14
  export declare const EditorCommand: import("react").ForwardRefExoticComponent<Omit<{
15
15
  children?: import("react").ReactNode;
16
16
  } & import("react").HTMLAttributes<HTMLDivElement> & {
17
- label?: string | undefined;
18
- shouldFilter?: boolean | undefined;
19
- filter?: ((value: string, search: string) => number) | undefined;
20
- defaultValue?: string | undefined;
21
- value?: string | undefined;
22
- onValueChange?: ((value: string) => void) | undefined;
23
- loop?: boolean | undefined;
24
- vimBindings?: boolean | undefined;
17
+ label?: string;
18
+ shouldFilter?: boolean;
19
+ filter?: (value: string, search: string) => number;
20
+ defaultValue?: string;
21
+ value?: string;
22
+ onValueChange?: (value: string) => void;
23
+ loop?: boolean;
24
+ vimBindings?: boolean;
25
25
  } & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
26
26
  export declare const EditorCommandList: import("react").ForwardRefExoticComponent<{
27
27
  children?: import("react").ReactNode;
@@ -15,7 +15,7 @@ export type EditorContentProps = Omit<EditorProviderProps, "content"> & {
15
15
  };
16
16
  export declare const EditorContent: import("react").ForwardRefExoticComponent<Omit<EditorProviderProps, "content"> & {
17
17
  readonly children?: ReactNode;
18
- readonly className?: string | undefined;
19
- readonly initialContent?: JSONContent | undefined;
18
+ readonly className?: string;
19
+ readonly initialContent?: JSONContent;
20
20
  } & import("react").RefAttributes<HTMLDivElement>>;
21
21
  export {};
@@ -5,5 +5,5 @@ export declare function isValidUrl(url: string): boolean;
5
5
  export declare function getUrlFromString(str: string): string | null | undefined;
6
6
  export declare const getPrevText: (editor: Editor, { chars, offset, }: {
7
7
  chars: number;
8
- offset?: number | undefined;
8
+ offset?: number;
9
9
  }) => any;
@@ -5,5 +5,5 @@ export declare function isValidUrl(url: string): boolean;
5
5
  export declare function getUrlFromString(str: string): string | null | undefined;
6
6
  export declare const getPrevText: (editor: Editor, { chars, offset, }: {
7
7
  chars: number;
8
- offset?: number | undefined;
8
+ offset?: number;
9
9
  }) => any;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type StateCreator } from "zustand/vanilla";
3
2
  export type HisSliceProps = {};
4
3
  export interface HisSliceState extends HisSliceProps {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type StateCreator } from "zustand";
3
2
  export interface AppSliceProps {
4
3
  debug?: boolean;
@@ -30,7 +29,7 @@ export declare const gomtmContext: import("react").Context<(Omit<Omit<Omit<impor
30
29
  [k: string]: unknown;
31
30
  }>>) => void;
32
31
  clearStorage: () => void;
33
- rehydrate: () => void | Promise<void>;
32
+ rehydrate: () => Promise<void> | void;
34
33
  hasHydrated: () => boolean;
35
34
  onHydrate: (fn: (state: AppSliceState) => void) => () => void;
36
35
  onFinishHydration: (fn: (state: AppSliceState) => void) => () => void;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { DialogProps } from "@radix-ui/react-dialog";
3
2
  export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
4
3
  }
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio";
3
2
  declare const AspectRatio: import("react").ForwardRefExoticComponent<AspectRatioPrimitive.AspectRatioProps & import("react").RefAttributes<HTMLDivElement>>;
4
3
  export { AspectRatio };
@@ -5,7 +5,7 @@ declare const Breadcrumb: React.ForwardRefExoticComponent<Omit<React.DetailedHTM
5
5
  declare const BreadcrumbList: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, "ref"> & React.RefAttributes<HTMLOListElement>>;
6
6
  declare const BreadcrumbItem: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & React.RefAttributes<HTMLLIElement>>;
7
7
  declare const BreadcrumbLink: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & {
8
- asChild?: boolean | undefined;
8
+ asChild?: boolean;
9
9
  } & React.RefAttributes<HTMLAnchorElement>>;
10
10
  declare const BreadcrumbPage: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
11
11
  declare const BreadcrumbSeparator: {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
3
2
  declare const Collapsible: import("react").ForwardRefExoticComponent<CollapsiblePrimitive.CollapsibleProps & import("react").RefAttributes<HTMLDivElement>>;
4
3
  declare const CollapsibleTrigger: import("react").ForwardRefExoticComponent<CollapsiblePrimitive.CollapsibleTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
@@ -3,21 +3,21 @@ import * as React from "react";
3
3
  declare const Command: React.ForwardRefExoticComponent<Omit<{
4
4
  children?: React.ReactNode;
5
5
  } & React.HTMLAttributes<HTMLDivElement> & {
6
- label?: string | undefined;
7
- shouldFilter?: boolean | undefined;
8
- filter?: ((value: string, search: string) => number) | undefined;
9
- defaultValue?: string | undefined;
10
- value?: string | undefined;
11
- onValueChange?: ((value: string) => void) | undefined;
12
- loop?: boolean | undefined;
13
- vimBindings?: boolean | undefined;
6
+ label?: string;
7
+ shouldFilter?: boolean;
8
+ filter?: (value: string, search: string) => number;
9
+ defaultValue?: string;
10
+ value?: string;
11
+ onValueChange?: (value: string) => void;
12
+ loop?: boolean;
13
+ vimBindings?: boolean;
14
14
  } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
15
15
  interface CommandDialogProps extends DialogProps {
16
16
  }
17
17
  declare const CommandDialog: ({ children, ...props }: CommandDialogProps) => import("react/jsx-runtime").JSX.Element;
18
18
  declare const CommandInput: React.ForwardRefExoticComponent<Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "onChange"> & {
19
- value?: string | undefined;
20
- onValueChange?: ((search: string) => void) | undefined;
19
+ value?: string;
20
+ onValueChange?: (search: string) => void;
21
21
  } & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
22
22
  declare const CommandList: React.ForwardRefExoticComponent<Omit<{
23
23
  children?: React.ReactNode;
@@ -29,19 +29,19 @@ declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
29
29
  children?: React.ReactNode;
30
30
  } & Omit<React.HTMLAttributes<HTMLDivElement>, "value" | "heading"> & {
31
31
  heading?: React.ReactNode;
32
- value?: string | undefined;
33
- forceMount?: boolean | undefined;
32
+ value?: string;
33
+ forceMount?: boolean;
34
34
  } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
35
35
  declare const CommandSeparator: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLDivElement> & {
36
- alwaysRender?: boolean | undefined;
36
+ alwaysRender?: boolean;
37
37
  } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
38
38
  declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
39
39
  children?: React.ReactNode;
40
40
  } & Omit<React.HTMLAttributes<HTMLDivElement>, "disabled" | "value" | "onSelect"> & {
41
- disabled?: boolean | undefined;
42
- onSelect?: ((value: string) => void) | undefined;
43
- value?: string | undefined;
44
- forceMount?: boolean | undefined;
41
+ disabled?: boolean;
42
+ onSelect?: (value: string) => void;
43
+ value?: string;
44
+ forceMount?: boolean;
45
45
  } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
46
46
  declare const CommandShortcut: {
47
47
  ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>): import("react/jsx-runtime").JSX.Element;
@@ -7,17 +7,17 @@ declare const ContextMenuPortal: React.FC<ContextMenuPrimitive.ContextMenuPortal
7
7
  declare const ContextMenuSub: React.FC<ContextMenuPrimitive.ContextMenuSubProps>;
8
8
  declare const ContextMenuRadioGroup: React.ForwardRefExoticComponent<ContextMenuPrimitive.ContextMenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
9
9
  declare const ContextMenuSubTrigger: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuSubTriggerProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
10
- inset?: boolean | undefined;
10
+ inset?: boolean;
11
11
  } & React.RefAttributes<HTMLDivElement>>;
12
12
  declare const ContextMenuSubContent: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuSubContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
13
13
  declare const ContextMenuContent: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
14
14
  declare const ContextMenuItem: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
15
- inset?: boolean | undefined;
15
+ inset?: boolean;
16
16
  } & React.RefAttributes<HTMLDivElement>>;
17
17
  declare const ContextMenuCheckboxItem: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuCheckboxItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
18
18
  declare const ContextMenuRadioItem: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuRadioItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
19
19
  declare const ContextMenuLabel: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuLabelProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
20
- inset?: boolean | undefined;
20
+ inset?: boolean;
21
21
  } & React.RefAttributes<HTMLDivElement>>;
22
22
  declare const ContextMenuSeparator: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
23
23
  declare const ContextMenuShortcut: {
@@ -9,7 +9,7 @@ declare const DrawerPortal: React.FC<import("@radix-ui/react-dialog").DialogPort
9
9
  declare const DrawerClose: React.ForwardRefExoticComponent<import("@radix-ui/react-dialog").DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
10
10
  declare const DrawerOverlay: React.ForwardRefExoticComponent<Omit<Omit<import("@radix-ui/react-dialog").DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
11
11
  declare const DrawerContent: React.ForwardRefExoticComponent<Omit<Omit<import("@radix-ui/react-dialog").DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
12
- onAnimationEnd?: ((open: boolean) => void) | undefined;
12
+ onAnimationEnd?: (open: boolean) => void;
13
13
  } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
14
14
  declare const DrawerHeader: {
15
15
  ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
@@ -7,17 +7,17 @@ declare const DropdownMenuPortal: React.FC<DropdownMenuPrimitive.DropdownMenuPor
7
7
  declare const DropdownMenuSub: React.FC<DropdownMenuPrimitive.DropdownMenuSubProps>;
8
8
  declare const DropdownMenuRadioGroup: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
9
9
  declare const DropdownMenuSubTrigger: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSubTriggerProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
10
- inset?: boolean | undefined;
10
+ inset?: boolean;
11
11
  } & React.RefAttributes<HTMLDivElement>>;
12
12
  declare const DropdownMenuSubContent: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSubContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
13
13
  declare const DropdownMenuContent: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
14
14
  declare const DropdownMenuItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
15
- inset?: boolean | undefined;
15
+ inset?: boolean;
16
16
  } & React.RefAttributes<HTMLDivElement>>;
17
17
  declare const DropdownMenuCheckboxItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuCheckboxItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
18
18
  declare const DropdownMenuRadioItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuRadioItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
19
19
  declare const DropdownMenuLabel: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuLabelProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
20
- inset?: boolean | undefined;
20
+ inset?: boolean;
21
21
  } & React.RefAttributes<HTMLDivElement>>;
22
22
  declare const DropdownMenuSeparator: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
23
23
  declare const DropdownMenuShortcut: {
package/dist/ui/form.d.ts CHANGED
@@ -8,7 +8,7 @@ declare const useFormField: () => {
8
8
  isDirty: boolean;
9
9
  isTouched: boolean;
10
10
  isValidating: boolean;
11
- error?: import("react-hook-form").FieldError | undefined;
11
+ error?: import("react-hook-form").FieldError;
12
12
  id: string;
13
13
  name: string;
14
14
  formItemId: string;
@@ -13,17 +13,17 @@ declare const MenubarRadioGroup: React.ForwardRefExoticComponent<MenubarPrimitiv
13
13
  declare const Menubar: React.ForwardRefExoticComponent<Omit<MenubarPrimitive.MenubarProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
14
14
  declare const MenubarTrigger: React.ForwardRefExoticComponent<Omit<MenubarPrimitive.MenubarTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
15
15
  declare const MenubarSubTrigger: React.ForwardRefExoticComponent<Omit<MenubarPrimitive.MenubarSubTriggerProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
16
- inset?: boolean | undefined;
16
+ inset?: boolean;
17
17
  } & React.RefAttributes<HTMLDivElement>>;
18
18
  declare const MenubarSubContent: React.ForwardRefExoticComponent<Omit<MenubarPrimitive.MenubarSubContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
19
19
  declare const MenubarContent: React.ForwardRefExoticComponent<Omit<MenubarPrimitive.MenubarContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
20
20
  declare const MenubarItem: React.ForwardRefExoticComponent<Omit<MenubarPrimitive.MenubarItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
21
- inset?: boolean | undefined;
21
+ inset?: boolean;
22
22
  } & React.RefAttributes<HTMLDivElement>>;
23
23
  declare const MenubarCheckboxItem: React.ForwardRefExoticComponent<Omit<MenubarPrimitive.MenubarCheckboxItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
24
24
  declare const MenubarRadioItem: React.ForwardRefExoticComponent<Omit<MenubarPrimitive.MenubarRadioItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
25
25
  declare const MenubarLabel: React.ForwardRefExoticComponent<Omit<MenubarPrimitive.MenubarLabelProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
26
- inset?: boolean | undefined;
26
+ inset?: boolean;
27
27
  } & React.RefAttributes<HTMLDivElement>>;
28
28
  declare const MenubarSeparator: React.ForwardRefExoticComponent<Omit<MenubarPrimitive.MenubarSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
29
29
  declare const MenubarShortcut: {
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const MtButton: import("react").ForwardRefExoticComponent<import("../button").ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const MtForm: <TFieldValues extends import("react-hook-form").FieldValues, TContext = any, TTransformedValues extends import("react-hook-form").FieldValues | undefined = undefined>(props: import("react-hook-form").FormProviderProps<TFieldValues, TContext, TTransformedValues>) => import("react").JSX.Element;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const MtSeparator: import("react").ForwardRefExoticComponent<Omit<import("@radix-ui/react-separator").SeparatorProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export default function SimpleModel({ children }: {
3
2
  children: React.ReactNode;
4
3
  }): import("react/jsx-runtime").JSX.Element;
@@ -5,10 +5,10 @@ interface TreeDataItemType extends TreeItemBase {
5
5
  }
6
6
  export declare const Tree: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
7
7
  data: TreeDataItemType;
8
- initialSlelectedItemId?: string | undefined;
9
- onSelectChange?: ((item: TreeDataItemType) => void) | undefined;
10
- expandAll?: boolean | undefined;
11
- folderIcon?: LucideIcon | undefined;
12
- itemIcon?: LucideIcon | undefined;
8
+ initialSlelectedItemId?: string;
9
+ onSelectChange?: (item: TreeDataItemType) => void;
10
+ expandAll?: boolean;
11
+ folderIcon?: LucideIcon;
12
+ itemIcon?: LucideIcon;
13
13
  } & React.RefAttributes<HTMLDivElement>>;
14
14
  export {};
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  interface HeadlineProps {
3
2
  heading: string;
4
3
  text?: string;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const MtInput: import("react").ForwardRefExoticComponent<import("../../input").InputProps & import("react").RefAttributes<HTMLInputElement>>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type Renderable } from "mtxuilib/lib/render";
3
2
  import { type StateCreator } from "zustand/vanilla";
4
3
  export type ModalSliceProps = {
@@ -10,30 +10,30 @@ type TreeViewElement = {
10
10
  interface TreeViewComponentProps extends React.HTMLAttributes<HTMLDivElement> {
11
11
  }
12
12
  declare const Tree: React.ForwardRefExoticComponent<{
13
- initialSelectedId?: string | undefined;
14
- indicator?: boolean | undefined;
15
- elements?: TreeViewElement[] | undefined;
16
- initialExpendedItems?: string[] | undefined;
13
+ initialSelectedId?: string;
14
+ indicator?: boolean;
15
+ elements?: TreeViewElement[];
16
+ initialExpendedItems?: string[];
17
17
  openIcon?: React.ReactNode;
18
18
  closeIcon?: React.ReactNode;
19
19
  } & TreeViewComponentProps & React.RefAttributes<HTMLDivElement>>;
20
20
  interface FolderComponentProps extends React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item> {
21
21
  }
22
22
  declare const Folder: React.ForwardRefExoticComponent<{
23
- expendedItems?: string[] | undefined;
23
+ expendedItems?: string[];
24
24
  element: ReactNode;
25
- isSelectable?: boolean | undefined;
26
- isSelect?: boolean | undefined;
25
+ isSelectable?: boolean;
26
+ isSelect?: boolean;
27
27
  } & FolderComponentProps & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
28
28
  declare const File: React.ForwardRefExoticComponent<{
29
29
  value: string;
30
- handleSelect?: ((id: string) => void) | undefined;
31
- isSelectable?: boolean | undefined;
32
- isSelect?: boolean | undefined;
30
+ handleSelect?: (id: string) => void;
31
+ isSelectable?: boolean;
32
+ isSelect?: boolean;
33
33
  fileIcon?: React.ReactNode;
34
34
  } & Omit<AccordionPrimitive.AccordionTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
35
35
  declare const CollapseButton: React.ForwardRefExoticComponent<{
36
36
  elements: TreeViewElement[];
37
- expandAll?: boolean | undefined;
37
+ expandAll?: boolean;
38
38
  } & React.HTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
39
39
  export { Tree, Folder, File, CollapseButton, type TreeViewElement };
@@ -18,7 +18,7 @@ export declare const TreeView: {
18
18
  displayName: string;
19
19
  };
20
20
  export declare const TreeItem: React.ForwardRefExoticComponent<{
21
- elements?: TreeViewElement[] | undefined;
22
- indicator?: boolean | undefined;
21
+ elements?: TreeViewElement[];
22
+ indicator?: boolean;
23
23
  } & React.HTMLAttributes<HTMLUListElement> & React.RefAttributes<HTMLUListElement>>;
24
24
  export {};
@@ -1,3 +1,3 @@
1
1
  export declare const SkeletonCard: ({ isLoading }: {
2
- isLoading?: boolean | undefined;
2
+ isLoading?: boolean;
3
3
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
3
2
  label?: string;
4
3
  name: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import * as ResizablePrimitive from "react-resizable-panels";
3
2
  declare const ResizablePanelGroup: ({ className, ...props }: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => import("react/jsx-runtime").JSX.Element;
4
3
  declare const ResizablePanel: import("react").ForwardRefExoticComponent<Omit<import("react").HTMLAttributes<keyof HTMLElementTagNameMap>, "id" | "onResize"> & {
@@ -18,20 +17,7 @@ declare const ResizablePanel: import("react").ForwardRefExoticComponent<Omit<imp
18
17
  } & {
19
18
  children?: import("react").ReactNode;
20
19
  } & import("react").RefAttributes<ResizablePrimitive.ImperativePanelHandle>>;
21
- declare const ResizableHandle: ({ withHandle, className, ...props }: Omit<import("react").HTMLAttributes<keyof HTMLElementTagNameMap>, "id" | "onFocus" | "onBlur"> & {
22
- className?: string | undefined;
23
- disabled?: boolean | undefined;
24
- hitAreaMargins?: ResizablePrimitive.PointerHitAreaMargins | undefined;
25
- id?: string | null | undefined;
26
- onBlur?: (() => void) | undefined;
27
- onDragging?: ResizablePrimitive.PanelResizeHandleOnDragging | undefined;
28
- onFocus?: (() => void) | undefined;
29
- style?: import("react").CSSProperties | undefined;
30
- tabIndex?: number | undefined;
31
- tagName?: keyof HTMLElementTagNameMap | undefined;
32
- } & {
33
- children?: import("react").ReactNode;
34
- } & {
35
- withHandle?: boolean | undefined;
20
+ declare const ResizableHandle: ({ withHandle, className, ...props }: React.ComponentProps<typeof ResizablePrimitive.PanelResizeHandle> & {
21
+ withHandle?: boolean;
36
22
  }) => import("react/jsx-runtime").JSX.Element;
37
23
  export { ResizableHandle, ResizablePanel, ResizablePanelGroup };
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  declare function Skeleton({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
3
2
  export { Skeleton };
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { Toaster as Sonner } from "sonner";
3
2
  type ToasterProps = React.ComponentProps<typeof Sonner>;
4
3
  declare const Toaster: ({ ...props }: ToasterProps) => import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mtxuilib",
3
3
  "private": false,
4
- "version": "0.1.190",
4
+ "version": "0.1.192",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
File without changes
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,4 +0,0 @@
1
- import { ReactNode } from 'react';
2
- export declare function BigCode({ children }: {
3
- children?: ReactNode;
4
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,11 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import dynamic from 'next/dynamic';
4
- import { MtVideoPlayer } from '../../video-player/mt-video-player';
5
- const LzMonacoEditor = dynamic(() => import("@monaco-editor/react").then(x => x), {
6
- ssr: false
7
- });
8
- console.log("<BigCode/> loaded");
9
- export function BigCode({ children }) {
10
- return (_jsxs("div", { className: "bg-red-600 p-2", children: [_jsx(MtVideoPlayer, { videoSrc: "4444222" }), _jsx(LzMonacoEditor, { height: "30vh", defaultLanguage: "javascript", defaultValue: "// some comment" }), children] }));
11
- }
@@ -1,3 +0,0 @@
1
- export default function Page(props: {
2
- params: any;
3
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,31 +0,0 @@
1
- 'use client';
2
- import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
3
- function serialize(obj, format) {
4
- if (format.type === "json") {
5
- const jsonString = JSON.stringify(obj);
6
- return jsonString;
7
- }
8
- if (format.type === "binary") {
9
- const textEncoder = new TextEncoder();
10
- const uint8array = textEncoder.encode(JSON.stringify(obj));
11
- return uint8array;
12
- }
13
- if (format.type === "stream") {
14
- const textEncoder = new TextEncoder();
15
- const uint8array = textEncoder.encode(JSON.stringify(obj));
16
- const stream = new ReadableStream({
17
- start(controller) {
18
- controller.enqueue(uint8array);
19
- controller.close();
20
- },
21
- });
22
- return stream;
23
- }
24
- throw new Error("Invalid format");
25
- }
26
- const s1 = serialize({ a: 1, b: 2 }, { type: "json" });
27
- const s2 = serialize({ a: 1, b: 2 }, { type: "binary" });
28
- const s3 = serialize({ a: 1, b: 2 }, { type: "stream" });
29
- export default function Page(props) {
30
- return (_jsx(_Fragment, { children: "\u6F14\u793A\u4E86\u6761\u4EF6\u7C7B\u578B" }));
31
- }
@@ -1,3 +0,0 @@
1
- export declare const fakeFetchUser: (userId: string, noError?: boolean) => Promise<unknown>;
2
- export declare const fetchPosts: () => any;
3
- export declare const fetchPost: (postId: string) => any;
package/dist/demos/lib.js DELETED
@@ -1,20 +0,0 @@
1
- export const fakeFetchUser = (userId, noError = false) => {
2
- const ramdonNum = Math.random();
3
- if (!noError && ramdonNum > 0.5) {
4
- throw new Error("随机出错。。。" + ramdonNum);
5
- }
6
- else {
7
- console.log("ramdonNum", ramdonNum);
8
- return fetch(`https://jsonplaceholder.typicode.com/users/${userId}?_delay=2000`, {
9
- next: {
10
- revalidate: 0
11
- }
12
- }).then(x => x.json());
13
- }
14
- };
15
- export const fetchPosts = () => {
16
- return fetch(`https://jsonplaceholder.typicode.com/posts`, {}).then(x => x.json());
17
- };
18
- export const fetchPost = (postId) => {
19
- return fetch(`https://jsonplaceholder.typicode.com/posts/${postId}`, {}).then(x => x.json());
20
- };
@@ -1 +0,0 @@
1
- export declare const LongListExample: () => import("react/jsx-runtime").JSX.Element;
@@ -1,7 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- export const LongListExample = () => {
4
- return _jsx("div", { className: "container mx-auto flex flex-col", children: Array.from({ length: 50 }).map((_, i, a) => `v1.2.0-beta.${a.length - i}`).map((i) => {
5
- return _jsx("div", { className: "bg-blue-300 p-2", children: i }, i);
6
- }) });
7
- };
@@ -1 +0,0 @@
1
- export declare function ScrollAreaDemo(): import("react/jsx-runtime").JSX.Element;
@@ -1,14 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import useResizeObserver from 'use-resize-observer';
4
- import { cn } from '../../lib/utils';
5
- import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from '../../ui/resizable';
6
- import { ScrollArea } from '../../ui/scroll-area';
7
- import { Separator } from '../../ui/separator';
8
- const tags = Array.from({ length: 50 }).map((_, i, a) => `v1.2.0-beta.${a.length - i}`);
9
- export function ScrollAreaDemo() {
10
- const { ref: refRoot, width, height } = useResizeObserver();
11
- return (_jsx("div", { className: 'h-96 bg-red-200 p-2', children: _jsxs(ResizablePanelGroup, { direction: "horizontal", className: "h-[600px] max-h-[920px] w-full items-stretch rounded-lg border bg-yellow-200 p-2", onLayout: (sizes) => {
12
- console.log("size", sizes);
13
- }, children: [_jsx(ResizablePanel, { defaultSize: 50, className: ' overflow-scroll bg-blue-500 p-2', children: "one" }), _jsx(ResizableHandle, { withHandle: true }), _jsx(ResizablePanel, { defaultSize: 50, children: _jsxs(ResizablePanelGroup, { direction: "vertical", children: [_jsx(ResizablePanel, { defaultSize: 25, className: 'bg-red-300 p-2', children: _jsxs("span", { className: "font-semibold", children: ["width: ", width, " height:", height] }) }), _jsx(ResizableHandle, { withHandle: true }), _jsx(ResizablePanel, { defaultSize: 75, className: 'bg-blue-500 p-2 ', onResize: (e) => console.log(e), children: _jsx("div", { ref: refRoot, className: cn("mx-auto flex h-full items-center justify-center overflow-hidden bg-red-400"), children: _jsx(ScrollArea, { style: { width: 200, height: height }, className: "rounded-md border", children: _jsxs("div", { className: "p-0", children: [_jsx("h4", { className: "mb-0 text-sm font-medium leading-none", children: "Tags" }), tags.map((tag) => (_jsxs(_Fragment, { children: [_jsx("div", { className: "text-sm", children: tag }, tag), _jsx(Separator, { className: "my-2" })] })))] }) }) }) })] }) })] }) }));
14
- }
@@ -1,4 +0,0 @@
1
- import { ReactNode } from 'react';
2
- export declare function ExampleOg({ children }: {
3
- children?: ReactNode;
4
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { Card, CardContent, CardTitle } from '../../ui/card';
4
- import { MtImage } from '../../common/MtImage';
5
- export function ExampleOg({ children }) {
6
- return (_jsxs(Card, { children: [_jsx(CardTitle, { children: "\u56FE\u7247\u76F8\u5173" }), _jsxs(CardContent, { children: [_jsx("h2", { children: "og" }), _jsx(MtImage, { src: "/api.v1/og", alt: "og-example", width: 100, height: 100 }), _jsx("h2", { children: "\u9ED8\u8BA4\u4E0D\u5B58\u5728\u56FE\u7247" }), _jsx(MtImage, { src: "/any-image-not-exists.jpg", alt: "og-example", width: 100, height: 100 }), _jsx("h2", { children: "\u5916\u7AD9\u56FE\u7247" }), _jsx(MtImage, { src: "https://th.bing.com/th/id/R.0f70474ecd1ee9757981b82381476ec3?rik=FOxDfiUEZWxcfA&pid=ImgRaw&r=0", alt: "og-example", width: 100, height: 100 })] })] }));
7
- }
@@ -1,3 +0,0 @@
1
- import type { PropsWithChildren } from "react";
2
- export declare const ExamplePage: () => import("react/jsx-runtime").JSX.Element;
3
- export declare function RqErrorBoundary(props: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
@@ -1,13 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { Card, CardContent, CardTitle } from "../../ui/card";
4
- import { QueryErrorResetBoundary } from "@tanstack/react-query";
5
- import { ErrorBoundary } from "react-error-boundary";
6
- import { MtButton } from "../../ui/mt/Button";
7
- export const ExamplePage = () => {
8
- return (_jsxs(_Fragment, { children: [_jsx("h3", { children: "with AutoSuspense" }), _jsxs(Card, { children: [_jsx(CardTitle, { children: "lazy example" }), _jsx(CardContent, {})] }), _jsxs(Card, { children: [_jsx(CardTitle, { children: "lazy example" }), _jsx(CardContent, {})] }), _jsx(Card, { children: _jsx(CardContent, {}) })] }));
9
- };
10
- export function RqErrorBoundary(props) {
11
- const { children } = props;
12
- return (_jsx(_Fragment, { children: _jsx(QueryErrorResetBoundary, { children: ({ reset }) => (_jsx(ErrorBoundary, { onReset: reset, fallbackRender: ({ resetErrorBoundary, error }) => (_jsxs("div", { className: "green-red-100 prose dark:prose-invert container m-1 mx-auto border p-1 text-lg", children: [_jsxs("div", { className: "flex gap-2", children: [_jsx("h1", { className: "pb-1 text-center", children: " error" }), _jsx(MtButton, { onClick: () => resetErrorBoundary(), variant: "ghost", children: "Retry" })] }), _jsx("pre", { children: error?.toString() }), _jsx("div", { className: "flex items-center justify-center p-1" })] })), children: children })) }) }));
13
- }
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- export declare function ExampleProviderProviders({ children }: {
3
- children: React.ReactNode;
4
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,9 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
4
- import { ReactQueryStreamedHydration } from "@tanstack/react-query-next-experimental";
5
- import { useState } from "react";
6
- export function ExampleProviderProviders({ children }) {
7
- const [queryClient] = useState(() => new QueryClient());
8
- return (_jsx(QueryClientProvider, { client: queryClient, children: _jsx(ReactQueryStreamedHydration, { children: children }) }));
9
- }
@@ -1 +0,0 @@
1
- export declare const ReadMe: () => import("react/jsx-runtime").JSX.Element;
@@ -1,6 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { MtLink } from "../../common/mtlink";
4
- export const ReadMe = () => {
5
- return (_jsx(_Fragment, { children: _jsxs("div", { className: " p-2", children: [_jsx("h1", { children: "\u4F7F\u7528 suspense \u7684\u65B9\u5F0F \u5B9E\u73B0ssrs" }), _jsx("p", { children: "\u53EA\u8981 suspense \u5185\u90E8\u4E0D\u51FA\u73B0 throw error \u7684\u60C5\u51B5\uFF0C ReactQueryStreamedHydration + suspenseQuery \u7684\u65B9\u5F0F\u5B9E\u73B0SSR\uFF0C\u662F\u975E\u5E38\u597D\u7684\u65B9\u5F0F\u3002 \u53EA\u8981\u786E\u4FDD fetch \u8BF7\u6C42\u5916\u90E8\u6570\u636E\u65F6\uFF0C\u786E\u4FDDcatch\u4E86\u6240\u6709\u5F02\u5E38\uFF0C \u4F7F\u7528 custom error code\u5305\u88C5\u3002 \u6E32\u67D3\u65F6\uFF0C\u5224\u65AD code \uFF0C\u5982\u679C\u662F\u8BF7\u6C42\u6570\u636E\u5931\u8D25\uFF0C\u5219\u663E\u793A\u81EA\u5B9A\u4E49\u7684retry\u7EC4\u4EF6\uFF0C\u5373\u53EF\u3002" }), _jsx("h2", { children: "\u6CE8\u610F" }), _jsx("ol", { children: _jsx("li", { children: "\u4E1A\u52A1\u7EC4\u4EF6\u4E0D\u8981\u76F4\u63A5\u4F7F\u7528 \u4E0D\u8981QueryErrorResetBoundary \u548C ErrorBoundary\uFF0C \u8FD9\u4E24\u4E2A\u7EC4\u4EF6\u5E94\u8BE5\u4F5C\u4E3A\u515C\u5E95\u5904\u7406\u3002" }) }), _jsx("h2", { children: "\u57511" }), _jsx("ol", { children: _jsxs("li", { children: ["\u5F53\u51FA\u73B0\u524D\u7AEF\u4E0D\u505C\u7684 fetch\u8BF7\u6C42\u65F6\uFF0C \u5148\u786E\u4FDD console \u4E2D\u6CA1\u6709\u8F93\u51FA\u4EFB\u4F55\u9519\u8BEF\u4FE1\u606F\uFF0C\u7279\u522B\u662F hydrate error\u76F8\u5173\u7684\uFF0C \u7279\u522B\u662F\u4E00\u4E9B\u4E0D\u8D77\u773C\u7684\u95EE\u9898", _jsx("div", { children: "\u4F8B\u5982\uFF1A\u201Ch3 cannot appear as a descendant of p\u201D \u4E4B\u7C7B\u7684 html\u8BED\u6CD5\u9519\u8BEF\uFF0C\u90FD\u6709\u53EF\u80FD\u5BFC\u81F4 hydrate \u51FA\u73B0\u95EE\u9898\u3002" }), _jsx("p", { children: "\u7279\u522B\u662F\uFF1A \u201DHydration failed because the initial UI does not match what was rendered on the server.\u201C" }), _jsx("p", { children: "\u539F\u56E0\u5206\u6790\uFF1A query.isRefetching \u8FD9\u4E2A\u5B57\u6BB5\u9700\u8981\u6CE8\u610F\uFF0C\u7ECF\u5E38\u4F1A\u5BFC\u81F4 hydrate\u5931\u8D25\u3002\u539F\u56E0\u5728\u4E8E\u5982\u679C\u662F\u5904\u4E8E\u540E\u7AEF \u6570\u636E\u8F6C\u5230\u524D\u7AEF\u5F0F\uFF0C\u72B6\u6001\u5F80\u5F80\u4F1A\u53D8\u5316\u3002 \u800C\uFF0C \u5982\u679Chtml \u5143\u7D20\u6E32\u67D3\u4F9D\u8D56\u4E86\u8FD9\u4E2A\u503C\uFF0C\u5219\u5BFC\u81F4\u524D\u540E\u7AEF\u7684 html \u4E0D\u4E00\u81F4\uFF0C\u81F4\u4F7F hydrate \u5931\u8D25\u3002" })] }) }), _jsx("h2", { children: "\u57512" }), _jsx("ol", { children: _jsx("li", { children: "\u7531\u4E8E\u5B58\u5728 hydrate \u7684\u8FC7\u7A0B\uFF0C\u5FC5\u987B\u4FDD\u8BC1\u4F20\u9012\u7684\u5BF9\u8C61\u662F PlainObject\u3002" }) }), _jsx("h3", { children: "\u53C2\u8003" }), _jsx("ul", { children: _jsx("li", { children: _jsx(MtLink, { href: "https://codesandbox.io/p/devbox/react-query-next-streamed-hydration-broken-example-forked-try2hl", children: "codesandbox" }) }) })] }) }));
6
- };
@@ -1,3 +0,0 @@
1
- export declare const ExamplePostDetail: (props: {
2
- postId: string;
3
- }) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,20 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useSuspenseQuery } from "@tanstack/react-query";
4
- import { fetchPost } from "../lib";
5
- export const ExamplePostDetail = (props) => {
6
- const { postId } = props;
7
- const post = useSuspenseQuery({
8
- queryKey: ["examples", "post", postId],
9
- queryFn: () => {
10
- return fetchPost(postId);
11
- }
12
- });
13
- if (!post.data) {
14
- return null;
15
- }
16
- if (post.error) {
17
- return _jsx("div", { children: "post error" });
18
- }
19
- return (_jsx("div", { className: "prose dark:prose-invert m-4 border p-2 shadow-md", children: _jsxs("div", { children: [_jsx("h2", { children: post.data.title }), _jsx("article", { children: post.data.body })] }) }));
20
- };
@@ -1 +0,0 @@
1
- export declare const ExamplePosts: () => import("react/jsx-runtime").JSX.Element;
@@ -1,17 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useSuspenseQuery } from "@tanstack/react-query";
4
- import Link from "next/link";
5
- import { MtLink } from "../../common/mtlink";
6
- import { fetchPosts } from "../lib";
7
- export const ExamplePosts = () => {
8
- const postList = useSuspenseQuery({
9
- queryKey: ["examples", "posts"],
10
- queryFn: () => {
11
- return fetchPosts();
12
- }
13
- });
14
- return (_jsxs(_Fragment, { children: [_jsx("h2", { children: " examples posts " }), _jsx(MtLink, { variant: "ghost", href: "/demo/hydrate-demo", children: "to post list" }), _jsx("div", { children: postList?.data?.map((post) => {
15
- return _jsx("li", { children: _jsx(Link, { href: `/demo/hydrate-demo/${post.id}`, children: post.title }) }, post.id);
16
- }) })] }));
17
- };
@@ -1,18 +0,0 @@
1
- import { z } from "zod";
2
- export declare const addResourceTool: {
3
- addResource: import("ai").CoreTool<z.ZodObject<{
4
- content: z.ZodString;
5
- }, "strip", z.ZodTypeAny, {
6
- content: string;
7
- }, {
8
- content: string;
9
- }>, string | {
10
- message: string;
11
- }> & {
12
- execute: (args: {
13
- content: string;
14
- }) => PromiseLike<string | {
15
- message: string;
16
- }>;
17
- };
18
- };
@@ -1,27 +0,0 @@
1
- import { tool } from "ai";
2
- import { createResource } from "mtxlib/lib/ai/actions/resources";
3
- import { z } from "zod";
4
- export const addResourceTool = {
5
- addResource: tool({
6
- description: `add a resource to your knowledge base.
7
- If the user provides a random piece of knowledge unprompted, use this tool without asking for confirmation.`,
8
- parameters: z.object({
9
- content: z
10
- .string()
11
- .describe("the content or resource to add to the knowledge base"),
12
- }),
13
- execute: async ({ content }) => {
14
- try {
15
- console.log("添加 content 到 resource 表");
16
- const result = await createResource({ content });
17
- return result;
18
- }
19
- catch (e) {
20
- console.log("调用工具失败 findRelevantContent", e);
21
- return {
22
- message: `调用工具失败${e.toString()}`,
23
- };
24
- }
25
- },
26
- }),
27
- };