@prosekit/react 0.6.1 → 0.6.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.
Files changed (39) hide show
  1. package/dist/{create-component-CBvs05W1.js → create-component-DzdxL6Ne.js} +4 -3
  2. package/dist/{create-component-CBvs05W1.js.map → create-component-DzdxL6Ne.js.map} +1 -1
  3. package/dist/{create-props-EGV61dJR.d.ts → create-props-DTgCRwCm.d.ts} +2 -2
  4. package/dist/create-props-DTgCRwCm.d.ts.map +1 -0
  5. package/dist/{editor-context-Cci4uqN_.js → editor-context-cG0zkv13.js} +2 -2
  6. package/dist/{editor-context-Cci4uqN_.js.map → editor-context-cG0zkv13.js.map} +1 -1
  7. package/dist/prosekit-react-autocomplete.d.ts +1 -1
  8. package/dist/prosekit-react-autocomplete.d.ts.map +1 -1
  9. package/dist/prosekit-react-autocomplete.js +2 -2
  10. package/dist/prosekit-react-block-handle.d.ts +1 -1
  11. package/dist/prosekit-react-block-handle.d.ts.map +1 -1
  12. package/dist/prosekit-react-block-handle.js +2 -2
  13. package/dist/prosekit-react-drop-indicator.d.ts +1 -1
  14. package/dist/prosekit-react-drop-indicator.d.ts.map +1 -1
  15. package/dist/prosekit-react-drop-indicator.js +2 -2
  16. package/dist/prosekit-react-inline-popover.d.ts +1 -1
  17. package/dist/prosekit-react-inline-popover.d.ts.map +1 -1
  18. package/dist/prosekit-react-inline-popover.js +2 -2
  19. package/dist/prosekit-react-popover.d.ts +1 -1
  20. package/dist/prosekit-react-popover.d.ts.map +1 -1
  21. package/dist/prosekit-react-popover.js +2 -2
  22. package/dist/prosekit-react-resizable.d.ts +1 -1
  23. package/dist/prosekit-react-resizable.d.ts.map +1 -1
  24. package/dist/prosekit-react-resizable.js +2 -2
  25. package/dist/prosekit-react-table-handle.d.ts +1 -1
  26. package/dist/prosekit-react-table-handle.d.ts.map +1 -1
  27. package/dist/prosekit-react-table-handle.js +2 -2
  28. package/dist/prosekit-react-tooltip.d.ts +1 -1
  29. package/dist/prosekit-react-tooltip.d.ts.map +1 -1
  30. package/dist/prosekit-react-tooltip.js +2 -2
  31. package/dist/prosekit-react.d.ts +6 -12
  32. package/dist/prosekit-react.d.ts.map +1 -1
  33. package/dist/prosekit-react.js +21 -28
  34. package/dist/prosekit-react.js.map +1 -1
  35. package/package.json +12 -12
  36. package/src/components/create-component.ts +7 -3
  37. package/src/hooks/use-editor-derived-value.ts +6 -4
  38. package/src/hooks/use-extension.ts +1 -1
  39. package/dist/create-props-EGV61dJR.d.ts.map +0 -1
@@ -1,4 +1,4 @@
1
- import { useEditorContext } from "./editor-context-Cci4uqN_.js";
1
+ import { n as useEditorContext } from "./editor-context-cG0zkv13.js";
2
2
  import { createElement, forwardRef, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
3
3
 
4
4
  //#region src/components/merge-refs.ts
@@ -83,6 +83,7 @@ function createComponent(tagName, displayName, propNames, eventNames) {
83
83
  const mergedRef = useMemo(() => mergeRefs([ref, setEl]), [ref]);
84
84
  return createElement(tagName, {
85
85
  ...attributes,
86
+ suppressHydrationWarning: true,
86
87
  ref: mergedRef
87
88
  });
88
89
  });
@@ -91,5 +92,5 @@ function createComponent(tagName, displayName, propNames, eventNames) {
91
92
  }
92
93
 
93
94
  //#endregion
94
- export { createComponent };
95
- //# sourceMappingURL=create-component-CBvs05W1.js.map
95
+ export { createComponent as t };
96
+ //# sourceMappingURL=create-component-DzdxL6Ne.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-component-CBvs05W1.js","names":["cleanups: VoidFunction[]","properties: Record<string, unknown>","attributes: Record<string, unknown>","eventHandlers: Record<string, AnyFunction>","fixedEventHandlers: Record<string, AnyFunction>"],"sources":["../src/components/merge-refs.ts","../src/components/create-component.ts"],"sourcesContent":["import type { Ref } from 'react'\n\n/**\n * Assigns a value to a ref.\n * @returns The ref cleanup callback, if any.\n */\nfunction assignRef<T>(\n ref: Ref<T> | undefined,\n value: T | null,\n): VoidFunction | undefined | void {\n if (typeof ref === 'function') {\n return ref(value)\n } else if (ref) {\n ref.current = value\n }\n}\n\n/**\n * Merges multiple refs into a single one.\n */\nexport function mergeRefs<T>(refs: (Ref<T> | undefined)[]): Ref<T> {\n return (value: T | null) => {\n const cleanups: VoidFunction[] = []\n\n for (const ref of refs) {\n const cleanup = assignRef(ref, value)\n const isCleanup = typeof cleanup === 'function'\n cleanups.push(isCleanup ? cleanup : () => assignRef(ref, null))\n }\n\n return () => {\n for (const cleanup of cleanups) cleanup()\n }\n }\n}\n","import type { AnyFunction } from '@prosekit/core'\nimport {\n createElement,\n forwardRef,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type ForwardRefExoticComponent,\n type HTMLAttributes,\n type RefAttributes,\n} from 'react'\n\nimport { useEditorContext } from '../contexts/editor-context'\n\nimport { mergeRefs } from './merge-refs'\n\nconst useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect\n\nexport function createComponent<\n Props extends object,\n CustomElement extends HTMLElement,\n>(\n tagName: string,\n displayName: string,\n propNames: string[],\n eventNames: string[],\n): ForwardRefExoticComponent<\n Partial<Props> & RefAttributes<CustomElement> & HTMLAttributes<CustomElement>\n> {\n const hasEditor = propNames.includes('editor')\n const lowerCaseEventNameMap = new Map(\n eventNames.map((name) => [name.toLowerCase(), name]),\n )\n\n const Component = forwardRef<any, any>((props: Props, ref) => {\n const [el, setEl] = useState<HTMLElement | null>(null)\n\n const properties: Record<string, unknown> = {}\n const attributes: Record<string, unknown> = {}\n const eventHandlersRef = useRef<Record<string, AnyFunction>>({})\n const eventHandlers: Record<string, AnyFunction> = {}\n\n for (const [name, value] of Object.entries(props)) {\n if (value === undefined) {\n continue\n }\n\n if (propNames.includes(name)) {\n properties[name] = value\n continue\n }\n\n if (name.startsWith('on')) {\n const lowerCaseEventName = name.slice(2).toLowerCase()\n const eventName = lowerCaseEventNameMap.get(lowerCaseEventName)\n if (eventName) {\n const extractDetail = eventName.endsWith('Change')\n eventHandlers[eventName] = (event: Event) => {\n const handler = value as AnyFunction | null\n if (typeof handler === 'function') {\n handler(extractDetail ? (event as CustomEvent).detail : event)\n }\n }\n continue\n }\n }\n\n if (name === 'className') {\n attributes['class'] = value\n } else {\n attributes[name] = value\n }\n }\n\n const editor = useEditorContext()\n\n if (hasEditor && editor && !properties['editor']) {\n properties['editor'] = editor\n }\n\n // Set all properties.\n useIsomorphicLayoutEffect(() => {\n if (!el) return\n for (const [name, value] of Object.entries(properties)) {\n if (value !== undefined) {\n // @ts-expect-error: we know that name is a valid property name\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, react-compiler/react-compiler\n el[name] = value as unknown as any\n }\n }\n }, [el, ...propNames.map((name) => properties[name])])\n\n // Put all event listeners extracted from `props` into `eventHandlersRef`.\n useIsomorphicLayoutEffect(() => {\n eventHandlersRef.current = eventHandlers\n })\n\n // Register the event listeners to the element.\n useIsomorphicLayoutEffect(() => {\n if (!el) {\n return\n }\n\n const fixedEventHandlers: Record<string, AnyFunction> = {}\n\n for (const eventName of eventNames) {\n fixedEventHandlers[eventName] = (event: Event) => {\n eventHandlersRef.current[eventName]?.(event)\n }\n }\n\n for (const [name, handler] of Object.entries(fixedEventHandlers)) {\n el.addEventListener(name, handler)\n }\n\n return () => {\n for (const [name, handler] of Object.entries(fixedEventHandlers)) {\n el.removeEventListener(name, handler)\n }\n }\n }, [el])\n\n const mergedRef = useMemo(() => mergeRefs([ref, setEl]), [ref])\n\n return createElement(tagName, { ...attributes, ref: mergedRef })\n })\n\n Component.displayName = displayName\n\n return Component\n}\n"],"mappings":";;;;;;;;AAMA,SAAS,UACP,KACA,OACiC;AACjC,KAAI,OAAO,QAAQ,WACjB,QAAO,IAAI,MAAM;UACR,IACT,KAAI,UAAU;;;;;AAOlB,SAAgB,UAAa,MAAsC;AACjE,SAAQ,UAAoB;EAC1B,MAAMA,WAA2B,EAAE;AAEnC,OAAK,MAAM,OAAO,MAAM;GACtB,MAAM,UAAU,UAAU,KAAK,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MAAM,UAAU,OAAO,QAAQ,WAAW,CACpD,KAAI,UAAU,OAGZ,IAAG,QAAQ;KAGd,CAAC,IAAI,GAAG,UAAU,KAAK,SAAS,WAAW,MAAM,CAAC,CAAC;AAGtD,kCAAgC;AAC9B,oBAAiB,UAAU;IAC3B;AAGF,kCAAgC;AAC9B,OAAI,CAAC,GACH;GAGF,MAAMC,qBAAkD,EAAE;AAE1D,QAAK,MAAM,aAAa,WACtB,oBAAmB,cAAc,UAAiB;AAChD,qBAAiB,QAAQ,aAAa,MAAM;;AAIhD,QAAK,MAAM,CAAC,MAAM,YAAY,OAAO,QAAQ,mBAAmB,CAC9D,IAAG,iBAAiB,MAAM,QAAQ;AAGpC,gBAAa;AACX,SAAK,MAAM,CAAC,MAAM,YAAY,OAAO,QAAQ,mBAAmB,CAC9D,IAAG,oBAAoB,MAAM,QAAQ;;KAGxC,CAAC,GAAG,CAAC;EAER,MAAM,YAAY,cAAc,UAAU,CAAC,KAAK,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC;AAE/D,SAAO,cAAc,SAAS;GAAE,GAAG;GAAY,KAAK;GAAW,CAAC;GAChE;AAEF,WAAU,cAAc;AAExB,QAAO"}
1
+ {"version":3,"file":"create-component-DzdxL6Ne.js","names":["cleanups: VoidFunction[]","properties: Record<string, unknown>","attributes: Record<string, unknown>","eventHandlers: Record<string, AnyFunction>","fixedEventHandlers: Record<string, AnyFunction>"],"sources":["../src/components/merge-refs.ts","../src/components/create-component.ts"],"sourcesContent":["import type { Ref } from 'react'\n\n/**\n * Assigns a value to a ref.\n * @returns The ref cleanup callback, if any.\n */\nfunction assignRef<T>(\n ref: Ref<T> | undefined,\n value: T | null,\n): VoidFunction | undefined | void {\n if (typeof ref === 'function') {\n return ref(value)\n } else if (ref) {\n ref.current = value\n }\n}\n\n/**\n * Merges multiple refs into a single one.\n */\nexport function mergeRefs<T>(refs: (Ref<T> | undefined)[]): Ref<T> {\n return (value: T | null) => {\n const cleanups: VoidFunction[] = []\n\n for (const ref of refs) {\n const cleanup = assignRef(ref, value)\n const isCleanup = typeof cleanup === 'function'\n cleanups.push(isCleanup ? cleanup : () => assignRef(ref, null))\n }\n\n return () => {\n for (const cleanup of cleanups) cleanup()\n }\n }\n}\n","import type { AnyFunction } from '@prosekit/core'\nimport {\n createElement,\n forwardRef,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type ForwardRefExoticComponent,\n type HTMLAttributes,\n type RefAttributes,\n} from 'react'\n\nimport { useEditorContext } from '../contexts/editor-context'\n\nimport { mergeRefs } from './merge-refs'\n\nconst useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect\n\nexport function createComponent<\n Props extends object,\n CustomElement extends HTMLElement,\n>(\n tagName: string,\n displayName: string,\n propNames: string[],\n eventNames: string[],\n): ForwardRefExoticComponent<\n Partial<Props> & RefAttributes<CustomElement> & HTMLAttributes<CustomElement>\n> {\n const hasEditor = propNames.includes('editor')\n const lowerCaseEventNameMap = new Map(\n eventNames.map((name) => [name.toLowerCase(), name]),\n )\n\n const Component = forwardRef<any, any>((props: Props, ref) => {\n const [el, setEl] = useState<HTMLElement | null>(null)\n\n const properties: Record<string, unknown> = {}\n const attributes: Record<string, unknown> = {}\n const eventHandlersRef = useRef<Record<string, AnyFunction>>({})\n const eventHandlers: Record<string, AnyFunction> = {}\n\n for (const [name, value] of Object.entries(props)) {\n if (value === undefined) {\n continue\n }\n\n if (propNames.includes(name)) {\n properties[name] = value\n continue\n }\n\n if (name.startsWith('on')) {\n const lowerCaseEventName = name.slice(2).toLowerCase()\n const eventName = lowerCaseEventNameMap.get(lowerCaseEventName)\n if (eventName) {\n const extractDetail = eventName.endsWith('Change')\n eventHandlers[eventName] = (event: Event) => {\n const handler = value as AnyFunction | null\n if (typeof handler === 'function') {\n handler(extractDetail ? (event as CustomEvent).detail : event)\n }\n }\n continue\n }\n }\n\n if (name === 'className') {\n attributes['class'] = value\n } else {\n attributes[name] = value\n }\n }\n\n const editor = useEditorContext()\n\n if (hasEditor && editor && !properties['editor']) {\n properties['editor'] = editor\n }\n\n // Set all properties.\n useIsomorphicLayoutEffect(() => {\n if (!el) return\n for (const [name, value] of Object.entries(properties)) {\n if (value !== undefined) {\n // @ts-expect-error: we know that name is a valid property name\n el[name] = value as unknown\n }\n }\n }, [el, ...propNames.map((name) => properties[name])])\n\n // Put all event listeners extracted from `props` into `eventHandlersRef`.\n useIsomorphicLayoutEffect(() => {\n eventHandlersRef.current = eventHandlers\n })\n\n // Register the event listeners to the element.\n useIsomorphicLayoutEffect(() => {\n if (!el) {\n return\n }\n\n const fixedEventHandlers: Record<string, AnyFunction> = {}\n\n for (const eventName of eventNames) {\n fixedEventHandlers[eventName] = (event: Event) => {\n eventHandlersRef.current[eventName]?.(event)\n }\n }\n\n for (const [name, handler] of Object.entries(fixedEventHandlers)) {\n el.addEventListener(name, handler)\n }\n\n return () => {\n for (const [name, handler] of Object.entries(fixedEventHandlers)) {\n el.removeEventListener(name, handler)\n }\n }\n }, [el])\n\n const mergedRef = useMemo(() => mergeRefs([ref, setEl]), [ref])\n\n return createElement(tagName, {\n ...attributes,\n // Suppress hydration warnings for web components as the attributes are set after the component is mounted.\n suppressHydrationWarning: true,\n ref: mergedRef,\n })\n })\n\n Component.displayName = displayName\n\n return Component\n}\n"],"mappings":";;;;;;;;AAMA,SAAS,UACP,KACA,OACiC;AACjC,KAAI,OAAO,QAAQ,WACjB,QAAO,IAAI,MAAM;UACR,IACT,KAAI,UAAU;;;;;AAOlB,SAAgB,UAAa,MAAsC;AACjE,SAAQ,UAAoB;EAC1B,MAAMA,WAA2B,EAAE;AAEnC,OAAK,MAAM,OAAO,MAAM;GACtB,MAAM,UAAU,UAAU,KAAK,MAAM;GACrC,MAAM,YAAY,OAAO,YAAY;AACrC,YAAS,KAAK,YAAY,gBAAgB,UAAU,KAAK,KAAK,CAAC;;AAGjE,eAAa;AACX,QAAK,MAAM,WAAW,SAAU,UAAS;;;;;;;ACb/C,MAAM,4BA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,UAAU;IAC3B;AAGF,kCAAgC;AAC9B,OAAI,CAAC,GACH;GAGF,MAAMC,qBAAkD,EAAE;AAE1D,QAAK,MAAM,aAAa,WACtB,oBAAmB,cAAc,UAAiB;AAChD,qBAAiB,QAAQ,aAAa,MAAM;;AAIhD,QAAK,MAAM,CAAC,MAAM,YAAY,OAAO,QAAQ,mBAAmB,CAC9D,IAAG,iBAAiB,MAAM,QAAQ;AAGpC,gBAAa;AACX,SAAK,MAAM,CAAC,MAAM,YAAY,OAAO,QAAQ,mBAAmB,CAC9D,IAAG,oBAAoB,MAAM,QAAQ;;KAGxC,CAAC,GAAG,CAAC;EAER,MAAM,YAAY,cAAc,UAAU,CAAC,KAAK,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC;AAE/D,SAAO,cAAc,SAAS;GAC5B,GAAG;GAEH,0BAA0B;GAC1B,KAAK;GACN,CAAC;GACF;AAEF,WAAU,cAAc;AAExB,QAAO"}
@@ -2,5 +2,5 @@
2
2
  type CreateProps<Props extends { [PropName in keyof Props]: unknown }, Events extends { [EventName in keyof Events]: CustomEvent }> = Props & CreateEventProps<Events>;
3
3
  type CreateEventProps<Events extends { [EventName in keyof Events]: CustomEvent }> = { [EventName in keyof Events as `on${Capitalize<string & EventName>}`]: (event: EventName extends `${string}Change` ? Events[EventName]['detail'] : Events[EventName]) => void };
4
4
  //#endregion
5
- export { CreateProps };
6
- //# sourceMappingURL=create-props-EGV61dJR.d.ts.map
5
+ export { CreateProps as t };
6
+ //# sourceMappingURL=create-props-DTgCRwCm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-props-DTgCRwCm.d.ts","names":[],"sources":["../src/components/create-props.ts"],"sourcesContent":[],"mappings":";KAAY,yCAAA,MACyB,KADd,GAAA,OAAA,EACc,EAAA,eAAA,gBACE,MAAA,MAAA,GAAS,WAAT,EAAS,CAAA,GAC5C,KAD4C,GACpC,gBADoC,CACnB,MADmB,CAAA;KAG3C,gBAFD,CAAA,eAAA,gBAAyB,MAGU,MAHV,GAGmB,WAHnB,EAAjB,CAAA,GAAA,gBAAgB,MAKN,MALM,IAAA,KAKS,UALT,CAAA,MAAA,GAK6B,SAL7B,CAAA,EAAA,GAAA,CAAA,KAAA,EAMjB,SANiB,SAAA,GAAA,MAAA,QAAA,GAMqB,MANrB,CAM4B,SAN5B,CAAA,CAAA,QAAA,CAAA,GAOpB,MAPoB,CAOb,SAPa,CAAA,EAAA,GAAA,IAAA,EAAQ"}
@@ -14,5 +14,5 @@ function useEditorContext() {
14
14
  const EditorContextProvider = editorContext.Provider;
15
15
 
16
16
  //#endregion
17
- export { EditorContextProvider, useEditorContext };
18
- //# sourceMappingURL=editor-context-Cci4uqN_.js.map
17
+ export { useEditorContext as n, EditorContextProvider as t };
18
+ //# sourceMappingURL=editor-context-cG0zkv13.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"editor-context-Cci4uqN_.js","names":["EditorContextProvider: Provider<Editor | null>"],"sources":["../src/contexts/editor-context.ts"],"sourcesContent":["import type {\n Editor,\n Extension,\n} from '@prosekit/core'\nimport {\n createContext,\n useContext,\n type Provider,\n} from 'react'\n\nconst editorContext = createContext<Editor | null>(null)\n\n/**\n * @internal\n */\nexport function useEditorContext<E extends Extension>(): Editor<E> | null {\n return useContext(editorContext)\n}\n\n/**\n * @internal\n */\nexport const EditorContextProvider: Provider<Editor | null> = editorContext.Provider\n"],"mappings":";;;AAUA,MAAM,gBAAgB,cAA6B,KAAK;;;;AAKxD,SAAgB,mBAA0D;AACxE,QAAO,WAAW,cAAc;;;;;AAMlC,MAAaA,wBAAiD,cAAc"}
1
+ {"version":3,"file":"editor-context-cG0zkv13.js","names":["EditorContextProvider: Provider<Editor | null>"],"sources":["../src/contexts/editor-context.ts"],"sourcesContent":["import type {\n Editor,\n Extension,\n} from '@prosekit/core'\nimport {\n createContext,\n useContext,\n type Provider,\n} from 'react'\n\nconst editorContext = createContext<Editor | null>(null)\n\n/**\n * @internal\n */\nexport function useEditorContext<E extends Extension>(): Editor<E> | null {\n return useContext(editorContext)\n}\n\n/**\n * @internal\n */\nexport const EditorContextProvider: Provider<Editor | null> = editorContext.Provider\n"],"mappings":";;;AAUA,MAAM,gBAAgB,cAA6B,KAAK;;;;AAKxD,SAAgB,mBAA0D;AACxE,QAAO,WAAW,cAAc;;;;;AAMlC,MAAaA,wBAAiD,cAAc"}
@@ -1,4 +1,4 @@
1
- import { CreateProps } from "./create-props-EGV61dJR.js";
1
+ import { t as CreateProps } from "./create-props-DTgCRwCm.js";
2
2
  import { ForwardRefExoticComponent, HTMLAttributes, RefAttributes } from "react";
3
3
  import { AutocompleteEmptyElement, AutocompleteEmptyEvents, AutocompleteEmptyProps as AutocompleteEmptyProps$1, AutocompleteItemElement, AutocompleteItemEvents, AutocompleteItemProps as AutocompleteItemProps$1, AutocompleteListElement, AutocompleteListEvents, AutocompleteListProps as AutocompleteListProps$1, AutocompletePopoverElement, AutocompletePopoverEvents, AutocompletePopoverProps as AutocompletePopoverProps$1 } from "@prosekit/web/autocomplete";
4
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-react-autocomplete.d.ts","names":[],"sources":["../src/components/autocomplete/autocomplete-empty.gen.ts","../src/components/autocomplete/autocomplete-item.gen.ts","../src/components/autocomplete/autocomplete-list.gen.ts","../src/components/autocomplete/autocomplete-popover.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAmBA;AAAwC,UAAvB,sBAAA,SAA+B,OAAR,CAAgB,WAAhB,CAA4B,wBAA5B,EAAmC,uBAAnC,CAAA,CAAA,CAAA;AAAmC,cAE9D,iBAF8D,EAE3C,yBAF2C,CAGzE,sBAHyE,GAIzE,aAJyE,CAI3D,wBAJ2D,CAAA,GAKzE,cALyE,CAK1D,wBAL0D,CAAA,CAAA;;;;;AAA3E;AAAwC,UCAvB,qBAAA,SAA8B,ODAP,CCAe,WDAf,CCA2B,uBDA3B,ECAkC,sBDAlC,CAAA,CAAA,CAAA;AAAmC,cCE9D,gBDF8D,ECE5C,yBDF4C,CCGzE,qBDHyE,GCIzE,aDJyE,CCI3D,uBDJ2D,CAAA,GCKzE,cDLyE,CCK1D,uBDL0D,CAAA,CAAA;;;;;AAA3E;AAAwC,UEAvB,qBAAA,SAA8B,OFAP,CEAe,WFAf,CEA2B,uBFA3B,EEAkC,sBFAlC,CAAA,CAAA,CAAA;AAAmC,cEE9D,gBFF8D,EEE5C,yBFF4C,CEGzE,qBFHyE,GEIzE,aFJyE,CEI3D,uBFJ2D,CAAA,GEKzE,cFLyE,CEK1D,uBFL0D,CAAA,CAAA;;;;;AAA3E;AAAwC,UGAvB,wBAAA,SAAiC,OHAV,CGAkB,WHAlB,CGA8B,0BHA9B,EGAqC,yBHArC,CAAA,CAAA,CAAA;AAAmC,cGE9D,mBHF8D,EGEzC,yBHFyC,CGGzE,wBHHyE,GGIzE,aHJyE,CGI3D,0BHJ2D,CAAA,GGKzE,cHLyE,CGK1D,0BHL0D,CAAA,CAAA"}
1
+ {"version":3,"file":"prosekit-react-autocomplete.d.ts","names":[],"sources":["../src/components/autocomplete/autocomplete-empty.gen.ts","../src/components/autocomplete/autocomplete-item.gen.ts","../src/components/autocomplete/autocomplete-list.gen.ts","../src/components/autocomplete/autocomplete-popover.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAmBA;AAAoE,UAAnD,sBAAA,SAA+B,OAAoB,CAAZ,WAAY,CAAA,wBAAA,EAAO,uBAAP,CAAA,CAAA,CAAA;AAAZ,cAE3C,iBAF2C,EAExB,yBAFwB,CAGtD,sBAHsD,GAItD,aAJsD,CAIxC,wBAJwC,CAAA,GAKtD,cALsD,CAKvC,wBALuC,CAAA,CAAA;;;;;AAAxD;AAAoE,UCAnD,qBAAA,SAA8B,ODAqB,CCAb,WDAa,CCAD,uBDAC,ECAM,sBDAN,CAAA,CAAA,CAAA;AAAZ,cCE3C,gBDF2C,ECEzB,yBDFyB,CCGtD,qBDHsD,GCItD,aDJsD,CCIxC,uBDJwC,CAAA,GCKtD,cDLsD,CCKvC,uBDLuC,CAAA,CAAA;;;;;AAAxD;AAAoE,UEAnD,qBAAA,SAA8B,OFAqB,CEAb,WFAa,CEAD,uBFAC,EEAM,sBFAN,CAAA,CAAA,CAAA;AAAZ,cEE3C,gBFF2C,EEEzB,yBFFyB,CEGtD,qBFHsD,GEItD,aFJsD,CEIxC,uBFJwC,CAAA,GEKtD,cFLsD,CEKvC,uBFLuC,CAAA,CAAA;;;;;AAAxD;AAAoE,UGAnD,wBAAA,SAAiC,OHAkB,CGAV,WHAU,CGAE,0BHAF,EGAS,yBHAT,CAAA,CAAA,CAAA;AAAZ,cGE3C,mBHF2C,EGEtB,yBHFsB,CGGtD,wBHHsD,GGItD,aHJsD,CGIxC,0BHJwC,CAAA,GGKtD,cHLsD,CGKvC,0BHLuC,CAAA,CAAA"}
@@ -1,5 +1,5 @@
1
- import "./editor-context-Cci4uqN_.js";
2
- import { createComponent } from "./create-component-CBvs05W1.js";
1
+ import "./editor-context-cG0zkv13.js";
2
+ import { t as createComponent } from "./create-component-DzdxL6Ne.js";
3
3
  import { autocompleteEmptyEvents, autocompleteEmptyProps, autocompleteItemEvents, autocompleteItemProps, autocompleteListEvents, autocompleteListProps, autocompletePopoverEvents, autocompletePopoverProps } from "@prosekit/web/autocomplete";
4
4
 
5
5
  //#region src/components/autocomplete/autocomplete-empty.gen.ts
@@ -1,4 +1,4 @@
1
- import { CreateProps } from "./create-props-EGV61dJR.js";
1
+ import { t as CreateProps } from "./create-props-DTgCRwCm.js";
2
2
  import { ForwardRefExoticComponent, HTMLAttributes, RefAttributes } from "react";
3
3
  import { BlockHandleAddElement, BlockHandleAddEvents, BlockHandleAddProps as BlockHandleAddProps$1, BlockHandleDraggableElement, BlockHandleDraggableEvents, BlockHandleDraggableProps as BlockHandleDraggableProps$1, BlockHandlePopoverElement, BlockHandlePopoverEvents, BlockHandlePopoverProps as BlockHandlePopoverProps$1 } from "@prosekit/web/block-handle";
4
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-react-block-handle.d.ts","names":[],"sources":["../src/components/block-handle/block-handle-add.gen.ts","../src/components/block-handle/block-handle-draggable.gen.ts","../src/components/block-handle/block-handle-popover.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAmBA;AAAqC,UAApB,mBAAA,SAA4B,OAAR,CAAgB,WAAhB,CAA4B,qBAA5B,EAAmC,oBAAnC,CAAA,CAAA,CAAA;AAAmC,cAE3D,cAF2D,EAE3C,yBAF2C,CAGtE,mBAHsE,GAItE,aAJsE,CAIxD,qBAJwD,CAAA,GAKtE,cALsE,CAKvD,qBALuD,CAAA,CAAA;;;;;AAAxE;AAAqC,UCApB,yBAAA,SAAkC,ODAd,CCAsB,WDAtB,CCAkC,2BDAlC,ECAyC,0BDAzC,CAAA,CAAA,CAAA;AAAmC,cCE3D,oBDF2D,ECErC,yBDFqC,CCGtE,yBDHsE,GCItE,aDJsE,CCIxD,2BDJwD,CAAA,GCKtE,cDLsE,CCKvD,2BDLuD,CAAA,CAAA;;;;;AAAxE;AAAqC,UEApB,uBAAA,SAAgC,OFAZ,CEAoB,WFApB,CEAgC,yBFAhC,EEAuC,wBFAvC,CAAA,CAAA,CAAA;AAAmC,cEE3D,kBFF2D,EEEvC,yBFFuC,CEGtE,uBFHsE,GEItE,aFJsE,CEIxD,yBFJwD,CAAA,GEKtE,cFLsE,CEKvD,yBFLuD,CAAA,CAAA"}
1
+ {"version":3,"file":"prosekit-react-block-handle.d.ts","names":[],"sources":["../src/components/block-handle/block-handle-add.gen.ts","../src/components/block-handle/block-handle-draggable.gen.ts","../src/components/block-handle/block-handle-popover.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAmBA;AAAiE,UAAhD,mBAAA,SAA4B,OAAoB,CAAZ,WAAY,CAAA,qBAAA,EAAO,oBAAP,CAAA,CAAA,CAAA;AAAZ,cAExC,cAFwC,EAExB,yBAFwB,CAGnD,mBAHmD,GAInD,aAJmD,CAIrC,qBAJqC,CAAA,GAKnD,cALmD,CAKpC,qBALoC,CAAA,CAAA;;;;;AAArD;AAAiE,UCAhD,yBAAA,SAAkC,ODAc,CCAN,WDAM,CCAM,2BDAN,ECAa,0BDAb,CAAA,CAAA,CAAA;AAAZ,cCExC,oBDFwC,ECElB,yBDFkB,CCGnD,yBDHmD,GCInD,aDJmD,CCIrC,2BDJqC,CAAA,GCKnD,cDLmD,CCKpC,2BDLoC,CAAA,CAAA;;;;;AAArD;AAAiE,UEAhD,uBAAA,SAAgC,OFAgB,CEAR,WFAQ,CEAI,yBFAJ,EEAW,wBFAX,CAAA,CAAA,CAAA;AAAZ,cEExC,kBFFwC,EEEpB,yBFFoB,CEGnD,uBFHmD,GEInD,aFJmD,CEIrC,yBFJqC,CAAA,GEKnD,cFLmD,CEKpC,yBFLoC,CAAA,CAAA"}
@@ -1,5 +1,5 @@
1
- import "./editor-context-Cci4uqN_.js";
2
- import { createComponent } from "./create-component-CBvs05W1.js";
1
+ import "./editor-context-cG0zkv13.js";
2
+ import { t as createComponent } from "./create-component-DzdxL6Ne.js";
3
3
  import { blockHandleAddEvents, blockHandleAddProps, blockHandleDraggableEvents, blockHandleDraggableProps, blockHandlePopoverEvents, blockHandlePopoverProps } from "@prosekit/web/block-handle";
4
4
 
5
5
  //#region src/components/block-handle/block-handle-add.gen.ts
@@ -1,4 +1,4 @@
1
- import { CreateProps } from "./create-props-EGV61dJR.js";
1
+ import { t as CreateProps } from "./create-props-DTgCRwCm.js";
2
2
  import { ForwardRefExoticComponent, HTMLAttributes, RefAttributes } from "react";
3
3
  import { DropIndicatorElement, DropIndicatorEvents, DropIndicatorProps as DropIndicatorProps$1 } from "@prosekit/web/drop-indicator";
4
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-react-drop-indicator.d.ts","names":[],"sources":["../src/components/drop-indicator/drop-indicator.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAmBA;AAAoC,UAAnB,kBAAA,SAA2B,OAAR,CAAgB,WAAhB,CAA4B,oBAA5B,EAAmC,mBAAnC,CAAA,CAAA,CAAA;AAAmC,cAE1D,aAF0D,EAE3C,yBAF2C,CAGrE,kBAHqE,GAIrE,aAJqE,CAIvD,oBAJuD,CAAA,GAKrE,cALqE,CAKtD,oBALsD,CAAA,CAAA"}
1
+ {"version":3,"file":"prosekit-react-drop-indicator.d.ts","names":[],"sources":["../src/components/drop-indicator/drop-indicator.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAmBA;AAAgE,UAA/C,kBAAA,SAA2B,OAAoB,CAAZ,WAAY,CAAA,oBAAA,EAAO,mBAAP,CAAA,CAAA,CAAA;AAAZ,cAEvC,aAFuC,EAExB,yBAFwB,CAGlD,kBAHkD,GAIlD,aAJkD,CAIpC,oBAJoC,CAAA,GAKlD,cALkD,CAKnC,oBALmC,CAAA,CAAA"}
@@ -1,5 +1,5 @@
1
- import "./editor-context-Cci4uqN_.js";
2
- import { createComponent } from "./create-component-CBvs05W1.js";
1
+ import "./editor-context-cG0zkv13.js";
2
+ import { t as createComponent } from "./create-component-DzdxL6Ne.js";
3
3
  import { dropIndicatorEvents, dropIndicatorProps } from "@prosekit/web/drop-indicator";
4
4
 
5
5
  //#region src/components/drop-indicator/drop-indicator.gen.ts
@@ -1,4 +1,4 @@
1
- import { CreateProps } from "./create-props-EGV61dJR.js";
1
+ import { t as CreateProps } from "./create-props-DTgCRwCm.js";
2
2
  import { ForwardRefExoticComponent, HTMLAttributes, RefAttributes } from "react";
3
3
  import { InlinePopoverElement, InlinePopoverEvents, InlinePopoverProps as InlinePopoverProps$1 } from "@prosekit/web/inline-popover";
4
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-react-inline-popover.d.ts","names":[],"sources":["../src/components/inline-popover/inline-popover.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAmBA;AAAoC,UAAnB,kBAAA,SAA2B,OAAR,CAAgB,WAAhB,CAA4B,oBAA5B,EAAmC,mBAAnC,CAAA,CAAA,CAAA;AAAmC,cAE1D,aAF0D,EAE3C,yBAF2C,CAGrE,kBAHqE,GAIrE,aAJqE,CAIvD,oBAJuD,CAAA,GAKrE,cALqE,CAKtD,oBALsD,CAAA,CAAA"}
1
+ {"version":3,"file":"prosekit-react-inline-popover.d.ts","names":[],"sources":["../src/components/inline-popover/inline-popover.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAmBA;AAAgE,UAA/C,kBAAA,SAA2B,OAAoB,CAAZ,WAAY,CAAA,oBAAA,EAAO,mBAAP,CAAA,CAAA,CAAA;AAAZ,cAEvC,aAFuC,EAExB,yBAFwB,CAGlD,kBAHkD,GAIlD,aAJkD,CAIpC,oBAJoC,CAAA,GAKlD,cALkD,CAKnC,oBALmC,CAAA,CAAA"}
@@ -1,5 +1,5 @@
1
- import "./editor-context-Cci4uqN_.js";
2
- import { createComponent } from "./create-component-CBvs05W1.js";
1
+ import "./editor-context-cG0zkv13.js";
2
+ import { t as createComponent } from "./create-component-DzdxL6Ne.js";
3
3
  import { inlinePopoverEvents, inlinePopoverProps } from "@prosekit/web/inline-popover";
4
4
 
5
5
  //#region src/components/inline-popover/inline-popover.gen.ts
@@ -1,4 +1,4 @@
1
- import { CreateProps } from "./create-props-EGV61dJR.js";
1
+ import { t as CreateProps } from "./create-props-DTgCRwCm.js";
2
2
  import { ForwardRefExoticComponent, HTMLAttributes, RefAttributes } from "react";
3
3
  import { PopoverContentElement, PopoverContentEvents, PopoverContentProps as PopoverContentProps$1, PopoverRootElement, PopoverRootEvents, PopoverRootProps as PopoverRootProps$1, PopoverTriggerElement, PopoverTriggerEvents, PopoverTriggerProps as PopoverTriggerProps$1 } from "@prosekit/web/popover";
4
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-react-popover.d.ts","names":[],"sources":["../src/components/popover/popover-content.gen.ts","../src/components/popover/popover-root.gen.ts","../src/components/popover/popover-trigger.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAmBA;AAAqC,UAApB,mBAAA,SAA4B,OAAR,CAAgB,WAAhB,CAA4B,qBAA5B,EAAmC,oBAAnC,CAAA,CAAA,CAAA;AAAmC,cAE3D,cAF2D,EAE3C,yBAF2C,CAGtE,mBAHsE,GAItE,aAJsE,CAIxD,qBAJwD,CAAA,GAKtE,cALsE,CAKvD,qBALuD,CAAA,CAAA;;;;;AAAxE;AAAqC,UCApB,gBAAA,SAAyB,ODAL,CCAa,WDAb,CCAyB,kBDAzB,ECAgC,iBDAhC,CAAA,CAAA,CAAA;AAAmC,cCE3D,WDF2D,ECE9C,yBDF8C,CCGtE,gBDHsE,GCItE,aDJsE,CCIxD,kBDJwD,CAAA,GCKtE,cDLsE,CCKvD,kBDLuD,CAAA,CAAA;;;;;AAAxE;AAAqC,UEApB,mBAAA,SAA4B,OFAR,CEAgB,WFAhB,CEA4B,qBFA5B,EEAmC,oBFAnC,CAAA,CAAA,CAAA;AAAmC,cEE3D,cFF2D,EEE3C,yBFF2C,CEGtE,mBFHsE,GEItE,aFJsE,CEIxD,qBFJwD,CAAA,GEKtE,cFLsE,CEKvD,qBFLuD,CAAA,CAAA"}
1
+ {"version":3,"file":"prosekit-react-popover.d.ts","names":[],"sources":["../src/components/popover/popover-content.gen.ts","../src/components/popover/popover-root.gen.ts","../src/components/popover/popover-trigger.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAmBA;AAAiE,UAAhD,mBAAA,SAA4B,OAAoB,CAAZ,WAAY,CAAA,qBAAA,EAAO,oBAAP,CAAA,CAAA,CAAA;AAAZ,cAExC,cAFwC,EAExB,yBAFwB,CAGnD,mBAHmD,GAInD,aAJmD,CAIrC,qBAJqC,CAAA,GAKnD,cALmD,CAKpC,qBALoC,CAAA,CAAA;;;;;AAArD;AAAiE,UCAhD,gBAAA,SAAyB,ODAuB,CCAf,WDAe,CCAH,kBDAG,ECAI,iBDAJ,CAAA,CAAA,CAAA;AAAZ,cCExC,WDFwC,ECE3B,yBDF2B,CCGnD,gBDHmD,GCInD,aDJmD,CCIrC,kBDJqC,CAAA,GCKnD,cDLmD,CCKpC,kBDLoC,CAAA,CAAA;;;;;AAArD;AAAiE,UEAhD,mBAAA,SAA4B,OFAoB,CEAZ,WFAY,CEAA,qBFAA,EEAO,oBFAP,CAAA,CAAA,CAAA;AAAZ,cEExC,cFFwC,EEExB,yBFFwB,CEGnD,mBFHmD,GEInD,aFJmD,CEIrC,qBFJqC,CAAA,GEKnD,cFLmD,CEKpC,qBFLoC,CAAA,CAAA"}
@@ -1,5 +1,5 @@
1
- import "./editor-context-Cci4uqN_.js";
2
- import { createComponent } from "./create-component-CBvs05W1.js";
1
+ import "./editor-context-cG0zkv13.js";
2
+ import { t as createComponent } from "./create-component-DzdxL6Ne.js";
3
3
  import { popoverContentEvents, popoverContentProps, popoverRootEvents, popoverRootProps, popoverTriggerEvents, popoverTriggerProps } from "@prosekit/web/popover";
4
4
 
5
5
  //#region src/components/popover/popover-content.gen.ts
@@ -1,4 +1,4 @@
1
- import { CreateProps } from "./create-props-EGV61dJR.js";
1
+ import { t as CreateProps } from "./create-props-DTgCRwCm.js";
2
2
  import { ForwardRefExoticComponent, HTMLAttributes, RefAttributes } from "react";
3
3
  import { ResizableHandleElement, ResizableHandleEvents, ResizableHandleProps as ResizableHandleProps$1, ResizableRootElement, ResizableRootEvents, ResizableRootProps as ResizableRootProps$1 } from "@prosekit/web/resizable";
4
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-react-resizable.d.ts","names":[],"sources":["../src/components/resizable/resizable-handle.gen.ts","../src/components/resizable/resizable-root.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAmBA;AAAsC,UAArB,oBAAA,SAA6B,OAAR,CAAgB,WAAhB,CAA4B,sBAA5B,EAAmC,qBAAnC,CAAA,CAAA,CAAA;AAAmC,cAE5D,eAF4D,EAE3C,yBAF2C,CAGvE,oBAHuE,GAIvE,aAJuE,CAIzD,sBAJyD,CAAA,GAKvE,cALuE,CAKxD,sBALwD,CAAA,CAAA;;;;;AAAzE;AAAsC,UCArB,kBAAA,SAA2B,ODAN,CCAc,WDAd,CCA0B,oBDA1B,ECAiC,mBDAjC,CAAA,CAAA,CAAA;AAAmC,cCE5D,aDF4D,ECE7C,yBDF6C,CCGvE,kBDHuE,GCIvE,aDJuE,CCIzD,oBDJyD,CAAA,GCKvE,cDLuE,CCKxD,oBDLwD,CAAA,CAAA"}
1
+ {"version":3,"file":"prosekit-react-resizable.d.ts","names":[],"sources":["../src/components/resizable/resizable-handle.gen.ts","../src/components/resizable/resizable-root.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAmBA;AAAkE,UAAjD,oBAAA,SAA6B,OAAoB,CAAZ,WAAY,CAAA,sBAAA,EAAO,qBAAP,CAAA,CAAA,CAAA;AAAZ,cAEzC,eAFyC,EAExB,yBAFwB,CAGpD,oBAHoD,GAIpD,aAJoD,CAItC,sBAJsC,CAAA,GAKpD,cALoD,CAKrC,sBALqC,CAAA,CAAA;;;;;AAAtD;AAAkE,UCAjD,kBAAA,SAA2B,ODAsB,CCAd,WDAc,CCAF,oBDAE,ECAK,mBDAL,CAAA,CAAA,CAAA;AAAZ,cCEzC,aDFyC,ECE1B,yBDF0B,CCGpD,kBDHoD,GCIpD,aDJoD,CCItC,oBDJsC,CAAA,GCKpD,cDLoD,CCKrC,oBDLqC,CAAA,CAAA"}
@@ -1,5 +1,5 @@
1
- import "./editor-context-Cci4uqN_.js";
2
- import { createComponent } from "./create-component-CBvs05W1.js";
1
+ import "./editor-context-cG0zkv13.js";
2
+ import { t as createComponent } from "./create-component-DzdxL6Ne.js";
3
3
  import { resizableHandleEvents, resizableHandleProps, resizableRootEvents, resizableRootProps } from "@prosekit/web/resizable";
4
4
 
5
5
  //#region src/components/resizable/resizable-handle.gen.ts
@@ -1,4 +1,4 @@
1
- import { CreateProps } from "./create-props-EGV61dJR.js";
1
+ import { t as CreateProps } from "./create-props-DTgCRwCm.js";
2
2
  import { ForwardRefExoticComponent, HTMLAttributes, RefAttributes } from "react";
3
3
  import { TableHandleColumnRootElement, TableHandleColumnRootEvents, TableHandleColumnRootProps as TableHandleColumnRootProps$1, TableHandleColumnTriggerElement, TableHandleColumnTriggerEvents, TableHandleColumnTriggerProps as TableHandleColumnTriggerProps$1, TableHandleDragPreviewElement, TableHandleDragPreviewEvents, TableHandleDragPreviewProps as TableHandleDragPreviewProps$1, TableHandleDropIndicatorElement, TableHandleDropIndicatorEvents, TableHandleDropIndicatorProps as TableHandleDropIndicatorProps$1, TableHandlePopoverContentElement, TableHandlePopoverContentEvents, TableHandlePopoverContentProps as TableHandlePopoverContentProps$1, TableHandlePopoverItemElement, TableHandlePopoverItemEvents, TableHandlePopoverItemProps as TableHandlePopoverItemProps$1, TableHandleRootElement, TableHandleRootEvents, TableHandleRootProps as TableHandleRootProps$1, TableHandleRowRootElement, TableHandleRowRootEvents, TableHandleRowRootProps as TableHandleRowRootProps$1, TableHandleRowTriggerElement, TableHandleRowTriggerEvents, TableHandleRowTriggerProps as TableHandleRowTriggerProps$1 } from "@prosekit/web/table-handle";
4
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-react-table-handle.d.ts","names":[],"sources":["../src/components/table-handle/table-handle-column-root.gen.ts","../src/components/table-handle/table-handle-column-trigger.gen.ts","../src/components/table-handle/table-handle-drag-preview.gen.ts","../src/components/table-handle/table-handle-drop-indicator.gen.ts","../src/components/table-handle/table-handle-popover-content.gen.ts","../src/components/table-handle/table-handle-popover-item.gen.ts","../src/components/table-handle/table-handle-root.gen.ts","../src/components/table-handle/table-handle-row-root.gen.ts","../src/components/table-handle/table-handle-row-trigger.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAmBA;AAA4C,UAA3B,0BAAA,SAAmC,OAAR,CAAgB,WAAhB,CAA4B,4BAA5B,EAAmC,2BAAnC,CAAA,CAAA,CAAA;AAAmC,cAElE,qBAFkE,EAE3C,yBAF2C,CAG7E,0BAH6E,GAI7E,aAJ6E,CAI/D,4BAJ+D,CAAA,GAK7E,cAL6E,CAK9D,4BAL8D,CAAA,CAAA;;;;;AAA/E;AAA4C,UC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,ONAF,CMAU,WNAV,CMAsB,sBNAtB,EMA6B,qBNA7B,CAAA,CAAA,CAAA;AAAmC,cMElE,eNFkE,EMEjD,yBNFiD,CMG7E,oBNH6E,GMI7E,aNJ6E,CMI/D,sBNJ+D,CAAA,GMK7E,cNL6E,CMK9D,sBNL8D,CAAA,CAAA;;;;;AAA/E;AAA4C,UOA3B,uBAAA,SAAgC,OPAL,COAa,WPAb,COAyB,yBPAzB,EOAgC,wBPAhC,CAAA,CAAA,CAAA;AAAmC,cOElE,kBPFkE,EOE9C,yBPF8C,COG7E,uBPH6E,GOI7E,aPJ6E,COI/D,yBPJ+D,CAAA,GOK7E,cPL6E,COK9D,yBPL8D,CAAA,CAAA;;;;;AAA/E;AAA4C,UQA3B,0BAAA,SAAmC,ORAR,CQAgB,WRAhB,CQA4B,4BRA5B,EQAmC,2BRAnC,CAAA,CAAA,CAAA;AAAmC,cQElE,qBRFkE,EQE3C,yBRF2C,CQG7E,0BRH6E,GQI7E,aRJ6E,CQI/D,4BRJ+D,CAAA,GQK7E,cRL6E,CQK9D,4BRL8D,CAAA,CAAA"}
1
+ {"version":3,"file":"prosekit-react-table-handle.d.ts","names":[],"sources":["../src/components/table-handle/table-handle-column-root.gen.ts","../src/components/table-handle/table-handle-column-trigger.gen.ts","../src/components/table-handle/table-handle-drag-preview.gen.ts","../src/components/table-handle/table-handle-drop-indicator.gen.ts","../src/components/table-handle/table-handle-popover-content.gen.ts","../src/components/table-handle/table-handle-popover-item.gen.ts","../src/components/table-handle/table-handle-root.gen.ts","../src/components/table-handle/table-handle-row-root.gen.ts","../src/components/table-handle/table-handle-row-trigger.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAmBA;AAAwE,UAAvD,0BAAA,SAAmC,OAAoB,CAAZ,WAAY,CAAA,4BAAA,EAAO,2BAAP,CAAA,CAAA,CAAA;AAAZ,cAE/C,qBAF+C,EAExB,yBAFwB,CAG1D,0BAH0D,GAI1D,aAJ0D,CAI5C,4BAJ4C,CAA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AA,CAAA;;;;;AAA5D;AAAwE,UMAvD,oBAAA,SAA6B,ONA0B,CMAlB,WNAkB,CMAN,sBNAM,EMAC,qBNAD,CAAA,CAAA,CAAA;AAAZ,cME/C,eNF+C,EME9B,yBNF8B,CMG1D,oBNH0D,GMI1D,aNJ0D,CMI5C,sBNJ4C,CAAA,GMK1D,cNL0D,CMK3C,sBNL2C,CAAA,CAAA;;;;;AAA5D;AAAwE,UOAvD,uBAAA,SAAgC,OPAuB,COAf,WPAe,COAH,yBPAG,EOAI,wBPAJ,CAAA,CAAA,CAAA;AAAZ,cOE/C,kBPF+C,EOE3B,yBPF2B,COG1D,uBPH0D,GOI1D,aPJ0D,COI5C,yBPJ4C,CAAA,GOK1D,cPL0D,COK3C,yBPL2C,CAAA,CAAA;;;;;AAA5D;AAAwE,UQAvD,0BAAA,SAAmC,ORAoB,CQAZ,WRAY,CQAA,4BRAA,EQAO,2BRAP,CAAA,CAAA,CAAA;AAAZ,cQE/C,qBRF+C,EQExB,yBRFwB,CQG1D,0BRH0D,GQI1D,aRJ0D,CQI5C,4BRJ4C,CAAA,GQK1D,cRL0D,CQK3C,4BRL2C,CAAA,CAAA"}
@@ -1,5 +1,5 @@
1
- import "./editor-context-Cci4uqN_.js";
2
- import { createComponent } from "./create-component-CBvs05W1.js";
1
+ import "./editor-context-cG0zkv13.js";
2
+ import { t as createComponent } from "./create-component-DzdxL6Ne.js";
3
3
  import { tableHandleColumnRootEvents, tableHandleColumnRootProps, tableHandleColumnTriggerEvents, tableHandleColumnTriggerProps, tableHandleDragPreviewEvents, tableHandleDragPreviewProps, tableHandleDropIndicatorEvents, tableHandleDropIndicatorProps, tableHandlePopoverContentEvents, tableHandlePopoverContentProps, tableHandlePopoverItemEvents, tableHandlePopoverItemProps, tableHandleRootEvents, tableHandleRootProps, tableHandleRowRootEvents, tableHandleRowRootProps, tableHandleRowTriggerEvents, tableHandleRowTriggerProps } from "@prosekit/web/table-handle";
4
4
 
5
5
  //#region src/components/table-handle/table-handle-column-root.gen.ts
@@ -1,4 +1,4 @@
1
- import { CreateProps } from "./create-props-EGV61dJR.js";
1
+ import { t as CreateProps } from "./create-props-DTgCRwCm.js";
2
2
  import { ForwardRefExoticComponent, HTMLAttributes, RefAttributes } from "react";
3
3
  import { TooltipContentElement, TooltipContentEvents, TooltipContentProps as TooltipContentProps$1, TooltipRootElement, TooltipRootEvents, TooltipRootProps as TooltipRootProps$1, TooltipTriggerElement, TooltipTriggerEvents, TooltipTriggerProps as TooltipTriggerProps$1 } from "@prosekit/web/tooltip";
4
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-react-tooltip.d.ts","names":[],"sources":["../src/components/tooltip/tooltip-content.gen.ts","../src/components/tooltip/tooltip-root.gen.ts","../src/components/tooltip/tooltip-trigger.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAmBA;AAAqC,UAApB,mBAAA,SAA4B,OAAR,CAAgB,WAAhB,CAA4B,qBAA5B,EAAmC,oBAAnC,CAAA,CAAA,CAAA;AAAmC,cAE3D,cAF2D,EAE3C,yBAF2C,CAGtE,mBAHsE,GAItE,aAJsE,CAIxD,qBAJwD,CAAA,GAKtE,cALsE,CAKvD,qBALuD,CAAA,CAAA;;;;;AAAxE;AAAqC,UCApB,gBAAA,SAAyB,ODAL,CCAa,WDAb,CCAyB,kBDAzB,ECAgC,iBDAhC,CAAA,CAAA,CAAA;AAAmC,cCE3D,WDF2D,ECE9C,yBDF8C,CCGtE,gBDHsE,GCItE,aDJsE,CCIxD,kBDJwD,CAAA,GCKtE,cDLsE,CCKvD,kBDLuD,CAAA,CAAA;;;;;AAAxE;AAAqC,UEApB,mBAAA,SAA4B,OFAR,CEAgB,WFAhB,CEA4B,qBFA5B,EEAmC,oBFAnC,CAAA,CAAA,CAAA;AAAmC,cEE3D,cFF2D,EEE3C,yBFF2C,CEGtE,mBFHsE,GEItE,aFJsE,CEIxD,qBFJwD,CAAA,GEKtE,cFLsE,CEKvD,qBFLuD,CAAA,CAAA"}
1
+ {"version":3,"file":"prosekit-react-tooltip.d.ts","names":[],"sources":["../src/components/tooltip/tooltip-content.gen.ts","../src/components/tooltip/tooltip-root.gen.ts","../src/components/tooltip/tooltip-trigger.gen.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAmBA;AAAiE,UAAhD,mBAAA,SAA4B,OAAoB,CAAZ,WAAY,CAAA,qBAAA,EAAO,oBAAP,CAAA,CAAA,CAAA;AAAZ,cAExC,cAFwC,EAExB,yBAFwB,CAGnD,mBAHmD,GAInD,aAJmD,CAIrC,qBAJqC,CAAA,GAKnD,cALmD,CAKpC,qBALoC,CAAA,CAAA;;;;;AAArD;AAAiE,UCAhD,gBAAA,SAAyB,ODAuB,CCAf,WDAe,CCAH,kBDAG,ECAI,iBDAJ,CAAA,CAAA,CAAA;AAAZ,cCExC,WDFwC,ECE3B,yBDF2B,CCGnD,gBDHmD,GCInD,aDJmD,CCIrC,kBDJqC,CAAA,GCKnD,cDLmD,CCKpC,kBDLoC,CAAA,CAAA;;;;;AAArD;AAAiE,UEAhD,mBAAA,SAA4B,OFAoB,CEAZ,WFAY,CEAA,qBFAA,EEAO,oBFAP,CAAA,CAAA,CAAA;AAAZ,cEExC,cFFwC,EEExB,yBFFwB,CEGnD,mBFHmD,GEInD,aFJmD,CEIrC,qBFJqC,CAAA,GEKnD,cFLmD,CEKpC,qBFLoC,CAAA,CAAA"}
@@ -1,5 +1,5 @@
1
- import "./editor-context-Cci4uqN_.js";
2
- import { createComponent } from "./create-component-CBvs05W1.js";
1
+ import "./editor-context-cG0zkv13.js";
2
+ import { t as createComponent } from "./create-component-DzdxL6Ne.js";
3
3
  import { tooltipContentEvents, tooltipContentProps, tooltipRootEvents, tooltipRootProps, tooltipTriggerEvents, tooltipTriggerProps } from "@prosekit/web/tooltip";
4
4
 
5
5
  //#region src/components/tooltip/tooltip-content.gen.ts
@@ -37,10 +37,6 @@ interface ReactMarkViewOptions extends CoreMarkViewUserOptions<ReactMarkViewComp
37
37
  */
38
38
  name: string;
39
39
  }
40
- /**
41
- * @internal
42
- */
43
-
44
40
  /**
45
41
  * Defines a mark view using a React component.
46
42
  *
@@ -68,10 +64,6 @@ interface ReactNodeViewOptions extends CoreNodeViewUserOptions<ReactNodeViewComp
68
64
  */
69
65
  name: string;
70
66
  }
71
- /**
72
- * @internal
73
- */
74
-
75
67
  /**
76
68
  * Defines a node view using a React component.
77
69
  *
@@ -83,7 +75,7 @@ declare function defineReactNodeView(options: ReactNodeViewOptions): Extension;
83
75
  interface UseExtensionOptions {
84
76
  /**
85
77
  * The editor to add the extension to. If not provided, it will use the
86
- * editor from the nearest `ProseKit` component.
78
+ * editor from the nearest `<ProseKit>` component.
87
79
  */
88
80
  editor?: Editor;
89
81
  /**
@@ -134,17 +126,19 @@ declare function useEditor<E extends Extension = any>(options?: {
134
126
  interface UseEditorDerivedOptions<E extends Extension = any> {
135
127
  /**
136
128
  * The editor to add the extension to. If not provided, it will use the
137
- * editor from the nearest `ProseKit` component.
129
+ * editor from the nearest `<ProseKit>` component.
138
130
  */
139
131
  editor?: Editor<E>;
140
132
  }
141
133
  /**
142
- * A hook that runs a function to derive a value from the editor instance after
143
- * editor state changes.
134
+ * Runs a function to derive a value from the editor instance after editor state
135
+ * changes.
144
136
  *
145
137
  * This is useful when you need to render something based on the editor state,
146
138
  * for example, whether the selected text is wrapped in an italic mark.
147
139
  *
140
+ * It returns the derived value that updates whenever the editor state changes.
141
+ *
148
142
  * @public
149
143
  */
150
144
  declare function useEditorDerivedValue<E extends Extension, Derived>(
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-react.d.ts","names":[],"sources":["../src/components/prosekit.ts","../src/extensions/react-mark-view.ts","../src/extensions/react-node-view.ts","../src/hooks/use-extension.ts","../src/hooks/use-doc-change.ts","../src/hooks/use-editor.ts","../src/hooks/use-editor-derived-value.ts","../src/hooks/use-keymap.ts","../src/hooks/use-state-update.ts","../src/types.ts"],"sourcesContent":[],"mappings":";;;;;;;;UAYiB,aAAA;UACP;aACG;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../src/extensions/react-mark-view.ts","../src/extensions/react-node-view.ts","../src/hooks/use-extension.ts","../src/hooks/use-doc-change.ts","../src/hooks/use-editor.ts","../src/hooks/use-editor-derived-value.ts","../src/hooks/use-keymap.ts","../src/hooks/use-state-update.ts","../src/types.ts"],"sourcesContent":[],"mappings":";;;;;;;;UAYiB,aAAA;UACP;aACG;;;;AAFb;AAUA;;cAAa,UAAU,cAAc;;;;;;UCGpB,kBAAA,SAA2B,iBDb5C;AAUA;;;KCQY,sBAAA,GAAyB,cAAc;AALnD;AAKA;AAOA;AAiCA;;UAjCiB,oBAAA,SAA6B,wBAAwB;;ACZtE;AAKA;EAOiB,IAAA,EAAA,MAAA;AAiCjB;AC3CA;;;;ACbA;iBHwDgB,mBAAA,UAA6B,uBAAuB;;;;;;UC7CnD,kBAAA,SAA2B,iBFb5C;AAUA;;;KEQY,sBAAA,GAAyB,cAAc;ADLnD;AAKA;AAOA;AAiCA;;UCjCiB,oBAAA,SAA6B,wBAAwB;;AAZtE;AAKA;EAOiB,IAAA,EAAA,MAAA;AAiCjB;AC3CA;;;;ACbA;iBFwDgB,mBAAA,UAA6B,uBAAuB;;;UC3DnD,mBAAA;;;;;WAKN;;AHJX;AAUA;aGDa;;;AFIb;AAKA;AAOiB,iBEVD,YAAA;AF2ChB;;;;AC7CA,SAAiB,ECOJ,SDPI,GAAA,IAAmB,EAAA,OAAuB,CAAf,ECQhC,mBDR+C,CAAA,EAAA,IAAA;;;;;;;;iBEX3C,YAAA,gBACC,oCACL;;;;;;;;iBCII,oBAAoB;;ALRpC;AAUA;;;;ACGA;AAKA;AAOA;AAiCA;;;IIrCI,OAAO;;;UClBM,kCAAkC;;;;;WAKxC,OAAO;;ANRlB;AAUA;;;;ACGA;AAKA;AAOA;AAiCA;;;iBKpCgB,gCAAgC;AJThD;AAKA;AAOA;AAiCA;;;;AC3DA;AAgBA,MAAgB,EAAA,CAAA,MAAA,EGgBG,MHhBS,CGgBF,CHhBE,CAAA,EAAA,GGgBK,OHXpB,EAAA,OACkB,CAAnB,EGWA,uBHXmB,CGWK,CHXL,CAAA,CAAA,EGY5B,OHZ4B;;;iBItBf,SAAA,SAAkB,kBAAkB;;;;;;;;iBCGpC,cAAA,kBACG,gCACP;;;;;;KCbA,kCAAkC"}
@@ -1,4 +1,4 @@
1
- import { EditorContextProvider, useEditorContext } from "./editor-context-Cci4uqN_.js";
1
+ import { n as useEditorContext, t as EditorContextProvider } from "./editor-context-cG0zkv13.js";
2
2
  import { ProsemirrorAdapterProvider, useMarkViewContext, useMarkViewFactory, useNodeViewContext, useNodeViewFactory } from "@prosemirror-adapter/react";
3
3
  import { createElement, useEffect, useMemo, useReducer, useSyncExternalStore } from "react";
4
4
  import { EditorNotFoundError, ProseKitError, defineDocChangeHandler, defineKeymap, defineMarkViewComponent, defineMarkViewFactory, defineMountHandler, defineNodeViewComponent, defineNodeViewFactory, defineUpdateHandler, union, withPriority } from "@prosekit/core";
@@ -39,8 +39,7 @@ function useExtension(extension, options) {
39
39
  //#region src/extensions/react-mark-view.ts
40
40
  function withMarkViewProps(component) {
41
41
  return function MarkViewPropsWrapper() {
42
- const props = useMarkViewContext();
43
- return createElement(component, props);
42
+ return createElement(component, useMarkViewContext());
44
43
  };
45
44
  }
46
45
  /**
@@ -48,8 +47,7 @@ function withMarkViewProps(component) {
48
47
  */
49
48
  const ReactMarkViewConsumer = () => {
50
49
  const markViewFactory = useMarkViewFactory();
51
- const extension = useMemo(() => defineReactMarkViewFactory(markViewFactory), [markViewFactory]);
52
- useExtension(extension);
50
+ useExtension(useMemo(() => defineReactMarkViewFactory(markViewFactory), [markViewFactory]));
53
51
  return null;
54
52
  };
55
53
  /**
@@ -59,14 +57,13 @@ const ReactMarkViewConsumer = () => {
59
57
  */
60
58
  function defineReactMarkView(options) {
61
59
  const { name, component,...userOptions } = options;
62
- const args = {
63
- ...userOptions,
64
- component: withMarkViewProps(component)
65
- };
66
60
  return defineMarkViewComponent({
67
61
  group: "react",
68
62
  name,
69
- args
63
+ args: {
64
+ ...userOptions,
65
+ component: withMarkViewProps(component)
66
+ }
70
67
  });
71
68
  }
72
69
  function defineReactMarkViewFactory(factory) {
@@ -80,8 +77,7 @@ function defineReactMarkViewFactory(factory) {
80
77
  //#region src/extensions/react-node-view.ts
81
78
  function withNodeViewProps(component) {
82
79
  return function NodeViewPropsWrapper() {
83
- const props = useNodeViewContext();
84
- return createElement(component, props);
80
+ return createElement(component, useNodeViewContext());
85
81
  };
86
82
  }
87
83
  /**
@@ -89,8 +85,7 @@ function withNodeViewProps(component) {
89
85
  */
90
86
  const ReactNodeViewConsumer = () => {
91
87
  const nodeViewFactory = useNodeViewFactory();
92
- const extension = useMemo(() => defineReactNodeViewFactory(nodeViewFactory), [nodeViewFactory]);
93
- useExtension(extension);
88
+ useExtension(useMemo(() => defineReactNodeViewFactory(nodeViewFactory), [nodeViewFactory]));
94
89
  return null;
95
90
  };
96
91
  /**
@@ -100,14 +95,13 @@ const ReactNodeViewConsumer = () => {
100
95
  */
101
96
  function defineReactNodeView(options) {
102
97
  const { name, component,...userOptions } = options;
103
- const args = {
104
- ...userOptions,
105
- component: withNodeViewProps(component)
106
- };
107
98
  return defineNodeViewComponent({
108
99
  group: "react",
109
100
  name,
110
- args
101
+ args: {
102
+ ...userOptions,
103
+ component: withNodeViewProps(component)
104
+ }
111
105
  });
112
106
  }
113
107
  function defineReactNodeViewFactory(factory) {
@@ -137,8 +131,7 @@ const ProseKit = (props) => {
137
131
  * @public
138
132
  */
139
133
  function useDocChange(handler, options) {
140
- const extension = useMemo(() => defineDocChangeHandler((view) => handler(view.state.doc)), [handler]);
141
- useExtension(extension, options);
134
+ useExtension(useMemo(() => defineDocChangeHandler((view) => handler(view.state.doc)), [handler]), options);
142
135
  }
143
136
 
144
137
  //#endregion
@@ -173,12 +166,14 @@ function useForceUpdate() {
173
166
  //#endregion
174
167
  //#region src/hooks/use-editor-derived-value.ts
175
168
  /**
176
- * A hook that runs a function to derive a value from the editor instance after
177
- * editor state changes.
169
+ * Runs a function to derive a value from the editor instance after editor state
170
+ * changes.
178
171
  *
179
172
  * This is useful when you need to render something based on the editor state,
180
173
  * for example, whether the selected text is wrapped in an italic mark.
181
174
  *
175
+ * It returns the derived value that updates whenever the editor state changes.
176
+ *
182
177
  * @public
183
178
  */
184
179
  function useEditorDerivedValue(derive, options) {
@@ -188,7 +183,7 @@ function useEditorDerivedValue(derive, options) {
188
183
  const [subscribe, getSnapshot] = useMemo(() => {
189
184
  return createEditorStore(editor, derive);
190
185
  }, [editor, derive]);
191
- return useSyncExternalStore(subscribe, getSnapshot);
186
+ return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
192
187
  }
193
188
  function createEditorStore(editor, derive) {
194
189
  let dirty = true;
@@ -214,8 +209,7 @@ function createEditorStore(editor, derive) {
214
209
  //#endregion
215
210
  //#region src/hooks/use-keymap.ts
216
211
  function useKeymap(keymap, options) {
217
- const extension = useMemo(() => defineKeymap(keymap), [keymap]);
218
- useExtension(extension, options);
212
+ useExtension(useMemo(() => defineKeymap(keymap), [keymap]), options);
219
213
  }
220
214
 
221
215
  //#endregion
@@ -226,8 +220,7 @@ function useKeymap(keymap, options) {
226
220
  * @public
227
221
  */
228
222
  function useStateUpdate(handler, options) {
229
- const extension = useMemo(() => defineUpdateHandler((view) => handler(view.state)), [handler]);
230
- useExtension(extension, options);
223
+ useExtension(useMemo(() => defineUpdateHandler((view) => handler(view.state)), [handler]), options);
231
224
  }
232
225
 
233
226
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-react.js","names":["props: ReactMarkViewProps","ReactMarkViewConsumer: FC","args: ReactMarkViewUserOptions","props: ReactNodeViewProps","ReactNodeViewConsumer: FC","args: ReactNodeViewUserOptions","ProseKit: ComponentType<ProseKitProps>","derived: Derived"],"sources":["../src/hooks/use-editor-extension.ts","../src/hooks/use-priority-extension.ts","../src/hooks/use-extension.ts","../src/extensions/react-mark-view.ts","../src/extensions/react-node-view.ts","../src/components/prosekit.ts","../src/hooks/use-doc-change.ts","../src/hooks/use-editor.ts","../src/hooks/use-editor-derived-value.ts","../src/hooks/use-keymap.ts","../src/hooks/use-state-update.ts"],"sourcesContent":["import {\n EditorNotFoundError,\n type Editor,\n type Extension,\n} from '@prosekit/core'\nimport { useEffect } from 'react'\n\n/**\n * @internal\n */\nexport function useEditorExtension(\n editor: Editor | null | undefined,\n extension: Extension | null,\n): void {\n if (!editor) {\n throw new EditorNotFoundError()\n }\n\n useEffect(() => {\n if (extension) {\n return editor.use(extension)\n }\n }, [editor, extension])\n}\n","import {\n withPriority,\n type Extension,\n type Priority,\n} from '@prosekit/core'\nimport { useMemo } from 'react'\n\n/**\n * @internal\n */\nexport function usePriorityExtension<T extends Extension = Extension>(\n extension: T | null,\n priority?: Priority | null,\n): T | null {\n return useMemo(() => {\n return extension && priority ? withPriority(extension, priority) : extension\n }, [extension, priority])\n}\n","import type {\n Editor,\n Extension,\n Priority,\n} from '@prosekit/core'\n\nimport { useEditorContext } from '../contexts/editor-context'\n\nimport { useEditorExtension } from './use-editor-extension'\nimport { usePriorityExtension } from './use-priority-extension'\n\nexport interface UseExtensionOptions {\n /**\n * The editor to add the extension to. If not provided, it will use the\n * editor from the nearest `ProseKit` component.\n */\n editor?: Editor\n\n /**\n * Optional priority to add the extension with.\n */\n priority?: Priority\n}\n\n/**\n * Add an extension to the editor.\n */\nexport function useExtension(\n /**\n * The extension to add to the editor. If it changes, the previous\n * extension will be removed and the new one (if not null) will be added.\n */\n extension: Extension | null,\n options?: UseExtensionOptions,\n): void {\n const editorContext = useEditorContext()\n useEditorExtension(\n options?.editor || editorContext,\n usePriorityExtension(extension, options?.priority),\n )\n}\n","import {\n defineMarkViewComponent,\n defineMarkViewFactory,\n type Extension,\n} from '@prosekit/core'\nimport type { MarkViewConstructor } from '@prosekit/pm/view'\nimport type { CoreMarkViewUserOptions } from '@prosemirror-adapter/core'\nimport {\n useMarkViewContext,\n useMarkViewFactory,\n type MarkViewContext,\n type ReactMarkViewUserOptions,\n} from '@prosemirror-adapter/react'\nimport {\n createElement,\n useMemo,\n type ComponentType,\n type FC,\n} from 'react'\n\nimport { useExtension } from '../hooks/use-extension'\n\n/**\n * @public\n */\nexport interface ReactMarkViewProps extends MarkViewContext {}\n\n/**\n * @public\n */\nexport type ReactMarkViewComponent = ComponentType<ReactMarkViewProps>\n\n/**\n * Options for {@link defineReactMarkView}.\n *\n * @public\n */\nexport interface ReactMarkViewOptions extends CoreMarkViewUserOptions<ReactMarkViewComponent> {\n /**\n * The name of the mark type.\n */\n name: string\n}\n\nfunction withMarkViewProps(component: ReactMarkViewComponent) {\n return function MarkViewPropsWrapper() {\n const props: ReactMarkViewProps = useMarkViewContext()\n return createElement(component, props)\n }\n}\n\n/**\n * @internal\n */\nexport const ReactMarkViewConsumer: FC = () => {\n const markViewFactory = useMarkViewFactory()\n const extension = useMemo(\n () => defineReactMarkViewFactory(markViewFactory),\n [markViewFactory],\n )\n useExtension(extension)\n\n return null\n}\n\n/**\n * Defines a mark view using a React component.\n *\n * @public\n */\nexport function defineReactMarkView(options: ReactMarkViewOptions): Extension {\n const { name, component, ...userOptions } = options\n\n const args: ReactMarkViewUserOptions = {\n ...userOptions,\n component: withMarkViewProps(component),\n }\n\n return defineMarkViewComponent<ReactMarkViewUserOptions>({\n group: 'react',\n name,\n args,\n })\n}\n\nfunction defineReactMarkViewFactory(\n factory: (options: ReactMarkViewUserOptions) => MarkViewConstructor,\n) {\n return defineMarkViewFactory<ReactMarkViewUserOptions>({\n group: 'react',\n factory,\n })\n}\n","import {\n defineNodeViewComponent,\n defineNodeViewFactory,\n type Extension,\n} from '@prosekit/core'\nimport type { NodeViewConstructor } from '@prosekit/pm/view'\nimport type { CoreNodeViewUserOptions } from '@prosemirror-adapter/core'\nimport {\n useNodeViewContext,\n useNodeViewFactory,\n type NodeViewContext,\n type ReactNodeViewUserOptions,\n} from '@prosemirror-adapter/react'\nimport {\n createElement,\n useMemo,\n type ComponentType,\n type FC,\n} from 'react'\n\nimport { useExtension } from '../hooks/use-extension'\n\n/**\n * @public\n */\nexport interface ReactNodeViewProps extends NodeViewContext {}\n\n/**\n * @public\n */\nexport type ReactNodeViewComponent = ComponentType<ReactNodeViewProps>\n\n/**\n * Options for {@link defineReactNodeView}.\n *\n * @public\n */\nexport interface ReactNodeViewOptions extends CoreNodeViewUserOptions<ReactNodeViewComponent> {\n /**\n * The name of the node type.\n */\n name: string\n}\n\nfunction withNodeViewProps(component: ReactNodeViewComponent) {\n return function NodeViewPropsWrapper() {\n const props: ReactNodeViewProps = useNodeViewContext()\n return createElement(component, props)\n }\n}\n\n/**\n * @internal\n */\nexport const ReactNodeViewConsumer: FC = () => {\n const nodeViewFactory = useNodeViewFactory()\n const extension = useMemo(\n () => defineReactNodeViewFactory(nodeViewFactory),\n [nodeViewFactory],\n )\n useExtension(extension)\n\n return null\n}\n\n/**\n * Defines a node view using a React component.\n *\n * @public\n */\nexport function defineReactNodeView(options: ReactNodeViewOptions): Extension {\n const { name, component, ...userOptions } = options\n\n const args: ReactNodeViewUserOptions = {\n ...userOptions,\n component: withNodeViewProps(component),\n }\n\n return defineNodeViewComponent<ReactNodeViewUserOptions>({\n group: 'react',\n name,\n args,\n })\n}\n\nfunction defineReactNodeViewFactory(\n factory: (options: ReactNodeViewUserOptions) => NodeViewConstructor,\n) {\n return defineNodeViewFactory<ReactNodeViewUserOptions>({\n group: 'react',\n factory,\n })\n}\n","import type { Editor } from '@prosekit/core'\nimport { ProsemirrorAdapterProvider } from '@prosemirror-adapter/react'\nimport {\n createElement,\n type ComponentType,\n type ReactNode,\n} from 'react'\n\nimport { EditorContextProvider } from '../contexts/editor-context'\nimport { ReactMarkViewConsumer } from '../extensions/react-mark-view'\nimport { ReactNodeViewConsumer } from '../extensions/react-node-view'\n\nexport interface ProseKitProps {\n editor: Editor\n children?: ReactNode\n}\n\n/**\n * The root component for a ProseKit editor.\n *\n * @public\n */\nexport const ProseKit: ComponentType<ProseKitProps> = (props) => {\n const { editor, children } = props\n\n return createElement(\n ProsemirrorAdapterProvider,\n null,\n createElement(\n EditorContextProvider,\n { value: editor },\n createElement(ReactNodeViewConsumer),\n createElement(ReactMarkViewConsumer),\n children,\n ),\n )\n}\n","import { defineDocChangeHandler } from '@prosekit/core'\nimport type { ProseMirrorNode } from '@prosekit/pm/model'\nimport { useMemo } from 'react'\n\nimport {\n useExtension,\n type UseExtensionOptions,\n} from './use-extension'\n\n/**\n * Calls the given handler whenever the editor document changes.\n *\n * @public\n */\nexport function useDocChange(\n handler: (doc: ProseMirrorNode) => void,\n options?: UseExtensionOptions,\n): void {\n const extension = useMemo(\n () => defineDocChangeHandler((view) => handler(view.state.doc)),\n [handler],\n )\n useExtension(extension, options)\n}\n","import {\n defineMountHandler,\n defineUpdateHandler,\n ProseKitError,\n union,\n type Editor,\n type Extension,\n} from '@prosekit/core'\nimport {\n useEffect,\n useReducer,\n} from 'react'\n\nimport { useEditorContext } from '../contexts/editor-context'\n\n/**\n * Retrieves the editor instance from the nearest ProseKit component.\n *\n * @public\n */\nexport function useEditor<E extends Extension = any>(options?: {\n /**\n * Whether to update the component when the editor is mounted or editor state\n * is updated.\n *\n * Note this this option doesn't work with [React\n * compiler](https://react.dev/learn/react-compiler) because the returned\n * editor will be the same instance after state updates. If you're using React\n * compiler, you should use {@link useEditorDerivedValue} instead.\n *\n * @default false\n */\n update?: boolean\n}): Editor<E> {\n const update = options?.update ?? false\n\n const editor = useEditorContext<E>()\n if (!editor) {\n throw new ProseKitError(\n 'useEditor must be used within the ProseKit component',\n )\n }\n\n const forceUpdate = useForceUpdate()\n\n useEffect(() => {\n if (update) {\n const extension = union(\n defineMountHandler(forceUpdate),\n defineUpdateHandler(forceUpdate),\n )\n return editor.use(extension)\n }\n }, [editor, update, forceUpdate])\n\n return editor\n}\n\nfunction useForceUpdate() {\n const [, dispatch] = useReducer((x: number) => x + 1, 0)\n return dispatch\n}\n","import {\n defineMountHandler,\n defineUpdateHandler,\n EditorNotFoundError,\n union,\n type Editor,\n type Extension,\n} from '@prosekit/core'\nimport {\n useMemo,\n useSyncExternalStore,\n} from 'react'\n\nimport { useEditorContext } from '../contexts/editor-context'\n\nexport interface UseEditorDerivedOptions<E extends Extension = any> {\n /**\n * The editor to add the extension to. If not provided, it will use the\n * editor from the nearest `ProseKit` component.\n */\n editor?: Editor<E>\n}\n\n/**\n * A hook that runs a function to derive a value from the editor instance after\n * editor state changes.\n *\n * This is useful when you need to render something based on the editor state,\n * for example, whether the selected text is wrapped in an italic mark.\n *\n * @public\n */\nexport function useEditorDerivedValue<E extends Extension, Derived>(\n /**\n * A function that receives the editor instance and returns a derived value.\n *\n * It will be called whenever the editor's document state changes, or when it\n * mounts.\n *\n * This function should be memoized.\n */\n derive: (editor: Editor<E>) => Derived,\n options?: UseEditorDerivedOptions<E>,\n): Derived {\n const editorContext = useEditorContext<E>()\n const editor = options?.editor ?? editorContext\n if (!editor) {\n throw new EditorNotFoundError()\n }\n\n const [subscribe, getSnapshot] = useMemo(() => {\n return createEditorStore(editor, derive)\n }, [editor, derive])\n\n return useSyncExternalStore(subscribe, getSnapshot)\n}\n\nfunction createEditorStore<Derived, E extends Extension = any>(editor: Editor<E>, derive: (editor: Editor<E>) => Derived) {\n let dirty = true\n let derived: Derived\n\n const subscribe = (onChange: VoidFunction): VoidFunction => {\n const handleChange = () => {\n dirty = true\n onChange()\n }\n const extension = union(\n defineUpdateHandler(handleChange),\n defineMountHandler(handleChange),\n )\n return editor.use(extension)\n }\n\n const getSnapshot = () => {\n if (dirty) {\n dirty = false\n derived = derive(editor)\n }\n return derived\n }\n\n return [subscribe, getSnapshot] as const\n}\n","import {\n defineKeymap,\n type Keymap,\n} from '@prosekit/core'\nimport { useMemo } from 'react'\n\nimport {\n useExtension,\n type UseExtensionOptions,\n} from './use-extension'\n\nexport function useKeymap(keymap: Keymap, options?: UseExtensionOptions): void {\n const extension = useMemo(() => defineKeymap(keymap), [keymap])\n useExtension(extension, options)\n}\n","import { defineUpdateHandler } from '@prosekit/core'\nimport type { EditorState } from '@prosekit/pm/state'\nimport { useMemo } from 'react'\n\nimport {\n useExtension,\n type UseExtensionOptions,\n} from './use-extension'\n\n/**\n * Calls the given handler whenever the editor state changes.\n *\n * @public\n */\nexport function useStateUpdate(\n handler: (state: EditorState) => void,\n options?: UseExtensionOptions,\n): void {\n const extension = useMemo(\n () => defineUpdateHandler((view) => handler(view.state)),\n [handler],\n )\n useExtension(extension, options)\n}\n"],"mappings":";;;;;;;;;AAUA,SAAgB,mBACd,QACA,WACM;AACN,KAAI,CAAC,OACH,OAAM,IAAI,qBAAqB;AAGjC,iBAAgB;AACd,MAAI,UACF,QAAO,OAAO,IAAI,UAAU;IAE7B,CAAC,QAAQ,UAAU,CAAC;;;;;;;;ACZzB,SAAgB,qBACd,WACA,UACU;AACV,QAAO,cAAc;AACnB,SAAO,aAAa,WAAW,aAAa,WAAW,SAAS,GAAG;IAClE,CAAC,WAAW,SAAS,CAAC;;;;;;;;ACW3B,SAAgB,aAKd,WACA,SACM;CACN,MAAM,gBAAgB,kBAAkB;AACxC,oBACE,SAAS,UAAU,eACnB,qBAAqB,WAAW,SAAS,SAAS,CACnD;;;;;ACKH,SAAS,kBAAkB,WAAmC;AAC5D,QAAO,SAAS,uBAAuB;EACrC,MAAMA,QAA4B,oBAAoB;AACtD,SAAO,cAAc,WAAW,MAAM;;;;;;AAO1C,MAAaC,8BAAkC;CAC7C,MAAM,kBAAkB,oBAAoB;CAC5C,MAAM,YAAY,cACV,2BAA2B,gBAAgB,EACjD,CAAC,gBAAgB,CAClB;AACD,cAAa,UAAU;AAEvB,QAAO;;;;;;;AAQT,SAAgB,oBAAoB,SAA0C;CAC5E,MAAM,EAAE,MAAM,UAAW,GAAG,gBAAgB;CAE5C,MAAMC,OAAiC;EACrC,GAAG;EACH,WAAW,kBAAkB,UAAU;EACxC;AAED,QAAO,wBAAkD;EACvD,OAAO;EACP;EACA;EACD,CAAC;;AAGJ,SAAS,2BACP,SACA;AACA,QAAO,sBAAgD;EACrD,OAAO;EACP;EACD,C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;AAEjC,QAAO;;AAGT,SAAS,iBAAiB;CACxB,MAAM,GAAG,YAAY,YAAY,MAAc,IAAI,GAAG,EAAE;AACxD,QAAO;;;;;;;;;;;;;;AC5BT,SAAgB,sBASd,QACA,SACS;CACT,MAAM,gBAAgB,kBAAqB;CAC3C,MAAM,SAAS,SAAS,UAAU;AAClC,KAAI,CAAC,OACH,OAAM,IAAI,qBAAqB;CAGjC,MAAM,CAAC,WAAW,eAAe,cAAc;AAC7C,SAAO,kBAAkB,QAAQ,OAAO;IACvC,CAAC,QAAQ,OAAO,CAAC;AAEpB,QAAO,qBAAqB,WAAW,YAAY;;AAGrD,SAAS,kBAAsD,QAAmB,QAAwC;CACxH,IAAI,QAAQ;CACZ,IAAIC;CAEJ,MAAM,aAAa,aAAyC;EAC1D,MAAM,qBAAqB;AACzB,WAAQ;AACR,aAAU;;EAEZ,MAAM,YAAY,MAChB,oBAAoB,aAAa,EACjC,mBAAmB,aAAa,CACjC;AACD,SAAO,OAAO,IAAI,UAAU;;CAG9B,MAAM,oBAAoB;AACxB,MAAI,OAAO;AACT,WAAQ;AACR,aAAU,OAAO,OAAO;;AAE1B,SAAO;;AAGT,QAAO,CAAC,WAAW,YAAY;;;;;ACtEjC,SAAgB,UAAU,QAAgB,SAAqC;CAC7E,MAAM,YAAY,cAAc,aAAa,OAAO,EAAE,CAAC,OAAO,CAAC;AAC/D,cAAa,WAAW,QAAQ;;;;;;;;;;ACClC,SAAgB,eACd,SACA,SACM;CACN,MAAM,YAAY,cACV,qBAAqB,SAAS,QAAQ,KAAK,MAAM,CAAC,EACxD,CAAC,QAAQ,CACV;AACD,cAAa,WAAW,QAAQ"}
1
+ {"version":3,"file":"prosekit-react.js","names":["ReactMarkViewConsumer: FC","ReactNodeViewConsumer: FC","ProseKit: ComponentType<ProseKitProps>","derived: Derived"],"sources":["../src/hooks/use-editor-extension.ts","../src/hooks/use-priority-extension.ts","../src/hooks/use-extension.ts","../src/extensions/react-mark-view.ts","../src/extensions/react-node-view.ts","../src/components/prosekit.ts","../src/hooks/use-doc-change.ts","../src/hooks/use-editor.ts","../src/hooks/use-editor-derived-value.ts","../src/hooks/use-keymap.ts","../src/hooks/use-state-update.ts"],"sourcesContent":["import {\n EditorNotFoundError,\n type Editor,\n type Extension,\n} from '@prosekit/core'\nimport { useEffect } from 'react'\n\n/**\n * @internal\n */\nexport function useEditorExtension(\n editor: Editor | null | undefined,\n extension: Extension | null,\n): void {\n if (!editor) {\n throw new EditorNotFoundError()\n }\n\n useEffect(() => {\n if (extension) {\n return editor.use(extension)\n }\n }, [editor, extension])\n}\n","import {\n withPriority,\n type Extension,\n type Priority,\n} from '@prosekit/core'\nimport { useMemo } from 'react'\n\n/**\n * @internal\n */\nexport function usePriorityExtension<T extends Extension = Extension>(\n extension: T | null,\n priority?: Priority | null,\n): T | null {\n return useMemo(() => {\n return extension && priority ? withPriority(extension, priority) : extension\n }, [extension, priority])\n}\n","import type {\n Editor,\n Extension,\n Priority,\n} from '@prosekit/core'\n\nimport { useEditorContext } from '../contexts/editor-context'\n\nimport { useEditorExtension } from './use-editor-extension'\nimport { usePriorityExtension } from './use-priority-extension'\n\nexport interface UseExtensionOptions {\n /**\n * The editor to add the extension to. If not provided, it will use the\n * editor from the nearest `<ProseKit>` component.\n */\n editor?: Editor\n\n /**\n * Optional priority to add the extension with.\n */\n priority?: Priority\n}\n\n/**\n * Add an extension to the editor.\n */\nexport function useExtension(\n /**\n * The extension to add to the editor. If it changes, the previous\n * extension will be removed and the new one (if not null) will be added.\n */\n extension: Extension | null,\n options?: UseExtensionOptions,\n): void {\n const editorContext = useEditorContext()\n useEditorExtension(\n options?.editor || editorContext,\n usePriorityExtension(extension, options?.priority),\n )\n}\n","import {\n defineMarkViewComponent,\n defineMarkViewFactory,\n type Extension,\n} from '@prosekit/core'\nimport type { MarkViewConstructor } from '@prosekit/pm/view'\nimport type { CoreMarkViewUserOptions } from '@prosemirror-adapter/core'\nimport {\n useMarkViewContext,\n useMarkViewFactory,\n type MarkViewContext,\n type ReactMarkViewUserOptions,\n} from '@prosemirror-adapter/react'\nimport {\n createElement,\n useMemo,\n type ComponentType,\n type FC,\n} from 'react'\n\nimport { useExtension } from '../hooks/use-extension'\n\n/**\n * @public\n */\nexport interface ReactMarkViewProps extends MarkViewContext {}\n\n/**\n * @public\n */\nexport type ReactMarkViewComponent = ComponentType<ReactMarkViewProps>\n\n/**\n * Options for {@link defineReactMarkView}.\n *\n * @public\n */\nexport interface ReactMarkViewOptions extends CoreMarkViewUserOptions<ReactMarkViewComponent> {\n /**\n * The name of the mark type.\n */\n name: string\n}\n\nfunction withMarkViewProps(component: ReactMarkViewComponent) {\n return function MarkViewPropsWrapper() {\n const props: ReactMarkViewProps = useMarkViewContext()\n return createElement(component, props)\n }\n}\n\n/**\n * @internal\n */\nexport const ReactMarkViewConsumer: FC = () => {\n const markViewFactory = useMarkViewFactory()\n const extension = useMemo(\n () => defineReactMarkViewFactory(markViewFactory),\n [markViewFactory],\n )\n useExtension(extension)\n\n return null\n}\n\n/**\n * Defines a mark view using a React component.\n *\n * @public\n */\nexport function defineReactMarkView(options: ReactMarkViewOptions): Extension {\n const { name, component, ...userOptions } = options\n\n const args: ReactMarkViewUserOptions = {\n ...userOptions,\n component: withMarkViewProps(component),\n }\n\n return defineMarkViewComponent<ReactMarkViewUserOptions>({\n group: 'react',\n name,\n args,\n })\n}\n\nfunction defineReactMarkViewFactory(\n factory: (options: ReactMarkViewUserOptions) => MarkViewConstructor,\n) {\n return defineMarkViewFactory<ReactMarkViewUserOptions>({\n group: 'react',\n factory,\n })\n}\n","import {\n defineNodeViewComponent,\n defineNodeViewFactory,\n type Extension,\n} from '@prosekit/core'\nimport type { NodeViewConstructor } from '@prosekit/pm/view'\nimport type { CoreNodeViewUserOptions } from '@prosemirror-adapter/core'\nimport {\n useNodeViewContext,\n useNodeViewFactory,\n type NodeViewContext,\n type ReactNodeViewUserOptions,\n} from '@prosemirror-adapter/react'\nimport {\n createElement,\n useMemo,\n type ComponentType,\n type FC,\n} from 'react'\n\nimport { useExtension } from '../hooks/use-extension'\n\n/**\n * @public\n */\nexport interface ReactNodeViewProps extends NodeViewContext {}\n\n/**\n * @public\n */\nexport type ReactNodeViewComponent = ComponentType<ReactNodeViewProps>\n\n/**\n * Options for {@link defineReactNodeView}.\n *\n * @public\n */\nexport interface ReactNodeViewOptions extends CoreNodeViewUserOptions<ReactNodeViewComponent> {\n /**\n * The name of the node type.\n */\n name: string\n}\n\nfunction withNodeViewProps(component: ReactNodeViewComponent) {\n return function NodeViewPropsWrapper() {\n const props: ReactNodeViewProps = useNodeViewContext()\n return createElement(component, props)\n }\n}\n\n/**\n * @internal\n */\nexport const ReactNodeViewConsumer: FC = () => {\n const nodeViewFactory = useNodeViewFactory()\n const extension = useMemo(\n () => defineReactNodeViewFactory(nodeViewFactory),\n [nodeViewFactory],\n )\n useExtension(extension)\n\n return null\n}\n\n/**\n * Defines a node view using a React component.\n *\n * @public\n */\nexport function defineReactNodeView(options: ReactNodeViewOptions): Extension {\n const { name, component, ...userOptions } = options\n\n const args: ReactNodeViewUserOptions = {\n ...userOptions,\n component: withNodeViewProps(component),\n }\n\n return defineNodeViewComponent<ReactNodeViewUserOptions>({\n group: 'react',\n name,\n args,\n })\n}\n\nfunction defineReactNodeViewFactory(\n factory: (options: ReactNodeViewUserOptions) => NodeViewConstructor,\n) {\n return defineNodeViewFactory<ReactNodeViewUserOptions>({\n group: 'react',\n factory,\n })\n}\n","import type { Editor } from '@prosekit/core'\nimport { ProsemirrorAdapterProvider } from '@prosemirror-adapter/react'\nimport {\n createElement,\n type ComponentType,\n type ReactNode,\n} from 'react'\n\nimport { EditorContextProvider } from '../contexts/editor-context'\nimport { ReactMarkViewConsumer } from '../extensions/react-mark-view'\nimport { ReactNodeViewConsumer } from '../extensions/react-node-view'\n\nexport interface ProseKitProps {\n editor: Editor\n children?: ReactNode\n}\n\n/**\n * The root component for a ProseKit editor.\n *\n * @public\n */\nexport const ProseKit: ComponentType<ProseKitProps> = (props) => {\n const { editor, children } = props\n\n return createElement(\n ProsemirrorAdapterProvider,\n null,\n createElement(\n EditorContextProvider,\n { value: editor },\n createElement(ReactNodeViewConsumer),\n createElement(ReactMarkViewConsumer),\n children,\n ),\n )\n}\n","import { defineDocChangeHandler } from '@prosekit/core'\nimport type { ProseMirrorNode } from '@prosekit/pm/model'\nimport { useMemo } from 'react'\n\nimport {\n useExtension,\n type UseExtensionOptions,\n} from './use-extension'\n\n/**\n * Calls the given handler whenever the editor document changes.\n *\n * @public\n */\nexport function useDocChange(\n handler: (doc: ProseMirrorNode) => void,\n options?: UseExtensionOptions,\n): void {\n const extension = useMemo(\n () => defineDocChangeHandler((view) => handler(view.state.doc)),\n [handler],\n )\n useExtension(extension, options)\n}\n","import {\n defineMountHandler,\n defineUpdateHandler,\n ProseKitError,\n union,\n type Editor,\n type Extension,\n} from '@prosekit/core'\nimport {\n useEffect,\n useReducer,\n} from 'react'\n\nimport { useEditorContext } from '../contexts/editor-context'\n\n/**\n * Retrieves the editor instance from the nearest ProseKit component.\n *\n * @public\n */\nexport function useEditor<E extends Extension = any>(options?: {\n /**\n * Whether to update the component when the editor is mounted or editor state\n * is updated.\n *\n * Note this this option doesn't work with [React\n * compiler](https://react.dev/learn/react-compiler) because the returned\n * editor will be the same instance after state updates. If you're using React\n * compiler, you should use {@link useEditorDerivedValue} instead.\n *\n * @default false\n */\n update?: boolean\n}): Editor<E> {\n const update = options?.update ?? false\n\n const editor = useEditorContext<E>()\n if (!editor) {\n throw new ProseKitError(\n 'useEditor must be used within the ProseKit component',\n )\n }\n\n const forceUpdate = useForceUpdate()\n\n useEffect(() => {\n if (update) {\n const extension = union(\n defineMountHandler(forceUpdate),\n defineUpdateHandler(forceUpdate),\n )\n return editor.use(extension)\n }\n }, [editor, update, forceUpdate])\n\n return editor\n}\n\nfunction useForceUpdate() {\n const [, dispatch] = useReducer((x: number) => x + 1, 0)\n return dispatch\n}\n","import {\n defineMountHandler,\n defineUpdateHandler,\n EditorNotFoundError,\n union,\n type Editor,\n type Extension,\n} from '@prosekit/core'\nimport {\n useMemo,\n useSyncExternalStore,\n} from 'react'\n\nimport { useEditorContext } from '../contexts/editor-context'\n\nexport interface UseEditorDerivedOptions<E extends Extension = any> {\n /**\n * The editor to add the extension to. If not provided, it will use the\n * editor from the nearest `<ProseKit>` component.\n */\n editor?: Editor<E>\n}\n\n/**\n * Runs a function to derive a value from the editor instance after editor state\n * changes.\n *\n * This is useful when you need to render something based on the editor state,\n * for example, whether the selected text is wrapped in an italic mark.\n *\n * It returns the derived value that updates whenever the editor state changes.\n *\n * @public\n */\nexport function useEditorDerivedValue<E extends Extension, Derived>(\n /**\n * A function that receives the editor instance and returns a derived value.\n *\n * It will be called whenever the editor's document state changes, or when it\n * mounts.\n *\n * This function should be memoized.\n */\n derive: (editor: Editor<E>) => Derived,\n options?: UseEditorDerivedOptions<E>,\n): Derived {\n const editorContext = useEditorContext<E>()\n const editor = options?.editor ?? editorContext\n if (!editor) {\n throw new EditorNotFoundError()\n }\n\n const [subscribe, getSnapshot] = useMemo(() => {\n return createEditorStore(editor, derive)\n }, [editor, derive])\n\n return useSyncExternalStore(subscribe, getSnapshot, getSnapshot)\n}\n\nfunction createEditorStore<Derived, E extends Extension = any>(editor: Editor<E>, derive: (editor: Editor<E>) => Derived) {\n let dirty = true\n let derived: Derived\n\n const subscribe = (onChange: VoidFunction): VoidFunction => {\n const handleChange = () => {\n dirty = true\n onChange()\n }\n const extension = union(\n defineUpdateHandler(handleChange),\n defineMountHandler(handleChange),\n )\n return editor.use(extension)\n }\n\n const getSnapshot = () => {\n if (dirty) {\n dirty = false\n derived = derive(editor)\n }\n return derived\n }\n\n return [subscribe, getSnapshot] as const\n}\n","import {\n defineKeymap,\n type Keymap,\n} from '@prosekit/core'\nimport { useMemo } from 'react'\n\nimport {\n useExtension,\n type UseExtensionOptions,\n} from './use-extension'\n\nexport function useKeymap(keymap: Keymap, options?: UseExtensionOptions): void {\n const extension = useMemo(() => defineKeymap(keymap), [keymap])\n useExtension(extension, options)\n}\n","import { defineUpdateHandler } from '@prosekit/core'\nimport type { EditorState } from '@prosekit/pm/state'\nimport { useMemo } from 'react'\n\nimport {\n useExtension,\n type UseExtensionOptions,\n} from './use-extension'\n\n/**\n * Calls the given handler whenever the editor state changes.\n *\n * @public\n */\nexport function useStateUpdate(\n handler: (state: EditorState) => void,\n options?: UseExtensionOptions,\n): void {\n const extension = useMemo(\n () => defineUpdateHandler((view) => handler(view.state)),\n [handler],\n )\n useExtension(extension, options)\n}\n"],"mappings":";;;;;;;;;AAUA,SAAgB,mBACd,QACA,WACM;AACN,KAAI,CAAC,OACH,OAAM,IAAI,qBAAqB;AAGjC,iBAAgB;AACd,MAAI,UACF,QAAO,OAAO,IAAI,UAAU;IAE7B,CAAC,QAAQ,UAAU,CAAC;;;;;;;;ACZzB,SAAgB,qBACd,WACA,UACU;AACV,QAAO,cAAc;AACnB,SAAO,aAAa,WAAW,aAAa,WAAW,SAAS,GAAG;IAClE,CAAC,WAAW,SAAS,CAAC;;;;;;;;ACW3B,SAAgB,aAKd,WACA,SACM;CACN,MAAM,gBAAgB,kBAAkB;AACxC,oBACE,SAAS,UAAU,eACnB,qBAAqB,WAAW,SAAS,SAAS,CACnD;;;;;ACKH,SAAS,kBAAkB,WAAmC;AAC5D,QAAO,SAAS,uBAAuB;AAErC,SAAO,cAAc,WADa,oBAAoB,CAChB;;;;;;AAO1C,MAAaA,8BAAkC;CAC7C,MAAM,kBAAkB,oBAAoB;AAK5C,cAJkB,cACV,2BAA2B,gBAAgB,EACjD,CAAC,gBAAgB,CAClB,CACsB;AAEvB,QAAO;;;;;;;AAQT,SAAgB,oBAAoB,SAA0C;CAC5E,MAAM,EAAE,MAAM,UAAW,GAAG,gBAAgB;AAO5C,QAAO,wBAAkD;EACvD,OAAO;EACP;EACA,MARqC;GACrC,GAAG;GACH,WAAW,kBAAkB,UAAU;GACxC;EAMA,CAAC;;AAGJ,SAAS,2BACP,SACA;AACA,QAAO,sBAAgD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B,MAAM,GAAG,YAAY,YAAY,MAAc,IAAI,GAAG,EAAE;AACxD,QAAO;;;;;;;;;;;;;;;;AC1BT,SAAgB,sBASd,QACA,SACS;CACT,MAAM,gBAAgB,kBAAqB;CAC3C,MAAM,SAAS,SAAS,UAAU;AAClC,KAAI,CAAC,OACH,OAAM,IAAI,qBAAqB;CAGjC,MAAM,CAAC,WAAW,eAAe,cAAc;AAC7C,SAAO,kBAAkB,QAAQ,OAAO;IACvC,CAAC,QAAQ,OAAO,CAAC;AAEpB,QAAO,qBAAqB,WAAW,aAAa,YAAY;;AAGlE,SAAS,kBAAsD,QAAmB,QAAwC;CACxH,IAAI,QAAQ;CACZ,IAAIC;CAEJ,MAAM,aAAa,aAAyC;EAC1D,MAAM,qBAAqB;AACzB,WAAQ;AACR,aAAU;;EAEZ,MAAM,YAAY,MAChB,oBAAoB,aAAa,EACjC,mBAAmB,aAAa,CACjC;AACD,SAAO,OAAO,IAAI,UAAU;;CAG9B,MAAM,oBAAoB;AACxB,MAAI,OAAO;AACT,WAAQ;AACR,aAAU,OAAO,OAAO;;AAE1B,SAAO;;AAGT,QAAO,CAAC,WAAW,YAAY;;;;;ACxEjC,SAAgB,UAAU,QAAgB,SAAqC;AAE7E,cADkB,cAAc,aAAa,OAAO,EAAE,CAAC,OAAO,CAAC,EACvC,QAAQ;;;;;;;;;;ACClC,SAAgB,eACd,SACA,SACM;AAKN,cAJkB,cACV,qBAAqB,SAAS,QAAQ,KAAK,MAAM,CAAC,EACxD,CAAC,QAAQ,CACV,EACuB,QAAQ"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/react",
3
3
  "type": "module",
4
- "version": "0.6.1",
4
+ "version": "0.6.2",
5
5
  "private": false,
6
6
  "description": "React components and utilities for ProseKit",
7
7
  "author": {
@@ -68,11 +68,11 @@
68
68
  "src"
69
69
  ],
70
70
  "dependencies": {
71
- "@prosemirror-adapter/core": "^0.4.2",
72
- "@prosemirror-adapter/react": "^0.4.4",
73
- "@prosekit/web": "^0.7.4",
74
- "@prosekit/pm": "^0.1.12",
75
- "@prosekit/core": "^0.8.4"
71
+ "@prosemirror-adapter/core": "^0.4.6",
72
+ "@prosemirror-adapter/react": "^0.4.6",
73
+ "@prosekit/core": "^0.8.6",
74
+ "@prosekit/pm": "^0.1.14",
75
+ "@prosekit/web": "^0.7.6"
76
76
  },
77
77
  "peerDependencies": {
78
78
  "react": ">= 18.2.0",
@@ -87,12 +87,12 @@
87
87
  }
88
88
  },
89
89
  "devDependencies": {
90
- "@types/react": "^19.1.12",
91
- "@types/react-dom": "^19.1.9",
92
- "react": "^19.1.1",
93
- "react-dom": "^19.1.1",
94
- "tsdown": "^0.14.2",
95
- "typescript": "~5.9.2",
90
+ "@types/react": "^19.2.3",
91
+ "@types/react-dom": "^19.2.2",
92
+ "react": "^19.2.0",
93
+ "react-dom": "^19.2.0",
94
+ "tsdown": "^0.16.2",
95
+ "typescript": "~5.9.3",
96
96
  "@prosekit/config-tsdown": "0.0.0",
97
97
  "@prosekit/config-vitest": "0.0.0"
98
98
  },
@@ -86,8 +86,7 @@ export function createComponent<
86
86
  for (const [name, value] of Object.entries(properties)) {
87
87
  if (value !== undefined) {
88
88
  // @ts-expect-error: we know that name is a valid property name
89
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, react-compiler/react-compiler
90
- el[name] = value as unknown as any
89
+ el[name] = value as unknown
91
90
  }
92
91
  }
93
92
  }, [el, ...propNames.map((name) => properties[name])])
@@ -124,7 +123,12 @@ export function createComponent<
124
123
 
125
124
  const mergedRef = useMemo(() => mergeRefs([ref, setEl]), [ref])
126
125
 
127
- return createElement(tagName, { ...attributes, ref: mergedRef })
126
+ return createElement(tagName, {
127
+ ...attributes,
128
+ // Suppress hydration warnings for web components as the attributes are set after the component is mounted.
129
+ suppressHydrationWarning: true,
130
+ ref: mergedRef,
131
+ })
128
132
  })
129
133
 
130
134
  Component.displayName = displayName
@@ -16,18 +16,20 @@ import { useEditorContext } from '../contexts/editor-context'
16
16
  export interface UseEditorDerivedOptions<E extends Extension = any> {
17
17
  /**
18
18
  * The editor to add the extension to. If not provided, it will use the
19
- * editor from the nearest `ProseKit` component.
19
+ * editor from the nearest `<ProseKit>` component.
20
20
  */
21
21
  editor?: Editor<E>
22
22
  }
23
23
 
24
24
  /**
25
- * A hook that runs a function to derive a value from the editor instance after
26
- * editor state changes.
25
+ * Runs a function to derive a value from the editor instance after editor state
26
+ * changes.
27
27
  *
28
28
  * This is useful when you need to render something based on the editor state,
29
29
  * for example, whether the selected text is wrapped in an italic mark.
30
30
  *
31
+ * It returns the derived value that updates whenever the editor state changes.
32
+ *
31
33
  * @public
32
34
  */
33
35
  export function useEditorDerivedValue<E extends Extension, Derived>(
@@ -52,7 +54,7 @@ export function useEditorDerivedValue<E extends Extension, Derived>(
52
54
  return createEditorStore(editor, derive)
53
55
  }, [editor, derive])
54
56
 
55
- return useSyncExternalStore(subscribe, getSnapshot)
57
+ return useSyncExternalStore(subscribe, getSnapshot, getSnapshot)
56
58
  }
57
59
 
58
60
  function createEditorStore<Derived, E extends Extension = any>(editor: Editor<E>, derive: (editor: Editor<E>) => Derived) {
@@ -12,7 +12,7 @@ import { usePriorityExtension } from './use-priority-extension'
12
12
  export interface UseExtensionOptions {
13
13
  /**
14
14
  * The editor to add the extension to. If not provided, it will use the
15
- * editor from the nearest `ProseKit` component.
15
+ * editor from the nearest `<ProseKit>` component.
16
16
  */
17
17
  editor?: Editor
18
18
 
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-props-EGV61dJR.d.ts","names":[],"sources":["../src/components/create-props.ts"],"sourcesContent":[],"mappings":";KAAY,yCAAA,MACyB,KADd,GAAA,OAAA,EAAA,EAAA,eAAA,gBACc,MACE,MADF,GACW,WADX,MAEjC,KADmC,GAC3B,gBAD2B,CACV,MADU,CAAA;KAGlC,gBAH2C,CAAA,eAAA,gBAC5C,MAGmC,MAHnC,GAG4C,WAH5C,sBAAQ,MAKU,MALV,IAAA,KAKyB,UALzB,CAAA,MAAA,GAK6C,SAL7C,CAAA,EAAA,GAAA,CAAA,KAAA,EAMD,SANC,SAAA,GAAA,MAAA,QAAA,GAMqC,MANrC,CAM4C,SAN5C,CAAA,CAAA,QAAA,CAAA,GAOJ,MAPI,CAOG,SAPH,CAAA,EAAA,GAAA,IAAA,EAAgB"}