@prosekit/preact 0.6.0 → 0.6.1

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 (38) hide show
  1. package/dist/{create-component-D7yDR5ux.js → create-component-BqjC2d_2.js} +3 -3
  2. package/dist/{create-component-D7yDR5ux.js.map → create-component-BqjC2d_2.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-imq7MdJr.js → editor-context-DNun2Non.js} +2 -2
  6. package/dist/{editor-context-imq7MdJr.js.map → editor-context-DNun2Non.js.map} +1 -1
  7. package/dist/prosekit-preact-autocomplete.d.ts +1 -1
  8. package/dist/prosekit-preact-autocomplete.d.ts.map +1 -1
  9. package/dist/prosekit-preact-autocomplete.js +2 -2
  10. package/dist/prosekit-preact-block-handle.d.ts +1 -1
  11. package/dist/prosekit-preact-block-handle.d.ts.map +1 -1
  12. package/dist/prosekit-preact-block-handle.js +2 -2
  13. package/dist/prosekit-preact-drop-indicator.d.ts +1 -1
  14. package/dist/prosekit-preact-drop-indicator.d.ts.map +1 -1
  15. package/dist/prosekit-preact-drop-indicator.js +2 -2
  16. package/dist/prosekit-preact-inline-popover.d.ts +1 -1
  17. package/dist/prosekit-preact-inline-popover.d.ts.map +1 -1
  18. package/dist/prosekit-preact-inline-popover.js +2 -2
  19. package/dist/prosekit-preact-popover.d.ts +1 -1
  20. package/dist/prosekit-preact-popover.d.ts.map +1 -1
  21. package/dist/prosekit-preact-popover.js +2 -2
  22. package/dist/prosekit-preact-resizable.d.ts +1 -1
  23. package/dist/prosekit-preact-resizable.d.ts.map +1 -1
  24. package/dist/prosekit-preact-resizable.js +2 -2
  25. package/dist/prosekit-preact-table-handle.d.ts +1 -1
  26. package/dist/prosekit-preact-table-handle.d.ts.map +1 -1
  27. package/dist/prosekit-preact-table-handle.js +2 -2
  28. package/dist/prosekit-preact-tooltip.d.ts +1 -1
  29. package/dist/prosekit-preact-tooltip.d.ts.map +1 -1
  30. package/dist/prosekit-preact-tooltip.js +2 -2
  31. package/dist/prosekit-preact.d.ts +6 -4
  32. package/dist/prosekit-preact.d.ts.map +1 -1
  33. package/dist/prosekit-preact.js +5 -3
  34. package/dist/prosekit-preact.js.map +1 -1
  35. package/package.json +8 -8
  36. package/src/hooks/use-editor-derived-value.ts +5 -3
  37. package/src/hooks/use-extension.ts +1 -1
  38. package/dist/create-props-EGV61dJR.d.ts.map +0 -1
@@ -1,4 +1,4 @@
1
- import { useEditorContext } from "./editor-context-imq7MdJr.js";
1
+ import { n as useEditorContext } from "./editor-context-DNun2Non.js";
2
2
  import { createElement } from "preact";
3
3
  import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "preact/hooks";
4
4
  import { forwardRef } from "preact/compat";
@@ -93,5 +93,5 @@ function createComponent(tagName, displayName, propNames, eventNames) {
93
93
  }
94
94
 
95
95
  //#endregion
96
- export { createComponent };
97
- //# sourceMappingURL=create-component-D7yDR5ux.js.map
96
+ export { createComponent as t };
97
+ //# sourceMappingURL=create-component-BqjC2d_2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-component-D7yDR5ux.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 'preact'\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 { createElement } from 'preact'\nimport {\n forwardRef,\n type ForwardRefExoticComponent,\n type HTMLAttributes,\n type RefAttributes,\n} from 'preact/compat'\nimport {\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'preact/hooks'\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\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,MAAM;GACrC,MAAM,YAAY,OAAO,YAAY;AACrC,YAAS,KAAK,YAAY,gBAAgB,UAAU,KAAK,KAAK,CAAC;;AAGjE,eAAa;AACX,QAAK,MAAM,WAAW,SAAU,UAAS;;;;;;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gC;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-BqjC2d_2.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 'preact'\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 { createElement } from 'preact'\nimport {\n forwardRef,\n type ForwardRefExoticComponent,\n type HTMLAttributes,\n type RefAttributes,\n} from 'preact/compat'\nimport {\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'preact/hooks'\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\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,MAAM;GACrC,MAAM,YAAY,OAAO,YAAY;AACrC,YAAS,KAAK,YAAY,gBAAgB,UAAU,KAAK,KAAK,CAAC;;AAGjE,eAAa;AACX,QAAK,MAAM,WAAW,SAAU,UAAS;;;;;;;ACX/C,MAAM,4BAA4B,OAAO,WAAW,cAAc,kBAAkB;AAEpF,SAAgB,gBAId,SACA,aACA,WACA,YAGA;CACA,MAAM,YAAY,UAAU,SAAS,SAAS;CAC9C,MAAM,wBAAwB,IA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B;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"}
@@ -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"}
@@ -15,5 +15,5 @@ function useEditorContext() {
15
15
  const EditorContextProvider = editorContext.Provider;
16
16
 
17
17
  //#endregion
18
- export { EditorContextProvider, useEditorContext };
19
- //# sourceMappingURL=editor-context-imq7MdJr.js.map
18
+ export { useEditorContext as n, EditorContextProvider as t };
19
+ //# sourceMappingURL=editor-context-DNun2Non.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"editor-context-imq7MdJr.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 type Provider,\n} from 'preact'\nimport { useContext } from 'preact/hooks'\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-DNun2Non.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 type Provider,\n} from 'preact'\nimport { useContext } from 'preact/hooks'\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 "preact/compat";
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-preact-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,OAHyE,CAGjE,sBAHiE,CAAA,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,ODHyE,CCGjE,qBDHiE,CAAA,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,OFHyE,CEGjE,qBFHiE,CAAA,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,OHHyE,CGGjE,wBHHiE,CAAA,GGIzE,aHJyE,CGI3D,0BHJ2D,CAAA,GGKzE,cHLyE,CGK1D,0BHL0D,CAAA,CAAA"}
1
+ {"version":3,"file":"prosekit-preact-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,OAHsD,CAG9C,sBAH8C,CAAA,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,ODHsD,CCG9C,qBDH8C,CAAA,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,OFHsD,CEG9C,qBFH8C,CAAA,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,OHHsD,CGG9C,wBHH8C,CAAA,GGItD,aHJsD,CGIxC,0BHJwC,CAAA,GGKtD,cHLsD,CGKvC,0BHLuC,CAAA,CAAA"}
@@ -1,5 +1,5 @@
1
- import "./editor-context-imq7MdJr.js";
2
- import { createComponent } from "./create-component-D7yDR5ux.js";
1
+ import "./editor-context-DNun2Non.js";
2
+ import { t as createComponent } from "./create-component-BqjC2d_2.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 "preact/compat";
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-preact-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,OAHsE,CAG9D,mBAH8D,CAAA,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,ODHsE,CCG9D,yBDH8D,CAAA,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,OFHsE,CEG9D,uBFH8D,CAAA,GEItE,aFJsE,CEIxD,yBFJwD,CAAA,GEKtE,cFLsE,CEKvD,yBFLuD,CAAA,CAAA"}
1
+ {"version":3,"file":"prosekit-preact-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,OAHmD,CAG3C,mBAH2C,CAAA,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,ODHmD,CCG3C,yBDH2C,CAAA,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,OFHmD,CEG3C,uBFH2C,CAAA,GEInD,aFJmD,CEIrC,yBFJqC,CAAA,GEKnD,cFLmD,CEKpC,yBFLoC,CAAA,CAAA"}
@@ -1,5 +1,5 @@
1
- import "./editor-context-imq7MdJr.js";
2
- import { createComponent } from "./create-component-D7yDR5ux.js";
1
+ import "./editor-context-DNun2Non.js";
2
+ import { t as createComponent } from "./create-component-BqjC2d_2.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 "preact/compat";
3
3
  import { DropIndicatorElement, DropIndicatorEvents, DropIndicatorProps as DropIndicatorProps$1 } from "@prosekit/web/drop-indicator";
4
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-preact-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,OAHqE,CAG7D,kBAH6D,CAAA,GAIrE,aAJqE,CAIvD,oBAJuD,CAAA,GAKrE,cALqE,CAKtD,oBALsD,CAAA,CAAA"}
1
+ {"version":3,"file":"prosekit-preact-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,OAHkD,CAG1C,kBAH0C,CAAA,GAIlD,aAJkD,CAIpC,oBAJoC,CAAA,GAKlD,cALkD,CAKnC,oBALmC,CAAA,CAAA"}
@@ -1,5 +1,5 @@
1
- import "./editor-context-imq7MdJr.js";
2
- import { createComponent } from "./create-component-D7yDR5ux.js";
1
+ import "./editor-context-DNun2Non.js";
2
+ import { t as createComponent } from "./create-component-BqjC2d_2.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 "preact/compat";
3
3
  import { InlinePopoverElement, InlinePopoverEvents, InlinePopoverProps as InlinePopoverProps$1 } from "@prosekit/web/inline-popover";
4
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-preact-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,OAHqE,CAG7D,kBAH6D,CAAA,GAIrE,aAJqE,CAIvD,oBAJuD,CAAA,GAKrE,cALqE,CAKtD,oBALsD,CAAA,CAAA"}
1
+ {"version":3,"file":"prosekit-preact-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,OAHkD,CAG1C,kBAH0C,CAAA,GAIlD,aAJkD,CAIpC,oBAJoC,CAAA,GAKlD,cALkD,CAKnC,oBALmC,CAAA,CAAA"}
@@ -1,5 +1,5 @@
1
- import "./editor-context-imq7MdJr.js";
2
- import { createComponent } from "./create-component-D7yDR5ux.js";
1
+ import "./editor-context-DNun2Non.js";
2
+ import { t as createComponent } from "./create-component-BqjC2d_2.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 "preact/compat";
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-preact-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,OAHsE,CAG9D,mBAH8D,CAAA,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,ODHsE,CCG9D,gBDH8D,CAAA,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,OFHsE,CEG9D,mBFH8D,CAAA,GEItE,aFJsE,CEIxD,qBFJwD,CAAA,GEKtE,cFLsE,CEKvD,qBFLuD,CAAA,CAAA"}
1
+ {"version":3,"file":"prosekit-preact-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,OAHmD,CAG3C,mBAH2C,CAAA,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,ODHmD,CCG3C,gBDH2C,CAAA,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,OFHmD,CEG3C,mBFH2C,CAAA,GEInD,aFJmD,CEIrC,qBFJqC,CAAA,GEKnD,cFLmD,CEKpC,qBFLoC,CAAA,CAAA"}
@@ -1,5 +1,5 @@
1
- import "./editor-context-imq7MdJr.js";
2
- import { createComponent } from "./create-component-D7yDR5ux.js";
1
+ import "./editor-context-DNun2Non.js";
2
+ import { t as createComponent } from "./create-component-BqjC2d_2.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 "preact/compat";
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-preact-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,OAHuE,CAG/D,oBAH+D,CAAA,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,ODHuE,CCG/D,kBDH+D,CAAA,GCIvE,aDJuE,CCIzD,oBDJyD,CAAA,GCKvE,cDLuE,CCKxD,oBDLwD,CAAA,CAAA"}
1
+ {"version":3,"file":"prosekit-preact-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,OAHoD,CAG5C,oBAH4C,CAAA,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,ODHoD,CCG5C,kBDH4C,CAAA,GCIpD,aDJoD,CCItC,oBDJsC,CAAA,GCKpD,cDLoD,CCKrC,oBDLqC,CAAA,CAAA"}
@@ -1,5 +1,5 @@
1
- import "./editor-context-imq7MdJr.js";
2
- import { createComponent } from "./create-component-D7yDR5ux.js";
1
+ import "./editor-context-DNun2Non.js";
2
+ import { t as createComponent } from "./create-component-BqjC2d_2.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 "preact/compat";
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-preact-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,OAH6E,CAGrE,0BAHqE,CAAA,GAI7E,aAJ6E,CAI/D,4BAJ+D,CAAA,GAK7E,cAL6E,CAK9D,4BAL8D,CAAA,CAAA;;;;;AAA/E;AAA4C,UCA3B,6BAAA,SAAsC,ODAX,CCAmB,WDAnB,CCA+B,+BDA/B,ECAsC,8BDAtC,CAAA,CAAA,CAAA;AAAmC,cCElE,wBDFkE,ECExC,yBDFwC,CCG7E,ODH6E,CCGrE,6BDHqE,CAAA,GCI7E,aDJ6E,CCI/D,+BDJ+D,CAAA,GCK7E,cDL6E,CCK9D,+BDL8D,CAAA,CAAA;;;;;AAA/E;AAA4C,UEA3B,2BAAA,SAAoC,OFAT,CEAiB,WFAjB,CEA6B,6BFA7B,EEAoC,4BFApC,CAAA,CAAA,CAAA;AAAmC,cEElE,sBFFkE,EEE1C,yBFF0C,CEG7E,OFH6E,CEGrE,2BFHqE,CAAA,GEI7E,aFJ6E,CEI/D,6BFJ+D,CAAA,GEK7E,cFL6E,CEK9D,6BFL8D,CAAA,CAAA;;;;;AAA/E;AAA4C,UGA3B,6BAAA,SAAsC,OHAX,CGAmB,WHAnB,CGA+B,+BHA/B,EGAsC,8BHAtC,CAAA,CAAA,CAAA;AAAmC,cGElE,wBHFkE,EGExC,yBHFwC,CGG7E,OHH6E,CGGrE,6BHHqE,CAAA,GGI7E,aHJ6E,CGI/D,+BHJ+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yBRF2C,CQG7E,ORH6E,CQGrE,0BRHqE,CAAA,GQI7E,aRJ6E,CQI/D,4BRJ+D,CAAA,GQK7E,cRL6E,CQK9D,4BRL8D,CAAA,CAAA"}
1
+ {"version":3,"file":"prosekit-preact-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,OAH0D,CAGlD,0BAHkD,CAAA,GAI1D,aAJ0D,CAI5C,4BAJ4C,CAAA,GAK1D,cAL0D,CAK3C,4BAL2C,CAAA,CAAA;;;;;AAA5D;AAAwE,UCAvD,6BAAA,SAAsC,ODAiB,CCAT,WDAS,CCAG,+BDAH,ECAU,8BDAV,CAAA,CAAA,CAAA;AAAZ,cCE/C,wBDF+C,ECErB,yBDFqB,CCG1D,ODH0D,CCGlD,6BDHkD,CAAA,GCI1D,aDJ0D,CCI5C,+BDJ4C,CAAA,GCK1D,cDL0D,CCK3C,+BDL2C,CAAA,CAAA;;;;;AAA5D;AAAwE,UEAvD,2BAAA,SAAoC,OFAmB,CEAX,WFAW,CEAC,6BFAD,EEAQ,4BFAR,CAAA,CAAA,CAAA;AAAZ,cEE/C,sBFF+C,EEEvB,yBFFuB,CEG1D,OFH0D,CEGlD,2BFHkD,CAAA,GEI1D,aFJ0D,CEI5C,6BFJ4C,CAAA,GEK1D,cFL0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PHkD,CAAA,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,ORH0D,CQGlD,0BRHkD,CAAA,GQI1D,aRJ0D,CQI5C,4BRJ4C,CAAA,GQK1D,cRL0D,CQK3C,4BRL2C,CAAA,CAAA"}
@@ -1,5 +1,5 @@
1
- import "./editor-context-imq7MdJr.js";
2
- import { createComponent } from "./create-component-D7yDR5ux.js";
1
+ import "./editor-context-DNun2Non.js";
2
+ import { t as createComponent } from "./create-component-BqjC2d_2.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 "preact/compat";
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-preact-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,OAHsE,CAG9D,mBAH8D,CAAA,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,ODHsE,CCG9D,gBDH8D,CAAA,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,OFHsE,CEG9D,mBFH8D,CAAA,GEItE,aFJsE,CEIxD,qBFJwD,CAAA,GEKtE,cFLsE,CEKvD,qBFLuD,CAAA,CAAA"}
1
+ {"version":3,"file":"prosekit-preact-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,OAHmD,CAG3C,mBAH2C,CAAA,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,ODHmD,CCG3C,gBDH2C,CAAA,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,OFHmD,CEG3C,mBFH2C,CAAA,GEInD,aFJmD,CEIrC,qBFJqC,CAAA,GEKnD,cFLmD,CEKpC,qBFLoC,CAAA,CAAA"}
@@ -1,5 +1,5 @@
1
- import "./editor-context-imq7MdJr.js";
2
- import { createComponent } from "./create-component-D7yDR5ux.js";
1
+ import "./editor-context-DNun2Non.js";
2
+ import { t as createComponent } from "./create-component-BqjC2d_2.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
@@ -75,7 +75,7 @@ declare function definePreactNodeView(options: PreactNodeViewOptions): Extension
75
75
  interface UseExtensionOptions {
76
76
  /**
77
77
  * The editor to add the extension to. If not provided, it will use the
78
- * editor from the nearest `ProseKit` component.
78
+ * editor from the nearest `<ProseKit>` component.
79
79
  */
80
80
  editor?: Editor;
81
81
  /**
@@ -121,17 +121,19 @@ declare function useEditor<E extends Extension = any>(options?: {
121
121
  interface UseEditorDerivedOptions<E extends Extension = any> {
122
122
  /**
123
123
  * The editor to add the extension to. If not provided, it will use the
124
- * editor from the nearest `ProseKit` component.
124
+ * editor from the nearest `<ProseKit>` component.
125
125
  */
126
126
  editor?: Editor<E>;
127
127
  }
128
128
  /**
129
- * A hook that runs a function to derive a value from the editor instance after
130
- * editor state changes.
129
+ * Runs a function to derive a value from the editor instance after editor state
130
+ * changes.
131
131
  *
132
132
  * This is useful when you need to render something based on the editor state,
133
133
  * for example, whether the selected text is wrapped in an italic mark.
134
134
  *
135
+ * It returns the derived value that updates whenever the editor state changes.
136
+ *
135
137
  * @public
136
138
  */
137
139
  declare function useEditorDerivedValue<E extends Extension, Derived>(
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-preact.d.ts","names":[],"sources":["../src/components/prosekit.ts","../src/extensions/preact-mark-view.ts","../src/extensions/preact-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;;;AAEa,cAQA,QARA,EAQU,aARV,CAQwB,aARxB,CAAA;;;;;;UCWI,mBAAA,SAA4B,iBDb7C;;;;AAE8B,KCgBlB,uBAAA,GAA0B,aDhBR,CCgBsB,mBDhBtB,CAAA;AAQ9B;;;;;UCeiB,qBAAA,SAA8B,wBAAwB;;;AAZvE;EAKY,IAAA,EAAA,MAAA;;;;;;AAwCZ;AAAoC,iBAApB,oBAAA,CAAoB,OAAA,EAAU,qBAAV,CAAA,EAAkC,SAAlC;;;;;;UC7CnB,mBAAA,SAA4B,iBFb7C;;;;AAE8B,KEgBlB,uBAAA,GAA0B,aFhBR,CEgBsB,mBFhBtB,CAAA;AAQ9B;;;;;UEeiB,qBAAA,SAA8B,wBAAwB;;;ADZvE;EAKY,IAAA,EAAA,MAAA;;;;;;AAwCZ;AAAoC,iBCApB,oBAAA,CDAoB,OAAA,ECAU,qBDAV,CAAA,ECAkC,SDAlC;;;UE3DnB,mBAAA;;;;;WAKN;;AHJX;;UACU,CAAA,EGQG,QHRH;;;AASV;;AAAqC,iBGKrB,YAAA;;;;;WAKH,4BACD;;;;;;;;iBCnBI,YAAA,gBACC,oCACL;;;;;;;;iBCII,oBAAoB,wBLgBnC;;AAxBD;;;;;EAUa,MAAA,CAAA,EAAA,OAcZ;CAAA,CAAA,EKRG,MLQH,CKRU,CLQV,CAAA;;;UMvBgB,kCAAkC;;;;;WAKxC,OAAO;;ANNlB;;;;;AAUA;;;;AAAoC,iBMQpB,qBNRoB,CAAA,UMQY,SNRZ,EAAA,OAAA,CAAA;;;;ACGpC;AAKA;;;;MAAmD,EAAA,CAAA,MAAA,EKShC,MLTgC,CKSzB,CLTyB,CAAA,EAAA,GKSlB,OLTkB,EAAA,OAAA,CAAA,EKUvC,uBLVuC,CKUf,CLVe,CAAA,CAAA,EKWhD,OLXgD;;;iBMnBnC,SAAA,SAAkB,kBAAkB;;;;;;;;iBCGpC,cAAA,kBACG,gCACP;;;;;;KCXA,8BAA8B;;;;ATO1C;;;AAEa,KSDD,iBTCC,CAAA,IAAA,OAAA,CAAA,GSDgC,CTChC,GAAA;EAAiB,QAAA,CAAA,ESAjB,iBTAiB,GAAA,SAAA;AAQ9B,CAAA"}
1
+ {"version":3,"file":"prosekit-preact.d.ts","names":[],"sources":["../src/components/prosekit.ts","../src/extensions/preact-mark-view.ts","../src/extensions/preact-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,mBAAA,SAA4B,iBDb7C;AAUA;;;KCQY,uBAAA,GAA0B,cAAc;AALpD;AAKA;AAOA;AAiCA;;UAjCiB,qBAAA,SAA8B,wBAAwB;;ACZvE;AAKA;EAOiB,IAAA,EAAA,MAAA;AAiCjB;AC3CA;;;;ACbA;iBHwDgB,oBAAA,UAA8B,wBAAwB;;;;;;UC7CrD,mBAAA,SAA4B,iBFb7C;AAUA;;;KEQY,uBAAA,GAA0B,cAAc;ADLpD;AAKA;AAOA;AAiCA;;UCjCiB,qBAAA,SAA8B,wBAAwB;;AAZvE;AAKA;EAOiB,IAAA,EAAA,MAAA;AAiCjB;AC3CA;;;;ACbA;iBFwDgB,oBAAA,UAA8B,wBAAwB;;;UC3DrD,mBAAA;;;;;WAKN;;AHJX;AAUA;aGDa;;;AFIb;AAKA;AAOiB,iBEVD,YAAA;AF2ChB;;;;AC7CA,SAAiB,ECOJ,SDPI,GAAA,IAAoB,EAAA,OAAuB,CAAvB,ECQzB,mBDRgD,CAAA,EAAA,IAAA;;;;;;;;iBEX5C,YAAA,gBACC,oCACL;;;;;;;;iBCII,oBAAoB,wBJUpC;;ADlBA;AAUA;;;;ECGiB,MAAA,CAAA,EAAA,OAAA;AAKjB,CAAA,CAAA,EIFI,MJEQ,CIFD,CJEC,CAAA;;;UKjBK,kCAAkC;;;;;WAKxC,OAAO;;ANNlB;AAUA;;;;ACGA;AAKA;AAOA;AAiCA;;;iBKtCgB,gCAAgC;AJPhD;AAKA;AAOA;AAiCA;;;;AC3DA;AAgBA,MAAgB,EAAA,CAAA,MAAA,EGcG,MHdS,CGcF,CHdE,CAAA,EAAA,GGcK,OHTpB,EAAA,OACkB,CAAnB,EGSA,uBHTmB,CGSK,CHTL,CAAA,CAAA,EGU5B,OHV4B;;;iBItBf,SAAA,SAAkB,kBAAkB;;;;;;;;iBCGpC,cAAA,kBACG,gCACP;;;;;;KCXA,8BAA8B;;;;ATO1C;AAUA;;KSTY,iCAAiC;aAChC;ARWb,CAAA"}
@@ -1,4 +1,4 @@
1
- import { EditorContextProvider, useEditorContext } from "./editor-context-imq7MdJr.js";
1
+ import { n as useEditorContext, t as EditorContextProvider } from "./editor-context-DNun2Non.js";
2
2
  import { ProsemirrorAdapterProvider, useMarkViewContext, useMarkViewFactory, useNodeViewContext, useNodeViewFactory } from "@prosemirror-adapter/preact";
3
3
  import { h } from "preact";
4
4
  import { useEffect, useMemo, useReducer } from "preact/hooks";
@@ -168,12 +168,14 @@ function useForceUpdate() {
168
168
  //#endregion
169
169
  //#region src/hooks/use-editor-derived-value.ts
170
170
  /**
171
- * A hook that runs a function to derive a value from the editor instance after
172
- * editor state changes.
171
+ * Runs a function to derive a value from the editor instance after editor state
172
+ * changes.
173
173
  *
174
174
  * This is useful when you need to render something based on the editor state,
175
175
  * for example, whether the selected text is wrapped in an italic mark.
176
176
  *
177
+ * It returns the derived value that updates whenever the editor state changes.
178
+ *
177
179
  * @public
178
180
  */
179
181
  function useEditorDerivedValue(derive, options) {
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-preact.js","names":["PreactMarkViewConsumer: FunctionComponent","PreactNodeViewConsumer: FunctionComponent","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/preact-mark-view.ts","../src/extensions/preact-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 'preact/hooks'\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 'preact/hooks'\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 PreactMarkViewUserOptions,\n} from '@prosemirror-adapter/preact'\nimport {\n h,\n type ComponentType,\n type FunctionComponent,\n} from 'preact'\nimport { useMemo } from 'preact/hooks'\n\nimport { useExtension } from '../hooks/use-extension'\n\n/**\n * @public\n */\nexport interface PreactMarkViewProps extends MarkViewContext {}\n\n/**\n * @public\n */\nexport type PreactMarkViewComponent = ComponentType<PreactMarkViewProps>\n\n/**\n * Options for {@link definePreactMarkView}.\n *\n * @public\n */\nexport interface PreactMarkViewOptions extends CoreMarkViewUserOptions<PreactMarkViewComponent> {\n /**\n * The name of the mark type.\n */\n name: string\n}\n\nfunction withMarkViewProps(component: PreactMarkViewComponent) {\n return function MarkViewPropsWrapper() {\n const props: PreactMarkViewProps = useMarkViewContext()\n return h(component, props)\n }\n}\n\n/**\n * @internal\n */\nexport const PreactMarkViewConsumer: FunctionComponent = () => {\n const markViewFactory = useMarkViewFactory()\n const extension = useMemo(\n () => definePreactMarkViewFactory(markViewFactory),\n [markViewFactory],\n )\n useExtension(extension)\n\n return null\n}\n\n/**\n * Defines a mark view using a Preact component.\n *\n * @public\n */\nexport function definePreactMarkView(options: PreactMarkViewOptions): Extension {\n const { name, component, ...userOptions } = options\n\n const args: PreactMarkViewUserOptions = {\n ...userOptions,\n component: withMarkViewProps(component),\n }\n\n return defineMarkViewComponent<PreactMarkViewUserOptions>({\n group: 'preact',\n name,\n args,\n })\n}\n\nfunction definePreactMarkViewFactory(\n factory: (options: PreactMarkViewUserOptions) => MarkViewConstructor,\n) {\n return defineMarkViewFactory<PreactMarkViewUserOptions>({\n group: 'preact',\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 PreactNodeViewUserOptions,\n} from '@prosemirror-adapter/preact'\nimport {\n h,\n type ComponentType,\n type FunctionComponent,\n} from 'preact'\nimport { useMemo } from 'preact/hooks'\n\nimport { useExtension } from '../hooks/use-extension'\n\n/**\n * @public\n */\nexport interface PreactNodeViewProps extends NodeViewContext {}\n\n/**\n * @public\n */\nexport type PreactNodeViewComponent = ComponentType<PreactNodeViewProps>\n\n/**\n * Options for {@link definePreactNodeView}.\n *\n * @public\n */\nexport interface PreactNodeViewOptions extends CoreNodeViewUserOptions<PreactNodeViewComponent> {\n /**\n * The name of the node type.\n */\n name: string\n}\n\nfunction withNodeViewProps(component: PreactNodeViewComponent) {\n return function NodeViewPropsWrapper() {\n const props: PreactNodeViewProps = useNodeViewContext()\n return h(component, props)\n }\n}\n\n/**\n * @internal\n */\nexport const PreactNodeViewConsumer: FunctionComponent = () => {\n const nodeViewFactory = useNodeViewFactory()\n const extension = useMemo(\n () => definePreactNodeViewFactory(nodeViewFactory),\n [nodeViewFactory],\n )\n useExtension(extension)\n\n return null\n}\n\n/**\n * Defines a node view using a Preact component.\n *\n * @public\n */\nexport function definePreactNodeView(options: PreactNodeViewOptions): Extension {\n const { name, component, ...userOptions } = options\n\n const args: PreactNodeViewUserOptions = {\n ...userOptions,\n component: withNodeViewProps(component),\n }\n\n return defineNodeViewComponent<PreactNodeViewUserOptions>({\n group: 'preact',\n name,\n args,\n })\n}\n\nfunction definePreactNodeViewFactory(\n factory: (options: PreactNodeViewUserOptions) => NodeViewConstructor,\n) {\n return defineNodeViewFactory<PreactNodeViewUserOptions>({\n group: 'preact',\n factory,\n })\n}\n","import type { Editor } from '@prosekit/core'\nimport { ProsemirrorAdapterProvider } from '@prosemirror-adapter/preact'\nimport {\n h,\n type ComponentChildren,\n type ComponentType,\n} from 'preact'\n\nimport { EditorContextProvider } from '../contexts/editor-context'\nimport { PreactMarkViewConsumer } from '../extensions/preact-mark-view'\nimport { PreactNodeViewConsumer } from '../extensions/preact-node-view'\n\nexport interface ProseKitProps {\n editor: Editor\n children?: ComponentChildren\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 h(\n ProsemirrorAdapterProvider,\n null,\n h(\n EditorContextProvider,\n { value: editor },\n h(PreactNodeViewConsumer, null),\n h(PreactMarkViewConsumer, null),\n children,\n ),\n )\n}\n","import { defineDocChangeHandler } from '@prosekit/core'\nimport type { ProseMirrorNode } from '@prosekit/pm/model'\nimport { useMemo } from 'preact/hooks'\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 'preact/hooks'\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 * @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 { useSyncExternalStore } from 'preact/compat'\nimport { useMemo } from 'preact/hooks'\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 'preact/hooks'\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 'preact/hooks'\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;A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AAoB,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;;;;;ACpEjC,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"}
1
+ {"version":3,"file":"prosekit-preact.js","names":["PreactMarkViewConsumer: FunctionComponent","PreactNodeViewConsumer: FunctionComponent","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/preact-mark-view.ts","../src/extensions/preact-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 'preact/hooks'\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 'preact/hooks'\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 PreactMarkViewUserOptions,\n} from '@prosemirror-adapter/preact'\nimport {\n h,\n type ComponentType,\n type FunctionComponent,\n} from 'preact'\nimport { useMemo } from 'preact/hooks'\n\nimport { useExtension } from '../hooks/use-extension'\n\n/**\n * @public\n */\nexport interface PreactMarkViewProps extends MarkViewContext {}\n\n/**\n * @public\n */\nexport type PreactMarkViewComponent = ComponentType<PreactMarkViewProps>\n\n/**\n * Options for {@link definePreactMarkView}.\n *\n * @public\n */\nexport interface PreactMarkViewOptions extends CoreMarkViewUserOptions<PreactMarkViewComponent> {\n /**\n * The name of the mark type.\n */\n name: string\n}\n\nfunction withMarkViewProps(component: PreactMarkViewComponent) {\n return function MarkViewPropsWrapper() {\n const props: PreactMarkViewProps = useMarkViewContext()\n return h(component, props)\n }\n}\n\n/**\n * @internal\n */\nexport const PreactMarkViewConsumer: FunctionComponent = () => {\n const markViewFactory = useMarkViewFactory()\n const extension = useMemo(\n () => definePreactMarkViewFactory(markViewFactory),\n [markViewFactory],\n )\n useExtension(extension)\n\n return null\n}\n\n/**\n * Defines a mark view using a Preact component.\n *\n * @public\n */\nexport function definePreactMarkView(options: PreactMarkViewOptions): Extension {\n const { name, component, ...userOptions } = options\n\n const args: PreactMarkViewUserOptions = {\n ...userOptions,\n component: withMarkViewProps(component),\n }\n\n return defineMarkViewComponent<PreactMarkViewUserOptions>({\n group: 'preact',\n name,\n args,\n })\n}\n\nfunction definePreactMarkViewFactory(\n factory: (options: PreactMarkViewUserOptions) => MarkViewConstructor,\n) {\n return defineMarkViewFactory<PreactMarkViewUserOptions>({\n group: 'preact',\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 PreactNodeViewUserOptions,\n} from '@prosemirror-adapter/preact'\nimport {\n h,\n type ComponentType,\n type FunctionComponent,\n} from 'preact'\nimport { useMemo } from 'preact/hooks'\n\nimport { useExtension } from '../hooks/use-extension'\n\n/**\n * @public\n */\nexport interface PreactNodeViewProps extends NodeViewContext {}\n\n/**\n * @public\n */\nexport type PreactNodeViewComponent = ComponentType<PreactNodeViewProps>\n\n/**\n * Options for {@link definePreactNodeView}.\n *\n * @public\n */\nexport interface PreactNodeViewOptions extends CoreNodeViewUserOptions<PreactNodeViewComponent> {\n /**\n * The name of the node type.\n */\n name: string\n}\n\nfunction withNodeViewProps(component: PreactNodeViewComponent) {\n return function NodeViewPropsWrapper() {\n const props: PreactNodeViewProps = useNodeViewContext()\n return h(component, props)\n }\n}\n\n/**\n * @internal\n */\nexport const PreactNodeViewConsumer: FunctionComponent = () => {\n const nodeViewFactory = useNodeViewFactory()\n const extension = useMemo(\n () => definePreactNodeViewFactory(nodeViewFactory),\n [nodeViewFactory],\n )\n useExtension(extension)\n\n return null\n}\n\n/**\n * Defines a node view using a Preact component.\n *\n * @public\n */\nexport function definePreactNodeView(options: PreactNodeViewOptions): Extension {\n const { name, component, ...userOptions } = options\n\n const args: PreactNodeViewUserOptions = {\n ...userOptions,\n component: withNodeViewProps(component),\n }\n\n return defineNodeViewComponent<PreactNodeViewUserOptions>({\n group: 'preact',\n name,\n args,\n })\n}\n\nfunction definePreactNodeViewFactory(\n factory: (options: PreactNodeViewUserOptions) => NodeViewConstructor,\n) {\n return defineNodeViewFactory<PreactNodeViewUserOptions>({\n group: 'preact',\n factory,\n })\n}\n","import type { Editor } from '@prosekit/core'\nimport { ProsemirrorAdapterProvider } from '@prosemirror-adapter/preact'\nimport {\n h,\n type ComponentChildren,\n type ComponentType,\n} from 'preact'\n\nimport { EditorContextProvider } from '../contexts/editor-context'\nimport { PreactMarkViewConsumer } from '../extensions/preact-mark-view'\nimport { PreactNodeViewConsumer } from '../extensions/preact-node-view'\n\nexport interface ProseKitProps {\n editor: Editor\n children?: ComponentChildren\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 h(\n ProsemirrorAdapterProvider,\n null,\n h(\n EditorContextProvider,\n { value: editor },\n h(PreactNodeViewConsumer, null),\n h(PreactMarkViewConsumer, null),\n children,\n ),\n )\n}\n","import { defineDocChangeHandler } from '@prosekit/core'\nimport type { ProseMirrorNode } from '@prosekit/pm/model'\nimport { useMemo } from 'preact/hooks'\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 'preact/hooks'\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 * @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 { useSyncExternalStore } from 'preact/compat'\nimport { useMemo } from 'preact/hooks'\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)\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 'preact/hooks'\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 'preact/hooks'\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,a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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;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/preact",
3
3
  "type": "module",
4
- "version": "0.6.0",
4
+ "version": "0.6.1",
5
5
  "private": false,
6
6
  "description": "Preact 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.5",
72
- "@prosemirror-adapter/preact": "^0.4.5",
73
- "@prosekit/web": "^0.7.4",
74
- "@prosekit/core": "^0.8.4",
75
- "@prosekit/pm": "^0.1.12"
71
+ "@prosemirror-adapter/core": "^0.4.6",
72
+ "@prosemirror-adapter/preact": "^0.4.6",
73
+ "@prosekit/core": "^0.8.6",
74
+ "@prosekit/web": "^0.7.6",
75
+ "@prosekit/pm": "^0.1.14"
76
76
  },
77
77
  "peerDependencies": {
78
78
  "preact": ">= 10.11.0"
@@ -84,8 +84,8 @@
84
84
  },
85
85
  "devDependencies": {
86
86
  "preact": "^10.27.2",
87
- "tsdown": "^0.15.6",
88
- "typescript": "~5.9.2",
87
+ "tsdown": "^0.16.2",
88
+ "typescript": "~5.9.3",
89
89
  "@prosekit/config-tsdown": "0.0.0",
90
90
  "@prosekit/config-vitest": "0.0.0"
91
91
  },
@@ -14,18 +14,20 @@ import { useEditorContext } from '../contexts/editor-context'
14
14
  export interface UseEditorDerivedOptions<E extends Extension = any> {
15
15
  /**
16
16
  * The editor to add the extension to. If not provided, it will use the
17
- * editor from the nearest `ProseKit` component.
17
+ * editor from the nearest `<ProseKit>` component.
18
18
  */
19
19
  editor?: Editor<E>
20
20
  }
21
21
 
22
22
  /**
23
- * A hook that runs a function to derive a value from the editor instance after
24
- * editor state changes.
23
+ * Runs a function to derive a value from the editor instance after editor state
24
+ * changes.
25
25
  *
26
26
  * This is useful when you need to render something based on the editor state,
27
27
  * for example, whether the selected text is wrapped in an italic mark.
28
28
  *
29
+ * It returns the derived value that updates whenever the editor state changes.
30
+ *
29
31
  * @public
30
32
  */
31
33
  export function useEditorDerivedValue<E extends Extension, 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"}