@prosekit/web
Advanced tools
Comparing version 0.3.17 to 0.3.18
@@ -14,4 +14,3 @@ import { BaseElement } from '@aria-ui/core'; | ||
import type { EmptyObject } from '@aria-ui/core'; | ||
import { Extension } from '@prosekit/core'; | ||
import { ExtensionTyping } from '@prosekit/core'; | ||
import type { Extension } from '@prosekit/core'; | ||
import { FocusChangeHandler } from '@prosekit/core'; | ||
@@ -26,2 +25,3 @@ import { ItemFilter } from '@aria-ui/collection'; | ||
import type { Placement } from '@floating-ui/dom'; | ||
import { PlainExtension } from '@prosekit/core'; | ||
import { PopoverContentProps } from '@aria-ui/popover'; | ||
@@ -619,7 +619,5 @@ import { PopoverRootProps } from '@aria-ui/popover'; | ||
export declare function defineCellHoverHandler(handler: (hoveringCell: HoveringCellInfo | null) => void): Extension<ExtensionTyping<any, any, any>>; | ||
export declare function defineCustomElement(name: string, constructor: CustomElementConstructor, options?: ElementDefinitionOptions): void; | ||
export declare function defineElementHoverHandler(handler: ElementHoverHandler): Union<readonly [Extension<ExtensionTyping<any, any, any>>, Extension<ExtensionTyping<any, any, any>>, Extension<ExtensionTyping<any, any, any>>]>; | ||
export declare function defineElementHoverHandler(handler: ElementHoverHandler): Union<readonly [PlainExtension, PlainExtension, PlainExtension]>; | ||
@@ -626,0 +624,0 @@ export declare type ElementHoverHandler = (reference: VirtualElement | null, hoverState: HoverState | null) => void; |
@@ -222,2 +222,3 @@ import { | ||
import { | ||
createComputed as createComputed3, | ||
createSignal as createSignal4, | ||
@@ -305,6 +306,9 @@ useEffect as useEffect3 | ||
const typing = useEditorTyping(host, editor); | ||
const isInTable = createComputed3(() => !!hoveringCell.get()); | ||
const selecting = useSelecting(host, editor, isInTable); | ||
useEffect3(host, () => { | ||
const typingValue = typing.get(); | ||
const selectingValue = selecting.get(); | ||
const hoveringCellValue = hoveringCell.get(); | ||
context.set(typingValue ? null : hoveringCellValue); | ||
context.set(typingValue || selectingValue ? null : hoveringCellValue); | ||
}); | ||
@@ -331,2 +335,32 @@ tableHandleRootContext.provide(host, context); | ||
} | ||
function useSelecting(host, editor, isInTable) { | ||
const selecting = createSignal4(false); | ||
useEffect3(host, () => { | ||
var _a; | ||
if (!isInTable.get()) { | ||
return; | ||
} | ||
const root = (_a = editor.peek()) == null ? void 0 : _a.view.root; | ||
if (!root) { | ||
return; | ||
} | ||
const pointerDownHandler = (event) => { | ||
const target = event.target; | ||
if (!target || host.contains(event.target)) { | ||
return; | ||
} | ||
selecting.set(true); | ||
}; | ||
const pointerUpHandler = () => { | ||
selecting.set(false); | ||
}; | ||
root.addEventListener("pointerdown", pointerDownHandler); | ||
root.addEventListener("pointerup", pointerUpHandler); | ||
return () => { | ||
root.removeEventListener("pointerdown", pointerDownHandler); | ||
root.removeEventListener("pointerup", pointerUpHandler); | ||
}; | ||
}); | ||
return selecting; | ||
} | ||
@@ -353,3 +387,3 @@ // src/components/table-handle/table-handle-root/element.gen.ts | ||
import { | ||
createComputed as createComputed3, | ||
createComputed as createComputed4, | ||
createSignal as createSignal5, | ||
@@ -366,7 +400,7 @@ mapSignals as mapSignals3, | ||
const rootContext = tableHandleRootContext.consume(host); | ||
const rowFirstCellPos = createComputed3(() => { | ||
const rowFirstCellPos = createComputed4(() => { | ||
var _a; | ||
return (_a = rootContext.get()) == null ? void 0 : _a.rowFirstCellPos; | ||
}); | ||
const referenceCell = createComputed3(() => { | ||
const referenceCell = createComputed4(() => { | ||
var _a; | ||
@@ -386,3 +420,3 @@ const pos = rowFirstCellPos.get(); | ||
}); | ||
const presence = createComputed3(() => !!referenceCell.get()); | ||
const presence = createComputed4(() => !!referenceCell.get()); | ||
useAttribute3(host, "data-state", () => presence.get() ? "open" : "closed"); | ||
@@ -389,0 +423,0 @@ usePresence2(host, presence); |
{ | ||
"name": "@prosekit/web", | ||
"type": "module", | ||
"version": "0.3.17", | ||
"version": "0.3.18", | ||
"private": false, | ||
@@ -81,4 +81,4 @@ "author": { | ||
"@aria-ui/tooltip": "^0.0.22", | ||
"@floating-ui/dom": "^1.6.10", | ||
"@zag-js/dom-query": "^0.66.1", | ||
"@floating-ui/dom": "^1.6.11", | ||
"@zag-js/dom-query": "^0.68.1", | ||
"just-omit": "^2.2.0", | ||
@@ -91,5 +91,5 @@ "prosemirror-tables": "^1.5.0", | ||
"devDependencies": { | ||
"tsup": "^8.2.4", | ||
"typescript": "^5.5.4", | ||
"vitest": "^2.0.5", | ||
"tsup": "^8.3.0", | ||
"typescript": "^5.6.2", | ||
"vitest": "^2.1.1", | ||
"@prosekit/dev": "0.0.0" | ||
@@ -96,0 +96,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
100864
2676
+ Added@zag-js/dom-query@0.68.1(transitive)
- Removed@zag-js/dom-query@0.66.1(transitive)
Updated@floating-ui/dom@^1.6.11
Updated@zag-js/dom-query@^0.68.1