@prosekit/solid 0.7.0 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,6 +29,15 @@ export interface AutocompleteRootProps {
29
29
  * @default defaultItemFilter
30
30
  */
31
31
  filter?: AutocompleteRootElementProps['filter'];
32
+ /**
33
+ * The reference to position the popup against. This can be a DOM element, a
34
+ * Floating UI virtual element, or a function that returns either of them.
35
+ * By default, the popup will be positioned against the text content that
36
+ * triggers the autocomplete.
37
+ *
38
+ * @default null
39
+ */
40
+ anchor?: AutocompleteRootElementProps['anchor'];
32
41
  /** Fired when the open state changes. */
33
42
  onOpenChange?: (event: AutocompleteRootEvents['openChange']) => void;
34
43
  /** Fired when the query changes. */
@@ -52,15 +61,15 @@ export const AutocompleteRoot: Component<AutocompleteRootProps & JSX.HTMLAttribu
52
61
  const [getElement, setElement] = createSignal<AutocompleteRootElement | null>(null);
53
62
  const handlers: Array<((event: any) => void) | undefined> = [];
54
63
 
55
- const [elementProps, eventHandlers, restProps] = splitProps(props, ['editor', 'filter', 'regex'], ['onOpenChange', 'onQueryChange', 'onValueChange', 'onValuesChange']);
64
+ const [elementProps, eventHandlers, restProps] = splitProps(props, ['anchor', 'editor', 'filter', 'regex'], ['onOpenChange', 'onQueryChange', 'onValueChange', 'onValuesChange']);
56
65
 
57
- const p0Fallback = useEditorContext();
66
+ const p1Fallback = useEditorContext();
58
67
 
59
68
  createEffect(() => {
60
69
  const element = getElement();
61
70
  if (!element) return;
62
71
 
63
- Object.assign(element, { editor: elementProps.editor ?? p0Fallback, filter: elementProps.filter, regex: elementProps.regex });
72
+ Object.assign(element, { anchor: elementProps.anchor, editor: elementProps.editor ?? p1Fallback, filter: elementProps.filter, regex: elementProps.regex });
64
73
 
65
74
  handlers.length = 0;
66
75
  handlers.push(eventHandlers.onOpenChange);
@@ -11,8 +11,6 @@ export type ProseKitProps = ParentProps<{
11
11
 
12
12
  /**
13
13
  * The root component for a ProseKit editor.
14
- *
15
- * @public
16
14
  */
17
15
  export const ProseKit: Component<ProseKitProps> = (props) => {
18
16
  return createComponent(EditorContextProvider, {
@@ -11,20 +11,12 @@ import { Portal } from 'solid-js/web'
11
11
 
12
12
  import { hidePortalDiv } from './helpers.ts'
13
13
 
14
- /**
15
- * @public
16
- */
17
14
  export interface SolidMarkViewProps extends MarkViewContextProps {}
18
15
 
19
- /**
20
- * @public
21
- */
22
16
  export type SolidMarkViewComponent = Component<SolidMarkViewProps>
23
17
 
24
18
  /**
25
19
  * Options for {@link defineSolidMarkView}.
26
- *
27
- * @public
28
20
  */
29
21
  export interface SolidMarkViewOptions extends CoreMarkViewUserOptions<SolidMarkViewComponent> {
30
22
  /**
@@ -72,8 +64,6 @@ export function defineSolidMarkViewFactory(
72
64
 
73
65
  /**
74
66
  * Defines a mark view using a Solid component.
75
- *
76
- * @public
77
67
  */
78
68
  export function defineSolidMarkView(options: SolidMarkViewOptions): Extension {
79
69
  return defineMarkViewComponent<SolidMarkViewOptions>({
@@ -11,20 +11,12 @@ import { Portal } from 'solid-js/web'
11
11
 
12
12
  import { hidePortalDiv } from './helpers.ts'
13
13
 
14
- /**
15
- * @public
16
- */
17
14
  export interface SolidNodeViewProps extends NodeViewContextProps {}
18
15
 
19
- /**
20
- * @public
21
- */
22
16
  export type SolidNodeViewComponent = Component<SolidNodeViewProps>
23
17
 
24
18
  /**
25
19
  * Options for {@link defineSolidNodeView}.
26
- *
27
- * @public
28
20
  */
29
21
  export interface SolidNodeViewOptions extends CoreNodeViewUserOptions<SolidNodeViewComponent> {
30
22
  /**
@@ -87,8 +79,6 @@ export function defineSolidNodeViewFactory(
87
79
 
88
80
  /**
89
81
  * Defines a node view using a Solid component.
90
- *
91
- * @public
92
82
  */
93
83
  export function defineSolidNodeView(options: SolidNodeViewOptions): Extension {
94
84
  return defineNodeViewComponent<SolidNodeViewOptions>({
@@ -5,8 +5,6 @@ import { useExtension, type UseExtensionOptions } from './use-extension.ts'
5
5
 
6
6
  /**
7
7
  * Calls the given handler whenever the editor document changes.
8
- *
9
- * @public
10
8
  */
11
9
  export function useDocChange(
12
10
  handler: (doc: ProseMirrorNode) => void,
@@ -23,8 +23,6 @@ export interface UseEditorDerivedOptions<E extends Extension = any> {
23
23
  *
24
24
  * It returns an accessor of the derived value that updates whenever the editor
25
25
  * state changes.
26
- *
27
- * @public
28
26
  */
29
27
  export function useEditorDerivedValue<E extends Extension, Derived>(
30
28
  /**
@@ -5,8 +5,6 @@ import { useEditorContext } from '../contexts/editor-context.ts'
5
5
 
6
6
  /**
7
7
  * Retrieves the editor instance from the nearest ProseKit component.
8
- *
9
- * @public
10
8
  */
11
9
  export function useEditor<E extends Extension = any>(options?: {
12
10
  /**
@@ -5,8 +5,6 @@ import { useExtension, type UseExtensionOptions } from './use-extension.ts'
5
5
 
6
6
  /**
7
7
  * Calls the given handler whenever the editor state changes.
8
- *
9
- * @public
10
8
  */
11
9
  export function useStateUpdate(
12
10
  handler: (state: EditorState) => void,