@prosekit/react 0.7.1 → 0.7.2

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
- {"version":3,"file":"tooltip.js","names":[],"sources":["../src/components/tooltip/tooltip-popup.gen.ts","../src/components/tooltip/tooltip-positioner.gen.ts","../src/components/tooltip/tooltip-root.gen.ts","../src/components/tooltip/tooltip-trigger.gen.ts","../src/components/tooltip/index.ts"],"sourcesContent":["// This file is auto-generated by \"@aria-ui/cli\". Do not edit this file directly.\n\nimport { registerTooltipPopupElement, type TooltipPopupElement } from '@prosekit/web/tooltip';\nimport { createElement, forwardRef, useCallback, useRef, type ForwardedRef, type ForwardRefExoticComponent, type HTMLAttributes, type RefAttributes } from 'react';\n\n/** Props for the {@link TooltipPopup} React component. */\nexport interface TooltipPopupProps {}\n\nfunction TooltipPopupComponent(props: TooltipPopupProps, forwardedRef: ForwardedRef<TooltipPopupElement>) {\n registerTooltipPopupElement();\n\n const elementRef = useRef<TooltipPopupElement>(null);\n\n const { ...restProps } = props;\n\n const mergedRef = useCallback(\n (element: TooltipPopupElement | null) => {\n elementRef.current = element;\n if (typeof forwardedRef === 'function') {\n forwardedRef(element);\n } else if (forwardedRef) {\n forwardedRef.current = element;\n }\n },\n [forwardedRef],\n );\n\n return createElement('prosekit-tooltip-popup', { ...restProps, ref: mergedRef, suppressHydrationWarning: true });\n}\n\n/** A React component that renders an `prosekit-tooltip-popup` custom element. */\nexport const TooltipPopup: ForwardRefExoticComponent<TooltipPopupProps & HTMLAttributes<TooltipPopupElement> & RefAttributes<TooltipPopupElement>> = /* @__PURE__ */ forwardRef(TooltipPopupComponent);\n","// This file is auto-generated by \"@aria-ui/cli\". Do not edit this file directly.\n\nimport { registerTooltipPositionerElement, type TooltipPositionerElement, type TooltipPositionerProps as TooltipPositionerElementProps } from '@prosekit/web/tooltip';\nimport { createElement, forwardRef, useCallback, useRef, type ForwardedRef, type ForwardRefExoticComponent, type HTMLAttributes, type RefAttributes, useLayoutEffect } from 'react';\n\n/** Props for the {@link TooltipPositioner} React component. */\nexport interface TooltipPositionerProps {\n /**\n * The strategy to use for positioning\n *\n * @default \"absolute\"\n */\n strategy?: TooltipPositionerElementProps['strategy'];\n /**\n * The initial placement of the floating element\n *\n * @default \"top\"\n */\n placement?: TooltipPositionerElementProps['placement'];\n /**\n * Options to activate auto-update listeners\n *\n * @see https://floating-ui.com/docs/autoUpdate\n *\n * @default true\n */\n autoUpdate?: TooltipPositionerElementProps['autoUpdate'];\n /**\n * Whether to use the browser Popover API to place the floating element on\n * top of other page content.\n *\n * @default true\n */\n hoist?: TooltipPositionerElementProps['hoist'];\n /**\n * The distance between the reference and floating element.\n *\n * @default 6\n */\n offset?: TooltipPositionerElementProps['offset'];\n /**\n * Whether to flip the `placement` in order to keep it in view when the\n * preferred placement(s) will overflow the clipping boundary. You can also\n * provide an array of placements to try sequentially if the preferred\n * `placement` does not fit.\n *\n * @default true\n */\n flip?: TooltipPositionerElementProps['flip'];\n /**\n * Whether the floating element should shift to keep it in view.\n *\n * @default true\n */\n shift?: TooltipPositionerElementProps['shift'];\n /**\n * Whether the floating element can overlap the reference element to keep it\n * in view.\n *\n * @default false\n */\n overlap?: TooltipPositionerElementProps['overlap'];\n /**\n * Whether to constrain the floating element's width and height to not exceed\n * the viewport.\n *\n * @default false\n */\n fitViewport?: TooltipPositionerElementProps['fitViewport'];\n /**\n * Whether to constrain the floating element's width so that it matches the\n * reference element.\n *\n * @default false\n */\n sameWidth?: TooltipPositionerElementProps['sameWidth'];\n /**\n * Whether to constrain the floating element's height so that it matches the\n * reference element.\n *\n * @default false\n */\n sameHeight?: TooltipPositionerElementProps['sameHeight'];\n /**\n * Whether to improve positioning for inline reference elements that span over\n * multiple lines.\n *\n * @default false\n */\n inline?: TooltipPositionerElementProps['inline'];\n /**\n * Whether to hide the floating element when the reference element or the\n * floating element is fully clipped.\n *\n * @default false\n */\n hide?: TooltipPositionerElementProps['hide'];\n /**\n * Describes the clipping element(s) or area that overflow will be checked relative to.\n * Please see https://floating-ui.com/docs/detectoverflow#boundary for more information.\n *\n * @default 'clippingAncestors'\n */\n boundary?: TooltipPositionerElementProps['boundary'];\n /**\n * Describes the root boundary that the element will be checked for overflow relative to.\n * Please see https://floating-ui.com/docs/detectoverflow#rootboundary for more information.\n *\n * @default 'viewport'\n */\n rootBoundary?: TooltipPositionerElementProps['rootBoundary'];\n /**\n * Describes the virtual padding around the boundary to check for overflow.\n * Please see https://floating-ui.com/docs/detectoverflow#padding for more information.\n *\n * @default 4\n */\n overflowPadding?: TooltipPositionerElementProps['overflowPadding'];\n /**\n * The element that will be used to check for overflow. Please see\n * https://floating-ui.com/docs/detectoverflow#elementcontext for more\n * information.\n *\n * @default 'floating'\n */\n elementContext?: TooltipPositionerElementProps['elementContext'];\n /**\n * Whether to check the alternate elementContext's boundary. Please see\n * https://floating-ui.com/docs/detectoverflow#altboundary for more\n * information.\n *\n * @default false\n */\n altBoundary?: TooltipPositionerElementProps['altBoundary'];\n}\n\nfunction TooltipPositionerComponent(props: TooltipPositionerProps, forwardedRef: ForwardedRef<TooltipPositionerElement>) {\n registerTooltipPositionerElement();\n\n const elementRef = useRef<TooltipPositionerElement>(null);\n\n const { altBoundary: p0, autoUpdate: p1, boundary: p2, elementContext: p3, fitViewport: p4, flip: p5, hide: p6, hoist: p7, inline: p8, offset: p9, overflowPadding: p10, overlap: p11, placement: p12, rootBoundary: p13, sameHeight: p14, sameWidth: p15, shift: p16, strategy: p17, ...restProps } = props;\n\n useLayoutEffect(() => {\n const element = elementRef.current as Record<string, unknown> | null;\n if (!element) return;\n Object.assign(element, { altBoundary: p0, autoUpdate: p1, boundary: p2, elementContext: p3, fitViewport: p4, flip: p5, hide: p6, hoist: p7, inline: p8, offset: p9, overflowPadding: p10, overlap: p11, placement: p12, rootBoundary: p13, sameHeight: p14, sameWidth: p15, shift: p16, strategy: p17 });\n });\n\n const mergedRef = useCallback(\n (element: TooltipPositionerElement | null) => {\n elementRef.current = element;\n if (typeof forwardedRef === 'function') {\n forwardedRef(element);\n } else if (forwardedRef) {\n forwardedRef.current = element;\n }\n },\n [forwardedRef],\n );\n\n return createElement('prosekit-tooltip-positioner', { ...restProps, ref: mergedRef, suppressHydrationWarning: true });\n}\n\n/** A React component that renders an `prosekit-tooltip-positioner` custom element. */\nexport const TooltipPositioner: ForwardRefExoticComponent<TooltipPositionerProps & HTMLAttributes<TooltipPositionerElement> & RefAttributes<TooltipPositionerElement>> = /* @__PURE__ */ forwardRef(TooltipPositionerComponent);\n","// This file is auto-generated by \"@aria-ui/cli\". Do not edit this file directly.\n\nimport { registerTooltipRootElement, type TooltipRootElement, type TooltipRootProps as TooltipRootElementProps, type TooltipRootEvents } from '@prosekit/web/tooltip';\nimport { createElement, forwardRef, useCallback, useRef, type ForwardedRef, type ForwardRefExoticComponent, type HTMLAttributes, type RefAttributes, useLayoutEffect } from 'react';\n\n/** Props for the {@link TooltipRoot} React component. */\nexport interface TooltipRootProps {\n /**\n * Whether the overlay is initially open.\n * @default false\n */\n defaultOpen?: TooltipRootElementProps['defaultOpen'];\n /**\n * Whether the overlay is currently open.\n * @default null\n */\n open?: TooltipRootElementProps['open'];\n /**\n * Whether the component should ignore user interaction.\n * @default false\n */\n disabled?: TooltipRootElementProps['disabled'];\n /** Emitted when the tooltip is opened or closed. */\n onOpenChange?: (event: TooltipRootEvents['openChange']) => void;\n}\n\nfunction TooltipRootComponent(props: TooltipRootProps, forwardedRef: ForwardedRef<TooltipRootElement>) {\n registerTooltipRootElement();\n\n const elementRef = useRef<TooltipRootElement>(null);\n const handlersRef = useRef<Array<((event: Event) => void) | undefined>>([]);\n\n const { defaultOpen: p0, disabled: p1, open: p2, onOpenChange: e0, ...restProps } = props;\n\n useLayoutEffect(() => {\n const element = elementRef.current as Record<string, unknown> | null;\n if (!element) return;\n Object.assign(element, { defaultOpen: p0, disabled: p1, open: p2 });\n handlersRef.current = [e0] as Array<((event: Event) => void) | undefined>;\n });\n\n useLayoutEffect(() => {\n const element = elementRef.current;\n if (!element) return;\n const ac = new AbortController();\n for (const [index, eventName] of ['openChange'].entries()) {\n element.addEventListener(\n eventName,\n (event: Event) => {\n handlersRef.current[index]?.(event);\n },\n { signal: ac.signal },\n );\n }\n return () => ac.abort();\n }, []);\n\n const mergedRef = useCallback(\n (element: TooltipRootElement | null) => {\n elementRef.current = element;\n if (typeof forwardedRef === 'function') {\n forwardedRef(element);\n } else if (forwardedRef) {\n forwardedRef.current = element;\n }\n },\n [forwardedRef],\n );\n\n return createElement('prosekit-tooltip-root', { ...restProps, ref: mergedRef, suppressHydrationWarning: true });\n}\n\n/** A React component that renders an `prosekit-tooltip-root` custom element. */\nexport const TooltipRoot: ForwardRefExoticComponent<TooltipRootProps & HTMLAttributes<TooltipRootElement> & RefAttributes<TooltipRootElement>> = /* @__PURE__ */ forwardRef(TooltipRootComponent);\n","// This file is auto-generated by \"@aria-ui/cli\". Do not edit this file directly.\n\nimport { registerTooltipTriggerElement, type TooltipTriggerElement, type TooltipTriggerProps as TooltipTriggerElementProps } from '@prosekit/web/tooltip';\nimport { createElement, forwardRef, useCallback, useRef, type ForwardedRef, type ForwardRefExoticComponent, type HTMLAttributes, type RefAttributes, useLayoutEffect } from 'react';\n\n/** Props for the {@link TooltipTrigger} React component. */\nexport interface TooltipTriggerProps {\n /**\n * Whether the component should ignore user interaction.\n * @default false\n */\n disabled?: TooltipTriggerElementProps['disabled'];\n /**\n * The delay in milliseconds before opening the tooltip on hover.\n * @default 600\n */\n openDelay?: TooltipTriggerElementProps['openDelay'];\n /**\n * The delay in milliseconds before closing the tooltip when hover/focus ends.\n * @default 0\n */\n closeDelay?: TooltipTriggerElementProps['closeDelay'];\n}\n\nfunction TooltipTriggerComponent(props: TooltipTriggerProps, forwardedRef: ForwardedRef<TooltipTriggerElement>) {\n registerTooltipTriggerElement();\n\n const elementRef = useRef<TooltipTriggerElement>(null);\n\n const { closeDelay: p0, disabled: p1, openDelay: p2, ...restProps } = props;\n\n useLayoutEffect(() => {\n const element = elementRef.current as Record<string, unknown> | null;\n if (!element) return;\n Object.assign(element, { closeDelay: p0, disabled: p1, openDelay: p2 });\n });\n\n const mergedRef = useCallback(\n (element: TooltipTriggerElement | null) => {\n elementRef.current = element;\n if (typeof forwardedRef === 'function') {\n forwardedRef(element);\n } else if (forwardedRef) {\n forwardedRef.current = element;\n }\n },\n [forwardedRef],\n );\n\n return createElement('prosekit-tooltip-trigger', { ...restProps, ref: mergedRef, suppressHydrationWarning: true });\n}\n\n/** A React component that renders an `prosekit-tooltip-trigger` custom element. */\nexport const TooltipTrigger: ForwardRefExoticComponent<TooltipTriggerProps & HTMLAttributes<TooltipTriggerElement> & RefAttributes<TooltipTriggerElement>> = /* @__PURE__ */ forwardRef(TooltipTriggerComponent);\n","/**\n\n@module\n\n## Anatomy\n\n```jsx\nimport {\n TooltipPopup,\n TooltipPositioner,\n TooltipRoot,\n TooltipTrigger,\n} from 'prosekit/react/tooltip'\n\n<TooltipRoot>\n <TooltipTrigger>...</TooltipTrigger>\n <TooltipPositioner>\n <TooltipPopup>...</TooltipPopup>\n </TooltipPositioner>\n</TooltipRoot>\n```\n*/\n\n'use client'\n\nexport * from './index.gen.ts'\n"],"mappings":";;;AAQA,SAAS,sBAAsB,OAA0B,cAAiD;CACxG,6BAA6B;CAE7B,MAAM,aAAa,OAA4B,KAAK;CAEpD,MAAM,EAAE,GAAG,cAAc;CAEzB,MAAM,YAAY,aACf,YAAwC;EACvC,WAAW,UAAU;EACrB,IAAI,OAAO,iBAAiB,YAC1B,aAAa,QAAQ;OAChB,IAAI,cACT,aAAa,UAAU;IAG3B,CAAC,aAAa,CACf;CAED,OAAO,cAAc,0BAA0B;EAAE,GAAG;EAAW,KAAK;EAAW,0BAA0B;EAAM,CAAC;;;AAIlH,MAAa,eAAwJ,2BAAW,sBAAsB;ACyGtM,SAAS,2BAA2B,OAA+B,cAAsD;CACvH,kCAAkC;CAElC,MAAM,aAAa,OAAiC,KAAK;CAEz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;EACpB,MAAM,UAAU,WAAW;EAC3B,IAAI,CAAC,SAAS;EACd,MAAM,KAAK,IAAI,iBAAiB;EAChC,KAAK,MAAM,CAAC,OAAO,cAAc,CAAC,aAAa,CAAC,SAAS,EACvD,QAAQ,iBACN,YACC,UAAiB;GAChB,YAAY,QAAQ,SAAS,MAAM;KAErC,EAAE,QAAQ,GAAG,QAAQ,CACtB;EAEH,aAAa,GAAG,OAAO;IACtB,EAAE,CAAC;CAEN,MAAM,YAAY,aACf,YAAuC;EACtC,WAAW,UAAU;EACrB,IAAI,OAAO,iBAAiB,YAC1B,aAAa,QAAQ;OAChB,IAAI,cACT,aAAa,UAAU;IAG3B,CAAC,aAAa,CACf;CAED,OAAO,cAAc,yBAAyB;EAAE,GAAG;EAAW,KAAK;EAAW,0BAA0B;EAAM,CAAC;;;AAIjH,MAAa,cAAoJ,2BAAW,qBAAqB;ACjDjM,SAAS,wBAAwB,OAA4B,cAAmD;CAC9G,+BAA+B;CAE/B,MAAM,aAAa,OAA8B,KAAK;CAEtD,MAAM,EAAE,YAAY,IAAI,UAAU,IAAI,WAAW,IAAI,GAAG,cAAc;CAEtE,sBAAsB;EACpB,MAAM,UAAU,WAAW;EAC3B,IAAI,CAAC,SAAS;EACd,OAAO,OAAO,SAAS;GAAE,YAAY;GAAI,UAAU;GAAI,WAAW;GAAI,CAAC;GACvE;CAEF,MAAM,YAAY,aACf,YAA0C;EACzC,WAAW,UAAU;EACrB,IAAI,OAAO,iBAAiB,YAC1B,aAAa,QAAQ;OAChB,IAAI,cACT,aAAa,UAAU;IAG3B,CAAC,aAAa,CACf;CAED,OAAO,cAAc,4BAA4B;EAAE,GAAG;EAAW,KAAK;EAAW,0BAA0B;EAAM,CAAC;;;AAIpH,MAAa,iBAAgK,2BAAW,wBAAwB"}
1
+ {"version":3,"file":"tooltip.js","names":[],"sources":["../src/components/tooltip/tooltip-popup.gen.ts","../src/components/tooltip/tooltip-positioner.gen.ts","../src/components/tooltip/tooltip-root.gen.ts","../src/components/tooltip/tooltip-trigger.gen.ts","../src/components/tooltip/index.ts"],"sourcesContent":["// This file is auto-generated by \"@aria-ui/cli\". Do not edit this file directly.\n\nimport { registerTooltipPopupElement, type TooltipPopupElement } from '@prosekit/web/tooltip';\nimport { createElement, forwardRef, useCallback, useRef, type ForwardedRef, type ForwardRefExoticComponent, type HTMLAttributes, type RefAttributes } from 'react';\n\n/** Props for the {@link TooltipPopup} React component. */\nexport interface TooltipPopupProps {}\n\nfunction TooltipPopupComponent(props: TooltipPopupProps, forwardedRef: ForwardedRef<TooltipPopupElement>) {\n registerTooltipPopupElement();\n\n const elementRef = useRef<TooltipPopupElement>(null);\n\n const { ...restProps } = props;\n\n const mergedRef = useCallback(\n (element: TooltipPopupElement | null) => {\n elementRef.current = element;\n if (typeof forwardedRef === 'function') {\n forwardedRef(element);\n } else if (forwardedRef) {\n forwardedRef.current = element;\n }\n },\n [forwardedRef],\n );\n\n return createElement('prosekit-tooltip-popup', { ...restProps, ref: mergedRef, suppressHydrationWarning: true });\n}\n\n/** A React component that renders an `prosekit-tooltip-popup` custom element. */\nexport const TooltipPopup: ForwardRefExoticComponent<TooltipPopupProps & HTMLAttributes<TooltipPopupElement> & RefAttributes<TooltipPopupElement>> = /* @__PURE__ */ forwardRef(TooltipPopupComponent);\n","// This file is auto-generated by \"@aria-ui/cli\". Do not edit this file directly.\n\nimport { registerTooltipPositionerElement, type TooltipPositionerElement, type TooltipPositionerProps as TooltipPositionerElementProps } from '@prosekit/web/tooltip';\nimport { createElement, forwardRef, useCallback, useRef, type ForwardedRef, type ForwardRefExoticComponent, type HTMLAttributes, type RefAttributes, useLayoutEffect } from 'react';\n\n/** Props for the {@link TooltipPositioner} React component. */\nexport interface TooltipPositionerProps {\n /**\n * The strategy to use for positioning\n *\n * @default \"absolute\"\n */\n strategy?: TooltipPositionerElementProps['strategy'];\n /**\n * The initial placement of the floating element\n *\n * @default \"top\"\n */\n placement?: TooltipPositionerElementProps['placement'];\n /**\n * Options to activate auto-update listeners\n *\n * @see https://floating-ui.com/docs/autoUpdate\n *\n * @default true\n */\n autoUpdate?: TooltipPositionerElementProps['autoUpdate'];\n /**\n * Whether to use the browser Popover API to place the floating element on\n * top of other page content.\n *\n * @default true\n */\n hoist?: TooltipPositionerElementProps['hoist'];\n /**\n * The distance between the reference and floating element.\n *\n * @default 6\n */\n offset?: TooltipPositionerElementProps['offset'];\n /**\n * Whether to flip the `placement` in order to keep it in view when the\n * preferred placement(s) will overflow the clipping boundary. You can also\n * provide an array of placements to try sequentially if the preferred\n * `placement` does not fit.\n *\n * @default true\n */\n flip?: TooltipPositionerElementProps['flip'];\n /**\n * Whether the floating element should shift to keep it in view.\n *\n * @default true\n */\n shift?: TooltipPositionerElementProps['shift'];\n /**\n * Whether the floating element can overlap the reference element to keep it\n * in view.\n *\n * @default false\n */\n overlap?: TooltipPositionerElementProps['overlap'];\n /**\n * Whether to constrain the floating element's width and height to not exceed\n * the viewport.\n *\n * @default false\n */\n fitViewport?: TooltipPositionerElementProps['fitViewport'];\n /**\n * Whether to constrain the floating element's width so that it matches the\n * reference element.\n *\n * @default false\n */\n sameWidth?: TooltipPositionerElementProps['sameWidth'];\n /**\n * Whether to constrain the floating element's height so that it matches the\n * reference element.\n *\n * @default false\n */\n sameHeight?: TooltipPositionerElementProps['sameHeight'];\n /**\n * Whether to improve positioning for inline reference elements that span over\n * multiple lines.\n *\n * @default false\n */\n inline?: TooltipPositionerElementProps['inline'];\n /**\n * Whether to hide the floating element when the reference element or the\n * floating element is fully clipped.\n *\n * @default false\n */\n hide?: TooltipPositionerElementProps['hide'];\n /**\n * Describes the clipping element(s) or area that overflow will be checked relative to.\n * Please see https://floating-ui.com/docs/detectoverflow#boundary for more information.\n *\n * @default 'clippingAncestors'\n */\n boundary?: TooltipPositionerElementProps['boundary'];\n /**\n * Describes the root boundary that the element will be checked for overflow relative to.\n * Please see https://floating-ui.com/docs/detectoverflow#rootboundary for more information.\n *\n * @default 'viewport'\n */\n rootBoundary?: TooltipPositionerElementProps['rootBoundary'];\n /**\n * Describes the virtual padding around the boundary to check for overflow.\n * Please see https://floating-ui.com/docs/detectoverflow#padding for more information.\n *\n * @default 4\n */\n overflowPadding?: TooltipPositionerElementProps['overflowPadding'];\n /**\n * The element that will be used to check for overflow. Please see\n * https://floating-ui.com/docs/detectoverflow#elementcontext for more\n * information.\n *\n * @default 'floating'\n */\n elementContext?: TooltipPositionerElementProps['elementContext'];\n /**\n * Whether to check the alternate elementContext's boundary. Please see\n * https://floating-ui.com/docs/detectoverflow#altboundary for more\n * information.\n *\n * @default false\n */\n altBoundary?: TooltipPositionerElementProps['altBoundary'];\n}\n\nfunction TooltipPositionerComponent(props: TooltipPositionerProps, forwardedRef: ForwardedRef<TooltipPositionerElement>) {\n registerTooltipPositionerElement();\n\n const elementRef = useRef<TooltipPositionerElement>(null);\n\n const { altBoundary: p0, autoUpdate: p1, boundary: p2, elementContext: p3, fitViewport: p4, flip: p5, hide: p6, hoist: p7, inline: p8, offset: p9, overflowPadding: p10, overlap: p11, placement: p12, rootBoundary: p13, sameHeight: p14, sameWidth: p15, shift: p16, strategy: p17, ...restProps } = props;\n\n useLayoutEffect(() => {\n const element = elementRef.current as Record<string, unknown> | null;\n if (!element) return;\n Object.assign(element, { altBoundary: p0, autoUpdate: p1, boundary: p2, elementContext: p3, fitViewport: p4, flip: p5, hide: p6, hoist: p7, inline: p8, offset: p9, overflowPadding: p10, overlap: p11, placement: p12, rootBoundary: p13, sameHeight: p14, sameWidth: p15, shift: p16, strategy: p17 });\n });\n\n const mergedRef = useCallback(\n (element: TooltipPositionerElement | null) => {\n elementRef.current = element;\n if (typeof forwardedRef === 'function') {\n forwardedRef(element);\n } else if (forwardedRef) {\n forwardedRef.current = element;\n }\n },\n [forwardedRef],\n );\n\n return createElement('prosekit-tooltip-positioner', { ...restProps, ref: mergedRef, suppressHydrationWarning: true });\n}\n\n/** A React component that renders an `prosekit-tooltip-positioner` custom element. */\nexport const TooltipPositioner: ForwardRefExoticComponent<TooltipPositionerProps & HTMLAttributes<TooltipPositionerElement> & RefAttributes<TooltipPositionerElement>> = /* @__PURE__ */ forwardRef(TooltipPositionerComponent);\n","// This file is auto-generated by \"@aria-ui/cli\". Do not edit this file directly.\n\nimport { registerTooltipRootElement, type TooltipRootElement, type TooltipRootProps as TooltipRootElementProps, type TooltipRootEvents } from '@prosekit/web/tooltip';\nimport { createElement, forwardRef, useCallback, useRef, type ForwardedRef, type ForwardRefExoticComponent, type HTMLAttributes, type RefAttributes, useLayoutEffect } from 'react';\n\n/** Props for the {@link TooltipRoot} React component. */\nexport interface TooltipRootProps {\n /**\n * Whether the overlay is initially open.\n * @default false\n */\n defaultOpen?: TooltipRootElementProps['defaultOpen'];\n /**\n * Whether the overlay is currently open.\n * @default null\n */\n open?: TooltipRootElementProps['open'];\n /**\n * Whether the component should ignore user interaction.\n * @default false\n */\n disabled?: TooltipRootElementProps['disabled'];\n /** Emitted when the tooltip is opened or closed. */\n onOpenChange?: (event: TooltipRootEvents['openChange']) => void;\n}\n\nfunction TooltipRootComponent(props: TooltipRootProps, forwardedRef: ForwardedRef<TooltipRootElement>) {\n registerTooltipRootElement();\n\n const elementRef = useRef<TooltipRootElement>(null);\n const handlersRef = useRef<Array<((event: Event) => void) | undefined>>([]);\n\n const { defaultOpen: p0, disabled: p1, open: p2, onOpenChange: e0, ...restProps } = props;\n\n useLayoutEffect(() => {\n const element = elementRef.current as Record<string, unknown> | null;\n if (!element) return;\n Object.assign(element, { defaultOpen: p0, disabled: p1, open: p2 });\n handlersRef.current = [e0] as Array<((event: Event) => void) | undefined>;\n });\n\n useLayoutEffect(() => {\n const element = elementRef.current;\n if (!element) return;\n const ac = new AbortController();\n for (const [index, eventName] of ['openChange'].entries()) {\n element.addEventListener(\n eventName,\n (event: Event) => {\n handlersRef.current[index]?.(event);\n },\n { signal: ac.signal },\n );\n }\n return () => ac.abort();\n }, []);\n\n const mergedRef = useCallback(\n (element: TooltipRootElement | null) => {\n elementRef.current = element;\n if (typeof forwardedRef === 'function') {\n forwardedRef(element);\n } else if (forwardedRef) {\n forwardedRef.current = element;\n }\n },\n [forwardedRef],\n );\n\n return createElement('prosekit-tooltip-root', { ...restProps, ref: mergedRef, suppressHydrationWarning: true });\n}\n\n/** A React component that renders an `prosekit-tooltip-root` custom element. */\nexport const TooltipRoot: ForwardRefExoticComponent<TooltipRootProps & HTMLAttributes<TooltipRootElement> & RefAttributes<TooltipRootElement>> = /* @__PURE__ */ forwardRef(TooltipRootComponent);\n","// This file is auto-generated by \"@aria-ui/cli\". Do not edit this file directly.\n\nimport { registerTooltipTriggerElement, type TooltipTriggerElement, type TooltipTriggerProps as TooltipTriggerElementProps } from '@prosekit/web/tooltip';\nimport { createElement, forwardRef, useCallback, useRef, type ForwardedRef, type ForwardRefExoticComponent, type HTMLAttributes, type RefAttributes, useLayoutEffect } from 'react';\n\n/** Props for the {@link TooltipTrigger} React component. */\nexport interface TooltipTriggerProps {\n /**\n * Whether the component should ignore user interaction.\n * @default false\n */\n disabled?: TooltipTriggerElementProps['disabled'];\n /**\n * The delay in milliseconds before opening the tooltip on hover.\n * @default 600\n */\n openDelay?: TooltipTriggerElementProps['openDelay'];\n /**\n * The delay in milliseconds before closing the tooltip when hover/focus ends.\n * @default 0\n */\n closeDelay?: TooltipTriggerElementProps['closeDelay'];\n}\n\nfunction TooltipTriggerComponent(props: TooltipTriggerProps, forwardedRef: ForwardedRef<TooltipTriggerElement>) {\n registerTooltipTriggerElement();\n\n const elementRef = useRef<TooltipTriggerElement>(null);\n\n const { closeDelay: p0, disabled: p1, openDelay: p2, ...restProps } = props;\n\n useLayoutEffect(() => {\n const element = elementRef.current as Record<string, unknown> | null;\n if (!element) return;\n Object.assign(element, { closeDelay: p0, disabled: p1, openDelay: p2 });\n });\n\n const mergedRef = useCallback(\n (element: TooltipTriggerElement | null) => {\n elementRef.current = element;\n if (typeof forwardedRef === 'function') {\n forwardedRef(element);\n } else if (forwardedRef) {\n forwardedRef.current = element;\n }\n },\n [forwardedRef],\n );\n\n return createElement('prosekit-tooltip-trigger', { ...restProps, ref: mergedRef, suppressHydrationWarning: true });\n}\n\n/** A React component that renders an `prosekit-tooltip-trigger` custom element. */\nexport const TooltipTrigger: ForwardRefExoticComponent<TooltipTriggerProps & HTMLAttributes<TooltipTriggerElement> & RefAttributes<TooltipTriggerElement>> = /* @__PURE__ */ forwardRef(TooltipTriggerComponent);\n","/**\n\n@module\n\n## Anatomy\n\n```jsx\nimport {\n TooltipPopup,\n TooltipPositioner,\n TooltipRoot,\n TooltipTrigger,\n} from 'prosekit/react/tooltip'\n\n<TooltipRoot>\n <TooltipTrigger>...</TooltipTrigger>\n <TooltipPositioner>\n <TooltipPopup>...</TooltipPopup>\n </TooltipPositioner>\n</TooltipRoot>\n```\n*/\n\n'use client'\n\nexport * from './index.gen.ts'\n"],"mappings":";;;AAQA,SAAS,sBAAsB,OAA0B,cAAiD;CACxG,4BAA4B;CAE5B,MAAM,aAAa,OAA4B,IAAI;CAEnD,MAAM,EAAE,GAAG,cAAc;CAEzB,MAAM,YAAY,aACf,YAAwC;EACvC,WAAW,UAAU;EACrB,IAAI,OAAO,iBAAiB,YAC1B,aAAa,OAAO;OACf,IAAI,cACT,aAAa,UAAU;CAE3B,GACA,CAAC,YAAY,CACf;CAEA,OAAO,cAAc,0BAA0B;EAAE,GAAG;EAAW,KAAK;EAAW,0BAA0B;CAAK,CAAC;AACjH;;AAGA,MAAa,eAAwJ,2BAAW,qBAAqB;ACyGrM,SAAS,2BAA2B,OAA+B,cAAsD;CACvH,iCAAiC;CAEjC,MAAM,aAAa,OAAiC,IAAI;CAExD,MAAM,EAAE,aAAa,IAAI,YAAY,IAAI,UAAU,IAAI,gBAAgB,IAAI,aAAa,IAAI,MAAM,IAAI,MAAM,IAAI,OAAO,IAAI,QAAQ,IAAI,QAAQ,IAAI,iBAAiB,KAAK,SAAS,KAAK,WAAW,KAAK,cAAc,KAAK,YAAY,KAAK,WAAW,KAAK,OAAO,KAAK,UAAU,KAAK,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E,QAAQ,GAAG,OAAO,CACtB;EAEF,aAAa,GAAG,MAAM;CACxB,GAAG,CAAC,CAAC;CAEL,MAAM,YAAY,aACf,YAAuC;EACtC,WAAW,UAAU;EACrB,IAAI,OAAO,iBAAiB,YAC1B,aAAa,OAAO;OACf,IAAI,cACT,aAAa,UAAU;CAE3B,GACA,CAAC,YAAY,CACf;CAEA,OAAO,cAAc,yBAAyB;EAAE,GAAG;EAAW,KAAK;EAAW,0BAA0B;CAAK,CAAC;AAChH;;AAGA,MAAa,cAAoJ,2BAAW,oBAAoB;ACjDhM,SAAS,wBAAwB,OAA4B,cAAmD;CAC9G,8BAA8B;CAE9B,MAAM,aAAa,OAA8B,IAAI;CAErD,MAAM,EAAE,YAAY,IAAI,UAAU,IAAI,WAAW,IAAI,GAAG,cAAc;CAEtE,sBAAsB;EACpB,MAAM,UAAU,WAAW;EAC3B,IAAI,CAAC,SAAS;EACd,OAAO,OAAO,SAAS;GAAE,YAAY;GAAI,UAAU;GAAI,WAAW;EAAG,CAAC;CACxE,CAAC;CAED,MAAM,YAAY,aACf,YAA0C;EACzC,WAAW,UAAU;EACrB,IAAI,OAAO,iBAAiB,YAC1B,aAAa,OAAO;OACf,IAAI,cACT,aAAa,UAAU;CAE3B,GACA,CAAC,YAAY,CACf;CAEA,OAAO,cAAc,4BAA4B;EAAE,GAAG;EAAW,KAAK;EAAW,0BAA0B;CAAK,CAAC;AACnH;;AAGA,MAAa,iBAAgK,2BAAW,uBAAuB"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/react",
3
3
  "type": "module",
4
- "version": "0.7.1",
4
+ "version": "0.7.2",
5
5
  "private": false,
6
6
  "description": "React components and utilities for ProseKit",
7
7
  "author": {
@@ -74,9 +74,9 @@
74
74
  "dependencies": {
75
75
  "@prosemirror-adapter/core": "^0.5.3",
76
76
  "@prosemirror-adapter/react": "^0.5.3",
77
- "@prosekit/core": "^0.12.0",
78
- "@prosekit/web": "^0.8.1",
79
- "@prosekit/pm": "^0.1.16"
77
+ "@prosekit/core": "^0.12.1",
78
+ "@prosekit/pm": "^0.1.17",
79
+ "@prosekit/web": "^0.8.2"
80
80
  },
81
81
  "peerDependencies": {
82
82
  "react": ">= 18.2.0",
@@ -97,11 +97,11 @@
97
97
  "react-dom": "^19.2.6",
98
98
  "tsdown": "^0.22.0",
99
99
  "typescript": "~6.0.3",
100
- "vitest": "^4.1.5",
100
+ "vitest": "^4.1.6",
101
101
  "vitest-browser-react": "^2.2.0",
102
102
  "@prosekit/config-ts": "0.0.0",
103
- "@prosekit/config-vitest": "0.0.0",
104
103
  "@prosekit/config-tsdown": "0.0.0",
104
+ "@prosekit/config-vitest": "0.0.0",
105
105
  "@prosekit/testing": "0.0.0"
106
106
  },
107
107
  "scripts": {
@@ -12,8 +12,6 @@ export interface ProseKitProps {
12
12
 
13
13
  /**
14
14
  * The root component for a ProseKit editor.
15
- *
16
- * @public
17
15
  */
18
16
  export const ProseKit: ComponentType<ProseKitProps> = (props) => {
19
17
  const { editor, children } = props
@@ -9,20 +9,12 @@ import {
9
9
  import { createElement, type ComponentType, type ReactPortal } from 'react'
10
10
  import { createPortal } from 'react-dom'
11
11
 
12
- /**
13
- * @public
14
- */
15
12
  export interface ReactMarkViewProps extends MarkViewContext {}
16
13
 
17
- /**
18
- * @public
19
- */
20
14
  export type ReactMarkViewComponent = ComponentType<ReactMarkViewProps>
21
15
 
22
16
  /**
23
17
  * Options for {@link defineReactMarkView}.
24
- *
25
- * @public
26
18
  */
27
19
  export interface ReactMarkViewOptions extends CoreMarkViewUserOptions<ReactMarkViewComponent> {
28
20
  /**
@@ -59,8 +51,6 @@ export function defineReactMarkViewFactory(
59
51
 
60
52
  /**
61
53
  * Defines a mark view using a React component.
62
- *
63
- * @public
64
54
  */
65
55
  export function defineReactMarkView(options: ReactMarkViewOptions): Extension {
66
56
  return defineMarkViewComponent<ReactMarkViewOptions>({
@@ -1,5 +1,3 @@
1
- /* eslint-disable @eslint-react/component-hook-factories */
2
-
3
1
  import { createEditor, union, type NodeJSON } from '@prosekit/core'
4
2
  import { defineTestExtension, type ImageAttrs } from '@prosekit/testing'
5
3
  import { createElement, useEffect, useState } from 'react'
@@ -9,20 +9,12 @@ import {
9
9
  import { createElement, type ComponentType, type ReactPortal } from 'react'
10
10
  import { createPortal } from 'react-dom'
11
11
 
12
- /**
13
- * @public
14
- */
15
12
  export interface ReactNodeViewProps extends NodeViewContext {}
16
13
 
17
- /**
18
- * @public
19
- */
20
14
  export type ReactNodeViewComponent = ComponentType<ReactNodeViewProps>
21
15
 
22
16
  /**
23
17
  * Options for {@link defineReactNodeView}.
24
- *
25
- * @public
26
18
  */
27
19
  export interface ReactNodeViewOptions extends CoreNodeViewUserOptions<ReactNodeViewComponent> {
28
20
  /**
@@ -59,8 +51,6 @@ export function defineReactNodeViewFactory(
59
51
 
60
52
  /**
61
53
  * Defines a node view using a React component.
62
- *
63
- * @public
64
54
  */
65
55
  export function defineReactNodeView(options: ReactNodeViewOptions): Extension {
66
56
  return defineNodeViewComponent<ReactNodeViewOptions>({
@@ -7,8 +7,6 @@ import { useExtension, type UseExtensionOptions } from './use-extension.ts'
7
7
 
8
8
  /**
9
9
  * Calls the given handler whenever the editor document changes.
10
- *
11
- * @public
12
10
  */
13
11
  export function useDocChange(
14
12
  handler: (doc: ProseMirrorNode) => void,
@@ -19,8 +19,6 @@ export interface UseEditorDerivedOptions<E extends Extension = any> {
19
19
  * for example, whether the selected text is wrapped in an italic mark.
20
20
  *
21
21
  * It returns the derived value that updates whenever the editor state changes.
22
- *
23
- * @public
24
22
  */
25
23
  export function useEditorDerivedValue<E extends Extension, Derived>(
26
24
  /**
@@ -5,8 +5,6 @@ import { useEditorContext } from '../contexts/editor-context.ts'
5
5
 
6
6
  /**
7
7
  * Retrieves the editor instance from the nearest ProseKit component.
8
- *
9
- * @public
10
8
  */
11
9
  export function useEditor<E extends Extension = any>(options?: {
12
10
  /**
@@ -7,8 +7,6 @@ import { useExtension, type UseExtensionOptions } from './use-extension.ts'
7
7
 
8
8
  /**
9
9
  * Calls the given handler whenever the editor state changes.
10
- *
11
- * @public
12
10
  */
13
11
  export function useStateUpdate(
14
12
  handler: (state: EditorState) => void,