@machinerd/js-module 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/README.md +0 -6
  2. package/dist/{api-client-C0sbSOQf.mjs → api-client-B-kwZogn.mjs} +1 -1
  3. package/dist/hooks/common/index.cjs +1 -1
  4. package/dist/hooks/common/index.d.cts +6 -7
  5. package/dist/hooks/common/index.d.mts +6 -7
  6. package/dist/hooks/common/index.mjs +1 -1
  7. package/dist/index.d.cts +1 -1
  8. package/dist/index.d.mts +1 -1
  9. package/dist/index.mjs +1 -1
  10. package/dist/providers/api-client/index.cjs +1 -1
  11. package/dist/providers/api-client/index.d.cts +3 -3
  12. package/dist/providers/api-client/index.d.mts +3 -3
  13. package/dist/providers/api-client/index.mjs +1 -1
  14. package/dist/providers/noti-stack/index.d.cts +2 -2
  15. package/dist/{skeleton-Y22bmaaB.mjs → skeleton-azZrk5-3.mjs} +1 -1
  16. package/dist/styles/index.css +0 -251
  17. package/dist/ui/carousel/index.cjs +1 -1
  18. package/dist/ui/carousel/index.d.cts +9 -9
  19. package/dist/ui/carousel/index.d.mts +9 -9
  20. package/dist/ui/carousel/index.mjs +1 -1
  21. package/dist/ui/dialog/index.cjs +1 -1
  22. package/dist/ui/dialog/index.d.cts +2 -2
  23. package/dist/ui/dialog/index.d.mts +4 -4
  24. package/dist/ui/dialog/index.mjs +1 -1
  25. package/dist/ui/dnd/index.d.cts +2 -2
  26. package/dist/ui/image/index.cjs +1 -1
  27. package/dist/ui/image/index.d.cts +8 -8
  28. package/dist/ui/image/index.d.mts +8 -8
  29. package/dist/ui/image/index.mjs +1 -1
  30. package/dist/ui/index.cjs +1 -1
  31. package/dist/ui/index.d.cts +55 -12
  32. package/dist/ui/index.d.mts +58 -15
  33. package/dist/ui/index.mjs +1 -1
  34. package/dist/ui/motion-dialog/index.cjs +1 -1
  35. package/dist/ui/motion-dialog/index.mjs +1 -1
  36. package/dist/ui/sheet/index.cjs +1 -1
  37. package/dist/ui/sheet/index.d.cts +2 -2
  38. package/dist/ui/sheet/index.d.mts +2 -2
  39. package/dist/ui/sheet/index.mjs +1 -1
  40. package/dist/ui/switch/index.cjs +1 -1
  41. package/dist/ui/switch/index.mjs +1 -1
  42. package/dist/ui/tooltip/index.cjs +1 -1
  43. package/dist/ui/tooltip/index.d.cts +2 -2
  44. package/dist/ui/tooltip/index.mjs +1 -1
  45. package/dist/{use-subset-image-o_gmC1HL.cjs → use-subset-image-CTy5mCLo.cjs} +1 -1
  46. package/dist/{use-subset-image-Df2fCrtH.mjs → use-subset-image-LQWsE5P4.mjs} +1 -1
  47. package/dist/util/common.mjs +1 -1
  48. package/dist/util/file.mjs +1 -1
  49. package/dist/util/format.cjs +1 -1
  50. package/dist/util/format.d.cts +1 -29
  51. package/dist/util/format.d.mts +1 -29
  52. package/dist/util/format.mjs +1 -1
  53. package/package.json +4 -42
  54. package/dist/button-CQZuaIU7.mjs +0 -1
  55. package/dist/button-ChX3XGbR.cjs +0 -1
  56. package/dist/button-DHvx-GAg.d.cts +0 -50
  57. package/dist/button-DRIyBtEB.d.mts +0 -50
  58. package/dist/editor/index.cjs +0 -1
  59. package/dist/editor/index.d.cts +0 -80
  60. package/dist/editor/index.d.mts +0 -80
  61. package/dist/editor/index.mjs +0 -1
  62. package/dist/format-1_RTNUQv.mjs +0 -1
  63. package/dist/format-DEuImTYJ.cjs +0 -1
  64. package/dist/styles/editor.css +0 -255
  65. package/dist/ui/dropdown/index.cjs +0 -1
  66. package/dist/ui/dropdown/index.d.cts +0 -72
  67. package/dist/ui/dropdown/index.d.mts +0 -72
  68. package/dist/ui/dropdown/index.mjs +0 -1
  69. package/dist/ui/preserve-focus-button/index.cjs +0 -1
  70. package/dist/ui/preserve-focus-button/index.d.cts +0 -12
  71. package/dist/ui/preserve-focus-button/index.d.mts +0 -12
  72. package/dist/ui/preserve-focus-button/index.mjs +0 -1
  73. package/dist/ui-Bs9PP9eC.cjs +0 -1
  74. package/dist/ui-D2DoC_0E.mjs +0 -1
  75. package/dist/use-drag-resize-BdeLdulk.mjs +0 -1
  76. package/dist/use-drag-resize-DEgcua2U.d.cts +0 -48
  77. package/dist/use-drag-resize-DRHPv5RK.d.mts +0 -48
  78. package/dist/use-drag-resize-DeDqPC4h.cjs +0 -1
  79. package/dist/util/editor.cjs +0 -1
  80. package/dist/util/editor.d.cts +0 -21
  81. package/dist/util/editor.d.mts +0 -21
  82. package/dist/util/editor.mjs +0 -1
  83. /package/dist/{api-client-C3o2pO0q.cjs → api-client-BH5tW3p8.cjs} +0 -0
  84. /package/dist/{common-B8HXyhZa.cjs → common-BQEGjmFn.cjs} +0 -0
  85. /package/dist/{common-ZUMpASnc.mjs → common-CCtD91nO.mjs} +0 -0
  86. /package/dist/{common-CWHkXe0F.mjs → common-L3y7_eAy.mjs} +0 -0
  87. /package/dist/{file-B-UJkabO.mjs → file-CjW1pMb_.mjs} +0 -0
  88. /package/dist/{index-B1YNV_Vm.d.cts → index-CFOJBfVt.d.mts} +0 -0
  89. /package/dist/{index-C8chDULk.d.mts → index-ChiDX5zW.d.cts} +0 -0
  90. /package/dist/{skeleton-B5ZccRFX.cjs → skeleton-BCdxpynL.cjs} +0 -0
  91. /package/dist/{src-CIMlbgv1.mjs → src-Ce2i3Lkj.mjs} +0 -0
  92. /package/dist/{use-dialog-stack-YiLs-sNf.cjs → use-dialog-stack-DmBRPhe2.cjs} +0 -0
  93. /package/dist/{use-dialog-stack-Crj8YWJl.mjs → use-dialog-stack-STwnhvBB.mjs} +0 -0
  94. /package/dist/{use-subset-image-Dygkyw-W.d.mts → use-subset-image-Ck1Gk5Qk.d.mts} +0 -0
  95. /package/dist/{use-subset-image-bDB5TSd4.d.cts → use-subset-image-oZAiC9VK.d.cts} +0 -0
@@ -1,72 +0,0 @@
1
- import { CSSProperties, ComponentProps, ReactElement, ReactNode } from "react";
2
- import * as react_jsx_runtime17 from "react/jsx-runtime";
3
- import { Placement, VirtualElement, useFloating, useInteractions } from "@floating-ui/react";
4
-
5
- //#region src/ui/dropdown/dropdown.d.ts
6
- interface DropdownProps {
7
- trigger?: ReactElement;
8
- reference?: VirtualElement;
9
- children: ReactNode;
10
- placement?: Placement;
11
- boundary?: Element | null;
12
- offset?: number;
13
- maxWidth?: number;
14
- maxHeight?: number;
15
- className?: string;
16
- open?: boolean;
17
- onOpenChange?: (open: boolean) => void;
18
- preserveFocus?: boolean;
19
- role?: 'menu' | 'listbox' | 'dialog';
20
- }
21
- declare function Dropdown({
22
- trigger,
23
- reference,
24
- children,
25
- placement,
26
- boundary,
27
- offset,
28
- maxWidth,
29
- maxHeight,
30
- className,
31
- open: controlledOpen,
32
- onOpenChange,
33
- preserveFocus,
34
- role
35
- }: DropdownProps): react_jsx_runtime17.JSX.Element;
36
- //#endregion
37
- //#region src/ui/dropdown/dropdown-trigger.d.ts
38
- interface DropdownTriggerProps extends ComponentProps<'button'> {
39
- asChild?: boolean;
40
- }
41
- declare function DropdownTrigger({
42
- asChild,
43
- className,
44
- type,
45
- ...rest
46
- }: DropdownTriggerProps): react_jsx_runtime17.JSX.Element;
47
- //#endregion
48
- //#region src/ui/dropdown/dropdown-content.d.ts
49
- type DropdownContentProps = ComponentProps<'div'>;
50
- declare function DropdownContent({
51
- className,
52
- children,
53
- onMouseDown,
54
- onClick,
55
- ...rest
56
- }: DropdownContentProps): react_jsx_runtime17.JSX.Element | null;
57
- //#endregion
58
- //#region src/ui/dropdown/dropdown-context.d.ts
59
- interface DropdownContextValue {
60
- open: boolean;
61
- setOpen: (open: boolean) => void;
62
- close: () => void;
63
- refs: ReturnType<typeof useFloating>['refs'];
64
- floatingStyles: CSSProperties;
65
- getReferenceProps: ReturnType<typeof useInteractions>['getReferenceProps'];
66
- getFloatingProps: ReturnType<typeof useInteractions>['getFloatingProps'];
67
- preserveFocus: boolean;
68
- }
69
- declare function useDropdown(): DropdownContextValue;
70
- declare function useOptionalDropdown(): DropdownContextValue | null;
71
- //#endregion
72
- export { Dropdown, DropdownContent, type DropdownContentProps, type DropdownProps, DropdownTrigger, type DropdownTriggerProps, useDropdown, useOptionalDropdown };
@@ -1,72 +0,0 @@
1
- import { CSSProperties, ComponentProps, ReactElement, ReactNode } from "react";
2
- import * as react_jsx_runtime5 from "react/jsx-runtime";
3
- import { Placement, VirtualElement, useFloating, useInteractions } from "@floating-ui/react";
4
-
5
- //#region src/ui/dropdown/dropdown.d.ts
6
- interface DropdownProps {
7
- trigger?: ReactElement;
8
- reference?: VirtualElement;
9
- children: ReactNode;
10
- placement?: Placement;
11
- boundary?: Element | null;
12
- offset?: number;
13
- maxWidth?: number;
14
- maxHeight?: number;
15
- className?: string;
16
- open?: boolean;
17
- onOpenChange?: (open: boolean) => void;
18
- preserveFocus?: boolean;
19
- role?: 'menu' | 'listbox' | 'dialog';
20
- }
21
- declare function Dropdown({
22
- trigger,
23
- reference,
24
- children,
25
- placement,
26
- boundary,
27
- offset,
28
- maxWidth,
29
- maxHeight,
30
- className,
31
- open: controlledOpen,
32
- onOpenChange,
33
- preserveFocus,
34
- role
35
- }: DropdownProps): react_jsx_runtime5.JSX.Element;
36
- //#endregion
37
- //#region src/ui/dropdown/dropdown-trigger.d.ts
38
- interface DropdownTriggerProps extends ComponentProps<'button'> {
39
- asChild?: boolean;
40
- }
41
- declare function DropdownTrigger({
42
- asChild,
43
- className,
44
- type,
45
- ...rest
46
- }: DropdownTriggerProps): react_jsx_runtime5.JSX.Element;
47
- //#endregion
48
- //#region src/ui/dropdown/dropdown-content.d.ts
49
- type DropdownContentProps = ComponentProps<'div'>;
50
- declare function DropdownContent({
51
- className,
52
- children,
53
- onMouseDown,
54
- onClick,
55
- ...rest
56
- }: DropdownContentProps): react_jsx_runtime5.JSX.Element | null;
57
- //#endregion
58
- //#region src/ui/dropdown/dropdown-context.d.ts
59
- interface DropdownContextValue {
60
- open: boolean;
61
- setOpen: (open: boolean) => void;
62
- close: () => void;
63
- refs: ReturnType<typeof useFloating>['refs'];
64
- floatingStyles: CSSProperties;
65
- getReferenceProps: ReturnType<typeof useInteractions>['getReferenceProps'];
66
- getFloatingProps: ReturnType<typeof useInteractions>['getFloatingProps'];
67
- preserveFocus: boolean;
68
- }
69
- declare function useDropdown(): DropdownContextValue;
70
- declare function useOptionalDropdown(): DropdownContextValue | null;
71
- //#endregion
72
- export { Dropdown, DropdownContent, type DropdownContentProps, type DropdownProps, DropdownTrigger, type DropdownTriggerProps, useDropdown, useOptionalDropdown };
@@ -1 +0,0 @@
1
- "use client";import{n as e}from"../../common-ZUMpASnc.mjs";import{t}from"../../use-dialog-stack-Crj8YWJl.mjs";import{createContext as n,useCallback as r,useContext as i,useEffect as a,useMemo as o,useState as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{Slot as u}from"@radix-ui/react-slot";import{FloatingPortal as d,autoUpdate as f,flip as p,offset as m,shift as h,size as g,useClick as _,useDismiss as v,useFloating as y,useInteractions as b,useRole as x}from"@floating-ui/react";const S=n(null);function C(){let e=i(S);if(!e)throw Error(`useDropdown must be used within Dropdown`);return e}function w(){return i(S)}function T({className:t,children:n,onMouseDown:r,onClick:i,...a}){let{open:o,refs:s,floatingStyles:l,getFloatingProps:u,preserveFocus:f}=C();return o?c(d,{children:c(`div`,{"data-komc":!0,...u({...a,ref:s.setFloating,style:{...l,...a.style},className:e(`komc:z-50 komc:mt-0.5 komc:drop-shadow-md`,t),onMouseDown:e=>{f&&e.preventDefault(),r?.(e)},onClick:e=>{e.stopPropagation(),i?.(e)}}),children:n})}):null}function E({asChild:t=!0,className:n,type:r=`button`,...i}){let{open:a,refs:o,getReferenceProps:s}=C();return c(t?u:`button`,{"data-komc":!0,"data-state":a?`open`:`closed`,type:t?void 0:r,className:e(!t&&`komc:inline-flex komc:items-center komc:outline-none`,n),...s({...i,ref:o.setReference})})}function D({trigger:e,reference:n,children:i,placement:u=`bottom-start`,boundary:d,offset:C=8,maxWidth:w,maxHeight:D=300,className:O,open:k,onOpenChange:A,preserveFocus:j=!1,role:M=`menu`}){let N=k!==void 0,[P,F]=s(!1),I=N?k:P,L=r(e=>{N||F(e),A?.(e)},[N,A]),R=r(()=>L(!1),[L]);t(I,R,!1);let{refs:z,floatingStyles:B,context:V}=y({open:I,onOpenChange:L,placement:u,whileElementsMounted:f,middleware:o(()=>[m(C),p({boundary:d??void 0,padding:8}),h({boundary:d??void 0,padding:8}),g({boundary:d??void 0,padding:8,apply({availableHeight:e,availableWidth:t,elements:n}){let r={maxHeight:`${Math.min(e,D)}px`,overflowY:`auto`};w!=null&&(r.maxWidth=`${Math.min(t,w)}px`),Object.assign(n.floating.style,r)}})],[d,D,w,C])}),{getReferenceProps:H,getFloatingProps:U}=b([_(V),v(V,{escapeKey:!1}),x(V,{role:M})]);a(()=>{n&&z.setPositionReference(n)},[n,z]);let W=o(()=>({open:I,setOpen:L,close:R,refs:z,floatingStyles:B,getReferenceProps:H,getFloatingProps:U,preserveFocus:j}),[R,B,U,H,I,j,z,L]);return l(S.Provider,{value:W,children:[e?c(E,{asChild:!0,children:e}):null,e?c(T,{className:O,children:i}):i]})}export{D as Dropdown,T as DropdownContent,E as DropdownTrigger,C as useDropdown,w as useOptionalDropdown};
@@ -1 +0,0 @@
1
- "use client";const e=require(`../../chunk-Bmb41Sf3.cjs`);require(`../../common-D4sUwkFd.cjs`);const t=require(`../../button-ChX3XGbR.cjs`);let n=require(`react/jsx-runtime`);function r({className:e,onMouseDown:r,...i}){return(0,n.jsx)(t.t,{...i,onMouseDown:e=>{e.preventDefault(),r?.(e)}})}exports.PreserveFocusButton=r;
@@ -1,12 +0,0 @@
1
- import { t as Button } from "../../button-DHvx-GAg.cjs";
2
- import { ComponentProps } from "react";
3
- import * as react_jsx_runtime0 from "react/jsx-runtime";
4
-
5
- //#region src/ui/preserve-focus-button/preserve-focus.d.ts
6
- declare function PreserveFocusButton({
7
- className,
8
- onMouseDown,
9
- ...props
10
- }: ComponentProps<typeof Button>): react_jsx_runtime0.JSX.Element;
11
- //#endregion
12
- export { PreserveFocusButton };
@@ -1,12 +0,0 @@
1
- import { t as Button } from "../../button-DRIyBtEB.mjs";
2
- import { ComponentProps } from "react";
3
- import * as react_jsx_runtime4 from "react/jsx-runtime";
4
-
5
- //#region src/ui/preserve-focus-button/preserve-focus.d.ts
6
- declare function PreserveFocusButton({
7
- className,
8
- onMouseDown,
9
- ...props
10
- }: ComponentProps<typeof Button>): react_jsx_runtime4.JSX.Element;
11
- //#endregion
12
- export { PreserveFocusButton };
@@ -1 +0,0 @@
1
- "use client";import"../../common-ZUMpASnc.mjs";import{t as e}from"../../button-CQZuaIU7.mjs";import{jsx as t}from"react/jsx-runtime";function n({className:n,onMouseDown:r,...i}){return t(e,{...i,onMouseDown:e=>{e.preventDefault(),r?.(e)}})}export{n as PreserveFocusButton};
@@ -1 +0,0 @@
1
- const e=require(`./chunk-Bmb41Sf3.cjs`),t=require(`./common-D4sUwkFd.cjs`);let n=require(`react`);n=e.t(n);let r=require(`react/jsx-runtime`),i=require(`clsx`);i=e.t(i);let a=require(`class-variance-authority`);function o({className:e,items:t,render:a,...o}){return(0,r.jsx)(`nav`,{"data-komc":!0,"aria-label":`bottom app bar`,className:(0,i.default)(`komc:fixed komc:bottom-0 komc:left-0 komc:right-0`,`komc:border-t komc:border-neutral-200 komc:bg-white komc:z-10`,e),...o,children:(0,r.jsx)(`div`,{className:`komc:grid komc:min-h-15`,style:{gridTemplateColumns:`repeat(${t.length}, 1fr)`},children:t.map((e,t)=>(0,r.jsx)(n.default.Fragment,{children:a(e)},t))})})}function s({condition:e,wrapper:t,children:n}){return e?t(n):n}function c({condition:e,trueWrapper:t,falseWrapper:n,children:r}){return e?t(r):n(r)}const l=(0,a.cva)(t.n(`komc:flex komc:items-center komc:w-full komc:px-2`,`komc:[&>input]:outline-none komc:[&>input]:w-full`,`komc:[&>input]:focus:ring-0 komc:[&>input]:focus:ring-offset-0`,`komc:[&>input]:h-full`),{variants:{size:{xs:`komc:h-7.5`,sm:`komc:h-8`,base:`komc:h-9`,md:`komc:h-10`,lg:`komc:h-11`,xl:`komc:h-12`,"2xl":`komc:h-13`,"3xl":`komc:h-14`},gap:{none:`komc:gap-0`,xs:`komc:gap-1`,sm:`komc:gap-2`,md:`komc:gap-3`,lg:`komc:gap-4`,xl:`komc:gap-5`},outline:{line:`komc:border`,solid:`komc:border-transparent`,clear:`komc:border-none`,dashed:`komc:border-dashed`,dotted:`komc:border-dotted`},rounded:{none:`komc:rounded-none`,sm:`komc:rounded-sm`,md:`komc:rounded-md`,lg:`komc:rounded-lg`,xl:`komc:rounded-xl`,"2xl":`komc:rounded-2xl`}}}),u=(0,n.forwardRef)(({prefix:e=null,surffix:t=null,size:n=`lg`,gap:i=`xl`,outline:a=`line`,rounded:o=`lg`,className:s,...c},u)=>(0,r.jsxs)(`div`,{"data-komc":!0,className:l({size:n,gap:i,outline:a,rounded:o,className:s}),children:[e,(0,r.jsx)(`input`,{ref:u,type:`text`,...c}),t]}));var d=u;function f({children:e,className:t,...n}){return(0,r.jsx)(`span`,{...n,"data-komc":!0,"data-text":`${e}`,className:(0,i.default)(`komc:inline-flex komc:flex-col komc:justify-center komc:items-center`,`komc:after:content-[attr(data-text)] komc:after:font-bold`,`komc:after:h-0 komc:after:invisible komc:after:overflow-hidden`,`komc:after:select-none komc:after:pointer-events-none`,t),children:e})}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return f}});
@@ -1 +0,0 @@
1
- import{n as e}from"./common-ZUMpASnc.mjs";import t,{forwardRef as n}from"react";import{jsx as r,jsxs as i}from"react/jsx-runtime";import a from"clsx";import{cva as o}from"class-variance-authority";function s({className:e,items:n,render:i,...o}){return r(`nav`,{"data-komc":!0,"aria-label":`bottom app bar`,className:a(`komc:fixed komc:bottom-0 komc:left-0 komc:right-0`,`komc:border-t komc:border-neutral-200 komc:bg-white komc:z-10`,e),...o,children:r(`div`,{className:`komc:grid komc:min-h-15`,style:{gridTemplateColumns:`repeat(${n.length}, 1fr)`},children:n.map((e,n)=>r(t.Fragment,{children:i(e)},n))})})}function c({condition:e,wrapper:t,children:n}){return e?t(n):n}function l({condition:e,trueWrapper:t,falseWrapper:n,children:r}){return e?t(r):n(r)}const u=o(e(`komc:flex komc:items-center komc:w-full komc:px-2`,`komc:[&>input]:outline-none komc:[&>input]:w-full`,`komc:[&>input]:focus:ring-0 komc:[&>input]:focus:ring-offset-0`,`komc:[&>input]:h-full`),{variants:{size:{xs:`komc:h-7.5`,sm:`komc:h-8`,base:`komc:h-9`,md:`komc:h-10`,lg:`komc:h-11`,xl:`komc:h-12`,"2xl":`komc:h-13`,"3xl":`komc:h-14`},gap:{none:`komc:gap-0`,xs:`komc:gap-1`,sm:`komc:gap-2`,md:`komc:gap-3`,lg:`komc:gap-4`,xl:`komc:gap-5`},outline:{line:`komc:border`,solid:`komc:border-transparent`,clear:`komc:border-none`,dashed:`komc:border-dashed`,dotted:`komc:border-dotted`},rounded:{none:`komc:rounded-none`,sm:`komc:rounded-sm`,md:`komc:rounded-md`,lg:`komc:rounded-lg`,xl:`komc:rounded-xl`,"2xl":`komc:rounded-2xl`}}});var d=n(({prefix:e=null,surffix:t=null,size:n=`lg`,gap:a=`xl`,outline:o=`line`,rounded:s=`lg`,className:c,...l},d)=>i(`div`,{"data-komc":!0,className:u({size:n,gap:a,outline:o,rounded:s,className:c}),children:[e,r(`input`,{ref:d,type:`text`,...l}),t]}));function f({children:e,className:t,...n}){return r(`span`,{...n,"data-komc":!0,"data-text":`${e}`,className:a(`komc:inline-flex komc:flex-col komc:justify-center komc:items-center`,`komc:after:content-[attr(data-text)] komc:after:font-bold`,`komc:after:h-0 komc:after:invisible komc:after:overflow-hidden`,`komc:after:select-none komc:after:pointer-events-none`,t),children:e})}export{s as a,c as i,d as n,l as r,f as t};
@@ -1 +0,0 @@
1
- import{useCallback as e,useEffect as t,useRef as n,useState as r}from"react";const i={DEFAULT_WIDTH:200,DEFAULT_HEIGHT:100},a={width:i.DEFAULT_WIDTH,height:i.DEFAULT_HEIGHT},o={width:!0,height:!0};function s(e,t,n){let r=e;return t!==void 0&&(r=Math.max(r,t)),n!==void 0&&(r=Math.min(r,n)),r}function c(e,t,n,r){let i={...t};return e.includes(`left`)&&(i.width=t.width-n),e.includes(`right`)&&(i.width=t.width+n),e.includes(`top`)&&(i.height=t.height-r),e.includes(`bottom`)&&(i.height=t.height+r),i}function l(e,t,n){let r=[],i=[];return n?.width!==void 0&&r.push(n.width),n?.height!==void 0&&i.push(n.height),e&&(t.width&&r.push(e.width),t.height&&i.push(e.height)),{width:r.length?Math.min(...r):void 0,height:i.length?Math.min(...i):void 0}}function u(e,t,n){let{width:r,height:i}=e;if(t===`left`||t===`right`)return{width:r,height:r/n};if(t===`top`||t===`bottom`)return{width:i*n,height:i};let a={width:r,height:r/n},o={width:i*n,height:i};return Math.abs(a.height-i)<=Math.abs(o.width-r)?a:o}function d(e,t,n,r){if(!r)return{width:Math.ceil(s(e.width,t.width,n.width)),height:Math.ceil(s(e.height,t.height,n.height))};let{width:i,height:a}=e;(i<=0||a<=0)&&(i=t.width,a=t.width/r);let o=Math.min(n.width===void 0?1:n.width/i,n.height===void 0?1:n.height/a,1);i*=o,a*=o;let c=Math.max(i<t.width?t.width/i:1,a<t.height?t.height/a:1,1);i*=c,a*=c;let l=Math.min(n.width===void 0?1:n.width/i,n.height===void 0?1:n.height/a,1);return i*=l,a*=l,{width:Math.ceil(i),height:Math.ceil(a)}}function f(e,t,n){let r=c(t.direction,t.startSize,e.clientX-t.startX,e.clientY-t.startY),i=n.keepAspectRatio&&t.startSize.height>0?t.startSize.width/t.startSize.height:null,a=i?u(r,t.direction,i):r,o=l(n.boundaryRef?.current?.getBoundingClientRect(),n.limitSize,n.maxSize);return d(a,n.minSize,o,i)}function p({boundaryRef:i,size:s,keepAspectRatio:c=!0,minSize:l=a,maxSize:u,limitSize:d=o,onResize:p,onResizeEnd:m}){let[h,g]=r(!1),_=n(null),v=n({boundaryRef:i,size:s,keepAspectRatio:c,limitSize:d,minSize:l,maxSize:u,onResize:p,onResizeEnd:m});t(()=>{v.current={boundaryRef:i,size:s,keepAspectRatio:c,limitSize:d,minSize:l,maxSize:u,onResize:p,onResizeEnd:m}});let y=e(e=>{let t=_.current;!t||e.pointerId!==t.pointerId||(_.current=null,g(!1),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),v.current.onResizeEnd?.(t.lastSize))},[]),b=e(e=>{let t=_.current;if(!t||e.pointerId!==t.pointerId)return;let n=f(e,t,v.current);t.lastSize=n,v.current.onResize?.(n)},[]);return t(()=>()=>{_.current=null},[]),{isResizing:h,getHandleProps:e(e=>({onPointerDown:t=>{if(t.button!==0)return;t.preventDefault(),t.stopPropagation(),t.currentTarget.setPointerCapture(t.pointerId);let n=v.current.size,r={width:n.width,height:n.height};_.current={pointerId:t.pointerId,startX:t.clientX,startY:t.clientY,startSize:r,direction:e,lastSize:r},g(!0)},onPointerMove:b,onPointerUp:y,onPointerCancel:y,style:{touchAction:`none`}}),[b,y])}}export{p as n,i as t};
@@ -1,48 +0,0 @@
1
- //#region src/hooks/use-drag-resize.d.ts
2
- declare const RESIZE_CONSTANTS: {
3
- DEFAULT_WIDTH: number;
4
- DEFAULT_HEIGHT: number;
5
- };
6
- type ResizeDirection = 'top' | 'right' | 'bottom' | 'left' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
7
- interface Size {
8
- width: number;
9
- height: number;
10
- }
11
- interface LimitSize {
12
- width: boolean;
13
- height: boolean;
14
- }
15
- interface ResizeHandleProps {
16
- onPointerDown: (event: React.PointerEvent<HTMLElement>) => void;
17
- onPointerMove: (event: React.PointerEvent<HTMLElement>) => void;
18
- onPointerUp: (event: React.PointerEvent<HTMLElement>) => void;
19
- onPointerCancel: (event: React.PointerEvent<HTMLElement>) => void;
20
- style: {
21
- touchAction: 'none';
22
- };
23
- }
24
- interface UseDragResizeProps {
25
- boundaryRef?: React.RefObject<HTMLElement | null>;
26
- size: Size;
27
- keepAspectRatio?: boolean;
28
- limitSize?: LimitSize;
29
- minSize?: Size;
30
- maxSize?: Size;
31
- onResize?: (size: Size) => void;
32
- onResizeEnd?: (size: Size) => void;
33
- }
34
- declare function useDragResize({
35
- boundaryRef,
36
- size,
37
- keepAspectRatio,
38
- minSize,
39
- maxSize,
40
- limitSize,
41
- onResize,
42
- onResizeEnd
43
- }: UseDragResizeProps): {
44
- isResizing: boolean;
45
- getHandleProps: (direction: ResizeDirection) => ResizeHandleProps;
46
- };
47
- //#endregion
48
- export { Size as a, ResizeHandleProps as i, RESIZE_CONSTANTS as n, UseDragResizeProps as o, ResizeDirection as r, useDragResize as s, LimitSize as t };
@@ -1,48 +0,0 @@
1
- //#region src/hooks/use-drag-resize.d.ts
2
- declare const RESIZE_CONSTANTS: {
3
- DEFAULT_WIDTH: number;
4
- DEFAULT_HEIGHT: number;
5
- };
6
- type ResizeDirection = 'top' | 'right' | 'bottom' | 'left' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
7
- interface Size {
8
- width: number;
9
- height: number;
10
- }
11
- interface LimitSize {
12
- width: boolean;
13
- height: boolean;
14
- }
15
- interface ResizeHandleProps {
16
- onPointerDown: (event: React.PointerEvent<HTMLElement>) => void;
17
- onPointerMove: (event: React.PointerEvent<HTMLElement>) => void;
18
- onPointerUp: (event: React.PointerEvent<HTMLElement>) => void;
19
- onPointerCancel: (event: React.PointerEvent<HTMLElement>) => void;
20
- style: {
21
- touchAction: 'none';
22
- };
23
- }
24
- interface UseDragResizeProps {
25
- boundaryRef?: React.RefObject<HTMLElement | null>;
26
- size: Size;
27
- keepAspectRatio?: boolean;
28
- limitSize?: LimitSize;
29
- minSize?: Size;
30
- maxSize?: Size;
31
- onResize?: (size: Size) => void;
32
- onResizeEnd?: (size: Size) => void;
33
- }
34
- declare function useDragResize({
35
- boundaryRef,
36
- size,
37
- keepAspectRatio,
38
- minSize,
39
- maxSize,
40
- limitSize,
41
- onResize,
42
- onResizeEnd
43
- }: UseDragResizeProps): {
44
- isResizing: boolean;
45
- getHandleProps: (direction: ResizeDirection) => ResizeHandleProps;
46
- };
47
- //#endregion
48
- export { Size as a, ResizeHandleProps as i, RESIZE_CONSTANTS as n, UseDragResizeProps as o, ResizeDirection as r, useDragResize as s, LimitSize as t };
@@ -1 +0,0 @@
1
- const e=require(`./chunk-Bmb41Sf3.cjs`);let t=require(`react`);const n={DEFAULT_WIDTH:200,DEFAULT_HEIGHT:100},r={width:n.DEFAULT_WIDTH,height:n.DEFAULT_HEIGHT},i={width:!0,height:!0};function a(e,t,n){let r=e;return t!==void 0&&(r=Math.max(r,t)),n!==void 0&&(r=Math.min(r,n)),r}function o(e,t,n,r){let i={...t};return e.includes(`left`)&&(i.width=t.width-n),e.includes(`right`)&&(i.width=t.width+n),e.includes(`top`)&&(i.height=t.height-r),e.includes(`bottom`)&&(i.height=t.height+r),i}function s(e,t,n){let r=[],i=[];return n?.width!==void 0&&r.push(n.width),n?.height!==void 0&&i.push(n.height),e&&(t.width&&r.push(e.width),t.height&&i.push(e.height)),{width:r.length?Math.min(...r):void 0,height:i.length?Math.min(...i):void 0}}function c(e,t,n){let{width:r,height:i}=e;if(t===`left`||t===`right`)return{width:r,height:r/n};if(t===`top`||t===`bottom`)return{width:i*n,height:i};let a={width:r,height:r/n},o={width:i*n,height:i};return Math.abs(a.height-i)<=Math.abs(o.width-r)?a:o}function l(e,t,n,r){if(!r)return{width:Math.ceil(a(e.width,t.width,n.width)),height:Math.ceil(a(e.height,t.height,n.height))};let{width:i,height:o}=e;(i<=0||o<=0)&&(i=t.width,o=t.width/r);let s=Math.min(n.width===void 0?1:n.width/i,n.height===void 0?1:n.height/o,1);i*=s,o*=s;let c=Math.max(i<t.width?t.width/i:1,o<t.height?t.height/o:1,1);i*=c,o*=c;let l=Math.min(n.width===void 0?1:n.width/i,n.height===void 0?1:n.height/o,1);return i*=l,o*=l,{width:Math.ceil(i),height:Math.ceil(o)}}function u(e,t,n){let r=o(t.direction,t.startSize,e.clientX-t.startX,e.clientY-t.startY),i=n.keepAspectRatio&&t.startSize.height>0?t.startSize.width/t.startSize.height:null,a=i?c(r,t.direction,i):r,u=s(n.boundaryRef?.current?.getBoundingClientRect(),n.limitSize,n.maxSize);return l(a,n.minSize,u,i)}function d({boundaryRef:e,size:n,keepAspectRatio:a=!0,minSize:o=r,maxSize:s,limitSize:c=i,onResize:l,onResizeEnd:d}){let[f,p]=(0,t.useState)(!1),m=(0,t.useRef)(null),h=(0,t.useRef)({boundaryRef:e,size:n,keepAspectRatio:a,limitSize:c,minSize:o,maxSize:s,onResize:l,onResizeEnd:d});(0,t.useEffect)(()=>{h.current={boundaryRef:e,size:n,keepAspectRatio:a,limitSize:c,minSize:o,maxSize:s,onResize:l,onResizeEnd:d}});let g=(0,t.useCallback)(e=>{let t=m.current;!t||e.pointerId!==t.pointerId||(m.current=null,p(!1),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),h.current.onResizeEnd?.(t.lastSize))},[]),_=(0,t.useCallback)(e=>{let t=m.current;if(!t||e.pointerId!==t.pointerId)return;let n=u(e,t,h.current);t.lastSize=n,h.current.onResize?.(n)},[]);return(0,t.useEffect)(()=>()=>{m.current=null},[]),{isResizing:f,getHandleProps:(0,t.useCallback)(e=>({onPointerDown:t=>{if(t.button!==0)return;t.preventDefault(),t.stopPropagation(),t.currentTarget.setPointerCapture(t.pointerId);let n=h.current.size,r={width:n.width,height:n.height};m.current={pointerId:t.pointerId,startX:t.clientX,startY:t.clientY,startSize:r,direction:e,lastSize:r},p(!0)},onPointerMove:_,onPointerUp:g,onPointerCancel:g,style:{touchAction:`none`}}),[_,g])}}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return n}});
@@ -1 +0,0 @@
1
- const e=require(`../chunk-Bmb41Sf3.cjs`);let t=require(`@tiptap/core`);const n=(e,t)=>!e.content||!Array.isArray(e.content)?e:{...e,content:e.content.filter(e=>!t.includes(e.type)).map(e=>n(e,t))},r=(e,r=[],i)=>{if(!i||e.length===0)return i;try{return(0,t.generateHTML)(n((0,t.generateJSON)(i,r),e),r)}catch(e){return console.error(`Failed to remove Tiptap nodes:`,e),i}},i=[`description`,`desc`];function a(e,t=[],n=[],a={}){let{default:o,fields:s=i}=a,c=o!==void 0;if(e===null)return null;if(e!==void 0){if(typeof e==`string`){let i=r(n,t,e);return c?i||o:i}return Array.isArray(e)?e.map(e=>{let i={};for(let a of s){if(!(a in e))continue;let s=e[a];if(s!=null&&typeof s!=`string`)continue;let l=s==null?s:r(n,t,s);i[a]=c?l||o:l}return Object.keys(i).length>0?{...e,...i}:e}):e}}const o=.75;function s(e){let{view:n,state:r}=e,{from:i,to:a}=r.selection,o=(0,t.posToDOMRect)(n,i,a),s=n.dom.getBoundingClientRect(),c=r.doc.content.size;return i<=1&&a>=c-1||o.height>=s.height*.75}function c(e){let{view:t,state:n}=e,{from:r,to:i}=n.selection,a=t.coordsAtPos(r),o=t.coordsAtPos(i),s=t.dom.getBoundingClientRect(),c=Math.max(s.top,0),l=Math.min(s.bottom,window.innerHeight),u=Math.min(a.top,o.top),d=Math.max(a.bottom,o.bottom),f=Math.max(u,c),p=Math.min(d,l),m=s.left,h=s.right,g=(f+p)/2;return new DOMRect(m,g,Math.max(h-m,0),0)}exports.isLargeTextSelection=s,exports.parseDescription=a,exports.removeNodes=r,exports.visibleSelectionRect=c;
@@ -1,21 +0,0 @@
1
- import { Editor, Extension, Node } from "@tiptap/core";
2
-
3
- //#region src/util/editor.d.ts
4
- declare const removeNodes: (nodeNames: string[], extensions?: Array<Extension | Node>, html?: string | null) => string | null | undefined;
5
- interface ParseOptions {
6
- default?: string | null;
7
- }
8
- interface ParseArrayOptions<F extends string> extends ParseOptions {
9
- fields?: readonly F[];
10
- }
11
- declare function parseDescription(input: string, extensions: Array<Extension | Node>, excludeNodes: string[], options?: ParseOptions): string;
12
- declare function parseDescription(input: null, extensions: Array<Extension | Node>, excludeNodes: string[], options?: ParseOptions): null;
13
- declare function parseDescription(input: undefined, extensions: Array<Extension | Node>, excludeNodes: string[], options?: ParseOptions): undefined;
14
- declare function parseDescription(input: string | null | undefined, extensions: Array<Extension | Node>, excludeNodes: string[], options?: ParseOptions): string | null | undefined;
15
- declare function parseDescription(input: string | null, extensions: Array<Extension | Node>, excludeNodes: string[], options?: ParseOptions): string | null;
16
- declare function parseDescription(input: string | undefined, extensions: Array<Extension | Node>, excludeNodes: string[], options?: ParseOptions): string | undefined;
17
- declare function parseDescription<T extends Record<string, any>>(input: T[], extensions: Array<Extension | Node>, excludeNodes: string[], options?: ParseArrayOptions<Extract<keyof T, string>>): T[];
18
- declare function isLargeTextSelection(editor: Editor): boolean;
19
- declare function visibleSelectionRect(editor: Editor): DOMRect;
20
- //#endregion
21
- export { isLargeTextSelection, parseDescription, removeNodes, visibleSelectionRect };
@@ -1,21 +0,0 @@
1
- import { Editor, Extension, Node } from "@tiptap/core";
2
-
3
- //#region src/util/editor.d.ts
4
- declare const removeNodes: (nodeNames: string[], extensions?: Array<Extension | Node>, html?: string | null) => string | null | undefined;
5
- interface ParseOptions {
6
- default?: string | null;
7
- }
8
- interface ParseArrayOptions<F extends string> extends ParseOptions {
9
- fields?: readonly F[];
10
- }
11
- declare function parseDescription(input: string, extensions: Array<Extension | Node>, excludeNodes: string[], options?: ParseOptions): string;
12
- declare function parseDescription(input: null, extensions: Array<Extension | Node>, excludeNodes: string[], options?: ParseOptions): null;
13
- declare function parseDescription(input: undefined, extensions: Array<Extension | Node>, excludeNodes: string[], options?: ParseOptions): undefined;
14
- declare function parseDescription(input: string | null | undefined, extensions: Array<Extension | Node>, excludeNodes: string[], options?: ParseOptions): string | null | undefined;
15
- declare function parseDescription(input: string | null, extensions: Array<Extension | Node>, excludeNodes: string[], options?: ParseOptions): string | null;
16
- declare function parseDescription(input: string | undefined, extensions: Array<Extension | Node>, excludeNodes: string[], options?: ParseOptions): string | undefined;
17
- declare function parseDescription<T extends Record<string, any>>(input: T[], extensions: Array<Extension | Node>, excludeNodes: string[], options?: ParseArrayOptions<Extract<keyof T, string>>): T[];
18
- declare function isLargeTextSelection(editor: Editor): boolean;
19
- declare function visibleSelectionRect(editor: Editor): DOMRect;
20
- //#endregion
21
- export { isLargeTextSelection, parseDescription, removeNodes, visibleSelectionRect };
@@ -1 +0,0 @@
1
- import{generateHTML as e,generateJSON as t,posToDOMRect as n}from"@tiptap/core";const r=(e,t)=>!e.content||!Array.isArray(e.content)?e:{...e,content:e.content.filter(e=>!t.includes(e.type)).map(e=>r(e,t))},i=(n,i=[],a)=>{if(!a||n.length===0)return a;try{return e(r(t(a,i),n),i)}catch(e){return console.error(`Failed to remove Tiptap nodes:`,e),a}},a=[`description`,`desc`];function o(e,t=[],n=[],r={}){let{default:o,fields:s=a}=r,c=o!==void 0;if(e===null)return null;if(e!==void 0){if(typeof e==`string`){let r=i(n,t,e);return c?r||o:r}return Array.isArray(e)?e.map(e=>{let r={};for(let a of s){if(!(a in e))continue;let s=e[a];if(s!=null&&typeof s!=`string`)continue;let l=s==null?s:i(n,t,s);r[a]=c?l||o:l}return Object.keys(r).length>0?{...e,...r}:e}):e}}function s(e){let{view:t,state:r}=e,{from:i,to:a}=r.selection,o=n(t,i,a),s=t.dom.getBoundingClientRect(),c=r.doc.content.size;return i<=1&&a>=c-1||o.height>=s.height*.75}function c(e){let{view:t,state:n}=e,{from:r,to:i}=n.selection,a=t.coordsAtPos(r),o=t.coordsAtPos(i),s=t.dom.getBoundingClientRect(),c=Math.max(s.top,0),l=Math.min(s.bottom,window.innerHeight),u=Math.min(a.top,o.top),d=Math.max(a.bottom,o.bottom),f=Math.max(u,c),p=Math.min(d,l),m=s.left,h=s.right,g=(f+p)/2;return new DOMRect(m,g,Math.max(h-m,0),0)}export{s as isLargeTextSelection,o as parseDescription,i as removeNodes,c as visibleSelectionRect};
File without changes
File without changes