@prosekit/core 0.8.7 → 0.9.0

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.
Files changed (56) hide show
  1. package/dist/{editor-M9OimMiI.d.ts → editor-4lgGc3CY.d.ts} +20 -60
  2. package/dist/editor-4lgGc3CY.d.ts.map +1 -0
  3. package/dist/{editor-B0L9BgMi.js → editor-DGNUXn-u.js} +98 -115
  4. package/dist/editor-DGNUXn-u.js.map +1 -0
  5. package/dist/prosekit-core-test.d.ts +1 -1
  6. package/dist/prosekit-core-test.js +1 -1
  7. package/dist/prosekit-core.d.ts +81 -180
  8. package/dist/prosekit-core.d.ts.map +1 -1
  9. package/dist/prosekit-core.js +316 -403
  10. package/dist/prosekit-core.js.map +1 -1
  11. package/package.json +8 -10
  12. package/src/commands/select-all.ts +3 -8
  13. package/src/commands/select-block.spec.ts +83 -0
  14. package/src/commands/select-block.ts +59 -0
  15. package/src/commands/wrap.ts +1 -6
  16. package/src/editor/action.ts +1 -11
  17. package/src/editor/editor.ts +20 -32
  18. package/src/extensions/command.ts +4 -0
  19. package/src/extensions/default-state.spec.ts +0 -4
  20. package/src/extensions/default-state.ts +4 -24
  21. package/src/extensions/events/dom-event.ts +1 -4
  22. package/src/extensions/events/editor-event.ts +1 -1
  23. package/src/extensions/history.ts +1 -1
  24. package/src/extensions/keymap-base.spec.ts +98 -0
  25. package/src/extensions/keymap-base.ts +37 -13
  26. package/src/extensions/keymap.spec.ts +9 -5
  27. package/src/extensions/keymap.ts +13 -56
  28. package/src/extensions/mark-spec.ts +32 -29
  29. package/src/extensions/node-spec.ts +28 -19
  30. package/src/extensions/plugin.ts +1 -2
  31. package/src/facets/command.ts +8 -2
  32. package/src/facets/state.spec.ts +6 -6
  33. package/src/facets/state.ts +1 -2
  34. package/src/index.ts +3 -23
  35. package/src/types/extension-command.ts +0 -7
  36. package/src/types/extension.ts +0 -16
  37. package/src/utils/array-grouping.spec.ts +1 -11
  38. package/src/utils/array-grouping.ts +1 -14
  39. package/src/utils/array.ts +0 -4
  40. package/src/utils/combine-event-handlers.ts +4 -6
  41. package/src/utils/editor-content.ts +3 -3
  42. package/src/utils/output-spec.ts +11 -0
  43. package/src/utils/parse.ts +9 -9
  44. package/dist/editor-B0L9BgMi.js.map +0 -1
  45. package/dist/editor-M9OimMiI.d.ts.map +0 -1
  46. package/src/extensions/doc.ts +0 -31
  47. package/src/extensions/paragraph.ts +0 -61
  48. package/src/extensions/text.ts +0 -34
  49. package/src/types/base-node-view-options.ts +0 -33
  50. package/src/types/object-entries.ts +0 -13
  51. package/src/utils/collect-children.ts +0 -21
  52. package/src/utils/collect-nodes.ts +0 -37
  53. package/src/utils/deep-equals.spec.ts +0 -26
  54. package/src/utils/deep-equals.ts +0 -29
  55. package/src/utils/get-id.spec.ts +0 -14
  56. package/src/utils/get-id.ts +0 -13
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor-DGNUXn-u.js","names":["_reducer?: FacetReducer<Input, Output> | undefined","_reduce?: () => FacetReducer<Input, Output>","schema: Schema | undefined","commands: CommandCreators | undefined","stateFunc: ((ctx: { schema: Schema }) => EditorStateConfig) | undefined","view: Omit<DirectEditorProps, 'state'> | undefined","rootFacet: Facet<RootPayload, RootOutput>","schemaFacet: Facet<SchemaSpec, RootPayload>","node: FacetNode | undefined","facet: Facet<I, O>","inputs: Tuple5<I[] | null>","children: Map<number, FacetNode>","reducers: Tuple5<FacetReducer<I, O> | null>","output: Tuple5<O | null>","input: I[]","facet: Facet<Input, Output>","payloads: Input[]","inputs: Tuple5<Input[] | null>","node: FacetNode","stateFacet: Facet<StatePayload, RootPayload>","callbacks: StatePayload[]","state: StatePayload","doc: ProseMirrorNode | undefined","selection: Selection | undefined","schema: Schema | undefined","document","config: EditorStateConfig","node","defaultApplyMark: ApplyMarkFunction","defaultCreateNode: CreateNodeFunction","nodes: Array<ProseMirrorNode>","extension: BaseExtension[]","children: FacetNode[]","extensions: Extension[]","DOMSerializer","lazyRemove: VoidFunction | null","action: CommandAction<Args>"],"sources":["../src/error.ts","../src/utils/get-mark-type.ts","../src/utils/assert.ts","../src/utils/get-node-type.ts","../src/utils/type-assertion.ts","../src/utils/attrs-match.ts","../src/utils/is-node-active.ts","../src/types/priority.ts","../src/facets/facet.ts","../src/facets/root.ts","../src/facets/schema.ts","../src/facets/base-extension.ts","../src/utils/array.ts","../src/facets/facet-node.ts","../src/facets/facet-extension.ts","../src/facets/state.ts","../src/utils/get-dom-api.ts","../src/utils/parse.ts","../src/utils/editor-content.ts","../src/extensions/default-state.ts","../src/utils/is-subset.ts","../src/utils/includes-mark.ts","../src/utils/is-mark-absent.ts","../src/utils/is-mark-active.ts","../src/editor/action.ts","../src/facets/union-extension.ts","../src/editor/union.ts","../src/editor/editor.ts"],"sourcesContent":["/**\n * Base class for all ProseKit errors.\n *\n * @internal\n */\nexport class ProseKitError extends Error {}\n\n/**\n * @internal\n */\nexport class EditorNotFoundError extends ProseKitError {\n constructor() {\n super(\n 'Unable to find editor. Pass it as an argument or call this function inside a ProseKit component.',\n )\n }\n}\n\n/**\n * @internal\n */\nexport class DOMDocumentNotFoundError extends ProseKitError {\n constructor() {\n super(\n 'Unable to find browser Document. When not in the browser environment, you need to pass a DOM Document.',\n )\n }\n}\n","import type {\n MarkType,\n Schema,\n} from '@prosekit/pm/model'\n\nimport { ProseKitError } from '../error'\n\n/**\n * @internal\n */\nexport function getMarkType(schema: Schema, type: string | MarkType): MarkType {\n if (typeof type === 'string') {\n const markType = schema.marks[type]\n if (!markType) {\n throw new ProseKitError(`Cannot find mark type \"${type}\"`)\n }\n return markType\n }\n return type\n}\n","import { ProseKitError } from '../error'\n\n/**\n * @internal\n */\nexport function assert(\n condition: unknown,\n message = 'Assertion failed',\n): asserts condition {\n if (!condition) {\n throw new ProseKitError(message)\n }\n}\n","import type {\n NodeType,\n Schema,\n} from '@prosekit/pm/model'\n\nimport { ProseKitError } from '../error'\n\n/**\n * @internal\n */\nexport function getNodeType(schema: Schema, type: string | NodeType): NodeType {\n if (typeof type === 'string') {\n const nodeType = schema.nodes[type]\n if (!nodeType) {\n throw new ProseKitError(`Cannot find ProseMirror node type \"${type}\"`)\n }\n return nodeType\n }\n return type\n}\n","import {\n Fragment,\n Mark,\n ProseMirrorNode,\n Slice,\n} from '@prosekit/pm/model'\nimport {\n AllSelection,\n NodeSelection,\n Selection,\n TextSelection,\n} from '@prosekit/pm/state'\n\n/**\n * Checks if the given object is a {@link ProseMirrorNode} instance.\n */\nexport function isProseMirrorNode(value: unknown): value is ProseMirrorNode {\n return value instanceof ProseMirrorNode\n}\n\n/**\n * Checks if the given object is a {@link Mark} instance.\n *\n * @public\n */\nexport function isMark(value: unknown): value is Mark {\n return value instanceof Mark\n}\n\n/**\n * Checks if the given object is a {@link Fragment} instance.\n *\n * @public\n */\nexport function isFragment(value: unknown): value is Fragment {\n return value instanceof Fragment\n}\n\n/**\n * Checks if the given object is a {@link Slice} instance.\n *\n * @public\n */\nexport function isSlice(value: unknown): value is Slice {\n return value instanceof Slice\n}\n\n/**\n * Checks if the given object is a {@link Selection} instance.\n *\n * @public\n */\nexport function isSelection(value: unknown): value is Selection {\n return value instanceof Selection\n}\n\n/**\n * Checks if the given object is a {@link TextSelection} instance.\n *\n * @public\n */\nexport function isTextSelection(value: Selection): value is TextSelection {\n return value instanceof TextSelection\n}\n\n/**\n * Checks if the given object is a {@link NodeSelection} instance.\n *\n * @public\n */\nexport function isNodeSelection(value: Selection): value is NodeSelection {\n return value instanceof NodeSelection\n}\n\n/**\n * Checks if the given object is a {@link AllSelection} instance.\n *\n * @public\n */\nexport function isAllSelection(value: Selection): value is AllSelection {\n return value instanceof AllSelection\n}\n\n/**\n * @internal\n */\nexport function isNotNullish<T>(\n value: T | null | undefined,\n): value is T {\n return value != null\n}\n","import type {\n Attrs,\n Mark,\n ProseMirrorNode,\n} from '@prosekit/pm/model'\n\nexport function attrsMatch(\n nodeOrMark: ProseMirrorNode | Mark,\n attrs: Attrs,\n): boolean {\n const currentAttrs = nodeOrMark.attrs\n\n for (const [key, value] of Object.entries(attrs)) {\n if (currentAttrs[key] !== value) {\n return false\n }\n }\n\n return true\n}\n","import type {\n Attrs,\n NodeType,\n} from '@prosekit/pm/model'\nimport type { EditorState } from '@prosekit/pm/state'\n\nimport { attrsMatch } from './attrs-match'\nimport { getNodeType } from './get-node-type'\n\nexport function isNodeActive(\n state: EditorState,\n type: string | NodeType,\n attrs?: Attrs | null,\n): boolean {\n const $pos = state.selection.$from\n const nodeType = getNodeType(state.schema, type)\n\n for (let depth = $pos.depth; depth >= 0; depth--) {\n const node = $pos.node(depth)\n if (node.type === nodeType && (!attrs || attrsMatch(node, attrs))) {\n return true\n }\n }\n return false\n}\n","/**\n * ProseKit extension priority.\n *\n * @public\n */\nexport enum Priority {\n lowest = 0,\n low = 1,\n default = 2,\n high = 3,\n highest = 4,\n}\n","import { assert } from '../utils/assert'\n\nimport type { FacetReducer } from './facet-types'\n\nlet facetCount = 0\n\n/**\n * @internal\n */\nexport class Facet<Input, Output> {\n /**\n * @internal\n */\n readonly index: number = facetCount++\n /**\n * @internal\n */\n readonly parent: Facet<Output, any> | null\n /**\n * @internal\n */\n readonly singleton: boolean\n /**\n * A index path to retrieve the current facet in a tree from the root.\n *\n * @internal\n */\n readonly path: number[]\n\n /**\n * @internal\n */\n constructor(\n parent: Facet<Output, any> | null,\n singleton: boolean,\n private _reducer?: FacetReducer<Input, Output> | undefined,\n private _reduce?: () => FacetReducer<Input, Output>,\n ) {\n // Only one of _reducer or _reduce can be defined\n assert((_reduce || _reducer) && !(_reduce && _reducer))\n\n this.parent = parent\n this.singleton = singleton\n this.path = parent ? [...parent.path, this.index] : []\n }\n\n get reducer(): FacetReducer<Input, Output> {\n return (this._reducer ?? this._reduce?.())!\n }\n}\n\n/**\n * @internal\n */\nexport function defineFacet<Input, Output>(options: {\n /**\n * The parent facet in the tree.\n */\n parent: Facet<Output, any>\n\n /**\n * Set this to true if you only want to keep one facet payload. For example,\n * this facet corresponds to a ProseMirror plugin with a key.\n */\n singleton?: boolean\n\n /**\n * A reducer is a function that accepts an array of input and produce a single\n * output.\n */\n reducer?: FacetReducer<Input, Output>\n /**\n * A callback function that returns a reducer. This is useful if you want to\n * store something in the closure.\n */\n reduce?: () => FacetReducer<Input, Output>\n}): Facet<Input, Output> {\n return new Facet(\n options.parent,\n options.singleton ?? false,\n options.reducer,\n options.reduce,\n )\n}\n","import type { Schema } from '@prosekit/pm/model'\nimport type { EditorStateConfig } from '@prosekit/pm/state'\nimport type { DirectEditorProps } from '@prosekit/pm/view'\n\nimport type { CommandCreators } from '../types/extension-command'\n\nimport { Facet } from './facet'\n\nexport type RootPayload = {\n schema?: Schema | null\n commands?: CommandCreators\n state?: (ctx: { schema: Schema }) => EditorStateConfig\n view?: Omit<DirectEditorProps, 'state'>\n}\n\nexport type RootOutput = {\n schema?: Schema | null\n commands?: CommandCreators\n state?: EditorStateConfig\n view?: Omit<DirectEditorProps, 'state'>\n}\n\nfunction rootReducer(inputs: RootPayload[]): RootOutput {\n let schema: Schema | undefined\n let commands: CommandCreators | undefined\n let stateFunc: ((ctx: { schema: Schema }) => EditorStateConfig) | undefined\n let view: Omit<DirectEditorProps, 'state'> | undefined\n\n for (const input of inputs) {\n schema = input.schema || schema\n commands = input.commands || commands\n stateFunc = input.state || stateFunc\n view = input.view || view\n }\n\n const state = schema && (stateFunc?.({ schema }) ?? { schema })\n\n return { schema, state, commands, view }\n}\n\nexport const rootFacet: Facet<RootPayload, RootOutput> = new Facet<\n RootPayload,\n RootOutput\n>(null, true, rootReducer)\n","import {\n Schema,\n type SchemaSpec,\n} from '@prosekit/pm/model'\n\nimport { assert } from '../utils/assert'\n\nimport {\n defineFacet,\n type Facet,\n} from './facet'\nimport {\n rootFacet,\n type RootPayload,\n} from './root'\n\nexport const schemaFacet: Facet<SchemaSpec, RootPayload> = defineFacet({\n reducer: (specs) => {\n assert(specs.length <= 1)\n const spec = specs[0]\n const schema = spec ? new Schema(spec) : null\n return { schema }\n },\n parent: rootFacet,\n singleton: true,\n})\n","import type { Schema } from '@prosekit/pm/model'\n\nimport type {\n Extension,\n ExtensionTyping,\n} from '../types/extension'\nimport { Priority } from '../types/priority'\n\nimport type { Facet } from './facet'\nimport type { FacetNode } from './facet-node'\nimport type { Tuple5 } from './facet-types'\nimport { schemaFacet } from './schema'\n\n/**\n * @internal\n */\nexport abstract class BaseExtension<T extends ExtensionTyping = ExtensionTyping> implements Extension<T> {\n abstract extension: Extension | Extension[]\n priority?: Priority\n _type?: T\n\n private trees: Tuple5<FacetNode | null> = [null, null, null, null, null]\n\n /**\n * @internal\n */\n abstract createTree(priority: Priority): FacetNode\n\n /**\n * @internal\n */\n getTree(priority?: Priority): FacetNode {\n const pri = priority ?? this.priority ?? Priority.default\n return (this.trees[pri] ||= this.createTree(pri))\n }\n\n /**\n * @internal\n */\n findFacetOutput<I, O>(facet: Facet<I, O>): Tuple5<O | null> | null {\n let node: FacetNode | undefined = this.getTree()\n\n for (const index of facet.path) {\n node = node?.children.get(index)\n }\n\n return node?.getOutput() ?? null\n }\n\n get schema(): Schema | null {\n const output = this.findFacetOutput(schemaFacet)\n return output?.find(Boolean)?.schema ?? null\n }\n}\n","export function uniqPush<T>(prev: readonly T[], next: readonly T[]): T[] {\n const result = [...prev]\n\n for (const item of next) {\n if (!result.includes(item)) {\n result.push(item)\n }\n }\n return result\n}\n\n/**\n * @internal\n */\nexport function arraySubtract<T>(a: T[], b: T[]): T[] {\n return a.filter((x) => !b.includes(x))\n}\n","import { Priority } from '../types/priority'\nimport {\n arraySubtract,\n uniqPush,\n} from '../utils/array'\nimport { assert } from '../utils/assert'\nimport { isNotNullish } from '../utils/type-assertion'\n\nimport type { Facet } from './facet'\nimport type {\n FacetReducer,\n Tuple5,\n} from './facet-types'\nimport type { RootOutput } from './root'\n\nfunction zip5<T>(\n a: Tuple5<T>,\n b: Tuple5<T>,\n mapper: (a: T, b: T) => T,\n): Tuple5<T> {\n return [\n mapper(a[0], b[0]),\n mapper(a[1], b[1]),\n mapper(a[2], b[2]),\n mapper(a[3], b[3]),\n mapper(a[4], b[4]),\n ]\n}\n\nfunction unionInput<T>(a: T[] | null, b: T[] | null): T[] | null {\n if (!a && !b) return null\n return uniqPush(a ?? [], b ?? [])\n}\n\nfunction subtractInput<T>(a: T[] | null, b: T[] | null): T[] | null {\n if (!a) return null\n if (!b) return [...a]\n return arraySubtract(a, b)\n}\n\nfunction unionChildren(\n a: Map<number, FacetNode>,\n b: Map<number, FacetNode>,\n): Map<number, FacetNode> {\n const merged = new Map(a)\n for (const [key, valueB] of b.entries()) {\n const valueA = a.get(key)\n merged.set(key, valueA ? unionFacetNode(valueA, valueB) : valueB)\n }\n return merged\n}\n\nfunction subtractChildren(\n a: Map<number, FacetNode>,\n b: Map<number, FacetNode>,\n): Map<number, FacetNode> {\n const merged = new Map(a)\n for (const [key, valueB] of b.entries()) {\n const valueA = a.get(key)\n if (valueA) {\n merged.set(key, subtractFacetNode(valueA, valueB))\n }\n }\n return merged\n}\n\n/**\n * Takes two facet nodes and returns a new facet node containing inputs and\n * children from both nodes.\n *\n * The reducers of the first facet node will be reused.\n *\n * @internal\n */\nexport function unionFacetNode<I, O>(\n a: FacetNode<I, O>,\n b: FacetNode<I, O>,\n): FacetNode<I, O> {\n assert(a.facet === b.facet)\n return new FacetNode(\n a.facet,\n zip5(a.inputs, b.inputs, unionInput),\n unionChildren(a.children, b.children),\n a.reducers,\n )\n}\n\n/**\n * Takes two facet nodes and returns a new facet node containing inputs and\n * children from the first node but not the second.\n *\n * The reducers of the first facet node will be reused.\n *\n * @internal\n */\nexport function subtractFacetNode<I, O>(\n a: FacetNode<I, O>,\n b: FacetNode<I, O>,\n): FacetNode<I, O> {\n assert(a.facet === b.facet)\n return new FacetNode(\n a.facet,\n zip5(a.inputs, b.inputs, subtractInput),\n subtractChildren(a.children, b.children),\n a.reducers,\n )\n}\n\nexport class FacetNode<I = any, O = any> {\n output: Tuple5<O | null> | null = null\n\n constructor(\n readonly facet: Facet<I, O>,\n readonly inputs: Tuple5<I[] | null> = [null, null, null, null, null],\n readonly children: Map<number, FacetNode> = new Map(),\n readonly reducers: Tuple5<FacetReducer<I, O> | null> = [\n null,\n null,\n null,\n null,\n null,\n ],\n ) {}\n\n private calcOutput(): Tuple5<O | null> {\n const inputs: Tuple5<I[] | null> = [null, null, null, null, null]\n const output: Tuple5<O | null> = [null, null, null, null, null]\n\n for (let pri = 0; pri < 5; pri++) {\n const input = this.inputs[pri]\n if (input) {\n inputs[pri] = [...input]\n }\n }\n\n for (const child of this.children.values()) {\n const childOutput = child.getOutput()\n for (let pri = 0; pri < 5; pri++) {\n if (childOutput[pri]) {\n const input = (inputs[pri] ||= [])\n input.push(childOutput[pri] as I)\n }\n }\n }\n\n if (this.facet.singleton) {\n const reducer = (this.reducers[Priority.default] ||= this.facet.reducer)\n const input: I[] = inputs.filter(isNotNullish).flat()\n output[Priority.default] = reducer(input)\n } else {\n for (let pri = 0; pri < 5; pri++) {\n const input = inputs[pri]\n if (input) {\n const reducer = (this.reducers[pri] ||= this.facet.reducer)\n output[pri] = reducer(input)\n }\n }\n }\n\n return output\n }\n\n getOutput(): Tuple5<O | null> {\n if (!this.output) {\n this.output = this.calcOutput()\n }\n return this.output\n }\n\n getSingletonOutput(): O | null {\n assert(this.facet.singleton)\n return this.getOutput()[Priority.default]\n }\n\n getRootOutput(): RootOutput {\n assert(this.isRoot())\n const output = this.getSingletonOutput()\n assert(output)\n return output\n }\n\n isRoot(): boolean {\n return !this.facet.parent\n }\n}\n","import type { Extension } from '../types/extension'\nimport type { Priority } from '../types/priority'\n\nimport { BaseExtension } from './base-extension'\nimport type { Facet } from './facet'\nimport { FacetNode } from './facet-node'\nimport type { Tuple5 } from './facet-types'\n\n/**\n * @internal\n */\nexport class FacetExtensionImpl<Input, Output> extends BaseExtension {\n declare extension: Extension\n\n /**\n * @internal\n */\n constructor(\n readonly facet: Facet<Input, Output>,\n readonly payloads: Input[],\n ) {\n super()\n }\n\n /**\n * @internal\n */\n createTree(priority: Priority): FacetNode {\n const pri = this.priority ?? priority\n\n const inputs: Tuple5<Input[] | null> = [null, null, null, null, null]\n inputs[pri] = [...this.payloads]\n\n let node: FacetNode = new FacetNode(this.facet, inputs)\n\n while (node.facet.parent) {\n const children = new Map([[node.facet.index, node]])\n node = new FacetNode(node.facet.parent, undefined, children)\n }\n\n return node\n }\n}\n\n/**\n * @internal\n */\nexport function defineFacetPayload<Input>(\n facet: Facet<Input, any>,\n payloads: Input[],\n): Extension {\n return new FacetExtensionImpl(facet, payloads)\n}\n","import type {\n Mark,\n ProseMirrorNode,\n Schema,\n} from '@prosekit/pm/model'\nimport type { EditorStateConfig } from '@prosekit/pm/state'\nimport type {\n Plugin,\n Selection,\n} from '@prosekit/pm/state'\n\nimport { assert } from '../utils/assert'\n\nimport {\n defineFacet,\n type Facet,\n} from './facet'\nimport {\n rootFacet,\n type RootPayload,\n} from './root'\n\nexport type StatePayload = (ctx: { schema: Schema }) => EditorStateConfig\n\nexport const stateFacet: Facet<StatePayload, RootPayload> = defineFacet({\n reduce: () => {\n // An array of state payloads from lower to higher priority.\n let callbacks: StatePayload[] = []\n\n const state: StatePayload = (ctx) => {\n let doc: ProseMirrorNode | undefined\n let selection: Selection | undefined\n let schema: Schema | undefined = ctx.schema\n const markSet = new Set<Mark>()\n const pluginSet = new Set<Plugin>()\n\n // An array of state payloads from higher to lower priority. This matches the\n // order of plugins required by ProseMirror.\n const reversedCallbacks = [...callbacks].reverse()\n\n for (const callback of reversedCallbacks) {\n const config = callback(ctx)\n\n doc ||= config.doc\n selection ||= config.selection\n schema ||= config.schema\n\n for (const mark of (config.storedMarks ?? [])) {\n markSet.add(mark)\n }\n\n for (const plugin of (config.plugins ?? [])) {\n // `config.plugins` is an array of plugins from higher to lower priority.\n pluginSet.add(plugin)\n }\n }\n\n // If both doc and schema are provided, the schema is not needed.\n if (doc && schema) {\n schema = undefined\n }\n\n assert(\n doc || schema,\n \"Can't create state without a schema nor a document\",\n )\n\n return {\n doc,\n selection,\n schema,\n storedMarks: Array.from(markSet),\n plugins: Array.from(pluginSet),\n }\n }\n\n return function reducer(inputs) {\n callbacks = inputs\n return { state }\n }\n },\n singleton: true,\n parent: rootFacet,\n})\n","import { DOMDocumentNotFoundError } from '../error'\n\nfunction findGlobalBrowserDocument() {\n if (typeof document !== 'undefined') {\n return document\n }\n\n if (typeof globalThis !== 'undefined' && globalThis.document) {\n return globalThis.document\n }\n}\n\nfunction findGlobalBrowserWindow() {\n if (typeof window !== 'undefined') {\n return window\n }\n\n if (typeof globalThis !== 'undefined' && globalThis.window) {\n return globalThis.window\n }\n}\n\nfunction findBrowserDocument(options?: { document?: Document }): Document | undefined {\n return (\n options?.document\n ?? findGlobalBrowserDocument()\n ?? findGlobalBrowserWindow()?.document\n )\n}\n\nfunction findBrowserWindow(options?: {\n document?: Document\n}): (Window & typeof globalThis) | undefined {\n return (\n options?.document?.defaultView\n ?? findGlobalBrowserWindow()\n ?? findBrowserDocument(options)?.defaultView\n ?? undefined\n )\n}\n\nexport function getBrowserDocument(options?: {\n document?: Document\n}): Document {\n const doc = findBrowserDocument(options)\n if (doc) return doc\n throw new DOMDocumentNotFoundError()\n}\n\nexport function getBrowserWindow(options?: {\n document?: Document\n}): Window & typeof globalThis {\n const win = findBrowserWindow(options)\n if (win) return win\n throw new DOMDocumentNotFoundError()\n}\n","import {\n DOMParser,\n DOMSerializer,\n type ParseOptions,\n type ProseMirrorNode,\n type Schema,\n} from '@prosekit/pm/model'\nimport { EditorState } from '@prosekit/pm/state'\n\nimport type { DOMNode } from '../types/dom-node'\nimport type {\n NodeJSON,\n StateJSON,\n} from '../types/model'\n\nimport {\n getBrowserDocument,\n getBrowserWindow,\n} from './get-dom-api'\n\n/** @public */\nexport interface DOMParserOptions extends ParseOptions {\n DOMParser?: typeof DOMParser\n}\n\n/** @public */\nexport interface DOMSerializerOptions {\n DOMSerializer?: { fromSchema: typeof DOMSerializer.fromSchema }\n}\n\n/** @public */\nexport interface DOMDocumentOptions {\n /**\n * The Document object to use for DOM operations. If not provided, defaults to\n * the current browser's document object. Useful for server-side rendering or\n * testing environments.\n */\n document?: Document\n}\n\n/** @public */\nexport interface JSONParserOptions {\n /**\n * The editor schema to use.\n */\n schema: Schema\n}\n\n/////////////// JSON <=> State ///////////////\n\n/**\n * Return a JSON object representing this state.\n *\n * @public\n *\n * @example\n *\n * ```ts\n * const state = editor.state\n * const json = jsonFromState(state)\n * ```\n */\nexport function jsonFromState(state: EditorState): StateJSON {\n return state.toJSON() as StateJSON\n}\n\n/**\n * Parse a JSON object to a ProseMirror state.\n *\n * @public\n *\n * @example\n *\n * ```ts\n * const json = { state: { type: 'doc', content: [{ type: 'paragraph' }], selection: { type: 'text', from: 1, to: 1 } } }\n * const state = stateFromJSON(json, { schema: editor.schema })\n * ```\n */\nexport function stateFromJSON(\n json: StateJSON,\n options: JSONParserOptions,\n): EditorState {\n return EditorState.fromJSON({ schema: options.schema }, json)\n}\n\n/////////////// JSON <=> Node ///////////////\n\n/**\n * Return a JSON object representing this node.\n *\n * @public\n *\n * @example\n *\n * ```ts\n * const node = editor.state.doc\n * const json = jsonFromNode(node)\n * ```\n */\nexport function jsonFromNode(node: ProseMirrorNode): NodeJSON {\n return node.toJSON() as NodeJSON\n}\n\n/**\n * Parse a JSON object to a ProseMirror node.\n *\n * @public\n *\n * @example\n *\n * ```ts\n * const json = { type: 'doc', content: [{ type: 'paragraph' }] }\n * const node = nodeFromJSON(json, { schema: editor.schema })\n * ```\n */\nexport function nodeFromJSON(\n json: NodeJSON,\n options: JSONParserOptions,\n): ProseMirrorNode {\n return options.schema.nodeFromJSON(json)\n}\n\n/////////////// Node <=> Element ///////////////\n\n/**\n * Parse a DOM node to a ProseMirror node.\n *\n * @public\n *\n * @example\n *\n * ```ts\n * const element = document.getElementById('content')\n * const node = nodeFromElement(element, { schema: editor.schema })\n * ```\n */\nexport function nodeFromElement(\n element: DOMNode,\n options: DOMParserOptions & JSONParserOptions,\n): ProseMirrorNode {\n const { DOMParser: CustomDOMParser, schema, ...parseOptions } = options\n return (CustomDOMParser || DOMParser)\n .fromSchema(schema)\n .parse(element, parseOptions)\n}\n\n/**\n * Serialize a ProseMirror node to an HTML element.\n *\n * @public\n *\n * @example\n *\n * ```ts\n * const node = editor.state.doc\n * const element = elementFromNode(node)\n * ```\n */\nexport function elementFromNode(\n node: ProseMirrorNode,\n options?: DOMSerializerOptions & DOMDocumentOptions,\n): HTMLElement {\n const Serializer = options?.DOMSerializer || DOMSerializer\n const document = getBrowserDocument(options)\n const schema = node.type.schema\n const serializer = Serializer.fromSchema(schema)\n\n if (schema.topNodeType !== node.type) {\n return serializer.serializeNode(node, { document }) as HTMLElement\n } else {\n return serializer.serializeFragment(\n node.content,\n { document },\n document.createElement('div'),\n ) as HTMLElement\n }\n}\n\n/////////////// Element <=> HTML ///////////////\n\n/**\n * Parse an HTML string to an HTML element.\n *\n * @internal\n */\nexport function elementFromHTML(\n html: string,\n options?: DOMDocumentOptions,\n): HTMLElement {\n const win = getBrowserWindow(options)\n const parser = new win.DOMParser()\n return parser.parseFromString(`<body><div>${html}</div></body>`, 'text/html')\n .body.firstElementChild as HTMLElement\n}\n\n/**\n * @internal\n */\nfunction htmlFromElement(element: HTMLElement): string {\n return element.outerHTML\n}\n\n/////////////// Node <=> HTML ///////////////\n\n/**\n * Parse an HTML string to a ProseMirror node.\n *\n * @public\n *\n * @example\n *\n * ```ts\n * const html = '<p>Hello, world!</p>'\n * const node = nodeFromHTML(html, { schema: editor.schema })\n * ```\n */\nexport function nodeFromHTML(\n html: string,\n options: DOMParserOptions & JSONParserOptions & DOMDocumentOptions,\n): ProseMirrorNode {\n return nodeFromElement(elementFromHTML(html, options), options)\n}\n\n/**\n * Serialize a ProseMirror node to an HTML string\n *\n * @public\n *\n * @example\n *\n * ```ts\n * const node = document.getElementById('content')\n * const html = htmlFromNode(node)\n * ```\n */\nexport function htmlFromNode(\n node: ProseMirrorNode,\n options?: DOMSerializerOptions & DOMDocumentOptions,\n): string {\n return elementFromNode(node, options).outerHTML\n}\n\n/////////////// JSON <=> Element ///////////////\n\n/**\n * Serialize an HTML element to a ProseMirror document JSON object.\n *\n * @public\n *\n * @example\n *\n * ```ts\n * const element = document.getElementById('content')\n * const json = jsonFromElement(element, { schema: editor.schema })\n * ```\n */\nexport function jsonFromElement(\n element: DOMNode,\n options: DOMParserOptions & JSONParserOptions,\n): NodeJSON {\n return jsonFromNode(nodeFromElement(element, options))\n}\n\n/**\n * Parse a ProseMirror document JSON object to an HTML element.\n *\n * @public\n *\n * @example\n *\n * ```ts\n * const json = { type: 'doc', content: [{ type: 'paragraph' }] }\n * const element = elementFromJSON(json, { schema: editor.schema })\n * ```\n */\nexport function elementFromJSON(\n json: NodeJSON,\n options: JSONParserOptions & DOMSerializerOptions & DOMDocumentOptions,\n): HTMLElement {\n return elementFromNode(nodeFromJSON(json, options), options)\n}\n\n/////////////// JSON <=> HTML ///////////////\n\n/**\n * Parse an HTML string to a ProseMirror document JSON object.\n *\n * @public\n *\n * @example\n *\n * ```ts\n * const html = '<p>Hello, world!</p>'\n * const json = jsonFromHTML(html, { schema: editor.schema })\n * ```\n */\nexport function jsonFromHTML(\n html: string,\n options: DOMDocumentOptions & DOMParserOptions & JSONParserOptions,\n): NodeJSON {\n return jsonFromElement(elementFromHTML(html, options), options)\n}\n\n/**\n * Parse a ProseMirror document JSON object to an HTML string.\n *\n * @public\n *\n * @example\n *\n * ```ts\n * const json = { type: 'doc', content: [{ type: 'paragraph' }] }\n * const html = htmlFromJSON(json, { schema: editor.schema })\n * ```\n */\nexport function htmlFromJSON(\n json: NodeJSON,\n options: JSONParserOptions & DOMSerializerOptions & DOMDocumentOptions,\n): string {\n return htmlFromElement(elementFromJSON(json, options))\n}\n","import { isElementLike } from '@ocavue/utils'\nimport type {\n ProseMirrorNode,\n Schema,\n} from '@prosekit/pm/model'\nimport { Selection } from '@prosekit/pm/state'\n\nimport type {\n NodeJSON,\n SelectionJSON,\n} from '../types/model'\n\nimport { assert } from './assert'\nimport {\n jsonFromElement,\n jsonFromHTML,\n} from './parse'\nimport {\n isProseMirrorNode,\n isSelection,\n} from './type-assertion'\n\nexport function getEditorContentJSON(\n schema: Schema,\n content: NodeJSON | string | Element,\n): NodeJSON {\n if (typeof content === 'string') {\n return jsonFromHTML(content, { schema })\n } else if (isElementLike(content)) {\n return jsonFromElement(content, { schema })\n } else {\n return content\n }\n}\n\nfunction getEditorContentNode(\n schema: Schema,\n content: NodeJSON | string | Element | ProseMirrorNode,\n): ProseMirrorNode {\n if (isProseMirrorNode(content)) {\n return content\n }\n return schema.nodeFromJSON(getEditorContentJSON(schema, content))\n}\n\nexport function getEditorContentDoc(\n schema: Schema,\n content: NodeJSON | string | Element | ProseMirrorNode,\n): ProseMirrorNode {\n const doc = getEditorContentNode(schema, content)\n assert(\n doc.type.schema === schema,\n 'Document schema does not match editor schema',\n )\n assert(\n doc.type === schema.topNodeType,\n `Document type does not match editor top node type. Expected ${schema.topNodeType.name}, got ${doc.type.name}`,\n )\n return doc\n}\n\nexport function getEditorSelection(\n doc: ProseMirrorNode,\n selection: SelectionJSON | Selection | 'start' | 'end',\n): Selection {\n if (isSelection(selection)) {\n assert(selection.$head.doc === doc, 'Selection and doc do not match')\n return selection\n }\n if (selection === 'start') {\n return Selection.atStart(doc)\n }\n if (selection === 'end') {\n return Selection.atEnd(doc)\n }\n return Selection.fromJSON(doc, selection)\n}\n","import {\n Selection,\n type EditorStateConfig,\n} from '@prosekit/pm/state'\n\nimport { defineFacetPayload } from '../facets/facet-extension'\nimport { stateFacet } from '../facets/state'\nimport type { PlainExtension } from '../types/extension'\nimport type {\n NodeJSON,\n SelectionJSON,\n} from '../types/model'\nimport { getEditorContentJSON } from '../utils/editor-content'\n\n/**\n * @public\n */\nexport interface DefaultStateOptions {\n /**\n * The starting document to use when creating the editor. It can be a\n * ProseMirror node JSON object, an HTML string, or a DOM element instance.\n */\n defaultContent?: NodeJSON | string | Element\n\n /**\n * A JSON object representing the starting selection to use when creating the\n * editor. It's only used when `defaultContent` is also provided.\n */\n defaultSelection?: SelectionJSON\n}\n\n/**\n * Define a default state for the editor.\n *\n * @param options\n *\n * @public\n */\nexport function defineDefaultState({\n defaultSelection,\n defaultContent,\n}: DefaultStateOptions): PlainExtension {\n return defineFacetPayload(stateFacet, [\n ({ schema }) => {\n const config: EditorStateConfig = {}\n if (defaultContent) {\n const json = getEditorContentJSON(schema, defaultContent)\n config.doc = schema.nodeFromJSON(json)\n if (defaultSelection) {\n config.selection = Selection.fromJSON(config.doc, defaultSelection)\n }\n }\n return config\n },\n ]) as PlainExtension\n}\n","/**\n * Check if `subset` is a subset of `superset`.\n *\n * @internal\n */\nexport function isSubset(\n subset: Record<string, unknown>,\n superset: Record<string, unknown>,\n): boolean {\n return Object.keys(subset).every((key) => subset[key] === superset[key])\n}\n","import type {\n Attrs,\n Mark,\n MarkType,\n} from '@prosekit/pm/model'\n\nimport { isSubset } from './is-subset'\n\nexport function includesMark(\n marks: readonly Mark[],\n markType: MarkType,\n attrs?: Attrs | null,\n): boolean {\n attrs = attrs || {}\n return marks.some((mark) => {\n return mark.type === markType && isSubset(attrs, mark.attrs)\n })\n}\n","import type {\n Attrs,\n MarkType,\n ProseMirrorNode,\n} from '@prosekit/pm/model'\n\nimport { includesMark } from './includes-mark'\n\n/**\n * Returns true if the given mark is missing in some part of the range.\n * Returns false if the entire range has the given mark.\n * Returns true if the mark is not allowed in the range.\n *\n * @internal\n */\nexport function isMarkAbsent(\n node: ProseMirrorNode,\n from: number,\n to: number,\n markType: MarkType,\n attrs?: Attrs | null,\n): boolean {\n let missing = false\n let available = false\n\n node.nodesBetween(from, to, (node, pos, parent) => {\n if (missing) {\n return false\n }\n\n const allowed = parent?.type.allowsMarkType(markType)\n && !node.marks.some((m) => m.type !== markType && m.type.excludes(markType))\n\n if (allowed) {\n available = true\n if (!includesMark(node.marks, markType, attrs)) {\n missing = true\n }\n }\n })\n return available ? missing : true\n}\n","import type {\n Attrs,\n MarkType,\n} from '@prosekit/pm/model'\nimport type { EditorState } from '@prosekit/pm/state'\n\nimport { getMarkType } from './get-mark-type'\nimport { includesMark } from './includes-mark'\nimport { isMarkAbsent } from './is-mark-absent'\n\n/**\n * @internal\n */\nexport function isMarkActive(\n state: EditorState,\n type: string | MarkType,\n attrs?: Attrs | null,\n): boolean {\n const { from, $from, to, empty } = state.selection\n const markType = getMarkType(state.schema, type)\n if (empty) {\n const marks = state.storedMarks || $from.marks()\n return includesMark(marks, markType, attrs)\n } else {\n return !isMarkAbsent(state.doc, from, to, markType, attrs)\n }\n}\n","import { mapValues } from '@ocavue/utils'\nimport type {\n Attrs,\n Mark,\n MarkType,\n NodeType,\n ProseMirrorNode,\n Schema,\n} from '@prosekit/pm/model'\nimport type { EditorState } from '@prosekit/pm/state'\n\nimport { ProseKitError } from '../error'\nimport type { AnyAttrs } from '../types/attrs'\nimport { assert } from '../utils/assert'\nimport { isMarkActive } from '../utils/is-mark-active'\nimport { isNodeActive } from '../utils/is-node-active'\nimport { isProseMirrorNode } from '../utils/type-assertion'\n\n/**\n * Available children parameters for {@link NodeAction} and {@link MarkAction}.\n *\n * @public\n */\nexport type NodeChild = ProseMirrorNode | string | NodeChild[]\n\n/**\n * A function for creating a node with optional attributes and any number of\n * children.\n *\n * It also has a `isActive` method for checking if the node is active in the\n * current editor selection.\n *\n * @public\n */\nexport interface NodeAction<Attrs extends AnyAttrs = AnyAttrs> {\n /**\n * Creates a node with attributes and any number of children.\n */\n (attrs: Attrs | null, ...children: NodeChild[]): ProseMirrorNode\n\n /**\n * Creates a node with any number of children.\n */\n (...children: NodeChild[]): ProseMirrorNode\n\n /**\n * Checks if the node is active in the current editor selection. If the\n * optional `attrs` parameter is provided, it will check if the node is active\n * with the given attributes.\n */\n isActive: (attrs?: Attrs) => boolean\n}\n\n/**\n * A function for applying a mark with optional attributes and any number of\n * children.\n *\n * It also has a `isActive` method for checking if the mark is active in the\n * current editor selection.\n *\n * @public\n */\nexport interface MarkAction<Attrs extends AnyAttrs = AnyAttrs> {\n /**\n * Applies a mark with attributes and any number of children.\n */\n (attrs: Attrs | null, ...children: NodeChild[]): ProseMirrorNode[]\n\n /**\n * Applies a mark with any number of children.\n */\n (...children: NodeChild[]): ProseMirrorNode[]\n\n /**\n * Checks if the mark is active in the current editor selection. If the\n * optional `attrs` parameter is provided, it will check if the mark is active\n * with the given attributes.\n */\n isActive: (attrs?: Attrs) => boolean\n}\n\n/**\n * @internal\n */\nexport function createNodeActions(\n schema: Schema,\n getState: GetStateFunction,\n createNode: CreateNodeFunction = defaultCreateNode,\n): Record<string, NodeAction> {\n return mapValues(schema.nodes, (type) => createNodeAction(type, getState, createNode))\n}\n\nfunction createNodeAction(\n type: NodeType,\n getState: GetStateFunction,\n createNode: CreateNodeFunction,\n): NodeAction {\n const action = (\n ...args: [Attrs | NodeChild | null | undefined, ...NodeChild[]]\n ) => buildNode(type, args, createNode)\n action.isActive = (attrs?: Attrs) => {\n const state = getState()\n return state ? isNodeActive(state, type, attrs) : false\n }\n return action\n}\n\n/**\n * @internal\n */\nexport function createMarkActions(\n schema: Schema,\n getState: GetStateFunction,\n applyMark: ApplyMarkFunction = defaultApplyMark,\n): Record<string, MarkAction> {\n return mapValues(schema.marks, (type) => createMarkAction(type, getState, applyMark))\n}\n\nfunction createMarkAction(\n type: MarkType,\n getState: GetStateFunction,\n applyMark: ApplyMarkFunction,\n): MarkAction {\n const action = (\n ...args: [Attrs | NodeChild | null | undefined, ...NodeChild[]]\n ) => buildMark(type, args, applyMark)\n action.isActive = (attrs?: Attrs) => {\n const state = getState()\n return state ? isMarkActive(state, type, attrs) : false\n }\n return action\n}\n\nfunction buildMark(\n type: MarkType,\n args: [Attrs | NodeChild | null | undefined, ...NodeChild[]],\n applyMark: ApplyMarkFunction,\n): ProseMirrorNode[] {\n const [attrs, children] = normalizeArgs(args)\n const mark = type.create(attrs)\n return applyMark(mark, flattenChildren(type.schema, children))\n}\n\n/**\n * @internal\n */\nexport type ApplyMarkFunction = (\n mark: Mark,\n children: ProseMirrorNode[],\n) => ProseMirrorNode[]\n\nconst defaultApplyMark: ApplyMarkFunction = (\n mark: Mark,\n children: ProseMirrorNode[],\n): ProseMirrorNode[] => {\n return children.map((node) => node.mark(mark.addToSet(node.marks)))\n}\n\nfunction buildNode(\n type: NodeType,\n args: [Attrs | NodeChild | null | undefined, ...NodeChild[]],\n createNode: CreateNodeFunction,\n): ProseMirrorNode {\n const [attrs, children] = normalizeArgs(args)\n return createNode(type, attrs, flattenChildren(type.schema, children))\n}\n\n/**\n * @internal\n */\nexport type CreateNodeFunction = (\n type: NodeType,\n attrs: Attrs | null,\n children: ProseMirrorNode[],\n) => ProseMirrorNode\n\ntype GetStateFunction = () => EditorState | null | undefined\n\nconst defaultCreateNode: CreateNodeFunction = (\n type: NodeType,\n attrs: Attrs | null,\n children: ProseMirrorNode[],\n) => {\n const node = type.createAndFill(attrs, children)\n assert(node, `Failed to create node ${type.name}`)\n return node\n}\n\nfunction flattenChildren(\n schema: Schema,\n children: NodeChild[],\n): Array<ProseMirrorNode> {\n const nodes: Array<ProseMirrorNode> = []\n\n for (const child of children) {\n if (typeof child === 'string') {\n if (child) {\n nodes.push(schema.text(child, null))\n }\n } else if (Array.isArray(child)) {\n nodes.push(...flattenChildren(schema, child))\n } else if (isProseMirrorNode(child)) {\n nodes.push(child)\n } else {\n throw new ProseKitError(`Invalid node child: ${typeof child}`)\n }\n }\n\n return nodes\n}\n\nfunction normalizeArgs(\n args: [Attrs | NodeChild | null | undefined, ...NodeChild[]],\n): [Attrs | null, NodeChild[]] {\n const [attrs, ...children] = args\n if (isNodeChild(attrs)) {\n children.unshift(attrs)\n return [null, children]\n } else if (typeof attrs === 'object') {\n return [attrs, children]\n } else {\n return [null, children]\n }\n}\n\nfunction isNodeChild(\n value: Attrs | NodeChild | null | undefined,\n): value is NodeChild {\n if (!value) {\n return false\n }\n\n return (\n typeof value === 'string'\n || Array.isArray(value)\n || isProseMirrorNode(value)\n )\n}\n","import type {\n Extension,\n ExtensionTyping,\n} from '../types/extension'\nimport type { Priority } from '../types/priority'\nimport { assert } from '../utils/assert'\n\nimport { BaseExtension } from './base-extension'\nimport {\n unionFacetNode,\n type FacetNode,\n} from './facet-node'\n\nexport class UnionExtensionImpl<T extends ExtensionTyping = ExtensionTyping> extends BaseExtension<T> implements Extension<T> {\n /**\n * @internal\n */\n constructor(public extension: BaseExtension[] = []) {\n super()\n }\n\n /**\n * @internal\n */\n createTree(priority: Priority): FacetNode {\n const pri = this.priority ?? priority\n\n const extensions = [...this.extension]\n extensions.sort((a, b) => (a.priority ?? pri) - (b.priority ?? pri))\n\n const children: FacetNode[] = extensions.map((ext) => ext.getTree(pri))\n\n assert(children.length > 0)\n\n let node = children[0]\n for (let i = 1; i < children.length; i++) {\n node = unionFacetNode(node, children[i])\n }\n return node\n }\n}\n","import type { BaseExtension } from '../facets/base-extension'\nimport { UnionExtensionImpl } from '../facets/union-extension'\nimport type {\n Extension,\n Union,\n} from '../types/extension'\nimport { assert } from '../utils/assert'\n\n/**\n * Merges multiple extensions into one. You can pass multiple extensions as\n * arguments or a single array containing multiple extensions.\n *\n * @throws If no extensions are provided.\n *\n * @example\n *\n * ```ts\n * function defineFancyNodes() {\n * return union(\n * defineFancyParagraph(),\n * defineFancyHeading(),\n * )\n * }\n * ```\n *\n * @example\n *\n * ```ts\n * function defineFancyNodes() {\n * return union([\n * defineFancyParagraph(),\n * defineFancyHeading(),\n * ])\n * }\n * ```\n *\n * @public\n */\nfunction union<const E extends readonly Extension[]>(...exts: E): Union<E>\nfunction union<const E extends readonly Extension[]>(exts: E): Union<E>\nfunction union(...exts: Array<Extension | Extension[]>): Extension {\n const extensions: Extension[] = exts.flat()\n assert(extensions.length > 0, 'At least one extension is required')\n return new UnionExtensionImpl(extensions as BaseExtension[]) as Extension\n}\n\nexport { union }\n","import { isDeepEqual } from '@ocavue/utils'\nimport type {\n ProseMirrorNode,\n Schema,\n} from '@prosekit/pm/model'\nimport {\n EditorState,\n type Command,\n type Plugin,\n type Selection,\n type Transaction,\n} from '@prosekit/pm/state'\nimport {\n EditorView,\n type DirectEditorProps,\n type EditorProps,\n} from '@prosekit/pm/view'\n\nimport { ProseKitError } from '../error'\nimport { defineDefaultState } from '../extensions/default-state'\nimport type { BaseExtension } from '../facets/base-extension'\nimport {\n subtractFacetNode,\n unionFacetNode,\n type FacetNode,\n} from '../facets/facet-node'\nimport type {\n Extension,\n ExtractCommandActions,\n ExtractMarkActions,\n ExtractMarkNames,\n ExtractNodeActions,\n ExtractNodeNames,\n} from '../types/extension'\nimport type {\n CommandAction,\n CommandCreator,\n} from '../types/extension-command'\nimport type {\n NodeJSON,\n SelectionJSON,\n} from '../types/model'\nimport { assert } from '../utils/assert'\nimport {\n getEditorContentDoc,\n getEditorSelection,\n} from '../utils/editor-content'\nimport {\n htmlFromNode,\n jsonFromNode,\n type DOMDocumentOptions,\n} from '../utils/parse'\n\nimport {\n createMarkActions,\n createNodeActions,\n type MarkAction,\n type NodeAction,\n} from './action'\nimport { union } from './union'\n\n/**\n * @public\n */\nexport interface EditorOptions<E extends Extension> {\n /**\n * The extension to use when creating the editor.\n */\n extension: E\n\n /**\n * The starting document to use when creating the editor. It can be a\n * ProseMirror node JSON object, an HTML string, or a DOM element instance.\n */\n defaultContent?: NodeJSON | string | Element\n\n /**\n * A JSON object representing the starting selection to use when creating the\n * editor. It's only used when `defaultContent` is also provided.\n */\n defaultSelection?: SelectionJSON\n}\n\n/**\n * @public\n */\nexport interface getDocHTMLOptions extends DOMDocumentOptions {}\n\n/**\n * @internal\n */\nexport function setupEditorExtension<E extends Extension>(\n options: EditorOptions<E>,\n): E {\n if (options.defaultContent) {\n return union(\n options.extension,\n defineDefaultState(options),\n ) as Extension as E\n }\n return options.extension\n}\n\n/**\n * @public\n */\nexport function createEditor<E extends Extension>(\n options: EditorOptions<E>,\n): Editor<E> {\n const extension = setupEditorExtension(options)\n const instance = new EditorInstance(extension)\n return new Editor(instance)\n}\n\n/**\n * An internal class to make TypeScript generic type easier to use.\n *\n * @internal\n */\nexport class EditorInstance {\n view: EditorView | null = null\n schema: Schema\n nodes: Record<string, NodeAction>\n marks: Record<string, MarkAction>\n commands: Record<string, CommandAction> = {}\n\n private tree: FacetNode\n private directEditorProps: DirectEditorProps\n private afterMounted: Array<VoidFunction> = []\n\n constructor(extension: Extension) {\n this.tree = (extension as BaseExtension).getTree()\n\n const payload = this.tree.getRootOutput()\n const schema = payload.schema\n const stateConfig = payload.state\n\n assert(schema && stateConfig, 'Schema must be defined')\n\n const state = EditorState.create(stateConfig)\n\n if (payload.commands) {\n for (const [name, commandCreator] of Object.entries(payload.commands)) {\n this.defineCommand(name, commandCreator)\n }\n }\n\n this.nodes = createNodeActions(state.schema, this.getState)\n this.marks = createMarkActions(state.schema, this.getState)\n\n this.schema = state.schema\n this.directEditorProps = { state, ...payload.view }\n }\n\n public getState = (): EditorState => {\n return this.view?.state || this.directEditorProps.state\n }\n\n private getDoc(): ProseMirrorNode {\n return this.getState().doc\n }\n\n private getProp<PropName extends keyof EditorProps>(propName: PropName): Partial<EditorProps>[PropName] {\n return this.view?.someProp(propName) ?? this.directEditorProps[propName]\n }\n\n public updateState(state: EditorState): void {\n if (this.view) {\n this.view.updateState(state)\n } else {\n this.directEditorProps.state = state\n }\n }\n\n private dispatch = (tr: Transaction): void => {\n if (this.view) {\n this.view.dispatch(tr)\n } else {\n this.directEditorProps.state = this.directEditorProps.state.apply(tr)\n }\n }\n\n public setContent(\n content: NodeJSON | string | Element | ProseMirrorNode,\n selection?: SelectionJSON | Selection | 'start' | 'end',\n ): void {\n const doc = getEditorContentDoc(this.schema, content)\n doc.check()\n const sel = getEditorSelection(doc, selection || 'start')\n\n const oldState = this.getState()\n if (doc.eq(oldState.doc) && (!selection || sel.eq(oldState.selection))) {\n return\n }\n\n const newState = EditorState.create({\n doc,\n selection: sel,\n plugins: oldState.plugins,\n })\n this.updateState(newState)\n }\n\n /**\n * Return a JSON object representing the editor's current document.\n */\n public getDocJSON = (): NodeJSON => {\n const state = this.getState()\n return jsonFromNode(state.doc)\n }\n\n /**\n * Return an HTML string representing the editor's current document.\n */\n public getDocHTML = (options?: getDocHTMLOptions): string => {\n const serializer = this.getProp('clipboardSerializer')\n const DOMSerializer = serializer ? { fromSchema: () => serializer } : undefined\n const doc = this.getDoc()\n return htmlFromNode(doc, { ...options, DOMSerializer })\n }\n\n private updateExtension(extension: Extension, add: boolean): void {\n const view = this.view\n\n // Don't update the extension if the editor is already unmounted\n if (!view || view.isDestroyed) {\n return\n }\n\n const tree = (extension as BaseExtension).getTree()\n const payload = tree.getRootOutput()\n\n if (payload?.schema) {\n throw new ProseKitError('Schema cannot be changed')\n }\n\n if (payload?.view) {\n throw new ProseKitError('View cannot be changed')\n }\n\n const oldPayload = this.tree.getRootOutput()\n const oldPlugins = [...(view.state?.plugins ?? [])]\n\n this.tree = add\n ? unionFacetNode(this.tree, tree)\n : subtractFacetNode(this.tree, tree)\n\n const newPayload = this.tree.getRootOutput()\n const newPlugins = [...(newPayload?.state?.plugins ?? [])]\n\n if (!isDeepEqual(oldPlugins, newPlugins)) {\n const state = view.state.reconfigure({ plugins: newPlugins })\n view.updateState(state)\n }\n\n if (\n newPayload?.commands\n && !isDeepEqual(oldPayload?.commands, newPayload?.commands)\n ) {\n const commands = newPayload.commands\n const names = Object.keys(commands)\n for (const name of names) {\n this.defineCommand(name, commands[name])\n }\n }\n }\n\n public use(extension: Extension): VoidFunction {\n if (!this.mounted) {\n let canceled = false\n let lazyRemove: VoidFunction | null = null\n\n const lazyCreate = () => {\n if (!canceled) {\n lazyRemove = this.use(extension)\n }\n }\n\n this.afterMounted.push(lazyCreate)\n\n return () => {\n canceled = true\n lazyRemove?.()\n }\n }\n\n this.updateExtension(extension, true)\n return () => this.updateExtension(extension, false)\n }\n\n public mount(place: HTMLElement): void {\n if (this.view) {\n // If the editor is already mounted to the same DOM element, do nothing\n if (this.view.dom === place) return\n // If the editor is already mounted to a different element, throw an error\n throw new ProseKitError('Editor is already mounted')\n }\n this.view = new EditorView({ mount: place }, this.directEditorProps)\n this.afterMounted.forEach((callback) => callback())\n }\n\n public unmount(): void {\n // If the editor is not mounted, do nothing\n if (!this.view) return\n\n this.directEditorProps.state = this.view.state\n this.view.destroy()\n this.view = null\n }\n\n get mounted(): boolean {\n return !!this.view && !this.view.isDestroyed\n }\n\n public get assertView(): EditorView {\n if (!this.view) {\n throw new ProseKitError('Editor is not mounted')\n }\n return this.view\n }\n\n public definePlugins(plugins: readonly Plugin[]): void {\n const view = this.assertView\n const state = view.state\n const newPlugins = [...plugins, ...state.plugins]\n const newState = state.reconfigure({ plugins: newPlugins })\n view.setProps({ state: newState })\n }\n\n public removePlugins(plugins: readonly Plugin[]): void {\n const view = this.view\n if (!view) return\n\n const state = view.state\n const newPlugins = state.plugins.filter((p) => !plugins.includes(p))\n const newState = state.reconfigure({ plugins: newPlugins })\n view.setProps({ state: newState })\n }\n\n exec(command: Command): boolean {\n const state = this.getState()\n return command(state, this.dispatch, this.view ?? undefined)\n }\n\n canExec(command: Command): boolean {\n const state = this.getState()\n return command(state, undefined, this.view ?? undefined)\n }\n\n public defineCommand<Args extends any[] = any[]>(\n name: string,\n commandCreator: CommandCreator<Args>,\n ): void {\n const action: CommandAction<Args> = (...args: Args) => {\n const command = commandCreator(...args)\n return this.exec(command)\n }\n\n const canExec = (...args: Args) => {\n const command = commandCreator(...args)\n return this.canExec(command)\n }\n\n action.canExec = canExec\n\n this.commands[name] = action as CommandAction\n }\n\n public removeCommand(name: string): void {\n delete this.commands[name]\n }\n}\n\n/**\n * @public\n */\nexport class Editor<E extends Extension = any> {\n private instance: EditorInstance\n\n /**\n * @internal\n */\n constructor(instance: EditorInstance) {\n if (!(instance instanceof EditorInstance)) {\n throw new TypeError('Invalid EditorInstance')\n }\n this.instance = instance\n }\n\n /**\n * Whether the editor is mounted.\n */\n get mounted(): boolean {\n return this.instance.mounted\n }\n\n /**\n * The editor view.\n */\n get view(): EditorView {\n return this.instance.assertView\n }\n\n /**\n * The editor schema.\n */\n get schema(): Schema<ExtractNodeNames<E>, ExtractMarkNames<E>> {\n return this.instance.schema\n }\n\n /**\n * The editor's current state.\n */\n get state(): EditorState {\n return this.instance.getState()\n }\n\n /**\n * Whether the editor is focused.\n */\n get focused(): boolean {\n return this.instance.view?.hasFocus() ?? false\n }\n\n /**\n * Mount the editor to the given HTML element. Pass `null` or `undefined` to\n * unmount the editor. When an element is passed, this method returns a\n * function to unmount the editor.\n */\n mount = (place: HTMLElement | null | undefined): void | VoidFunction => {\n if (place) {\n this.instance.mount(place)\n return this.unmount\n } else {\n this.instance.unmount()\n }\n }\n\n /**\n * Unmount the editor. This is equivalent to `mount(null)`.\n */\n unmount = (): void => {\n this.instance.unmount()\n }\n\n /**\n * Focus the editor.\n */\n focus = (): void => {\n this.instance.view?.focus()\n }\n\n /**\n * Blur the editor.\n */\n blur = (): void => {\n this.instance.view?.dom.blur()\n }\n\n /**\n * Register an extension to the editor. Return a function to unregister the\n * extension.\n */\n use = (extension: Extension): VoidFunction => {\n return this.instance.use(extension)\n }\n\n /**\n * Update the editor's state.\n *\n * @remarks\n *\n * This is an advanced method. Use it only if you have a specific reason to\n * directly manipulate the editor's state.\n */\n updateState = (state: EditorState): void => {\n this.instance.updateState(state)\n }\n\n /**\n * Update the editor's document and selection.\n *\n * @param content - The new document to set. It can be one of the following:\n * - A ProseMirror node instance\n * - A ProseMirror node JSON object\n * - An HTML string\n * - A DOM element instance\n * @param selection - Optional. Specifies the new selection. It can be one of the following:\n * - A ProseMirror selection instance\n * - A ProseMirror selection JSON object\n * - The string \"start\" (to set selection at the beginning, default value)\n * - The string \"end\" (to set selection at the end)\n */\n setContent = (\n content: ProseMirrorNode | NodeJSON | string | Element,\n selection?: SelectionJSON | Selection | 'start' | 'end',\n ): void => {\n return this.instance.setContent(content, selection)\n }\n\n /**\n * Return a JSON object representing the editor's current document.\n */\n public getDocJSON = (): NodeJSON => {\n return this.instance.getDocJSON()\n }\n\n /**\n * Return an HTML string representing the editor's current document.\n */\n public getDocHTML = (options?: getDocHTMLOptions): string => {\n return this.instance.getDocHTML(options)\n }\n\n /**\n * Execute the given command. Return `true` if the command was successfully\n * executed, otherwise `false`.\n */\n exec = (command: Command): boolean => {\n return this.instance.exec(command)\n }\n\n /**\n * Check if the given command can be executed. Return `true` if the command\n * can be executed, otherwise `false`.\n */\n canExec = (command: Command): boolean => {\n return this.instance.canExec(command)\n }\n\n /**\n * All {@link CommandAction}s defined by the editor.\n */\n get commands(): ExtractCommandActions<E> {\n return this.instance.commands as ExtractCommandActions<E>\n }\n\n /**\n * All {@link NodeAction}s defined by the editor.\n */\n get nodes(): ExtractNodeActions<E> {\n return this.instance.nodes as ExtractNodeActions<E>\n }\n\n /**\n * All {@link MarkAction}s defined by the editor.\n */\n get marks(): ExtractMarkActions<E> {\n return this.instance.marks as ExtractMarkActions<E>\n }\n}\n"],"mappings":";;;;;;;;;;;AAKA,IAAa,gBAAb,cAAmC,MAAM;;;;AAKzC,IAAa,sBAAb,cAAyC,cAAc;CACrD,cAAc;AACZ,QACE,mGACD;;;;;;AAOL,IAAa,2BAAb,cAA8C,cAAc;CAC1D,cAAc;AACZ,QACE,yGACD;;;;;;;;;ACfL,SAAgB,YAAY,QAAgB,MAAmC;AAC7E,KAAI,OAAO,SAAS,UAAU;EAC5B,MAAM,WAAW,OAAO,MAAM;AAC9B,MAAI,CAAC,SACH,OAAM,IAAI,cAAc,0BAA0B,KAAK,GAAG;AAE5D,SAAO;;AAET,QAAO;;;;;;;;ACbT,SAAgB,OACd,WACA,UAAU,oBACS;AACnB,KAAI,CAAC,UACH,OAAM,IAAI,cAAc,QAAQ;;;;;;;;ACApC,SAAgB,YAAY,QAAgB,MAAmC;AAC7E,KAAI,OAAO,SAAS,UAAU;EAC5B,MAAM,WAAW,OAAO,MAAM;AAC9B,MAAI,CAAC,SACH,OAAM,IAAI,cAAc,sCAAsC,KAAK,GAAG;AAExE,SAAO;;AAET,QAAO;;;;;;;;ACFT,SAAgB,kBAAkB,OAA0C;AAC1E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AAK,SAAS,WAAW,SAAS,UAAU;;0BAMjB;AAClC,UAAO,KAAK,SAAS,YAAY;;qBAMd,YAAwC;AAC3D,UAAO,KAAK,SAAS,WAAW,QAAQ;;eAOlC,YAA8B;AACpC,UAAO,KAAK,SAAS,KAAK,QAAQ;;kBAOzB,YAA8B;AACvC,UAAO,KAAK,SAAS,QAAQ,QAAQ;;AAhJrC,MAAI,EAAE,oBAAoB,gBACxB,OAAM,IAAI,UAAU,yBAAyB;AAE/C,OAAK,WAAW;;;;;CAMlB,IAAI,UAAmB;AACrB,SAAO,KAAK,SAAS;;;;;CAMvB,IAAI,OAAmB;AACrB,SAAO,KAAK,SAAS;;;;;CAMvB,IAAI,SAA2D;AAC7D,SAAO,KAAK,SAAS;;;;;CAMvB,IAAI,QAAqB;AACvB,SAAO,KAAK,SAAS,UAAU;;;;;CAMjC,IAAI,UAAmB;AACrB,SAAO,KAAK,SAAS,MAAM,UAAU,IAAI;;;;;CAgH3C,IAAI,WAAqC;AACvC,SAAO,KAAK,SAAS;;;;;CAMvB,IAAI,QAA+B;AACjC,SAAO,KAAK,SAAS;;;;;CAMvB,IAAI,QAA+B;AACjC,SAAO,KAAK,SAAS"}
@@ -1,4 +1,4 @@
1
- import { n as EditorInstance, r as EditorOptions, t as Editor, w as Extension } from "./editor-M9OimMiI.js";
1
+ import { n as EditorInstance, r as EditorOptions, t as Editor, w as Extension } from "./editor-4lgGc3CY.js";
2
2
  import { ProseMirrorNode } from "@prosekit/pm/model";
3
3
 
4
4
  //#region src/test/test-editor.d.ts
@@ -1,4 +1,4 @@
1
- import { B as assert, i as setupEditorExtension, k as isProseMirrorNode, n as EditorInstance, o as createMarkActions, s as createNodeActions, t as Editor } from "./editor-B0L9BgMi.js";
1
+ import { P as isProseMirrorNode, i as setupEditorExtension, n as EditorInstance, o as createMarkActions, s as createNodeActions, t as Editor, z as assert } from "./editor-DGNUXn-u.js";
2
2
  import { NodeSelection, TextSelection } from "@prosekit/pm/state";
3
3
 
4
4
  //#region src/test/test-builder.ts
@@ -1,7 +1,8 @@
1
- import { $ as NodeChild, A as ExtractMarkActions, B as Priority, C as StepJSON, D as ExtractCommandAppliers, E as ExtractCommandActions, F as PlainExtension, G as ToMarkAction, H as NodeTyping, I as Union, J as CommandTyping, K as CommandAction, L as UnionExtension, M as ExtractNodeActions, N as ExtractNodes, O as ExtractCommandCreators, P as ExtractTyping, Q as NodeBuilder, R as SimplifyUnion, S as StateJSON, T as ExtensionTyping, U as ToNodeAction, V as PickSubType, W as MarkTyping, X as MarkBuilder, Y as MarkAction, Z as NodeAction, _ as nodeFromHTML, a as DOMDocumentOptions, b as NodeJSON, c as JSONParserOptions, d as htmlFromJSON, et as AnyAttrs, f as htmlFromNode, g as nodeFromElement, h as jsonFromState, i as createEditor, j as ExtractMarks, k as ExtractCommands, l as elementFromJSON, m as jsonFromNode, o as DOMParserOptions, p as jsonFromHTML, q as CommandCreator, r as EditorOptions, s as DOMSerializerOptions, t as Editor, tt as AttrSpec, u as elementFromNode, v as nodeFromJSON, w as Extension, x as SelectionJSON, y as stateFromJSON, z as SimplifyDeeper } from "./editor-M9OimMiI.js";
1
+ import { A as ExtractMarks, B as NodeTyping, C as StepJSON, D as ExtractCommandCreators, E as ExtractCommandActions, F as Union, G as CommandCreator, H as MarkTyping, I as SimplifyUnion, J as NodeAction, K as CommandTyping, L as SimplifyDeeper, M as ExtractNodes, N as ExtractTyping, O as ExtractCommands, P as PlainExtension, R as Priority, S as StateJSON, T as ExtensionTyping, U as ToMarkAction, V as ToNodeAction, W as CommandAction, X as AnyAttrs, Y as NodeChild, Z as AttrSpec, _ as nodeFromHTML, a as DOMDocumentOptions, b as NodeJSON, c as JSONParserOptions, d as htmlFromJSON, f as htmlFromNode, g as nodeFromElement, h as jsonFromState, i as createEditor, j as ExtractNodeActions, k as ExtractMarkActions, l as elementFromJSON, m as jsonFromNode, o as DOMParserOptions, p as jsonFromHTML, q as MarkAction, r as EditorOptions, s as DOMSerializerOptions, t as Editor, u as elementFromNode, v as nodeFromJSON, w as Extension, x as SelectionJSON, y as stateFromJSON, z as PickSubType } from "./editor-4lgGc3CY.js";
2
2
  import { AllSelection, Command, EditorState, EditorStateConfig, NodeSelection, Plugin, Selection, TextSelection, Transaction } from "@prosekit/pm/state";
3
- import { Attrs, ContentMatch, DOMSerializer, Fragment, Mark, MarkSpec, MarkType, Node, NodeSpec, NodeType, ProseMirrorFragment, ProseMirrorNode, ResolvedPos, Schema, Slice } from "@prosekit/pm/model";
4
- import { DOMEventMap, EditorView, MarkViewConstructor, NodeView, NodeViewConstructor } from "@prosekit/pm/view";
3
+ import { Attrs, ContentMatch, DOMSerializer, Fragment, Mark, MarkSpec, MarkType, Node, NodeSpec, NodeType, ProseMirrorNode, ResolvedPos, Schema, Slice } from "@prosekit/pm/model";
4
+ import { ObjectEntries } from "@ocavue/utils";
5
+ import { DOMEventMap, EditorView, MarkViewConstructor, NodeViewConstructor } from "@prosekit/pm/view";
5
6
 
6
7
  //#region src/commands/add-mark.d.ts
7
8
  /**
@@ -150,6 +151,24 @@ interface RemoveNodeOptions {
150
151
  */
151
152
  declare function removeNode(options: RemoveNodeOptions): Command;
152
153
  //#endregion
154
+ //#region src/commands/select-all.d.ts
155
+ /**
156
+ * Returns a command that selects the whole document.
157
+ *
158
+ * @public
159
+ */
160
+ declare function selectAll(): Command;
161
+ //#endregion
162
+ //#region src/commands/select-block.d.ts
163
+ /**
164
+ * Returns a command to expand the text selection to cover the current block
165
+ * node. If the text selection spans multiple blocks, it will select all
166
+ * blocks in the selection.
167
+ *
168
+ * @public
169
+ */
170
+ declare function selectBlock(): Command;
171
+ //#endregion
153
172
  //#region src/commands/set-block-type.d.ts
154
173
  /**
155
174
  * @public
@@ -342,10 +361,6 @@ interface WrapOptions {
342
361
  * The node type to wrap the selected textblock with.
343
362
  */
344
363
  type: NodeType | string;
345
- /**
346
- * @deprecated Use `nodeSpec` instead.
347
- */
348
- nodeType?: NodeType;
349
364
  /**
350
365
  * Optional attributes to apply to the node.
351
366
  */
@@ -477,6 +492,7 @@ type BaseCommandsExtension = Extension<{
477
492
  setNodeAttrs: [options: SetNodeAttrsOptions];
478
493
  insertDefaultBlock: [options?: InsertDefaultBlockOptions];
479
494
  selectAll: [];
495
+ selectBlock: [];
480
496
  addMark: [options: AddMarkOptions];
481
497
  removeMark: [options: RemoveMarkOptions];
482
498
  unsetBlockType: [options?: UnsetBlockTypeOptions];
@@ -497,23 +513,9 @@ declare function defineBaseCommands(): BaseCommandsExtension;
497
513
  interface DefaultStateOptions {
498
514
  /**
499
515
  * The starting document to use when creating the editor. It can be a
500
- * ProseMirror node JSON object, a HTML string, or a HTML element instance.
501
- */
502
- defaultContent?: NodeJSON | string | HTMLElement;
503
- /**
504
- * A JSON object representing the starting document to use when creating the
505
- * editor.
506
- *
507
- * @deprecated Use `defaultContent` instead.
508
- */
509
- defaultDoc?: NodeJSON;
510
- /**
511
- * A HTML element or a HTML string representing the starting document to use
512
- * when creating the editor.
513
- *
514
- * @deprecated Use `defaultContent` instead.
516
+ * ProseMirror node JSON object, an HTML string, or a DOM element instance.
515
517
  */
516
- defaultHTML?: string | HTMLElement;
518
+ defaultContent?: NodeJSON | string | Element;
517
519
  /**
518
520
  * A JSON object representing the starting selection to use when creating the
519
521
  * editor. It's only used when `defaultContent` is also provided.
@@ -529,31 +531,9 @@ interface DefaultStateOptions {
529
531
  */
530
532
  declare function defineDefaultState({
531
533
  defaultSelection,
532
- defaultContent,
533
- defaultDoc,
534
- defaultHTML
534
+ defaultContent
535
535
  }: DefaultStateOptions): PlainExtension;
536
536
  //#endregion
537
- //#region src/extensions/doc.d.ts
538
- /**
539
- * @internal
540
- */
541
- type DocExtension = Extension<{
542
- Nodes: {
543
- doc: Attrs;
544
- };
545
- }>;
546
- /**
547
- * @public
548
- *
549
- * @deprecated Use the following import instead:
550
- *
551
- * ```ts
552
- * import { defineDoc } from 'prosekit/extensions/doc'
553
- * ```
554
- */
555
- declare function defineDoc(): DocExtension;
556
- //#endregion
557
537
  //#region src/extensions/events/doc-change.d.ts
558
538
  /**
559
539
  * A function that is called when the editor document is changed.
@@ -650,19 +630,6 @@ declare function defineFacet<Input, Output>(options: {
650
630
  reduce?: () => FacetReducer<Input, Output>;
651
631
  }): Facet<Input, Output>;
652
632
  //#endregion
653
- //#region src/types/object-entries.d.ts
654
- /**
655
- * @internal
656
- *
657
- * @example
658
- *
659
- * ```
660
- * type MyObject = { a: 1; b: 'B' }
661
- * type MyEntries = ObjectEntries<MyObject>
662
- * // ^ ["a", 1] | ["b", "B"]
663
- */
664
- type ObjectEntries<T extends Record<string, any>> = { [K in keyof T]: [K, T[K]] }[keyof T];
665
- //#endregion
666
633
  //#region src/facets/state.d.ts
667
634
  type StatePayload = (ctx: {
668
635
  schema: Schema;
@@ -933,18 +900,36 @@ declare const keymapFacet: Facet<KeymapPayload, PluginPayload>;
933
900
  */
934
901
  type BaseKeymapExtension = PlainExtension;
935
902
  /**
936
- * Defines some basic key bindings.
937
- *
938
903
  * @public
939
904
  */
940
- declare function defineBaseKeymap(options?: {
905
+ interface BaseKeymapOptions {
941
906
  /**
942
907
  * The priority of the keymap.
943
908
  *
944
909
  * @default Priority.low
945
910
  */
946
911
  priority?: Priority;
947
- }): BaseKeymapExtension;
912
+ /**
913
+ * If `true`, the first `Mod-a` press selects the current block that the
914
+ * cursor is in, and a second press selects the entire document.
915
+ *
916
+ * If `false`, `Mod-a` immediately selects the entire document.
917
+ *
918
+ * @default true
919
+ */
920
+ preferBlockSelection?: boolean;
921
+ }
922
+ /**
923
+ * Defines some basic key bindings.
924
+ *
925
+ * @param options
926
+ *
927
+ * @public
928
+ */
929
+ declare function defineBaseKeymap({
930
+ priority,
931
+ preferBlockSelection
932
+ }?: BaseKeymapOptions): BaseKeymapExtension;
948
933
  //#endregion
949
934
  //#region src/extensions/mark-spec.d.ts
950
935
  /**
@@ -987,7 +972,24 @@ interface MarkAttrOptions<MarkName extends string = string, AttrName extends str
987
972
  parseDOM?: (node: HTMLElement) => AttrType;
988
973
  }
989
974
  /**
975
+ * Defines a mark type into the editor schema.
976
+ *
990
977
  * @public
978
+ *
979
+ * @example
980
+ *
981
+ * ```ts
982
+ * const extension = defineMarkSpec({
983
+ * name: 'bold',
984
+ * parseDOM: [
985
+ * { tag: 'strong' },
986
+ * { tag: 'b' },
987
+ * ],
988
+ * toDOM() {
989
+ * return ['strong', 0]
990
+ * },
991
+ * })
992
+ * ```
991
993
  */
992
994
  declare function defineMarkSpec<Mark$1 extends string, Attrs$1 extends AnyAttrs = AnyAttrs>(options: MarkSpecOptions<Mark$1, Attrs$1>): Extension<{
993
995
  Marks: { [K in Mark$1]: Attrs$1 };
@@ -1085,9 +1087,23 @@ interface NodeAttrOptions<NodeName extends string = string, AttrName extends str
1085
1087
  parseDOM?: (node: HTMLElement) => AttrType;
1086
1088
  }
1087
1089
  /**
1088
- * Defines a node type.
1090
+ * Defines a node type into the editor schema.
1089
1091
  *
1090
1092
  * @public
1093
+ *
1094
+ * @example
1095
+ *
1096
+ * ```ts
1097
+ * const extension = defineNodeSpec({
1098
+ * name: 'fancyParagraph',
1099
+ * content: 'inline*',
1100
+ * group: 'block',
1101
+ * parseDOM: [{ tag: 'p.fancy' }],
1102
+ * toDOM() {
1103
+ * return ['p', { 'class': 'fancy' }, 0]
1104
+ * },
1105
+ * })
1106
+ * ```
1091
1107
  */
1092
1108
  declare function defineNodeSpec<Node$1 extends string, Attrs$1 extends AnyAttrs = AnyAttrs>(options: NodeSpecOptions<Node$1, Attrs$1>): Extension<{
1093
1109
  Nodes: { [K in Node$1]: Attrs$1 };
@@ -1133,91 +1149,12 @@ declare function defineNodeViewFactory<T>(options: NodeViewFactoryOptions<T>): E
1133
1149
  */
1134
1150
  declare function defineNodeViewComponent<T>(options: NodeViewComponentOptions<T>): Extension;
1135
1151
  //#endregion
1136
- //#region src/extensions/paragraph.d.ts
1137
- /**
1138
- * @internal
1139
- */
1140
- type ParagraphSpecExtension = Extension<{
1141
- Nodes: {
1142
- paragraph: Attrs;
1143
- };
1144
- }>;
1145
- /**
1146
- * @internal
1147
- *
1148
- * @deprecated Use the following import instead:
1149
- *
1150
- * ```ts
1151
- * import type { ParagraphExtension } from 'prosekit/extensions/paragraph'
1152
- * ```
1153
- */
1154
- type ParagraphExtension = ParagraphSpecExtension;
1155
- /**
1156
- * @public
1157
- *
1158
- * Defines a paragraph node spec as the highest priority, because it should be the default block node for most cases.
1159
- *
1160
- * @deprecated Use the following import instead:
1161
- *
1162
- * ```ts
1163
- * import { defineParagraph } from 'prosekit/extensions/paragraph'
1164
- * ```
1165
- */
1166
- declare function defineParagraph(): ParagraphExtension;
1167
- //#endregion
1168
- //#region src/extensions/text.d.ts
1169
- /**
1170
- * @internal
1171
- */
1172
- type TextExtension = Extension<{
1173
- Nodes: {
1174
- text: Attrs;
1175
- };
1176
- }>;
1177
- /**
1178
- * @public
1179
- *
1180
- * @deprecated Use the following import instead:
1181
- *
1182
- * ```ts
1183
- * import { defineText } from 'prosekit/extensions/text'
1184
- * ```
1185
- */
1186
- declare function defineText(): TextExtension;
1187
- //#endregion
1188
1152
  //#region src/facets/facet-extension.d.ts
1189
1153
  /**
1190
1154
  * @internal
1191
1155
  */
1192
1156
  declare function defineFacetPayload<Input>(facet: Facet<Input, any>, payloads: Input[]): Extension;
1193
1157
  //#endregion
1194
- //#region src/types/base-node-view-options.d.ts
1195
- /**
1196
- * Some basic props for custom node views.
1197
- *
1198
- * @deprecated - This is no longer needed. Use `CoreNodeViewUserOptions` from `@prosemirror-adapter/core` instead.
1199
- *
1200
- * @hidden
1201
- */
1202
- interface BaseNodeViewOptions {
1203
- /**
1204
- * The wrapping DOM element for the node view. Defaults to `div` for block nodes and `span` for inline nodes.
1205
- */
1206
- as?: string | HTMLElement | ((node: ProseMirrorNode) => HTMLElement);
1207
- /**
1208
- * The wrapping DOM element for the node view's content. Defaults to `div` for block nodes and `span` for inline nodes.
1209
- */
1210
- contentAs?: string | HTMLElement | ((node: ProseMirrorNode) => HTMLElement);
1211
- update?: NodeView['update'];
1212
- ignoreMutation?: NodeView['ignoreMutation'];
1213
- selectNode?: NodeView['selectNode'];
1214
- deselectNode?: NodeView['deselectNode'];
1215
- setSelection?: NodeView['setSelection'];
1216
- stopEvent?: NodeView['stopEvent'];
1217
- destroy?: NodeView['destroy'];
1218
- onUpdate?: () => void;
1219
- }
1220
- //#endregion
1221
1158
  //#region src/utils/assert.d.ts
1222
1159
  /**
1223
1160
  * @internal
@@ -1240,32 +1177,6 @@ declare const canUseRegexLookbehind: () => boolean;
1240
1177
  */
1241
1178
  declare const clsx: (...args: Array<string | boolean | null | undefined>) => string;
1242
1179
  //#endregion
1243
- //#region src/utils/collect-children.d.ts
1244
- /**
1245
- * Collects all children of a node or a fragment, and returns them as an array.
1246
- *
1247
- * @deprecated Use `node.children` or `fragment.content` instead.
1248
- *
1249
- * @hidden
1250
- */
1251
- declare function collectChildren(parent: ProseMirrorNode | Fragment): ProseMirrorNode[];
1252
- //#endregion
1253
- //#region src/utils/collect-nodes.d.ts
1254
- /**
1255
- * @hidden
1256
- *
1257
- * @deprecated
1258
- */
1259
- type NodeContent = ProseMirrorNode | ProseMirrorFragment | NodeContent[];
1260
- /**
1261
- * Collects all nodes from a given content.
1262
- *
1263
- * @deprecated Use `collectChildren` instead.
1264
- *
1265
- * @hidden
1266
- */
1267
- declare function collectNodes(content: NodeContent): ProseMirrorNode[];
1268
- //#endregion
1269
1180
  //#region src/utils/contains-inline-node.d.ts
1270
1181
  /**
1271
1182
  * @internal
@@ -1339,16 +1250,6 @@ type: NodeType | string,
1339
1250
  */
1340
1251
  $pos: ResolvedPos): FindParentNodeResult | undefined;
1341
1252
  //#endregion
1342
- //#region src/utils/get-id.d.ts
1343
- /**
1344
- * Returns a unique id in the current process that can be used in various places.
1345
- *
1346
- * @internal
1347
- *
1348
- * @deprecated Import `getId` from `@ocavue/utils` package instead. Remove it in a future version.
1349
- */
1350
- declare function getId(): string;
1351
- //#endregion
1352
1253
  //#region src/utils/get-mark-type.d.ts
1353
1254
  /**
1354
1255
  * @internal
@@ -1462,5 +1363,5 @@ declare const OBJECT_REPLACEMENT_CHARACTER = "\uFFFC";
1462
1363
  */
1463
1364
  declare function withSkipCodeBlock(command: Command): Command;
1464
1365
  //#endregion
1465
- export { type AddMarkOptions, type AnyAttrs, type AnyFunction, type AttrSpec, type BaseCommandsExtension, type BaseKeymapExtension, type BaseNodeViewOptions, type ClickHandler, type ClickOnHandler, type ClipboardSerializerOptions, type CommandAction, type CommandTyping, type DOMDocumentOptions, type DOMEventHandler, type DOMParserOptions, type DOMSerializerOptions, type DefaultStateOptions, type DocChangeHandler, type DocExtension, type DoubleClickHandler, type DoubleClickOnHandler, type DropHandler, Editor, type EditorEventPayload, EditorNotFoundError, type EditorOptions, type ExpandMarkOptions, type Extension, type ExtensionTyping, type ExtractCommandActions, type ExtractCommandAppliers, type ExtractCommandCreators, type ExtractCommands, type ExtractMarkActions, type ExtractMarks, type ExtractNodeActions, type ExtractNodes, type ExtractTyping, type Facet, type FindParentNodeResult, type FocusChangeHandler, type HistoryExtension, type HistoryOptions, type InsertDefaultBlockOptions, type InsertNodeOptions, type JSONParserOptions, type KeyDownHandler, type KeyPressHandler, type Keymap, type KeymapPayload, type MarkAction, type MarkAttrOptions, type MarkBuilder, type MarkSpecOptions, type MarkTyping, type MarkViewComponentOptions, type MarkViewFactoryOptions, type MarkViewOptions, type MountHandler, type NodeAction, type NodeAttrOptions, type NodeBuilder, type NodeChild, type NodeContent, type NodeJSON, type NodeSpecOptions, type NodeTyping, type NodeViewComponentOptions, type NodeViewFactoryOptions, type NodeViewOptions, OBJECT_REPLACEMENT_CHARACTER, type ParagraphExtension, type PasteHandler, type PickSubType, type PlainExtension, type PluginPayload, Priority, ProseKitError, type RemoveMarkOptions, type RemoveNodeOptions, type ScrollToSelectionHandler, type SelectionJSON, type SetBlockTypeOptions, type SetNodeAttrsOptions, type SimplifyDeeper, type SimplifyUnion, type StateJSON, type StepJSON, type TextExtension, type TextInputHandler, type ToMarkAction, type ToNodeAction, type ToggleMarkOptions, type ToggleNodeOptions, type ToggleWrapOptions, type TripleClickHandler, type TripleClickOnHandler, type Union, type UnionExtension, type UnmountHandler, type UnsetBlockTypeOptions, type UnsetMarkOptions, type UpdateHandler, type WrapOptions, getId as _getId, addMark, assert, canUseRegexLookbehind, clsx, collectChildren, collectNodes, containsInlineNode, createEditor, defaultBlockAt, defineBaseCommands, defineBaseKeymap, defineClickHandler, defineClickOnHandler, defineClipboardSerializer, defineCommands, defineDOMEventHandler, defineDefaultState, defineDoc, defineDocChangeHandler, defineDoubleClickHandler, defineDoubleClickOnHandler, defineDropHandler, defineFacet, defineFacetPayload, defineFocusChangeHandler, defineHistory, defineKeyDownHandler, defineKeyPressHandler, defineKeymap, defineMarkAttr, defineMarkSpec, defineMarkView, defineMarkViewComponent, defineMarkViewFactory, defineMountHandler, defineNodeAttr, defineNodeSpec, defineNodeView, defineNodeViewComponent, defineNodeViewFactory, defineParagraph, definePasteHandler, definePlugin, defineScrollToSelectionHandler, defineText, defineTextInputHandler, defineTripleClickHandler, defineTripleClickOnHandler, defineUnmountHandler, defineUpdateHandler, editorEventFacet, elementFromJSON, elementFromNode, expandMark, findParentNode, findParentNodeOfType, getMarkType, getNodeType, htmlFromJSON, htmlFromNode, insertDefaultBlock, insertNode, isAllSelection, isApple, isAtBlockStart, isFragment, isInCodeBlock, isMark, isMarkAbsent, isMarkActive, isNodeSelection, isProseMirrorNode, isSelection, isSlice, isTextSelection, jsonFromHTML, jsonFromNode, jsonFromState, keymapFacet, maybeRun, nodeFromElement, nodeFromHTML, nodeFromJSON, pluginFacet, removeMark, removeNode, setBlockType, setNodeAttrs, setSelectionAround, stateFromJSON, toggleMark, toggleNode, toggleWrap, union, unsetBlockType, unsetMark, withPriority, withSkipCodeBlock, wrap };
1366
+ export { type AddMarkOptions, type AnyAttrs, type AnyFunction, type AttrSpec, type BaseCommandsExtension, type BaseKeymapExtension, type BaseKeymapOptions, type ClickHandler, type ClickOnHandler, type ClipboardSerializerOptions, type CommandAction, type CommandTyping, type DOMDocumentOptions, type DOMEventHandler, type DOMParserOptions, type DOMSerializerOptions, type DefaultStateOptions, type DocChangeHandler, type DoubleClickHandler, type DoubleClickOnHandler, type DropHandler, Editor, type EditorEventPayload, EditorNotFoundError, type EditorOptions, type ExpandMarkOptions, type Extension, type ExtensionTyping, type ExtractCommandActions, type ExtractCommandCreators, type ExtractCommands, type ExtractMarkActions, type ExtractMarks, type ExtractNodeActions, type ExtractNodes, type ExtractTyping, type Facet, type FindParentNodeResult, type FocusChangeHandler, type HistoryExtension, type HistoryOptions, type InsertDefaultBlockOptions, type InsertNodeOptions, type JSONParserOptions, type KeyDownHandler, type KeyPressHandler, type Keymap, type KeymapPayload, type MarkAction, type MarkAttrOptions, type MarkSpecOptions, type MarkTyping, type MarkViewComponentOptions, type MarkViewFactoryOptions, type MarkViewOptions, type MountHandler, type NodeAction, type NodeAttrOptions, type NodeChild, type NodeJSON, type NodeSpecOptions, type NodeTyping, type NodeViewComponentOptions, type NodeViewFactoryOptions, type NodeViewOptions, OBJECT_REPLACEMENT_CHARACTER, type PasteHandler, type PickSubType, type PlainExtension, type PluginPayload, Priority, ProseKitError, type RemoveMarkOptions, type RemoveNodeOptions, type ScrollToSelectionHandler, type SelectionJSON, type SetBlockTypeOptions, type SetNodeAttrsOptions, type SimplifyDeeper, type SimplifyUnion, type StateJSON, type StepJSON, type TextInputHandler, type ToMarkAction, type ToNodeAction, type ToggleMarkOptions, type ToggleNodeOptions, type ToggleWrapOptions, type TripleClickHandler, type TripleClickOnHandler, type Union, type UnmountHandler, type UnsetBlockTypeOptions, type UnsetMarkOptions, type UpdateHandler, type WrapOptions, addMark, assert, canUseRegexLookbehind, clsx, containsInlineNode, createEditor, defaultBlockAt, defineBaseCommands, defineBaseKeymap, defineClickHandler, defineClickOnHandler, defineClipboardSerializer, defineCommands, defineDOMEventHandler, defineDefaultState, defineDocChangeHandler, defineDoubleClickHandler, defineDoubleClickOnHandler, defineDropHandler, defineFacet, defineFacetPayload, defineFocusChangeHandler, defineHistory, defineKeyDownHandler, defineKeyPressHandler, defineKeymap, defineMarkAttr, defineMarkSpec, defineMarkView, defineMarkViewComponent, defineMarkViewFactory, defineMountHandler, defineNodeAttr, defineNodeSpec, defineNodeView, defineNodeViewComponent, defineNodeViewFactory, definePasteHandler, definePlugin, defineScrollToSelectionHandler, defineTextInputHandler, defineTripleClickHandler, defineTripleClickOnHandler, defineUnmountHandler, defineUpdateHandler, editorEventFacet, elementFromJSON, elementFromNode, expandMark, findParentNode, findParentNodeOfType, getMarkType, getNodeType, htmlFromJSON, htmlFromNode, insertDefaultBlock, insertNode, isAllSelection, isApple, isAtBlockStart, isFragment, isInCodeBlock, isMark, isMarkAbsent, isMarkActive, isNodeSelection, isProseMirrorNode, isSelection, isSlice, isTextSelection, jsonFromHTML, jsonFromNode, jsonFromState, keymapFacet, maybeRun, nodeFromElement, nodeFromHTML, nodeFromJSON, pluginFacet, removeMark, removeNode, selectAll, selectBlock, setBlockType, setNodeAttrs, setSelectionAround, stateFromJSON, toggleMark, toggleNode, toggleWrap, union, unsetBlockType, unsetMark, withPriority, withSkipCodeBlock, wrap };
1466
1367
  //# sourceMappingURL=prosekit-core.d.ts.map