@prosekit/preact 0.4.12 → 0.4.13
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.
- package/dist/{create-component-BW93u26s.js → create-component-B23NJ9dW.js} +30 -3
- package/dist/prosekit-preact-autocomplete.js +1 -1
- package/dist/prosekit-preact-block-handle.js +1 -1
- package/dist/prosekit-preact-inline-popover.js +1 -1
- package/dist/prosekit-preact-popover.js +1 -1
- package/dist/prosekit-preact-resizable.js +1 -1
- package/dist/prosekit-preact-table-handle.js +1 -1
- package/dist/prosekit-preact-tooltip.js +1 -1
- package/package.json +3 -4
@@ -1,9 +1,35 @@
|
|
1
1
|
import { useEditorContext } from "./editor-context-imq7MdJr.js";
|
2
2
|
import { createElement } from "preact";
|
3
|
-
import { useEffect, useLayoutEffect, useRef, useState } from "preact/hooks";
|
3
|
+
import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "preact/hooks";
|
4
4
|
import { forwardRef } from "preact/compat";
|
5
|
-
import { mergeRefs } from "react-merge-refs";
|
6
5
|
|
6
|
+
//#region src/components/merge-refs.ts
|
7
|
+
/**
|
8
|
+
* Assigns a value to a ref.
|
9
|
+
* @returns The ref cleanup callback, if any.
|
10
|
+
*/
|
11
|
+
function assignRef(ref, value) {
|
12
|
+
if (typeof ref === "function") return ref(value);
|
13
|
+
else if (ref) ref.current = value;
|
14
|
+
}
|
15
|
+
/**
|
16
|
+
* Merges multiple refs into a single one.
|
17
|
+
*/
|
18
|
+
function mergeRefs(refs) {
|
19
|
+
return (value) => {
|
20
|
+
const cleanups = [];
|
21
|
+
for (const ref of refs) {
|
22
|
+
const cleanup = assignRef(ref, value);
|
23
|
+
const isCleanup = typeof cleanup === "function";
|
24
|
+
cleanups.push(isCleanup ? cleanup : () => assignRef(ref, null));
|
25
|
+
}
|
26
|
+
return () => {
|
27
|
+
for (const cleanup of cleanups) cleanup();
|
28
|
+
};
|
29
|
+
};
|
30
|
+
}
|
31
|
+
|
32
|
+
//#endregion
|
7
33
|
//#region src/components/create-component.ts
|
8
34
|
const useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
|
9
35
|
function createComponent(tagName, displayName, propNames, eventNames) {
|
@@ -56,9 +82,10 @@ function createComponent(tagName, displayName, propNames, eventNames) {
|
|
56
82
|
for (const [name, handler] of Object.entries(fixedEventHandlers)) el.removeEventListener(name, handler);
|
57
83
|
};
|
58
84
|
}, [el]);
|
85
|
+
const mergedRef = useMemo(() => mergeRefs([ref, setEl]), [ref]);
|
59
86
|
return createElement(tagName, {
|
60
87
|
...attributes,
|
61
|
-
ref:
|
88
|
+
ref: mergedRef
|
62
89
|
});
|
63
90
|
});
|
64
91
|
Component.displayName = displayName;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import "./editor-context-imq7MdJr.js";
|
2
|
-
import { createComponent } from "./create-component-
|
2
|
+
import { createComponent } from "./create-component-B23NJ9dW.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,5 +1,5 @@
|
|
1
1
|
import "./editor-context-imq7MdJr.js";
|
2
|
-
import { createComponent } from "./create-component-
|
2
|
+
import { createComponent } from "./create-component-B23NJ9dW.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,5 +1,5 @@
|
|
1
1
|
import "./editor-context-imq7MdJr.js";
|
2
|
-
import { createComponent } from "./create-component-
|
2
|
+
import { createComponent } from "./create-component-B23NJ9dW.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,5 +1,5 @@
|
|
1
1
|
import "./editor-context-imq7MdJr.js";
|
2
|
-
import { createComponent } from "./create-component-
|
2
|
+
import { createComponent } from "./create-component-B23NJ9dW.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,5 +1,5 @@
|
|
1
1
|
import "./editor-context-imq7MdJr.js";
|
2
|
-
import { createComponent } from "./create-component-
|
2
|
+
import { createComponent } from "./create-component-B23NJ9dW.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,5 +1,5 @@
|
|
1
1
|
import "./editor-context-imq7MdJr.js";
|
2
|
-
import { createComponent } from "./create-component-
|
2
|
+
import { createComponent } from "./create-component-B23NJ9dW.js";
|
3
3
|
import { tableHandleColumnRootEvents, tableHandleColumnRootProps, tableHandleColumnTriggerEvents, tableHandleColumnTriggerProps, 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,5 +1,5 @@
|
|
1
1
|
import "./editor-context-imq7MdJr.js";
|
2
|
-
import { createComponent } from "./create-component-
|
2
|
+
import { createComponent } from "./create-component-B23NJ9dW.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
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@prosekit/preact",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.4.
|
4
|
+
"version": "0.4.13",
|
5
5
|
"private": false,
|
6
6
|
"description": "Preact components and utilities for ProseKit",
|
7
7
|
"author": {
|
@@ -63,7 +63,6 @@
|
|
63
63
|
"dist"
|
64
64
|
],
|
65
65
|
"dependencies": {
|
66
|
-
"react-merge-refs": "^3.0.1",
|
67
66
|
"@prosekit/core": "^0.8.1",
|
68
67
|
"@prosekit/pm": "^0.1.10",
|
69
68
|
"@prosekit/web": "^0.5.8"
|
@@ -81,8 +80,8 @@
|
|
81
80
|
"tsdown": "^0.11.1",
|
82
81
|
"typescript": "~5.8.3",
|
83
82
|
"vitest": "^3.1.3",
|
84
|
-
"@prosekit/config-
|
85
|
-
"@prosekit/config-
|
83
|
+
"@prosekit/config-tsdown": "0.0.0",
|
84
|
+
"@prosekit/config-vitest": "0.0.0"
|
86
85
|
},
|
87
86
|
"publishConfig": {
|
88
87
|
"dev": {}
|