@prosekit/solid 0.7.0-beta.3 → 0.7.0-beta.5
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/editor-context.js +0 -2
- package/dist/editor-context.js.map +1 -1
- package/dist/prosekit-solid-autocomplete.d.ts +22 -73
- package/dist/prosekit-solid-autocomplete.d.ts.map +1 -1
- package/dist/prosekit-solid-autocomplete.js +7 -52
- package/dist/prosekit-solid-autocomplete.js.map +1 -1
- package/dist/prosekit-solid-block-handle.d.ts +22 -73
- package/dist/prosekit-solid-block-handle.d.ts.map +1 -1
- package/dist/prosekit-solid-block-handle.js +7 -52
- package/dist/prosekit-solid-block-handle.js.map +1 -1
- package/dist/prosekit-solid-drop-indicator.d.ts +4 -15
- package/dist/prosekit-solid-drop-indicator.d.ts.map +1 -1
- package/dist/prosekit-solid-drop-indicator.js +1 -10
- package/dist/prosekit-solid-drop-indicator.js.map +1 -1
- package/dist/prosekit-solid-inline-popover.d.ts +15 -46
- package/dist/prosekit-solid-inline-popover.d.ts.map +1 -1
- package/dist/prosekit-solid-inline-popover.js +5 -32
- package/dist/prosekit-solid-inline-popover.js.map +1 -1
- package/dist/prosekit-solid-menu.d.ts +61 -101
- package/dist/prosekit-solid-menu.d.ts.map +1 -1
- package/dist/prosekit-solid-menu.js +52 -76
- package/dist/prosekit-solid-menu.js.map +1 -1
- package/dist/prosekit-solid-popover.d.ts +18 -59
- package/dist/prosekit-solid-popover.d.ts.map +1 -1
- package/dist/prosekit-solid-popover.js +6 -42
- package/dist/prosekit-solid-popover.js.map +1 -1
- package/dist/prosekit-solid-resizable.d.ts +10 -31
- package/dist/prosekit-solid-resizable.d.ts.map +1 -1
- package/dist/prosekit-solid-resizable.js +4 -22
- package/dist/prosekit-solid-resizable.js.map +1 -1
- package/dist/prosekit-solid-table-handle.d.ts +44 -155
- package/dist/prosekit-solid-table-handle.d.ts.map +1 -1
- package/dist/prosekit-solid-table-handle.js +11 -110
- package/dist/prosekit-solid-table-handle.js.map +1 -1
- package/dist/prosekit-solid-tooltip.d.ts +18 -59
- package/dist/prosekit-solid-tooltip.d.ts.map +1 -1
- package/dist/prosekit-solid-tooltip.js +6 -42
- package/dist/prosekit-solid-tooltip.js.map +1 -1
- package/dist/prosekit-solid.d.ts +0 -21
- package/dist/prosekit-solid.d.ts.map +1 -1
- package/dist/prosekit-solid.js +0 -28
- package/dist/prosekit-solid.js.map +1 -1
- package/package.json +4 -4
- package/src/components/autocomplete/autocomplete-empty.gen.ts +5 -15
- package/src/components/autocomplete/autocomplete-item.gen.ts +5 -17
- package/src/components/autocomplete/autocomplete-popup.gen.ts +5 -17
- package/src/components/autocomplete/autocomplete-positioner.gen.ts +5 -15
- package/src/components/autocomplete/autocomplete-root.gen.ts +5 -17
- package/src/components/autocomplete/index.gen.ts +4 -8
- package/src/components/block-handle/block-handle-add.gen.ts +5 -15
- package/src/components/block-handle/block-handle-draggable.gen.ts +5 -15
- package/src/components/block-handle/block-handle-popup.gen.ts +5 -15
- package/src/components/block-handle/block-handle-positioner.gen.ts +5 -15
- package/src/components/block-handle/block-handle-root.gen.ts +5 -17
- package/src/components/block-handle/index.gen.ts +2 -6
- package/src/components/drop-indicator/drop-indicator.gen.ts +5 -15
- package/src/components/drop-indicator/index.gen.ts +1 -3
- package/src/components/inline-popover/index.gen.ts +2 -6
- package/src/components/inline-popover/inline-popover-popup.gen.ts +5 -15
- package/src/components/inline-popover/inline-popover-positioner.gen.ts +5 -15
- package/src/components/inline-popover/inline-popover-root.gen.ts +6 -18
- package/src/components/menu/index.gen.ts +4 -8
- package/src/components/menu/menu-item.gen.ts +5 -17
- package/src/components/menu/menu-popup.gen.ts +5 -15
- package/src/components/menu/menu-positioner.gen.ts +5 -15
- package/src/components/menu/menu-root.gen.ts +5 -17
- package/src/components/menu/menu-submenu-root.gen.ts +66 -19
- package/src/components/menu/menu-submenu-trigger.gen.ts +40 -19
- package/src/components/menu/menu-trigger.gen.ts +5 -17
- package/src/components/popover/index.gen.ts +3 -7
- package/src/components/popover/popover-popup.gen.ts +5 -15
- package/src/components/popover/popover-positioner.gen.ts +5 -15
- package/src/components/popover/popover-root.gen.ts +5 -17
- package/src/components/popover/popover-trigger.gen.ts +5 -17
- package/src/components/resizable/index.gen.ts +2 -6
- package/src/components/resizable/resizable-handle.gen.ts +5 -15
- package/src/components/resizable/resizable-root.gen.ts +5 -17
- package/src/components/table-handle/index.gen.ts +1 -3
- package/src/components/table-handle/table-handle-column-menu-root.gen.ts +5 -15
- package/src/components/table-handle/table-handle-column-menu-trigger.gen.ts +5 -15
- package/src/components/table-handle/table-handle-column-popup.gen.ts +5 -15
- package/src/components/table-handle/table-handle-column-positioner.gen.ts +5 -15
- package/src/components/table-handle/table-handle-drag-preview.gen.ts +5 -15
- package/src/components/table-handle/table-handle-drop-indicator.gen.ts +5 -15
- package/src/components/table-handle/table-handle-root.gen.ts +5 -15
- package/src/components/table-handle/table-handle-row-menu-root.gen.ts +5 -15
- package/src/components/table-handle/table-handle-row-menu-trigger.gen.ts +5 -15
- package/src/components/table-handle/table-handle-row-popup.gen.ts +5 -15
- package/src/components/table-handle/table-handle-row-positioner.gen.ts +5 -15
- package/src/components/tooltip/index.gen.ts +2 -6
- package/src/components/tooltip/tooltip-popup.gen.ts +5 -15
- package/src/components/tooltip/tooltip-positioner.gen.ts +5 -15
- package/src/components/tooltip/tooltip-root.gen.ts +5 -17
- package/src/components/tooltip/tooltip-trigger.gen.ts +5 -15
package/dist/prosekit-solid.js
CHANGED
|
@@ -3,13 +3,10 @@ import { createComponent, createEffect, createMemo, createSignal, onCleanup } fr
|
|
|
3
3
|
import { EditorNotFoundError, ProseKitError, defineDocChangeHandler, defineKeymap, defineMarkViewComponent, defineMarkViewFactory, defineMountHandler, defineNodeViewComponent, defineNodeViewFactory, defineUpdateHandler, union, withPriority } from "@prosekit/core";
|
|
4
4
|
import { AbstractSolidMarkView, AbstractSolidNodeView, buildSolidMarkViewCreator, buildSolidNodeViewCreator, useSolidRenderer } from "@prosemirror-adapter/solid";
|
|
5
5
|
import { Portal } from "solid-js/web";
|
|
6
|
-
//#region src/extensions/helpers.ts
|
|
7
6
|
function hidePortalDiv(el) {
|
|
8
7
|
el.style.display = "contents";
|
|
9
8
|
el.dataset.solidPortal = "true";
|
|
10
9
|
}
|
|
11
|
-
//#endregion
|
|
12
|
-
//#region src/extensions/solid-mark-view.ts
|
|
13
10
|
var ProseKitSolidMarkView = class extends AbstractSolidMarkView {
|
|
14
11
|
constructor(..._args) {
|
|
15
12
|
super(..._args);
|
|
@@ -55,8 +52,6 @@ function defineSolidMarkView(options) {
|
|
|
55
52
|
args: options
|
|
56
53
|
});
|
|
57
54
|
}
|
|
58
|
-
//#endregion
|
|
59
|
-
//#region src/extensions/solid-node-view.ts
|
|
60
55
|
var ProseKitSolidNodeView = class extends AbstractSolidNodeView {
|
|
61
56
|
constructor(..._args) {
|
|
62
57
|
super(..._args);
|
|
@@ -117,8 +112,6 @@ function defineSolidNodeView(options) {
|
|
|
117
112
|
args: options
|
|
118
113
|
});
|
|
119
114
|
}
|
|
120
|
-
//#endregion
|
|
121
|
-
//#region src/utils/to-value.ts
|
|
122
115
|
/**
|
|
123
116
|
* Accesses the value of a MaybeAccessor
|
|
124
117
|
*
|
|
@@ -131,8 +124,6 @@ function defineSolidNodeView(options) {
|
|
|
131
124
|
function toValue(v) {
|
|
132
125
|
return typeof v === "function" ? v() : v;
|
|
133
126
|
}
|
|
134
|
-
//#endregion
|
|
135
|
-
//#region src/hooks/use-editor-extension.ts
|
|
136
127
|
/**
|
|
137
128
|
* @internal
|
|
138
129
|
*/
|
|
@@ -145,16 +136,12 @@ function useEditorExtension(editorAccessor, extensionAccessor) {
|
|
|
145
136
|
if (extension) onCleanup(editor.use(extension));
|
|
146
137
|
});
|
|
147
138
|
}
|
|
148
|
-
//#endregion
|
|
149
|
-
//#region src/components/view-renderer.ts
|
|
150
139
|
const ViewRenderer = (props) => {
|
|
151
140
|
const { renderSolidRenderer, removeSolidRenderer, render } = useSolidRenderer();
|
|
152
141
|
const extension = union([defineSolidMarkViewFactory(renderSolidRenderer, removeSolidRenderer), defineSolidNodeViewFactory(renderSolidRenderer, removeSolidRenderer)]);
|
|
153
142
|
useEditorExtension(() => props.editor, () => extension);
|
|
154
143
|
return [props.children, render];
|
|
155
144
|
};
|
|
156
|
-
//#endregion
|
|
157
|
-
//#region src/components/prosekit.ts
|
|
158
145
|
/**
|
|
159
146
|
* The root component for a ProseKit editor.
|
|
160
147
|
*
|
|
@@ -177,8 +164,6 @@ const ProseKit = (props) => {
|
|
|
177
164
|
}
|
|
178
165
|
});
|
|
179
166
|
};
|
|
180
|
-
//#endregion
|
|
181
|
-
//#region src/hooks/use-priority-extension.ts
|
|
182
167
|
/**
|
|
183
168
|
* @internal
|
|
184
169
|
*/
|
|
@@ -188,16 +173,12 @@ function usePriorityExtension(extension, priority) {
|
|
|
188
173
|
return ext && priority ? withPriority(ext, priority) : ext;
|
|
189
174
|
};
|
|
190
175
|
}
|
|
191
|
-
//#endregion
|
|
192
|
-
//#region src/hooks/use-extension.ts
|
|
193
176
|
/**
|
|
194
177
|
* Add an extension to the editor.
|
|
195
178
|
*/
|
|
196
179
|
function useExtension(extension, options) {
|
|
197
180
|
useEditorExtension(options?.editor, usePriorityExtension(extension, options?.priority));
|
|
198
181
|
}
|
|
199
|
-
//#endregion
|
|
200
|
-
//#region src/hooks/use-doc-change.ts
|
|
201
182
|
/**
|
|
202
183
|
* Calls the given handler whenever the editor document changes.
|
|
203
184
|
*
|
|
@@ -207,8 +188,6 @@ function useDocChange(handler, options) {
|
|
|
207
188
|
const extension = defineDocChangeHandler((view) => handler(view.state.doc));
|
|
208
189
|
useExtension(() => extension, options);
|
|
209
190
|
}
|
|
210
|
-
//#endregion
|
|
211
|
-
//#region src/hooks/use-editor.ts
|
|
212
191
|
/**
|
|
213
192
|
* Retrieves the editor instance from the nearest ProseKit component.
|
|
214
193
|
*
|
|
@@ -237,8 +216,6 @@ function useEditor(options) {
|
|
|
237
216
|
function useForceUpdate() {
|
|
238
217
|
return createSignal(void 0, { equals: false });
|
|
239
218
|
}
|
|
240
|
-
//#endregion
|
|
241
|
-
//#region src/hooks/use-editor-derived-value.ts
|
|
242
219
|
/**
|
|
243
220
|
* Runs a function to derive a value from the editor instance after editor state
|
|
244
221
|
* changes.
|
|
@@ -256,14 +233,10 @@ function useEditorDerivedValue(derive, options) {
|
|
|
256
233
|
const editorAccessor = initialEditor ? () => toValue(initialEditor) : useEditor({ update: true });
|
|
257
234
|
return createMemo(() => derive(editorAccessor()));
|
|
258
235
|
}
|
|
259
|
-
//#endregion
|
|
260
|
-
//#region src/hooks/use-keymap.ts
|
|
261
236
|
function useKeymap(keymap, options) {
|
|
262
237
|
const extension = () => defineKeymap(keymap());
|
|
263
238
|
useExtension(extension, options);
|
|
264
239
|
}
|
|
265
|
-
//#endregion
|
|
266
|
-
//#region src/hooks/use-state-update.ts
|
|
267
240
|
/**
|
|
268
241
|
* Calls the given handler whenever the editor state changes.
|
|
269
242
|
*
|
|
@@ -273,7 +246,6 @@ function useStateUpdate(handler, options) {
|
|
|
273
246
|
const extension = defineUpdateHandler((view) => handler(view.state));
|
|
274
247
|
useExtension(() => extension, options);
|
|
275
248
|
}
|
|
276
|
-
//#endregion
|
|
277
249
|
export { ProseKit, defineSolidMarkView, defineSolidNodeView, useDocChange, useEditor, useEditorDerivedValue, useExtension, useKeymap, useStateUpdate };
|
|
278
250
|
|
|
279
251
|
//# sourceMappingURL=prosekit-solid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-solid.js","names":[],"sources":["../src/extensions/helpers.ts","../src/extensions/solid-mark-view.ts","../src/extensions/solid-node-view.ts","../src/utils/to-value.ts","../src/hooks/use-editor-extension.ts","../src/components/view-renderer.ts","../src/components/prosekit.ts","../src/hooks/use-priority-extension.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"],"sourcesContent":["export function hidePortalDiv(el: HTMLElement): void {\n el.style.display = 'contents'\n el.dataset.solidPortal = 'true'\n}\n","import { defineMarkViewComponent, defineMarkViewFactory, type Extension } from '@prosekit/core'\nimport type { CoreMarkViewUserOptions } from '@prosemirror-adapter/core'\nimport {\n AbstractSolidMarkView,\n buildSolidMarkViewCreator,\n type MarkViewContextProps,\n type SolidRendererResult,\n} from '@prosemirror-adapter/solid'\nimport { createComponent, type Component, type JSX } from 'solid-js'\nimport { Portal } from 'solid-js/web'\n\nimport { hidePortalDiv } from './helpers.ts'\n\n/**\n * @public\n */\nexport interface SolidMarkViewProps extends MarkViewContextProps {}\n\n/**\n * @public\n */\nexport type SolidMarkViewComponent = Component<SolidMarkViewProps>\n\n/**\n * Options for {@link defineSolidMarkView}.\n *\n * @public\n */\nexport interface SolidMarkViewOptions extends CoreMarkViewUserOptions<SolidMarkViewComponent> {\n /**\n * The name of the mark type.\n */\n name: string\n}\n\nclass ProseKitSolidMarkView extends AbstractSolidMarkView<SolidMarkViewComponent> {\n render = (): JSX.Element => {\n const UserComponent = this.component\n const getProps: () => SolidMarkViewProps = this.context\n const props: SolidMarkViewProps = {\n get contentRef() {\n return getProps().contentRef\n },\n get view() {\n return getProps().view\n },\n get mark() {\n return getProps().mark\n },\n }\n return createComponent(Portal, {\n mount: this.dom,\n children: createComponent(UserComponent, props),\n ref: hidePortalDiv,\n })\n }\n}\n\n/**\n * @internal\n */\nexport function defineSolidMarkViewFactory(\n renderSolidRenderer: SolidRendererResult['renderSolidRenderer'],\n removeSolidRenderer: SolidRendererResult['removeSolidRenderer'],\n): Extension {\n const factory = buildSolidMarkViewCreator(renderSolidRenderer, removeSolidRenderer, ProseKitSolidMarkView)\n return defineMarkViewFactory<SolidMarkViewOptions>({\n group: 'solid',\n factory,\n })\n}\n\n/**\n * Defines a mark view using a Solid component.\n *\n * @public\n */\nexport function defineSolidMarkView(options: SolidMarkViewOptions): Extension {\n return defineMarkViewComponent<SolidMarkViewOptions>({\n group: 'solid',\n name: options.name,\n args: options,\n })\n}\n","import { defineNodeViewComponent, defineNodeViewFactory, type Extension } from '@prosekit/core'\nimport type { CoreNodeViewUserOptions } from '@prosemirror-adapter/core'\nimport {\n AbstractSolidNodeView,\n buildSolidNodeViewCreator,\n type NodeViewContextProps,\n type SolidRendererResult,\n} from '@prosemirror-adapter/solid'\nimport { createComponent, type Component, type JSX } from 'solid-js'\nimport { Portal } from 'solid-js/web'\n\nimport { hidePortalDiv } from './helpers.ts'\n\n/**\n * @public\n */\nexport interface SolidNodeViewProps extends NodeViewContextProps {}\n\n/**\n * @public\n */\nexport type SolidNodeViewComponent = Component<SolidNodeViewProps>\n\n/**\n * Options for {@link defineSolidNodeView}.\n *\n * @public\n */\nexport interface SolidNodeViewOptions extends CoreNodeViewUserOptions<SolidNodeViewComponent> {\n /**\n * The name of the node type.\n */\n name: string\n}\n\nclass ProseKitSolidNodeView extends AbstractSolidNodeView<SolidNodeViewComponent> {\n render = (): JSX.Element => {\n const UserComponent = this.component\n const getProps: () => SolidNodeViewProps = this.context\n const props: SolidNodeViewProps = {\n get contentRef() {\n return getProps().contentRef\n },\n get view() {\n return getProps().view\n },\n get getPos() {\n return getProps().getPos\n },\n get setAttrs() {\n return getProps().setAttrs\n },\n get node() {\n return getProps().node\n },\n get selected() {\n return getProps().selected\n },\n get decorations() {\n return getProps().decorations\n },\n get innerDecorations() {\n return getProps().innerDecorations\n },\n }\n return createComponent(Portal, {\n mount: this.dom,\n children: createComponent(UserComponent, props),\n ref: hidePortalDiv,\n })\n }\n}\n\n/**\n * @internal\n */\nexport function defineSolidNodeViewFactory(\n renderSolidRenderer: SolidRendererResult['renderSolidRenderer'],\n removeSolidRenderer: SolidRendererResult['removeSolidRenderer'],\n): Extension {\n const factory = buildSolidNodeViewCreator(renderSolidRenderer, removeSolidRenderer, ProseKitSolidNodeView)\n return defineNodeViewFactory<SolidNodeViewOptions>({\n group: 'solid',\n factory,\n })\n}\n\n/**\n * Defines a node view using a Solid component.\n *\n * @public\n */\nexport function defineSolidNodeView(options: SolidNodeViewOptions): Extension {\n return defineNodeViewComponent<SolidNodeViewOptions>({\n group: 'solid',\n name: options.name,\n args: options,\n })\n}\n","/**\n * Accesses the value of a MaybeAccessor\n *\n * @example\n * ```ts\n * access(\"foo\") // => \"foo\"\n * access(() => \"foo\") // => \"foo\"\n * ```\n */\nexport function toValue<T>(\n v: (() => T) | T,\n): T {\n return (typeof v === 'function') ? (v as () => T)() : v\n}\n","import { EditorNotFoundError, type Editor, type Extension } from '@prosekit/core'\nimport { createEffect, onCleanup, type Accessor } from 'solid-js'\n\nimport { useEditorContext } from '../contexts/editor-context.ts'\nimport type { MaybeAccessor } from '../types.ts'\nimport { toValue } from '../utils/to-value.ts'\n\n/**\n * @internal\n */\nexport function useEditorExtension(\n editorAccessor: MaybeAccessor<Editor> | undefined | null,\n extensionAccessor: Accessor<Extension | null>,\n): void {\n const editorContext = useEditorContext()\n\n createEffect(() => {\n const editor = toValue(editorAccessor) || toValue(editorContext)\n const extension = extensionAccessor()\n\n if (!editor) {\n throw new EditorNotFoundError()\n }\n if (extension) {\n onCleanup(editor.use(extension))\n }\n })\n}\n","import { union, type Editor } from '@prosekit/core'\nimport { useSolidRenderer } from '@prosemirror-adapter/solid'\nimport type { Component, JSX, ParentProps } from 'solid-js'\n\nimport { defineSolidMarkViewFactory } from '../extensions/solid-mark-view.ts'\nimport { defineSolidNodeViewFactory } from '../extensions/solid-node-view.ts'\nimport { useEditorExtension } from '../hooks/use-editor-extension.ts'\n\ntype ViewRendererProps = ParentProps<{\n editor: Editor\n}>\n\nexport const ViewRenderer: Component<ViewRendererProps> = (props): JSX.Element => {\n const { renderSolidRenderer, removeSolidRenderer, render } = useSolidRenderer()\n\n const extension = union([\n defineSolidMarkViewFactory(renderSolidRenderer, removeSolidRenderer),\n defineSolidNodeViewFactory(renderSolidRenderer, removeSolidRenderer),\n ])\n\n useEditorExtension(() => props.editor, () => extension)\n\n return [props.children, render] as unknown as JSX.Element\n}\n","import type { Editor } from '@prosekit/core'\nimport { createComponent, type Component, type ParentProps } from 'solid-js'\n\nimport { EditorContextProvider } from '../contexts/editor-context.ts'\n\nimport { ViewRenderer } from './view-renderer.ts'\n\nexport type ProseKitProps = ParentProps<{\n editor: Editor\n}>\n\n/**\n * The root component for a ProseKit editor.\n *\n * @public\n */\nexport const ProseKit: Component<ProseKitProps> = (props) => {\n return createComponent(EditorContextProvider, {\n get value() {\n return props.editor\n },\n get children() {\n return createComponent(ViewRenderer, {\n get editor() {\n return props.editor\n },\n get children() {\n return props.children\n },\n })\n },\n })\n}\n","import { withPriority, type Extension, type Priority } from '@prosekit/core'\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 () => {\n const ext = extension()\n return ext && priority ? withPriority(ext, priority) : ext\n }\n}\n","import type { Editor, Extension, Priority } from '@prosekit/core'\nimport type { Accessor } from 'solid-js'\n\nimport type { MaybeAccessor } from '../types.ts'\n\nimport { useEditorExtension } from './use-editor-extension.ts'\nimport { usePriorityExtension } from './use-priority-extension.ts'\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?: MaybeAccessor<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 accessor to an 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: Accessor<Extension | null>,\n options?: UseExtensionOptions,\n): void {\n useEditorExtension(\n options?.editor,\n usePriorityExtension(extension, options?.priority),\n )\n}\n","import { defineDocChangeHandler } from '@prosekit/core'\nimport type { ProseMirrorNode } from '@prosekit/pm/model'\n\nimport { useExtension, type UseExtensionOptions } from './use-extension.ts'\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 = defineDocChangeHandler((view) => handler(view.state.doc))\n useExtension(() => extension, options)\n}\n","import { defineMountHandler, defineUpdateHandler, ProseKitError, union, type Editor, type Extension } from '@prosekit/core'\nimport { createEffect, createSignal } from 'solid-js'\n\nimport { useEditorContext } from '../contexts/editor-context.ts'\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 [depend, forceUpdate] = useForceUpdate()\n\n createEffect(() => {\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 () => {\n depend()\n return editor\n }\n}\n\nfunction useForceUpdate() {\n return createSignal(undefined, { equals: false })\n}\n","import type { Editor, Extension } from '@prosekit/core'\nimport { createMemo, type Accessor } from 'solid-js'\n\nimport type { MaybeAccessor } from '../types.ts'\nimport { toValue } from '../utils/to-value.ts'\n\nimport { useEditor } from './use-editor.ts'\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?: MaybeAccessor<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 an accessor of the derived value that updates whenever the editor\n * 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 derive: (editor: Editor<E>) => Derived,\n options?: UseEditorDerivedOptions<E>,\n): Accessor<Derived> {\n const initialEditor = options?.editor\n const editorAccessor: Accessor<Editor<E>> = initialEditor\n ? () => toValue(initialEditor)\n : useEditor<E>({ update: true })\n\n return createMemo(() => derive(editorAccessor()))\n}\n","import { defineKeymap, type Keymap } from '@prosekit/core'\n\nimport { useExtension, type UseExtensionOptions } from './use-extension.ts'\n\nexport function useKeymap(keymap: () => Keymap, options?: UseExtensionOptions): void {\n const extension = () => defineKeymap(keymap())\n useExtension(extension, options)\n}\n","import { defineUpdateHandler } from '@prosekit/core'\nimport type { EditorState } from '@prosekit/pm/state'\n\nimport { useExtension, type UseExtensionOptions } from './use-extension.ts'\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 = defineUpdateHandler((view) => handler(view.state))\n useExtension(() => extension, options)\n}\n"],"mappings":";;;;;;AAAA,SAAgB,cAAc,IAAuB;AACnD,IAAG,MAAM,UAAU;AACnB,IAAG,QAAQ,cAAc;;;;ACiC3B,IAAM,wBAAN,cAAoC,sBAA8C;;;sBACpD;GAC1B,MAAM,gBAAgB,KAAK;GAC3B,MAAM,WAAqC,KAAK;AAYhD,UAAO,gBAAgB,QAAQ;IAC7B,OAAO,KAAK;IACZ,UAAU,gBAAgB,eAbM;KAChC,IAAI,aAAa;AACf,aAAO,UAAU,CAAC;;KAEpB,IAAI,OAAO;AACT,aAAO,UAAU,CAAC;;KAEpB,IAAI,OAAO;AACT,aAAO,UAAU,CAAC;;KAErB,CAGgD;IAC/C,KAAK;IACN,CAAC;;;;;;;AAON,SAAgB,2BACd,qBACA,qBACW;AAEX,QAAO,sBAA4C;EACjD,OAAO;EACP,SAHc,0BAA0B,qBAAqB,qBAAqB,sBAAsB;EAIzG,CAAC;;;;;;;AAQJ,SAAgB,oBAAoB,SAA0C;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BAAiB;AACxB,QAAO,aAAa,KAAA,GAAW,EAAE,QAAQ,OAAO,CAAC;;;;;;;;;;;;;;;;ACnBnD,SAAgB,sBAOd,QACA,SACmB;CACnB,MAAM,gBAAgB,SAAS;CAC/B,MAAM,iBAAsC,sBAClC,QAAQ,cAAc,GAC5B,UAAa,EAAE,QAAQ,MAAM,CAAC;AAElC,QAAO,iBAAiB,OAAO,gBAAgB,CAAC,CAAC;;;;ACvCnD,SAAgB,UAAU,QAAsB,SAAqC;CACnF,MAAM,kBAAkB,aAAa,QAAQ,CAAC;AAC9C,cAAa,WAAW,QAAQ;;;;;;;;;ACIlC,SAAgB,eACd,SACA,SACM;CACN,MAAM,YAAY,qBAAqB,SAAS,QAAQ,KAAK,MAAM,CAAC;AACpE,oBAAmB,WAAW,QAAQ"}
|
|
1
|
+
{"version":3,"file":"prosekit-solid.js","names":[],"sources":["../src/extensions/helpers.ts","../src/extensions/solid-mark-view.ts","../src/extensions/solid-node-view.ts","../src/utils/to-value.ts","../src/hooks/use-editor-extension.ts","../src/components/view-renderer.ts","../src/components/prosekit.ts","../src/hooks/use-priority-extension.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"],"sourcesContent":["export function hidePortalDiv(el: HTMLElement): void {\n el.style.display = 'contents'\n el.dataset.solidPortal = 'true'\n}\n","import { defineMarkViewComponent, defineMarkViewFactory, type Extension } from '@prosekit/core'\nimport type { CoreMarkViewUserOptions } from '@prosemirror-adapter/core'\nimport {\n AbstractSolidMarkView,\n buildSolidMarkViewCreator,\n type MarkViewContextProps,\n type SolidRendererResult,\n} from '@prosemirror-adapter/solid'\nimport { createComponent, type Component, type JSX } from 'solid-js'\nimport { Portal } from 'solid-js/web'\n\nimport { hidePortalDiv } from './helpers.ts'\n\n/**\n * @public\n */\nexport interface SolidMarkViewProps extends MarkViewContextProps {}\n\n/**\n * @public\n */\nexport type SolidMarkViewComponent = Component<SolidMarkViewProps>\n\n/**\n * Options for {@link defineSolidMarkView}.\n *\n * @public\n */\nexport interface SolidMarkViewOptions extends CoreMarkViewUserOptions<SolidMarkViewComponent> {\n /**\n * The name of the mark type.\n */\n name: string\n}\n\nclass ProseKitSolidMarkView extends AbstractSolidMarkView<SolidMarkViewComponent> {\n render = (): JSX.Element => {\n const UserComponent = this.component\n const getProps: () => SolidMarkViewProps = this.context\n const props: SolidMarkViewProps = {\n get contentRef() {\n return getProps().contentRef\n },\n get view() {\n return getProps().view\n },\n get mark() {\n return getProps().mark\n },\n }\n return createComponent(Portal, {\n mount: this.dom,\n children: createComponent(UserComponent, props),\n ref: hidePortalDiv,\n })\n }\n}\n\n/**\n * @internal\n */\nexport function defineSolidMarkViewFactory(\n renderSolidRenderer: SolidRendererResult['renderSolidRenderer'],\n removeSolidRenderer: SolidRendererResult['removeSolidRenderer'],\n): Extension {\n const factory = buildSolidMarkViewCreator(renderSolidRenderer, removeSolidRenderer, ProseKitSolidMarkView)\n return defineMarkViewFactory<SolidMarkViewOptions>({\n group: 'solid',\n factory,\n })\n}\n\n/**\n * Defines a mark view using a Solid component.\n *\n * @public\n */\nexport function defineSolidMarkView(options: SolidMarkViewOptions): Extension {\n return defineMarkViewComponent<SolidMarkViewOptions>({\n group: 'solid',\n name: options.name,\n args: options,\n })\n}\n","import { defineNodeViewComponent, defineNodeViewFactory, type Extension } from '@prosekit/core'\nimport type { CoreNodeViewUserOptions } from '@prosemirror-adapter/core'\nimport {\n AbstractSolidNodeView,\n buildSolidNodeViewCreator,\n type NodeViewContextProps,\n type SolidRendererResult,\n} from '@prosemirror-adapter/solid'\nimport { createComponent, type Component, type JSX } from 'solid-js'\nimport { Portal } from 'solid-js/web'\n\nimport { hidePortalDiv } from './helpers.ts'\n\n/**\n * @public\n */\nexport interface SolidNodeViewProps extends NodeViewContextProps {}\n\n/**\n * @public\n */\nexport type SolidNodeViewComponent = Component<SolidNodeViewProps>\n\n/**\n * Options for {@link defineSolidNodeView}.\n *\n * @public\n */\nexport interface SolidNodeViewOptions extends CoreNodeViewUserOptions<SolidNodeViewComponent> {\n /**\n * The name of the node type.\n */\n name: string\n}\n\nclass ProseKitSolidNodeView extends AbstractSolidNodeView<SolidNodeViewComponent> {\n render = (): JSX.Element => {\n const UserComponent = this.component\n const getProps: () => SolidNodeViewProps = this.context\n const props: SolidNodeViewProps = {\n get contentRef() {\n return getProps().contentRef\n },\n get view() {\n return getProps().view\n },\n get getPos() {\n return getProps().getPos\n },\n get setAttrs() {\n return getProps().setAttrs\n },\n get node() {\n return getProps().node\n },\n get selected() {\n return getProps().selected\n },\n get decorations() {\n return getProps().decorations\n },\n get innerDecorations() {\n return getProps().innerDecorations\n },\n }\n return createComponent(Portal, {\n mount: this.dom,\n children: createComponent(UserComponent, props),\n ref: hidePortalDiv,\n })\n }\n}\n\n/**\n * @internal\n */\nexport function defineSolidNodeViewFactory(\n renderSolidRenderer: SolidRendererResult['renderSolidRenderer'],\n removeSolidRenderer: SolidRendererResult['removeSolidRenderer'],\n): Extension {\n const factory = buildSolidNodeViewCreator(renderSolidRenderer, removeSolidRenderer, ProseKitSolidNodeView)\n return defineNodeViewFactory<SolidNodeViewOptions>({\n group: 'solid',\n factory,\n })\n}\n\n/**\n * Defines a node view using a Solid component.\n *\n * @public\n */\nexport function defineSolidNodeView(options: SolidNodeViewOptions): Extension {\n return defineNodeViewComponent<SolidNodeViewOptions>({\n group: 'solid',\n name: options.name,\n args: options,\n })\n}\n","/**\n * Accesses the value of a MaybeAccessor\n *\n * @example\n * ```ts\n * access(\"foo\") // => \"foo\"\n * access(() => \"foo\") // => \"foo\"\n * ```\n */\nexport function toValue<T>(\n v: (() => T) | T,\n): T {\n return (typeof v === 'function') ? (v as () => T)() : v\n}\n","import { EditorNotFoundError, type Editor, type Extension } from '@prosekit/core'\nimport { createEffect, onCleanup, type Accessor } from 'solid-js'\n\nimport { useEditorContext } from '../contexts/editor-context.ts'\nimport type { MaybeAccessor } from '../types.ts'\nimport { toValue } from '../utils/to-value.ts'\n\n/**\n * @internal\n */\nexport function useEditorExtension(\n editorAccessor: MaybeAccessor<Editor> | undefined | null,\n extensionAccessor: Accessor<Extension | null>,\n): void {\n const editorContext = useEditorContext()\n\n createEffect(() => {\n const editor = toValue(editorAccessor) || toValue(editorContext)\n const extension = extensionAccessor()\n\n if (!editor) {\n throw new EditorNotFoundError()\n }\n if (extension) {\n onCleanup(editor.use(extension))\n }\n })\n}\n","import { union, type Editor } from '@prosekit/core'\nimport { useSolidRenderer } from '@prosemirror-adapter/solid'\nimport type { Component, JSX, ParentProps } from 'solid-js'\n\nimport { defineSolidMarkViewFactory } from '../extensions/solid-mark-view.ts'\nimport { defineSolidNodeViewFactory } from '../extensions/solid-node-view.ts'\nimport { useEditorExtension } from '../hooks/use-editor-extension.ts'\n\ntype ViewRendererProps = ParentProps<{\n editor: Editor\n}>\n\nexport const ViewRenderer: Component<ViewRendererProps> = (props): JSX.Element => {\n const { renderSolidRenderer, removeSolidRenderer, render } = useSolidRenderer()\n\n const extension = union([\n defineSolidMarkViewFactory(renderSolidRenderer, removeSolidRenderer),\n defineSolidNodeViewFactory(renderSolidRenderer, removeSolidRenderer),\n ])\n\n useEditorExtension(() => props.editor, () => extension)\n\n return [props.children, render] as unknown as JSX.Element\n}\n","import type { Editor } from '@prosekit/core'\nimport { createComponent, type Component, type ParentProps } from 'solid-js'\n\nimport { EditorContextProvider } from '../contexts/editor-context.ts'\n\nimport { ViewRenderer } from './view-renderer.ts'\n\nexport type ProseKitProps = ParentProps<{\n editor: Editor\n}>\n\n/**\n * The root component for a ProseKit editor.\n *\n * @public\n */\nexport const ProseKit: Component<ProseKitProps> = (props) => {\n return createComponent(EditorContextProvider, {\n get value() {\n return props.editor\n },\n get children() {\n return createComponent(ViewRenderer, {\n get editor() {\n return props.editor\n },\n get children() {\n return props.children\n },\n })\n },\n })\n}\n","import { withPriority, type Extension, type Priority } from '@prosekit/core'\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 () => {\n const ext = extension()\n return ext && priority ? withPriority(ext, priority) : ext\n }\n}\n","import type { Editor, Extension, Priority } from '@prosekit/core'\nimport type { Accessor } from 'solid-js'\n\nimport type { MaybeAccessor } from '../types.ts'\n\nimport { useEditorExtension } from './use-editor-extension.ts'\nimport { usePriorityExtension } from './use-priority-extension.ts'\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?: MaybeAccessor<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 accessor to an 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: Accessor<Extension | null>,\n options?: UseExtensionOptions,\n): void {\n useEditorExtension(\n options?.editor,\n usePriorityExtension(extension, options?.priority),\n )\n}\n","import { defineDocChangeHandler } from '@prosekit/core'\nimport type { ProseMirrorNode } from '@prosekit/pm/model'\n\nimport { useExtension, type UseExtensionOptions } from './use-extension.ts'\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 = defineDocChangeHandler((view) => handler(view.state.doc))\n useExtension(() => extension, options)\n}\n","import { defineMountHandler, defineUpdateHandler, ProseKitError, union, type Editor, type Extension } from '@prosekit/core'\nimport { createEffect, createSignal } from 'solid-js'\n\nimport { useEditorContext } from '../contexts/editor-context.ts'\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 [depend, forceUpdate] = useForceUpdate()\n\n createEffect(() => {\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 () => {\n depend()\n return editor\n }\n}\n\nfunction useForceUpdate() {\n return createSignal(undefined, { equals: false })\n}\n","import type { Editor, Extension } from '@prosekit/core'\nimport { createMemo, type Accessor } from 'solid-js'\n\nimport type { MaybeAccessor } from '../types.ts'\nimport { toValue } from '../utils/to-value.ts'\n\nimport { useEditor } from './use-editor.ts'\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?: MaybeAccessor<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 an accessor of the derived value that updates whenever the editor\n * 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 derive: (editor: Editor<E>) => Derived,\n options?: UseEditorDerivedOptions<E>,\n): Accessor<Derived> {\n const initialEditor = options?.editor\n const editorAccessor: Accessor<Editor<E>> = initialEditor\n ? () => toValue(initialEditor)\n : useEditor<E>({ update: true })\n\n return createMemo(() => derive(editorAccessor()))\n}\n","import { defineKeymap, type Keymap } from '@prosekit/core'\n\nimport { useExtension, type UseExtensionOptions } from './use-extension.ts'\n\nexport function useKeymap(keymap: () => Keymap, options?: UseExtensionOptions): void {\n const extension = () => defineKeymap(keymap())\n useExtension(extension, options)\n}\n","import { defineUpdateHandler } from '@prosekit/core'\nimport type { EditorState } from '@prosekit/pm/state'\n\nimport { useExtension, type UseExtensionOptions } from './use-extension.ts'\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 = defineUpdateHandler((view) => handler(view.state))\n useExtension(() => extension, options)\n}\n"],"mappings":";;;;;AAAA,SAAgB,cAAc,IAAuB;AACnD,IAAG,MAAM,UAAU;AACnB,IAAG,QAAQ,cAAc;;ACiC3B,IAAM,wBAAN,cAAoC,sBAA8C;;;sBACpD;GAC1B,MAAM,gBAAgB,KAAK;GAC3B,MAAM,WAAqC,KAAK;AAYhD,UAAO,gBAAgB,QAAQ;IAC7B,OAAO,KAAK;IACZ,UAAU,gBAAgB,eAbM;KAChC,IAAI,aAAa;AACf,aAAO,UAAU,CAAC;;KAEpB,IAAI,OAAO;AACT,aAAO,UAAU,CAAC;;KAEpB,IAAI,OAAO;AACT,aAAO,UAAU,CAAC;;KAErB,CAGgD;IAC/C,KAAK;IACN,CAAC;;;;;;;AAON,SAAgB,2BACd,qBACA,qBACW;AAEX,QAAO,sBAA4C;EACjD,OAAO;EACP,SAHc,0BAA0B,qBAAqB,qBAAqB,sBAAsB;EAIzG,CAAC;;;;;;;AAQJ,SAAgB,oBAAoB,SAA0C;AAC5E,QAAO,wBAA8C;EACnD,OAAO;EACP,MAAM,QAAQ;EACd,MAAM;EACP,CAAC;;AC/CJ,IAAM,wBAAN,cAAoC,sBAA8C;;;sBACpD;GAC1B,MAAM,gBAAgB,KAAK;GAC3B,MAAM,WAAqC,KAAK;AA2BhD,UAAO,gBAAgB,QAAQ;IAC7B,OAAO,KAAK;IACZ,UAAU,gBAAgB,eA5BM;KAChC,IAAI,aAAa;AACf,aAAO,UAAU,CAAC;;KAEpB,IAAI,OAAO;AACT,aAAO,UAAU,CAAC;;KAEpB,IAAI,SAAS;AACX,aAAO,UAAU,CAAC;;KAEpB,IAAI,WAAW;AACb,aAAO,UAAU,CAAC;;KAEpB,IAAI,OAAO;AACT,aAAO,UAAU,CA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AQ"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prosekit/solid",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.7.0-beta.
|
|
4
|
+
"version": "0.7.0-beta.5",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Solid components and utilities for ProseKit",
|
|
7
7
|
"author": {
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"@prosemirror-adapter/solid": "^0.5.3",
|
|
77
77
|
"@prosekit/core": "^0.12.0-beta.0",
|
|
78
78
|
"@prosekit/pm": "^0.1.15",
|
|
79
|
-
"@prosekit/web": "^0.8.0-beta.
|
|
79
|
+
"@prosekit/web": "^0.8.0-beta.4"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
|
82
82
|
"solid-js": ">= 1.7.0"
|
|
@@ -93,10 +93,10 @@
|
|
|
93
93
|
"vite-plugin-solid": "^2.11.12",
|
|
94
94
|
"vitest": "^4.1.4",
|
|
95
95
|
"vitest-browser-solid": "^1.0.1",
|
|
96
|
-
"@prosekit/config-tsdown": "0.0.0",
|
|
97
96
|
"@prosekit/config-ts": "0.0.0",
|
|
98
97
|
"@prosekit/config-vitest": "0.0.0",
|
|
99
|
-
"@prosekit/testing": "0.0.0"
|
|
98
|
+
"@prosekit/testing": "0.0.0",
|
|
99
|
+
"@prosekit/config-tsdown": "0.0.0"
|
|
100
100
|
},
|
|
101
101
|
"publishConfig": {
|
|
102
102
|
"dev": {}
|
|
@@ -1,24 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
* This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
|
|
3
|
-
*/
|
|
1
|
+
// This file is auto-generated by "@aria-ui/cli". Do not edit this file directly.
|
|
4
2
|
|
|
5
3
|
import { registerAutocompleteEmptyElement, type AutocompleteEmptyElement } from '@prosekit/web/autocomplete';
|
|
6
4
|
import type { Component, JSX } from 'solid-js';
|
|
7
5
|
import h from 'solid-js/h';
|
|
8
6
|
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
*
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
export interface AutocompleteEmptyProps extends JSX.HTMLAttributes<AutocompleteEmptyElement> {}
|
|
7
|
+
/** Props for the {@link AutocompleteEmpty} Solid component. */
|
|
8
|
+
export interface AutocompleteEmptyProps {}
|
|
15
9
|
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
*
|
|
19
|
-
* @public
|
|
20
|
-
*/
|
|
21
|
-
export const AutocompleteEmpty: Component<AutocompleteEmptyProps> = (props): any => {
|
|
10
|
+
/** A Solid component that renders an `prosekit-autocomplete-empty` custom element. */
|
|
11
|
+
export const AutocompleteEmpty: Component<AutocompleteEmptyProps & JSX.HTMLAttributes<AutocompleteEmptyElement>> = (props): any => {
|
|
22
12
|
registerAutocompleteEmptyElement();
|
|
23
13
|
|
|
24
14
|
const restProps = props;
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
* This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
|
|
3
|
-
*/
|
|
1
|
+
// This file is auto-generated by "@aria-ui/cli". Do not edit this file directly.
|
|
4
2
|
|
|
5
3
|
import { registerAutocompleteItemElement, type AutocompleteItemElement, type AutocompleteItemEvents, type AutocompleteItemProps as AutocompleteItemElementProps } from '@prosekit/web/autocomplete';
|
|
6
4
|
import { createEffect, createSignal, mergeProps, splitProps } from 'solid-js';
|
|
7
5
|
import type { Component, JSX } from 'solid-js';
|
|
8
6
|
import h from 'solid-js/h';
|
|
9
7
|
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
15
|
-
export interface AutocompleteItemProps extends JSX.HTMLAttributes<AutocompleteItemElement> {
|
|
8
|
+
/** Props for the {@link AutocompleteItem} Solid component. */
|
|
9
|
+
export interface AutocompleteItemProps {
|
|
16
10
|
/**
|
|
17
11
|
* The value of the item, which will be matched against the query.
|
|
18
12
|
*
|
|
@@ -31,12 +25,8 @@ export interface AutocompleteItemProps extends JSX.HTMLAttributes<AutocompleteIt
|
|
|
31
25
|
onSelect?: (event: AutocompleteItemEvents['select']) => void;
|
|
32
26
|
}
|
|
33
27
|
|
|
34
|
-
/**
|
|
35
|
-
|
|
36
|
-
*
|
|
37
|
-
* @public
|
|
38
|
-
*/
|
|
39
|
-
export const AutocompleteItem: Component<AutocompleteItemProps> = (props): any => {
|
|
28
|
+
/** A Solid component that renders an `prosekit-autocomplete-item` custom element. */
|
|
29
|
+
export const AutocompleteItem: Component<AutocompleteItemProps & JSX.HTMLAttributes<AutocompleteItemElement>> = (props): any => {
|
|
40
30
|
registerAutocompleteItemElement();
|
|
41
31
|
|
|
42
32
|
const [getElement, setElement] = createSignal<AutocompleteItemElement | null>(null);
|
|
@@ -81,5 +71,3 @@ export const AutocompleteItem: Component<AutocompleteItemProps> = (props): any =
|
|
|
81
71
|
}),
|
|
82
72
|
);
|
|
83
73
|
};
|
|
84
|
-
|
|
85
|
-
export type { AutocompleteItemEvents };
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
* This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
|
|
3
|
-
*/
|
|
1
|
+
// This file is auto-generated by "@aria-ui/cli". Do not edit this file directly.
|
|
4
2
|
|
|
5
3
|
import { registerAutocompletePopupElement, type AutocompletePopupElement, type AutocompletePopupEvents } from '@prosekit/web/autocomplete';
|
|
6
4
|
import { createEffect, createSignal, mergeProps, splitProps } from 'solid-js';
|
|
7
5
|
import type { Component, JSX } from 'solid-js';
|
|
8
6
|
import h from 'solid-js/h';
|
|
9
7
|
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
15
|
-
export interface AutocompletePopupProps extends JSX.HTMLAttributes<AutocompletePopupElement> {
|
|
8
|
+
/** Props for the {@link AutocompletePopup} Solid component. */
|
|
9
|
+
export interface AutocompletePopupProps {
|
|
16
10
|
/**
|
|
17
11
|
* Emitted when the selected value changes. Only available when multiple is
|
|
18
12
|
* false.
|
|
@@ -25,12 +19,8 @@ export interface AutocompletePopupProps extends JSX.HTMLAttributes<AutocompleteP
|
|
|
25
19
|
onValuesChange?: (event: AutocompletePopupEvents['valuesChange']) => void;
|
|
26
20
|
}
|
|
27
21
|
|
|
28
|
-
/**
|
|
29
|
-
|
|
30
|
-
*
|
|
31
|
-
* @public
|
|
32
|
-
*/
|
|
33
|
-
export const AutocompletePopup: Component<AutocompletePopupProps> = (props): any => {
|
|
22
|
+
/** A Solid component that renders an `prosekit-autocomplete-popup` custom element. */
|
|
23
|
+
export const AutocompletePopup: Component<AutocompletePopupProps & JSX.HTMLAttributes<AutocompletePopupElement>> = (props): any => {
|
|
34
24
|
registerAutocompletePopupElement();
|
|
35
25
|
|
|
36
26
|
const [getElement, setElement] = createSignal<AutocompletePopupElement | null>(null);
|
|
@@ -74,5 +64,3 @@ export const AutocompletePopup: Component<AutocompletePopupProps> = (props): any
|
|
|
74
64
|
}),
|
|
75
65
|
);
|
|
76
66
|
};
|
|
77
|
-
|
|
78
|
-
export type { AutocompletePopupEvents };
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
* This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
|
|
3
|
-
*/
|
|
1
|
+
// This file is auto-generated by "@aria-ui/cli". Do not edit this file directly.
|
|
4
2
|
|
|
5
3
|
import { registerAutocompletePositionerElement, type AutocompletePositionerElement, type AutocompletePositionerProps as AutocompletePositionerElementProps } from '@prosekit/web/autocomplete';
|
|
6
4
|
import { createEffect, createSignal, mergeProps, splitProps } from 'solid-js';
|
|
7
5
|
import type { Component, JSX } from 'solid-js';
|
|
8
6
|
import h from 'solid-js/h';
|
|
9
7
|
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
15
|
-
export interface AutocompletePositionerProps extends JSX.HTMLAttributes<AutocompletePositionerElement> {
|
|
8
|
+
/** Props for the {@link AutocompletePositioner} Solid component. */
|
|
9
|
+
export interface AutocompletePositionerProps {
|
|
16
10
|
/**
|
|
17
11
|
* The placement of the popover, relative to the text cursor.
|
|
18
12
|
*
|
|
@@ -117,12 +111,8 @@ export interface AutocompletePositionerProps extends JSX.HTMLAttributes<Autocomp
|
|
|
117
111
|
altBoundary?: AutocompletePositionerElementProps['altBoundary'];
|
|
118
112
|
}
|
|
119
113
|
|
|
120
|
-
/**
|
|
121
|
-
|
|
122
|
-
*
|
|
123
|
-
* @public
|
|
124
|
-
*/
|
|
125
|
-
export const AutocompletePositioner: Component<AutocompletePositionerProps> = (props): any => {
|
|
114
|
+
/** A Solid component that renders an `prosekit-autocomplete-positioner` custom element. */
|
|
115
|
+
export const AutocompletePositioner: Component<AutocompletePositionerProps & JSX.HTMLAttributes<AutocompletePositionerElement>> = (props): any => {
|
|
126
116
|
registerAutocompletePositionerElement();
|
|
127
117
|
|
|
128
118
|
const [getElement, setElement] = createSignal<AutocompletePositionerElement | null>(null);
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
|
|
3
|
-
*/
|
|
1
|
+
// This file is auto-generated by "@aria-ui/cli". Do not edit this file directly.
|
|
4
2
|
|
|
5
3
|
import { registerAutocompleteRootElement, type AutocompleteRootElement, type AutocompleteRootEvents, type AutocompleteRootProps as AutocompleteRootElementProps } from '@prosekit/web/autocomplete';
|
|
6
4
|
import { createEffect, createSignal, mergeProps, splitProps } from 'solid-js';
|
|
@@ -9,12 +7,8 @@ import h from 'solid-js/h';
|
|
|
9
7
|
|
|
10
8
|
import { useEditorContext } from '../../contexts/editor-context.ts';
|
|
11
9
|
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
*
|
|
15
|
-
* @public
|
|
16
|
-
*/
|
|
17
|
-
export interface AutocompleteRootProps extends JSX.HTMLAttributes<AutocompleteRootElement> {
|
|
10
|
+
/** Props for the {@link AutocompleteRoot} Solid component. */
|
|
11
|
+
export interface AutocompleteRootProps {
|
|
18
12
|
/**
|
|
19
13
|
* The ProseKit editor instance.
|
|
20
14
|
*
|
|
@@ -51,12 +45,8 @@ export interface AutocompleteRootProps extends JSX.HTMLAttributes<AutocompleteRo
|
|
|
51
45
|
onValuesChange?: (event: AutocompleteRootEvents['valuesChange']) => void;
|
|
52
46
|
}
|
|
53
47
|
|
|
54
|
-
/**
|
|
55
|
-
|
|
56
|
-
*
|
|
57
|
-
* @public
|
|
58
|
-
*/
|
|
59
|
-
export const AutocompleteRoot: Component<AutocompleteRootProps> = (props): any => {
|
|
48
|
+
/** A Solid component that renders an `prosekit-autocomplete-root` custom element. */
|
|
49
|
+
export const AutocompleteRoot: Component<AutocompleteRootProps & JSX.HTMLAttributes<AutocompleteRootElement>> = (props): any => {
|
|
60
50
|
registerAutocompleteRootElement();
|
|
61
51
|
|
|
62
52
|
const [getElement, setElement] = createSignal<AutocompleteRootElement | null>(null);
|
|
@@ -106,5 +96,3 @@ export const AutocompleteRoot: Component<AutocompleteRootProps> = (props): any =
|
|
|
106
96
|
}),
|
|
107
97
|
);
|
|
108
98
|
};
|
|
109
|
-
|
|
110
|
-
export type { AutocompleteRootEvents };
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
* This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
|
|
3
|
-
*/
|
|
1
|
+
// This file is auto-generated by "@aria-ui/cli". Do not edit this file directly.
|
|
4
2
|
|
|
5
3
|
export { AutocompleteEmpty, type AutocompleteEmptyProps } from './autocomplete-empty.gen.ts';
|
|
6
4
|
|
|
7
|
-
export { AutocompleteItem, type AutocompleteItemProps
|
|
5
|
+
export { AutocompleteItem, type AutocompleteItemProps } from './autocomplete-item.gen.ts';
|
|
8
6
|
|
|
9
|
-
export { AutocompletePopup, type AutocompletePopupProps
|
|
7
|
+
export { AutocompletePopup, type AutocompletePopupProps } from './autocomplete-popup.gen.ts';
|
|
10
8
|
|
|
11
9
|
export { AutocompletePositioner, type AutocompletePositionerProps } from './autocomplete-positioner.gen.ts';
|
|
12
10
|
|
|
13
|
-
export { AutocompleteRoot, type AutocompleteRootProps
|
|
14
|
-
|
|
15
|
-
export { OpenChangeEvent, QueryChangeEvent, SelectEvent, ValueChangeEvent, ValuesChangeEvent } from '@prosekit/web/autocomplete';
|
|
11
|
+
export { AutocompleteRoot, type AutocompleteRootProps } from './autocomplete-root.gen.ts';
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
|
|
3
|
-
*/
|
|
1
|
+
// This file is auto-generated by "@aria-ui/cli". Do not edit this file directly.
|
|
4
2
|
|
|
5
3
|
import { registerBlockHandleAddElement, type BlockHandleAddElement, type BlockHandleAddProps as BlockHandleAddElementProps } from '@prosekit/web/block-handle';
|
|
6
4
|
import { createEffect, createSignal, mergeProps, splitProps } from 'solid-js';
|
|
@@ -9,12 +7,8 @@ import h from 'solid-js/h';
|
|
|
9
7
|
|
|
10
8
|
import { useEditorContext } from '../../contexts/editor-context.ts';
|
|
11
9
|
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
*
|
|
15
|
-
* @public
|
|
16
|
-
*/
|
|
17
|
-
export interface BlockHandleAddProps extends JSX.HTMLAttributes<BlockHandleAddElement> {
|
|
10
|
+
/** Props for the {@link BlockHandleAdd} Solid component. */
|
|
11
|
+
export interface BlockHandleAddProps {
|
|
18
12
|
/**
|
|
19
13
|
* The ProseKit editor instance.
|
|
20
14
|
*
|
|
@@ -24,12 +18,8 @@ export interface BlockHandleAddProps extends JSX.HTMLAttributes<BlockHandleAddEl
|
|
|
24
18
|
editor?: BlockHandleAddElementProps['editor'];
|
|
25
19
|
}
|
|
26
20
|
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
-
*
|
|
30
|
-
* @public
|
|
31
|
-
*/
|
|
32
|
-
export const BlockHandleAdd: Component<BlockHandleAddProps> = (props): any => {
|
|
21
|
+
/** A Solid component that renders an `prosekit-block-handle-add` custom element. */
|
|
22
|
+
export const BlockHandleAdd: Component<BlockHandleAddProps & JSX.HTMLAttributes<BlockHandleAddElement>> = (props): any => {
|
|
33
23
|
registerBlockHandleAddElement();
|
|
34
24
|
|
|
35
25
|
const [getElement, setElement] = createSignal<BlockHandleAddElement | null>(null);
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
|
|
3
|
-
*/
|
|
1
|
+
// This file is auto-generated by "@aria-ui/cli". Do not edit this file directly.
|
|
4
2
|
|
|
5
3
|
import { registerBlockHandleDraggableElement, type BlockHandleDraggableElement, type BlockHandleDraggableProps as BlockHandleDraggableElementProps } from '@prosekit/web/block-handle';
|
|
6
4
|
import { createEffect, createSignal, mergeProps, splitProps } from 'solid-js';
|
|
@@ -9,12 +7,8 @@ import h from 'solid-js/h';
|
|
|
9
7
|
|
|
10
8
|
import { useEditorContext } from '../../contexts/editor-context.ts';
|
|
11
9
|
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
*
|
|
15
|
-
* @public
|
|
16
|
-
*/
|
|
17
|
-
export interface BlockHandleDraggableProps extends JSX.HTMLAttributes<BlockHandleDraggableElement> {
|
|
10
|
+
/** Props for the {@link BlockHandleDraggable} Solid component. */
|
|
11
|
+
export interface BlockHandleDraggableProps {
|
|
18
12
|
/**
|
|
19
13
|
* The ProseKit editor instance.
|
|
20
14
|
*
|
|
@@ -24,12 +18,8 @@ export interface BlockHandleDraggableProps extends JSX.HTMLAttributes<BlockHandl
|
|
|
24
18
|
editor?: BlockHandleDraggableElementProps['editor'];
|
|
25
19
|
}
|
|
26
20
|
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
-
*
|
|
30
|
-
* @public
|
|
31
|
-
*/
|
|
32
|
-
export const BlockHandleDraggable: Component<BlockHandleDraggableProps> = (props): any => {
|
|
21
|
+
/** A Solid component that renders an `prosekit-block-handle-draggable` custom element. */
|
|
22
|
+
export const BlockHandleDraggable: Component<BlockHandleDraggableProps & JSX.HTMLAttributes<BlockHandleDraggableElement>> = (props): any => {
|
|
33
23
|
registerBlockHandleDraggableElement();
|
|
34
24
|
|
|
35
25
|
const [getElement, setElement] = createSignal<BlockHandleDraggableElement | null>(null);
|
|
@@ -1,24 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
* This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
|
|
3
|
-
*/
|
|
1
|
+
// This file is auto-generated by "@aria-ui/cli". Do not edit this file directly.
|
|
4
2
|
|
|
5
3
|
import { registerBlockHandlePopupElement, type BlockHandlePopupElement } from '@prosekit/web/block-handle';
|
|
6
4
|
import type { Component, JSX } from 'solid-js';
|
|
7
5
|
import h from 'solid-js/h';
|
|
8
6
|
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
*
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
export interface BlockHandlePopupProps extends JSX.HTMLAttributes<BlockHandlePopupElement> {}
|
|
7
|
+
/** Props for the {@link BlockHandlePopup} Solid component. */
|
|
8
|
+
export interface BlockHandlePopupProps {}
|
|
15
9
|
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
*
|
|
19
|
-
* @public
|
|
20
|
-
*/
|
|
21
|
-
export const BlockHandlePopup: Component<BlockHandlePopupProps> = (props): any => {
|
|
10
|
+
/** A Solid component that renders an `prosekit-block-handle-popup` custom element. */
|
|
11
|
+
export const BlockHandlePopup: Component<BlockHandlePopupProps & JSX.HTMLAttributes<BlockHandlePopupElement>> = (props): any => {
|
|
22
12
|
registerBlockHandlePopupElement();
|
|
23
13
|
|
|
24
14
|
const restProps = props;
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
* This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
|
|
3
|
-
*/
|
|
1
|
+
// This file is auto-generated by "@aria-ui/cli". Do not edit this file directly.
|
|
4
2
|
|
|
5
3
|
import { registerBlockHandlePositionerElement, type BlockHandlePositionerElement, type BlockHandlePositionerProps as BlockHandlePositionerElementProps } from '@prosekit/web/block-handle';
|
|
6
4
|
import { createEffect, createSignal, mergeProps, splitProps } from 'solid-js';
|
|
7
5
|
import type { Component, JSX } from 'solid-js';
|
|
8
6
|
import h from 'solid-js/h';
|
|
9
7
|
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
15
|
-
export interface BlockHandlePositionerProps extends JSX.HTMLAttributes<BlockHandlePositionerElement> {
|
|
8
|
+
/** Props for the {@link BlockHandlePositioner} Solid component. */
|
|
9
|
+
export interface BlockHandlePositionerProps {
|
|
16
10
|
/**
|
|
17
11
|
* The placement of the popover, relative to the hovered block.
|
|
18
12
|
*
|
|
@@ -135,12 +129,8 @@ export interface BlockHandlePositionerProps extends JSX.HTMLAttributes<BlockHand
|
|
|
135
129
|
altBoundary?: BlockHandlePositionerElementProps['altBoundary'];
|
|
136
130
|
}
|
|
137
131
|
|
|
138
|
-
/**
|
|
139
|
-
|
|
140
|
-
*
|
|
141
|
-
* @public
|
|
142
|
-
*/
|
|
143
|
-
export const BlockHandlePositioner: Component<BlockHandlePositionerProps> = (props): any => {
|
|
132
|
+
/** A Solid component that renders an `prosekit-block-handle-positioner` custom element. */
|
|
133
|
+
export const BlockHandlePositioner: Component<BlockHandlePositionerProps & JSX.HTMLAttributes<BlockHandlePositionerElement>> = (props): any => {
|
|
144
134
|
registerBlockHandlePositionerElement();
|
|
145
135
|
|
|
146
136
|
const [getElement, setElement] = createSignal<BlockHandlePositionerElement | null>(null);
|