@prosekit/lit
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -925,2 +925,5 @@ import { AutoUpdateOptions } from '@floating-ui/dom'; | ||
/** | ||
* @internal | ||
*/ | ||
export declare function useDismissable(host: LitElement, { onEscapeKeyDown, onPointerDownOutside, onDismiss, getReference, }: { | ||
@@ -933,12 +936,30 @@ onEscapeKeyDown: (event: KeyboardEvent) => void; | ||
/** | ||
* @internal | ||
*/ | ||
export declare function useEditorExtension(host: WithEditor<ReactiveControllerHost>, extension: Extension): void; | ||
/** | ||
* @internal | ||
*/ | ||
export declare function useEditorFocusChangeEvent(host: WithEditor<ReactiveControllerHost>, handler: FocusChangeHandler): void; | ||
/** | ||
* @internal | ||
*/ | ||
export declare function useEditorUpdateEvent(host: WithEditor<ReactiveControllerHost>, handler: UpdateHandler): void; | ||
/** | ||
* @internal | ||
*/ | ||
export declare function useEffect<T>(host: ReactiveControllerHost, getValue: () => T, onChange: (value: T) => void): void; | ||
/** | ||
* @internal | ||
*/ | ||
export declare function useInlinePopover(host: WithEditor<LitElement>, onReferenceChange: (reference: ReferenceElement | undefined) => void): () => ReferenceElement | undefined; | ||
/** | ||
* @internal | ||
*/ | ||
export declare function usePointerDownEvent(host: LitElement, handler: (event: PointerEvent) => void): void; | ||
@@ -945,0 +966,0 @@ |
@@ -61,14 +61,2 @@ import { | ||
// src/controllers/use-pointer-down-event.ts | ||
function usePointerDownEvent(host, handler) { | ||
host.addController({ | ||
hostConnected: () => { | ||
host.addEventListener("pointerdown", handler); | ||
}, | ||
hostDisconnected: () => { | ||
host.removeEventListener("pointerdown", handler); | ||
} | ||
}); | ||
} | ||
// src/components/inline-popover/helpers.ts | ||
@@ -114,16 +102,13 @@ import { isNodeSelection, isTextSelection } from "@prosekit/core"; | ||
function useInlinePopover(host, onReferenceChange) { | ||
let interacting = false; | ||
let reference; | ||
usePointerDownEvent(host, () => { | ||
interacting = true; | ||
}); | ||
let editorFocused = false; | ||
const isPopoverFocused = () => { | ||
return !editorFocused && host.contains(host.ownerDocument.activeElement); | ||
}; | ||
useEditorFocusChangeEvent(host, (focus) => { | ||
if (focus) { | ||
interacting = false; | ||
} | ||
editorFocused = focus; | ||
}); | ||
useEditorUpdateEvent(host, (view) => { | ||
if (interacting) { | ||
if (isPopoverFocused()) | ||
return; | ||
} | ||
const ref = getVirtualSelectionElement(view); | ||
@@ -130,0 +115,0 @@ if (reference !== ref) { |
{ | ||
"name": "@prosekit/lit", | ||
"type": "module", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"private": false, | ||
@@ -98,11 +98,11 @@ "author": { | ||
"dependencies": { | ||
"@floating-ui/dom": "^1.5.3", | ||
"@floating-ui/dom": "^1.5.4", | ||
"@lit/context": "^1.1.0", | ||
"@prosekit/core": "^0.2.4", | ||
"@prosekit/extensions": "^0.2.4", | ||
"@prosekit/core": "^0.2.6", | ||
"@prosekit/extensions": "^0.2.5", | ||
"@prosekit/pm": "^0.1.1", | ||
"@superhuman/command-score": "^0.5.0", | ||
"@zag-js/dismissable": "^0.32.0", | ||
"@zag-js/dom-query": "^0.32.0", | ||
"@zag-js/utils": "^0.32.0", | ||
"@zag-js/dismissable": "^0.32.1", | ||
"@zag-js/dom-query": "^0.32.1", | ||
"@zag-js/utils": "^0.32.1", | ||
"lit": "^3.1.1" | ||
@@ -115,3 +115,3 @@ }, | ||
"typescript": "^5.3.3", | ||
"vitest": "^1.2.0" | ||
"vitest": "^1.2.1" | ||
}, | ||
@@ -118,0 +118,0 @@ "scripts": { |
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
2700
84017
39
Updated@floating-ui/dom@^1.5.4
Updated@prosekit/core@^0.2.6
Updated@prosekit/extensions@^0.2.5
Updated@zag-js/dismissable@^0.32.1
Updated@zag-js/dom-query@^0.32.1
Updated@zag-js/utils@^0.32.1