mtxuilib 0.0.350 → 0.0.352

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.
@@ -1 +1 @@
1
- "use client";var b=(l,s,t)=>new Promise((o,n)=>{var v=e=>{try{m(t.next(e))}catch(i){n(i)}},r=e=>{try{m(t.throw(e))}catch(i){n(i)}},m=e=>e.done?o(e.value):Promise.resolve(e.value).then(v,r);m((t=t.apply(l,s)).next())});import{jsx as a,jsxs as d}from"react/jsx-runtime";import y,{useState as S}from"react";import{useFormContext as k}from"react-hook-form";import{cn as M}from"../lib/utils";import{ConformDeleteBtn as g}from"./deleteConform";import{MtButton as u}from"../ui/ui-mt/Button";const x=y.forwardRef((l,s)=>{const{submitText:t,onSubmit:o,onCancel:n,children:v,zodForm:r,enableCancelConform:m,enableDeleteButton:e,onDelete:i}=l,c=k(),D=c.formState.isDirty,B=c.formState,[p,C]=S(!1);return d("div",{className:"flex w-full flex-col p-1",children:[!p&&d("div",{className:"flex justify-end gap-2",children:[a(u,{variant:"outline",className:" min-w-24",onClick:f=>{f.preventDefault(),m&&D?C(!0):n&&n()},children:"cancel"}),a(u,{form:r==null?void 0:r.id,type:"submit",disabled:B.isSubmitting,className:" min-w-24",onClick:f=>{o&&(o(c.getValues()),f.preventDefault(),f.stopPropagation())},children:t||"submit"}),e&&a(g,{callback:()=>b(void 0,null,function*(){i&&i()}),disabled:c.formState.isSubmitting,variant:"destructive",children:"delete"})]}),p&&a(N,{onBack:()=>{C(!1)},onContinue:()=>{n&&n()}})]})});x.displayName="EditFormToolbar";const N=l=>{const{onContinue:s,onBack:t}=l;return d("div",{className:"flex gap-2",children:["\u672A\u4FDD\u5B58\u66F4\u6539\uFF0C\u786E\u5B9A\u7EE7\u7EED\u5417\uFF1F",a(u,{onClick:o=>{o.preventDefault(),t()},children:"\u7EE7\u7EED\u7F16\u8F91"}),a(u,{variant:"destructive",className:M(""),onClick:o=>{o.preventDefault(),s()},children:"\u5173\u95ED"})]})};export{x as EditFormToolbar};
1
+ "use client";var b=(l,m,e)=>new Promise((o,n)=>{var v=t=>{try{s(e.next(t))}catch(i){n(i)}},r=t=>{try{s(e.throw(t))}catch(i){n(i)}},s=t=>t.done?o(t.value):Promise.resolve(t.value).then(v,r);s((e=e.apply(l,m)).next())});import{jsx as a,jsxs as d}from"react/jsx-runtime";import y,{useState as M}from"react";import{useFormContext as S}from"react-hook-form";import{cn as g}from"../lib/utils";import{MtButton as u,MtButtonWithHostKey as h}from"../ui/ui-mt/Button";import{ConformDeleteBtn as k}from"./deleteConform";const x=y.forwardRef((l,m)=>{const{submitText:e,onSubmit:o,onCancel:n,children:v,zodForm:r,enableCancelConform:s,enableDeleteButton:t,onDelete:i}=l,f=S(),D=f.formState.isDirty,B=f.formState,[p,C]=M(!1);return d("div",{className:"flex w-full flex-col p-1",children:[!p&&d("div",{className:"flex justify-end gap-2",children:[a(u,{variant:"outline",className:" min-w-24",onClick:c=>{c.preventDefault(),s&&D?C(!0):n&&n()},children:"cancel"}),a(h,{hotKey:"alt+g",form:r==null?void 0:r.id,type:"submit",disabled:B.isSubmitting,className:" min-w-24",onClick:c=>{o&&(o(f.getValues()),c.preventDefault(),c.stopPropagation())},children:e||"submit"}),t&&a(k,{callback:()=>b(void 0,null,function*(){i&&i()}),disabled:f.formState.isSubmitting,variant:"destructive",children:"delete"})]}),p&&a(N,{onBack:()=>{C(!1)},onContinue:()=>{n&&n()}})]})});x.displayName="EditFormToolbar";const N=l=>{const{onContinue:m,onBack:e}=l;return d("div",{className:"flex gap-2",children:["\u672A\u4FDD\u5B58\u66F4\u6539\uFF0C\u786E\u5B9A\u7EE7\u7EED\u5417\uFF1F",a(u,{onClick:o=>{o.preventDefault(),e()},children:"\u7EE7\u7EED\u7F16\u8F91"}),a(u,{variant:"destructive",className:g(""),onClick:o=>{o.preventDefault(),m()},children:"\u5173\u95ED"})]})};export{x as EditFormToolbar};
@@ -0,0 +1,13 @@
1
+ import { DecoratedMutation } from "@trpc/react-query/dist/createTRPCReact";
2
+ import { PropsWithChildren } from "react";
3
+ type ResolverDef = {
4
+ input: any;
5
+ output: any;
6
+ transformer: boolean;
7
+ errorShape: any;
8
+ };
9
+ export declare function MutationCallButton<T extends ResolverDef>(props: {
10
+ method: DecoratedMutation<T>;
11
+ variables?: any;
12
+ } & PropsWithChildren): import("react").JSX.Element;
13
+ export {};
@@ -0,0 +1 @@
1
+ "use client";var s=(e,n,o)=>new Promise((r,u)=>{var p=t=>{try{a(o.next(t))}catch(i){u(i)}},c=t=>{try{a(o.throw(t))}catch(i){u(i)}},a=t=>t.done?r(t.value):Promise.resolve(t.value).then(p,c);a((o=o.apply(e,n)).next())});import{Fragment as d,jsx as l}from"react/jsx-runtime";import{MtButton as m}from"../../ui/ui-mt/Button";function v(e){const{method:n,children:o}=e,r=n.useMutation();return l(d,{children:l(m,{onClick:()=>s(this,null,function*(){yield r.mutateAsync({})}),children:o})})}export{v as MutationCallButton};
@@ -1 +1,2 @@
1
1
  export declare function convertEditorJsonToHTML(editorJsonValue: any): string;
2
+ export declare function convertEditorHTMLToJson(editorJsonValue: any): Record<string, any>;
@@ -1 +1 @@
1
- import{generateHTML as n}from"@tiptap/html";import{defaultExtensions as r}from"./extensions";function i(o){return console.log("convertEditorJsonToHTML",o),n(o,[...r])}export{i as convertEditorJsonToHTML};
1
+ import{generateHTML as r,generateJSON as t}from"@tiptap/html";import{defaultExtensions as n}from"./extensions";function a(o){return r(o,[...n])}function f(o){return t(o,[...n])}export{f as convertEditorHTMLToJson,a as convertEditorJsonToHTML};
@@ -1,2 +1,6 @@
1
1
  /// <reference types="react" />
2
- export declare const MtButton: import("react").ForwardRefExoticComponent<import("../button").ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
2
+ import { ButtonProps } from "../button";
3
+ export declare const MtButton: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
4
+ export declare const MtButtonWithHostKey: (props: {
5
+ hotKey: string;
6
+ } & ButtonProps) => import("react").JSX.Element;
@@ -1 +1 @@
1
- import{Button as t}from"../button";const n=t;export{n as MtButton};
1
+ var i=Object.defineProperty;var r=Object.getOwnPropertySymbols;var p=Object.prototype.hasOwnProperty,B=Object.prototype.propertyIsEnumerable;var c=(t,n,o)=>n in t?i(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o,f=(t,n)=>{for(var o in n||(n={}))p.call(n,o)&&c(t,o,n[o]);if(r)for(var o of r(n))B.call(n,o)&&c(t,o,n[o]);return t};var l=(t,n)=>{var o={};for(var e in t)p.call(t,e)&&n.indexOf(e)<0&&(o[e]=t[e]);if(t!=null&&r)for(var e of r(t))n.indexOf(e)<0&&B.call(t,e)&&(o[e]=t[e]);return o};import{jsx as H}from"react/jsx-runtime";import{useRef as y}from"react";import{useHotkeys as h}from"react-hotkeys-hook";import{Button as m}from"../button";const b=m,x=t=>{const s=t,{hotKey:n}=s,o=l(s,["hotKey"]),e=y(null),K=h(n,()=>{var u;console.log("\u5FEB\u6377\u952E\u751F\u6548"),(u=e.current)==null||u.click()},{});return H(m,f({},o))};export{b as MtButton,x as MtButtonWithHostKey};
@@ -0,0 +1,7 @@
1
+ import { ComponentProps } from "react";
2
+ import { DropdownMenuItem } from "../dropdown-menu";
3
+ type DropdownMenuItemLinkProps = ComponentProps<typeof DropdownMenuItem>;
4
+ export declare const DropdownMenuItemLink: (props: {
5
+ href: string;
6
+ } & DropdownMenuItemLinkProps) => import("react").JSX.Element;
7
+ export {};
@@ -0,0 +1 @@
1
+ "use client";var t=Object.getOwnPropertySymbols;var i=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable;var p=(n,e)=>{var r={};for(var o in n)i.call(n,o)&&e.indexOf(o)<0&&(r[o]=n[o]);if(n!=null&&t)for(var o of t(n))e.indexOf(o)<0&&M.call(n,o)&&(r[o]=n[o]);return r};import{jsx as m}from"react/jsx-runtime";import{MtLink as d}from"../../common/mtlink";import{DropdownMenuItem as f}from"../dropdown-menu";const k=n=>{const o=n,{href:e}=o,r=p(o,["href"]);return m(d,{href:e,children:m(f,{children:"Edit"})})};export{k as DropdownMenuItemLink};
@@ -1,8 +1,7 @@
1
1
  import React from "react";
2
2
  interface RichTextInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'name'> {
3
- onOpenFile?: (data: any) => void;
4
- asChild?: boolean;
5
3
  name: string;
4
+ contentType: "html" | "json";
6
5
  }
7
6
  export declare const RichTextInput: (props: RichTextInputProps) => React.JSX.Element;
8
7
  export {};
@@ -1 +1 @@
1
- import{jsx as t}from"react/jsx-runtime";import{useFormContext as r}from"react-hook-form";import{TailwindAdvancedEditor as i}from"../../novel/tailwind/advanced-editor";import{convertEditorJsonToHTML as p}from"../../novel/tailwind/utils";const l=a=>{const o=r();return t("div",{children:t(i,{onValueChange:n=>{const e=p(n);o.setValue("content",e)}})})};export{l as RichTextInput};
1
+ import{Fragment as l,jsx as r}from"react/jsx-runtime";import{useMemo as i}from"react";import{useFormContext as u}from"react-hook-form";import{TailwindAdvancedEditor as p}from"../../novel/tailwind/advanced-editor";import{convertEditorHTMLToJson as a,convertEditorJsonToHTML as T}from"../../novel/tailwind/utils";const M=s=>{const{name:n,contentType:o}=s,e=u(),c=i(()=>{const t=e.getValues()[n];return o=="html"?a(t):t},[o,e,n]);return r(l,{children:r(p,{content:c,onValueChange:t=>{const m=T(t);e.setValue("content",m)}})})};export{M as RichTextInput};
@@ -56,8 +56,8 @@ var import_jsx_runtime = require("react/jsx-runtime");
56
56
  var import_react = __toESM(require("react"), 1);
57
57
  var import_react_hook_form = require("react-hook-form");
58
58
  var import_utils = require("../lib/utils");
59
- var import_deleteConform = require("./deleteConform");
60
59
  var import_Button = require("../ui/ui-mt/Button");
60
+ var import_deleteConform = require("./deleteConform");
61
61
  const EditFormToolbar = import_react.default.forwardRef(
62
62
  (props, forwardedRef) => {
63
63
  const { submitText, onSubmit, onCancel, children, zodForm, enableCancelConform, enableDeleteButton, onDelete } = props;
@@ -84,8 +84,9 @@ const EditFormToolbar = import_react.default.forwardRef(
84
84
  }
85
85
  ),
86
86
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
87
- import_Button.MtButton,
87
+ import_Button.MtButtonWithHostKey,
88
88
  {
89
+ hotKey: "alt+g",
89
90
  form: zodForm == null ? void 0 : zodForm.id,
90
91
  type: "submit",
91
92
  disabled: formState.isSubmitting,
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var __async = (__this, __arguments, generator) => {
21
+ return new Promise((resolve, reject) => {
22
+ var fulfilled = (value) => {
23
+ try {
24
+ step(generator.next(value));
25
+ } catch (e) {
26
+ reject(e);
27
+ }
28
+ };
29
+ var rejected = (value) => {
30
+ try {
31
+ step(generator.throw(value));
32
+ } catch (e) {
33
+ reject(e);
34
+ }
35
+ };
36
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
37
+ step((generator = generator.apply(__this, __arguments)).next());
38
+ });
39
+ };
40
+ var MutationCallButton_exports = {};
41
+ __export(MutationCallButton_exports, {
42
+ MutationCallButton: () => MutationCallButton
43
+ });
44
+ module.exports = __toCommonJS(MutationCallButton_exports);
45
+ var import_jsx_runtime = require("react/jsx-runtime");
46
+ var import_Button = require("../../ui/ui-mt/Button");
47
+ function MutationCallButton(props) {
48
+ const { method, children } = props;
49
+ const a = method.useMutation();
50
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.MtButton, { onClick: () => __async(this, null, function* () {
51
+ yield a.mutateAsync({});
52
+ }), children }) });
53
+ }
54
+ // Annotate the CommonJS export names for ESM import in node:
55
+ 0 && (module.exports = {
56
+ MutationCallButton
57
+ });