@prosekit/core 0.8.7 → 0.10.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 (139) hide show
  1. package/dist/{editor-M9OimMiI.d.ts → editor-BULC1zqX.d.ts} +31 -71
  2. package/dist/editor-BULC1zqX.d.ts.map +1 -0
  3. package/dist/{editor-B0L9BgMi.js → editor-g-Rqn-ZE.js} +119 -136
  4. package/dist/editor-g-Rqn-ZE.js.map +1 -0
  5. package/dist/prosekit-core-test.d.ts +1 -2
  6. package/dist/prosekit-core-test.d.ts.map +1 -1
  7. package/dist/prosekit-core-test.js +1 -1
  8. package/dist/prosekit-core-test.js.map +1 -1
  9. package/dist/prosekit-core.d.ts +182 -202
  10. package/dist/prosekit-core.d.ts.map +1 -1
  11. package/dist/prosekit-core.js +543 -549
  12. package/dist/prosekit-core.js.map +1 -1
  13. package/package.json +9 -12
  14. package/src/commands/add-mark.ts +1 -4
  15. package/src/commands/expand-mark.ts +2 -9
  16. package/src/commands/insert-default-block.spec.ts +1 -5
  17. package/src/commands/insert-default-block.ts +1 -4
  18. package/src/commands/insert-node.ts +4 -8
  19. package/src/commands/remove-mark.ts +1 -4
  20. package/src/commands/remove-node.ts +2 -2
  21. package/src/commands/select-all.ts +3 -8
  22. package/src/commands/select-block.spec.ts +81 -0
  23. package/src/commands/select-block.ts +56 -0
  24. package/src/commands/set-block-type.ts +1 -4
  25. package/src/commands/set-node-attrs-between.spec.ts +221 -0
  26. package/src/commands/set-node-attrs-between.ts +77 -0
  27. package/src/commands/set-node-attrs.spec.ts +129 -0
  28. package/src/commands/set-node-attrs.ts +25 -26
  29. package/src/commands/toggle-mark.ts +1 -4
  30. package/src/commands/toggle-node.ts +2 -5
  31. package/src/commands/toggle-wrap.spec.ts +1 -5
  32. package/src/commands/toggle-wrap.ts +1 -4
  33. package/src/commands/unset-block-type.spec.ts +1 -5
  34. package/src/commands/unset-block-type.ts +2 -8
  35. package/src/commands/unset-mark.spec.ts +1 -5
  36. package/src/commands/wrap.ts +2 -10
  37. package/src/editor/action.spec.ts +2 -6
  38. package/src/editor/action.ts +2 -19
  39. package/src/editor/editor.spec.ts +2 -9
  40. package/src/editor/editor.ts +31 -77
  41. package/src/editor/union.spec.ts +1 -5
  42. package/src/editor/union.ts +1 -4
  43. package/src/extensions/clipboard-serializer.ts +4 -16
  44. package/src/extensions/command.ts +20 -48
  45. package/src/extensions/default-state.spec.ts +1 -9
  46. package/src/extensions/default-state.ts +6 -32
  47. package/src/extensions/events/dom-event.spec.ts +1 -6
  48. package/src/extensions/events/dom-event.ts +5 -20
  49. package/src/extensions/events/editor-event.ts +5 -17
  50. package/src/extensions/events/focus.spec.ts +1 -6
  51. package/src/extensions/events/plugin-view.ts +2 -9
  52. package/src/extensions/history.ts +3 -10
  53. package/src/extensions/keymap-base.spec.ts +89 -0
  54. package/src/extensions/keymap-base.ts +34 -13
  55. package/src/extensions/keymap.spec.ts +12 -22
  56. package/src/extensions/keymap.ts +16 -69
  57. package/src/extensions/mark-spec.spec.ts +5 -20
  58. package/src/extensions/mark-spec.ts +33 -41
  59. package/src/extensions/mark-view-effect.ts +3 -9
  60. package/src/extensions/mark-view.ts +2 -8
  61. package/src/extensions/node-spec.spec.ts +5 -21
  62. package/src/extensions/node-spec.ts +31 -33
  63. package/src/extensions/node-view-effect.ts +3 -9
  64. package/src/extensions/node-view.ts +2 -8
  65. package/src/extensions/plugin.spec.ts +3 -16
  66. package/src/extensions/plugin.ts +4 -14
  67. package/src/facets/base-extension.ts +1 -4
  68. package/src/facets/command.ts +10 -10
  69. package/src/facets/facet-extension.spec.ts +4 -15
  70. package/src/facets/facet-node.spec.ts +2 -9
  71. package/src/facets/facet-node.ts +4 -9
  72. package/src/facets/facet.spec.ts +1 -4
  73. package/src/facets/schema-spec.ts +2 -9
  74. package/src/facets/schema.ts +3 -12
  75. package/src/facets/state.spec.ts +8 -15
  76. package/src/facets/state.ts +5 -20
  77. package/src/facets/union-extension.ts +2 -8
  78. package/src/index.ts +42 -188
  79. package/src/test/index.ts +1 -4
  80. package/src/test/test-builder.ts +1 -4
  81. package/src/test/test-editor.spec.ts +1 -5
  82. package/src/test/test-editor.ts +5 -24
  83. package/src/testing/index.ts +18 -14
  84. package/src/types/extension-command.ts +0 -7
  85. package/src/types/extension.spec.ts +1 -4
  86. package/src/types/extension.ts +3 -29
  87. package/src/types/simplify-union.ts +1 -4
  88. package/src/utils/array-grouping.spec.ts +2 -15
  89. package/src/utils/array-grouping.ts +1 -14
  90. package/src/utils/array.ts +0 -4
  91. package/src/utils/attrs-match.ts +1 -5
  92. package/src/utils/clsx.spec.ts +1 -4
  93. package/src/utils/combine-event-handlers.spec.ts +1 -5
  94. package/src/utils/combine-event-handlers.ts +4 -6
  95. package/src/utils/default-block-at.ts +1 -4
  96. package/src/utils/editor-content.spec.ts +1 -4
  97. package/src/utils/editor-content.ts +7 -19
  98. package/src/utils/find-node.ts +65 -0
  99. package/src/utils/find-parent-node-of-type.ts +6 -12
  100. package/src/utils/find-parent-node.spec.ts +1 -5
  101. package/src/utils/find-parent-node.ts +1 -4
  102. package/src/utils/get-custom-selection.ts +1 -5
  103. package/src/utils/get-mark-type.ts +1 -4
  104. package/src/utils/get-node-type.ts +1 -4
  105. package/src/utils/get-node-types.ts +1 -4
  106. package/src/utils/includes-mark.ts +1 -5
  107. package/src/utils/is-at-block-start.ts +1 -4
  108. package/src/utils/is-mark-absent.spec.ts +1 -4
  109. package/src/utils/is-mark-absent.ts +1 -5
  110. package/src/utils/is-mark-active.ts +1 -4
  111. package/src/utils/is-node-active.spec.ts +109 -0
  112. package/src/utils/is-node-active.ts +17 -8
  113. package/src/utils/is-subset.spec.ts +1 -4
  114. package/src/utils/maybe-run.spec.ts +1 -5
  115. package/src/utils/merge-objects.spec.ts +1 -4
  116. package/src/utils/merge-objects.ts +2 -1
  117. package/src/utils/merge-specs.ts +1 -4
  118. package/src/utils/object-equal.spec.ts +1 -4
  119. package/src/utils/output-spec.test.ts +1 -5
  120. package/src/utils/output-spec.ts +12 -9
  121. package/src/utils/parse.spec.ts +2 -11
  122. package/src/utils/parse.ts +12 -24
  123. package/src/utils/remove-undefined-values.spec.ts +1 -4
  124. package/src/utils/set-selection-around.ts +1 -4
  125. package/src/utils/type-assertion.ts +2 -21
  126. package/src/utils/unicode.spec.ts +1 -4
  127. package/dist/editor-B0L9BgMi.js.map +0 -1
  128. package/dist/editor-M9OimMiI.d.ts.map +0 -1
  129. package/src/extensions/doc.ts +0 -31
  130. package/src/extensions/paragraph.ts +0 -61
  131. package/src/extensions/text.ts +0 -34
  132. package/src/types/base-node-view-options.ts +0 -33
  133. package/src/types/object-entries.ts +0 -13
  134. package/src/utils/collect-children.ts +0 -21
  135. package/src/utils/collect-nodes.ts +0 -37
  136. package/src/utils/deep-equals.spec.ts +0 -26
  137. package/src/utils/deep-equals.ts +0 -29
  138. package/src/utils/get-id.spec.ts +0 -14
  139. package/src/utils/get-id.ts +0 -13
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-core-test.js","names":["createNodeForTest: CreateNodeFunction","tags: Tags","normalizedChildren: TaggedProseMirrorNode[]","node: TaggedProseMirrorNode | null","applyMarkForTest: ApplyMarkFunction","newNode: TaggedProseMirrorNode"],"sources":["../src/test/test-builder.ts","../src/test/test-editor.ts"],"sourcesContent":["import type { ProseMirrorNode } from '@prosekit/pm/model'\n\nimport type {\n ApplyMarkFunction,\n CreateNodeFunction,\n} from '../editor/action'\nimport { assert } from '../utils/assert'\n\ntype Tags = Record<string, number>\nexport type TaggedProseMirrorNode = ProseMirrorNode & { tags?: Tags }\n\nexport const createNodeForTest: CreateNodeFunction = (\n type,\n attrs,\n children: TaggedProseMirrorNode[],\n): TaggedProseMirrorNode => {\n const tags: Tags = {}\n const isTopNode = type === type.schema.topNodeType\n let pos = isTopNode ? 0 : 1\n const normalizedChildren: TaggedProseMirrorNode[] = []\n\n for (const child of children) {\n if (child.tags) {\n for (const [key, value] of Object.entries(child.tags)) {\n tags[key] = pos + value\n }\n normalizedChildren.push(child)\n pos += child.nodeSize\n } else if (child.isText) {\n const text = child.text!\n const re = /<(a|b)>/g\n let i = 0\n let out = ''\n for (const match of text.matchAll(re)) {\n out += text.slice(i, match.index)\n tags[match[1]] = pos + out.length\n i = match.index + match[0].length\n }\n out += text.slice(i)\n if (out) {\n normalizedChildren.push(child.type.schema.text(out).mark(child.marks))\n pos += out.length\n }\n } else {\n normalizedChildren.push(child)\n pos += child.nodeSize\n }\n }\n\n const node: TaggedProseMirrorNode | null = type.createAndFill(\n attrs,\n normalizedChildren,\n )\n assert(node, `Failed to create node ${type.name}`)\n node.tags = tags\n return node\n}\n\nexport const applyMarkForTest: ApplyMarkFunction = (\n mark,\n children: TaggedProseMirrorNode[],\n): TaggedProseMirrorNode[] => {\n return children.map((node) => {\n const newNode: TaggedProseMirrorNode = node.mark(mark.addToSet(node.marks))\n newNode.tags = node.tags\n return newNode\n })\n}\n","import type { ProseMirrorNode } from '@prosekit/pm/model'\nimport {\n NodeSelection,\n TextSelection,\n type Selection,\n} from '@prosekit/pm/state'\n\nimport {\n createMarkActions,\n createNodeActions,\n} from '../editor/action'\nimport {\n Editor,\n EditorInstance,\n setupEditorExtension,\n type EditorOptions,\n} from '../editor/editor'\nimport type { Extension } from '../types/extension'\nimport type {\n NodeJSON,\n SelectionJSON,\n} from '../types/model'\nimport { isProseMirrorNode } from '../utils/type-assertion'\n\nimport {\n applyMarkForTest,\n createNodeForTest,\n type TaggedProseMirrorNode,\n} from './test-builder'\n\nfunction maybeResolve(doc: ProseMirrorNode, pos?: number) {\n if (pos != null) {\n return doc.resolve(pos)\n }\n return undefined\n}\n\nfunction getSelection(doc: TaggedProseMirrorNode): Selection {\n const tags = doc.tags\n const $a = maybeResolve(doc, tags?.a)\n const $b = maybeResolve(doc, tags?.b)\n\n if ($a) {\n if ($a.parent.inlineContent) {\n return new TextSelection($a, $b)\n } else {\n return new NodeSelection($a)\n }\n }\n return TextSelection.atStart(doc)\n}\n\nclass TestEditorInstance extends EditorInstance {\n constructor(extension: Extension) {\n super(extension)\n this.nodes = createNodeActions(this.schema, this.getState, createNodeForTest)\n this.marks = createMarkActions(this.schema, this.getState, applyMarkForTest)\n }\n\n override setContent(\n content: ProseMirrorNode | NodeJSON | string | HTMLElement,\n selection?: SelectionJSON | Selection | 'start' | 'end',\n ): void {\n return super.setContent(\n content,\n isProseMirrorNode(content) && !selection\n ? getSelection(content)\n : selection,\n )\n }\n}\n\n/**\n * An editor for testing purposes.\n * @public\n */\nexport class TestEditor<E extends Extension = Extension> extends Editor<E> {\n constructor(instance: EditorInstance) {\n super(instance)\n }\n\n /**\n * Set the editor state to the given document. You can use special tokens\n * `<a>` and `<b>` to set the anchor and head positions of the selection.\n *\n * @example\n *\n * ```ts\n * const editor = createTestEditor({ extension })\n * const n = editor.nodes\n * const doc = n.doc(n.paragraph('<a>Hello<b> world!'))\n * editor.set(doc) // \"Hello\" is selected.\n * ```\n */\n set(doc: ProseMirrorNode): void {\n return this.setContent(doc)\n }\n\n dispatchEvent(event: Event): void {\n this.view.dispatchEvent(event)\n }\n}\n\n/**\n * @public\n */\nexport function createTestEditor<E extends Extension>(\n options: EditorOptions<E>,\n): TestEditor<E> {\n const extension = setupEditorExtension(options)\n const instance = new TestEditorInstance(extension)\n return new TestEditor(instance)\n}\n"],"mappings":";;;;AAWA,MAAaA,qBACX,MACA,OACA,aAC0B;CAC1B,MAAMC,OAAa,EAAE;CAErB,IAAI,MADc,SAAS,KAAK,OAAO,cACjB,IAAI;CAC1B,MAAMC,qBAA8C,EAAE;AAEtD,MAAK,MAAM,SAAS,SAClB,KAAI,MAAM,MAAM;AACd,OAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,KAAK,CACnD,MAAK,OAAO,MAAM;AAEpB,qBAAmB,KAAK,MAAM;AAC9B,SAAO,MAAM;YACJ,MAAM,QAAQ;EACvB,MAAM,OAAO,MAAM;EACnB,MAAM,KAAK;EACX,IAAI,IAAI;EACR,IAAI,MAAM;AACV,OAAK,MAAM,SAAS,KAAK,SAAS,GAAG,EAAE;AACrC,UAAO,KAAK,MAAM,GAAG,MAAM,MAAM;AACjC,QAAK,MAAM,MAAM,MAAM,IAAI;AAC3B,OAAI,MAAM,QAAQ,MAAM,GAAG;;AAE7B,SAAO,KAAK,MAAM,EAAE;AACpB,MAAI,KAAK;AACP,sBAAmB,KAAK,MAAM,KAAK,OAAO,KAAK,IAAI,CAAC,KAAK,MAAM,MAAM,CAAC;AACtE,UAAO,IAAI;;QAER;AACL,qBAAmB,KAAK,MAAM;AAC9B,SAAO,MAAM;;CAIjB,MAAMC,OAAqC,KAAK,cAC9C,OACA,mBACD;AACD,QAAO,MAAM,yBAAyB,KAAK,OAAO;AAClD,MAAK,OAAO;AACZ,QAAO;;AAGT,MAAaC,oBACX,MACA,aAC4B;AAC5B,QAAO,SAAS,KAAK,SAAS;EAC5B,MAAMC,UAAiC,KAAK,KAAK,KAAK,SAAS,KAAK,MAAM,CAAC;AAC3E,UAAQ,OAAO,KAAK;AACpB,SAAO;GACP;;;;;ACpCJ,SAAS,aAAa,KAAsB,KAAc;AACxD,KAAI,OAAO,KACT,QAAO,IAAI,QAAQ,IAAI;;AAK3B,SAAS,aAAa,KAAuC;CAC3D,MAAM,OAAO,IAAI;CACjB,MAAM,KAAK,aAAa,KAAK,MAAM,EAAE;CACrC,MAAM,KAAK,aAAa,KAAK,MAAM,EAAE;AAErC,KAAI,GACF,KAAI,GAAG,OAAO,cACZ,QAAO,IAAI,cAAc,IAAI,GAAG;KAEhC,QAAO,IAAI,cAAc,GAAG;AAGhC,QAAO,cAAc,QAAQ,IAAI;;AAGnC,IAAM,qBAAN,cAAiC,eAAe;CAC9C,YAAY,WAAsB;AAChC,QAAM,UAAU;AAChB,OAAK,QAAQ,kBAAkB,KAAK,QAAQ,KAAK,UAAU,kBAAkB;AAC7E,OAAK,QAAQ,kBAAkB,KAAK,QAAQ,KAAK,UAAU,iBAAiB;;CAG9E,AAAS,WACP,SACA,WACM;AACN,SAAO,MAAM,WACX,SACA,kBAAkB,QAAQ,IAAI,CAAC,YAC3B,aAAa,QAAQ,GACrB,UACL;;;;;;;AAQL,IAAa,aAAb,cAAiE,OAAU;CACzE,YAAY,UAA0B;AACpC,QAAM,SAAS;;;;;;;;;;;;;;;CAgBjB,IAAI,KAA4B;AAC9B,SAAO,KAAK,WAAW,IAAI;;CAG7B,cAAc,OAAoB;AAChC,OAAK,KAAK,cAAc,MAAM;;;;;;AAOlC,SAAgB,iBACd,SACe;AAGf,QAAO,IAAI,WADM,IAAI,mBADH,qBAAqB,QAAQ,CACG,CACnB"}
1
+ {"version":3,"file":"prosekit-core-test.js","names":[],"sources":["../src/test/test-builder.ts","../src/test/test-editor.ts"],"sourcesContent":["import type { ProseMirrorNode } from '@prosekit/pm/model'\n\nimport type { ApplyMarkFunction, CreateNodeFunction } from '../editor/action'\nimport { assert } from '../utils/assert'\n\ntype Tags = Record<string, number>\nexport type TaggedProseMirrorNode = ProseMirrorNode & { tags?: Tags }\n\nexport const createNodeForTest: CreateNodeFunction = (\n type,\n attrs,\n children: TaggedProseMirrorNode[],\n): TaggedProseMirrorNode => {\n const tags: Tags = {}\n const isTopNode = type === type.schema.topNodeType\n let pos = isTopNode ? 0 : 1\n const normalizedChildren: TaggedProseMirrorNode[] = []\n\n for (const child of children) {\n if (child.tags) {\n for (const [key, value] of Object.entries(child.tags)) {\n tags[key] = pos + value\n }\n normalizedChildren.push(child)\n pos += child.nodeSize\n } else if (child.isText) {\n const text = child.text!\n const re = /<(a|b)>/g\n let i = 0\n let out = ''\n for (const match of text.matchAll(re)) {\n out += text.slice(i, match.index)\n tags[match[1]] = pos + out.length\n i = match.index + match[0].length\n }\n out += text.slice(i)\n if (out) {\n normalizedChildren.push(child.type.schema.text(out).mark(child.marks))\n pos += out.length\n }\n } else {\n normalizedChildren.push(child)\n pos += child.nodeSize\n }\n }\n\n const node: TaggedProseMirrorNode | null = type.createAndFill(\n attrs,\n normalizedChildren,\n )\n assert(node, `Failed to create node ${type.name}`)\n node.tags = tags\n return node\n}\n\nexport const applyMarkForTest: ApplyMarkFunction = (\n mark,\n children: TaggedProseMirrorNode[],\n): TaggedProseMirrorNode[] => {\n return children.map((node) => {\n const newNode: TaggedProseMirrorNode = node.mark(mark.addToSet(node.marks))\n newNode.tags = node.tags\n return newNode\n })\n}\n","import type { ProseMirrorNode } from '@prosekit/pm/model'\nimport { NodeSelection, TextSelection, type Selection } from '@prosekit/pm/state'\n\nimport { createMarkActions, createNodeActions } from '../editor/action'\nimport { Editor, EditorInstance, setupEditorExtension, type EditorOptions } from '../editor/editor'\nimport type { Extension } from '../types/extension'\nimport type { NodeJSON, SelectionJSON } from '../types/model'\nimport { isProseMirrorNode } from '../utils/type-assertion'\n\nimport { applyMarkForTest, createNodeForTest, type TaggedProseMirrorNode } from './test-builder'\n\nfunction maybeResolve(doc: ProseMirrorNode, pos?: number) {\n if (pos != null) {\n return doc.resolve(pos)\n }\n return undefined\n}\n\nfunction getSelection(doc: TaggedProseMirrorNode): Selection {\n const tags = doc.tags\n const $a = maybeResolve(doc, tags?.a)\n const $b = maybeResolve(doc, tags?.b)\n\n if ($a) {\n if ($a.parent.inlineContent) {\n return new TextSelection($a, $b)\n } else {\n return new NodeSelection($a)\n }\n }\n return TextSelection.atStart(doc)\n}\n\nclass TestEditorInstance extends EditorInstance {\n constructor(extension: Extension) {\n super(extension)\n this.nodes = createNodeActions(this.schema, this.getState, createNodeForTest)\n this.marks = createMarkActions(this.schema, this.getState, applyMarkForTest)\n }\n\n override setContent(\n content: ProseMirrorNode | NodeJSON | string | HTMLElement,\n selection?: SelectionJSON | Selection | 'start' | 'end',\n ): void {\n return super.setContent(\n content,\n isProseMirrorNode(content) && !selection\n ? getSelection(content)\n : selection,\n )\n }\n}\n\n/**\n * An editor for testing purposes.\n * @public\n */\nexport class TestEditor<E extends Extension = Extension> extends Editor<E> {\n constructor(instance: EditorInstance) {\n super(instance)\n }\n\n /**\n * Set the editor state to the given document. You can use special tokens\n * `<a>` and `<b>` to set the anchor and head positions of the selection.\n *\n * @example\n *\n * ```ts\n * const editor = createTestEditor({ extension })\n * const n = editor.nodes\n * const doc = n.doc(n.paragraph('<a>Hello<b> world!'))\n * editor.set(doc) // \"Hello\" is selected.\n * ```\n */\n set(doc: ProseMirrorNode): void {\n return this.setContent(doc)\n }\n\n dispatchEvent(event: Event): void {\n this.view.dispatchEvent(event)\n }\n}\n\n/**\n * @public\n */\nexport function createTestEditor<E extends Extension>(\n options: EditorOptions<E>,\n): TestEditor<E> {\n const extension = setupEditorExtension(options)\n const instance = new TestEditorInstance(extension)\n return new TestEditor(instance)\n}\n"],"mappings":";;;;AAQA,MAAa,qBACX,MACA,OACA,aAC0B;CAC1B,MAAM,OAAa,EAAE;CAErB,IAAI,MADc,SAAS,KAAK,OAAO,cACjB,IAAI;CAC1B,MAAM,qBAA8C,EAAE;AAEtD,MAAK,MAAM,SAAS,SAClB,KAAI,MAAM,MAAM;AACd,OAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,KAAK,CACnD,MAAK,OAAO,MAAM;AAEpB,qBAAmB,KAAK,MAAM;AAC9B,SAAO,MAAM;YACJ,MAAM,QAAQ;EACvB,MAAM,OAAO,MAAM;EACnB,MAAM,KAAK;EACX,IAAI,IAAI;EACR,IAAI,MAAM;AACV,OAAK,MAAM,SAAS,KAAK,SAAS,GAAG,EAAE;AACrC,UAAO,KAAK,MAAM,GAAG,MAAM,MAAM;AACjC,QAAK,MAAM,MAAM,MAAM,IAAI;AAC3B,OAAI,MAAM,QAAQ,MAAM,GAAG;;AAE7B,SAAO,KAAK,MAAM,EAAE;AACpB,MAAI,KAAK;AACP,sBAAmB,KAAK,MAAM,KAAK,OAAO,KAAK,IAAI,CAAC,KAAK,MAAM,MAAM,CAAC;AACtE,UAAO,IAAI;;QAER;AACL,qBAAmB,KAAK,MAAM;AAC9B,SAAO,MAAM;;CAIjB,MAAM,OAAqC,KAAK,cAC9C,OACA,mBACD;AACD,QAAO,MAAM,yBAAyB,KAAK,OAAO;AAClD,MAAK,OAAO;AACZ,QAAO;;AAGT,MAAa,oBACX,MACA,aAC4B;AAC5B,QAAO,SAAS,KAAK,SAAS;EAC5B,MAAM,UAAiC,KAAK,KAAK,KAAK,SAAS,KAAK,MAAM,CAAC;AAC3E,UAAQ,OAAO,KAAK;AACpB,SAAO;GACP;;;;;ACpDJ,SAAS,aAAa,KAAsB,KAAc;AACxD,KAAI,OAAO,KACT,QAAO,IAAI,QAAQ,IAAI;;AAK3B,SAAS,aAAa,KAAuC;CAC3D,MAAM,OAAO,IAAI;CACjB,MAAM,KAAK,aAAa,KAAK,MAAM,EAAE;CACrC,MAAM,KAAK,aAAa,KAAK,MAAM,EAAE;AAErC,KAAI,GACF,KAAI,GAAG,OAAO,cACZ,QAAO,IAAI,cAAc,IAAI,GAAG;KAEhC,QAAO,IAAI,cAAc,GAAG;AAGhC,QAAO,cAAc,QAAQ,IAAI;;AAGnC,IAAM,qBAAN,cAAiC,eAAe;CAC9C,YAAY,WAAsB;AAChC,QAAM,UAAU;AAChB,OAAK,QAAQ,kBAAkB,KAAK,QAAQ,KAAK,UAAU,kBAAkB;AAC7E,OAAK,QAAQ,kBAAkB,KAAK,QAAQ,KAAK,UAAU,iBAAiB;;CAG9E,AAAS,WACP,SACA,WACM;AACN,SAAO,MAAM,WACX,SACA,kBAAkB,QAAQ,IAAI,CAAC,YAC3B,aAAa,QAAQ,GACrB,UACL;;;;;;;AAQL,IAAa,aAAb,cAAiE,OAAU;CACzE,YAAY,UAA0B;AACpC,QAAM,SAAS;;;;;;;;;;;;;;;CAgBjB,IAAI,KAA4B;AAC9B,SAAO,KAAK,WAAW,IAAI;;CAG7B,cAAc,OAAoB;AAChC,OAAK,KAAK,cAAc,MAAM;;;;;;AAOlC,SAAgB,iBACd,SACe;AAGf,QAAO,IAAI,WADM,IAAI,mBADH,qBAAqB,QAAQ,CACG,CACnB"}
@@ -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-BULC1zqX.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
  /**
@@ -138,8 +139,8 @@ interface RemoveNodeOptions {
138
139
  */
139
140
  type: string | NodeType;
140
141
  /**
141
- * The document position to start searching node. By default it will be the
142
- * anchor position of current selection.
142
+ * The document position to start searching for the node. By default, it will
143
+ * use the anchor position of current selection.
143
144
  */
144
145
  pos?: number;
145
146
  }
@@ -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
@@ -175,8 +194,6 @@ declare function setBlockType(options: SetBlockTypeOptions): Command;
175
194
  interface SetNodeAttrsOptions {
176
195
  /**
177
196
  * The type of node to set the attributes of.
178
- *
179
- * If current node is not of this type, the command will do nothing.
180
197
  */
181
198
  type: string | NodeType | string[] | NodeType[];
182
199
  /**
@@ -184,17 +201,56 @@ interface SetNodeAttrsOptions {
184
201
  */
185
202
  attrs: Attrs;
186
203
  /**
187
- * The position of the node. Defaults to the position of the wrapping node
188
- * containing the current selection.
204
+ * The document position of the node to update. If not provided, the command
205
+ * will find the closest ancestor node that matches the type based on the
206
+ * anchor position of the selection.
189
207
  */
190
208
  pos?: number;
191
209
  }
192
210
  /**
193
- * Returns a command that set the attributes of the current node.
211
+ * Returns a command that sets the attributes of the current node.
212
+ *
213
+ * @param options
194
214
  *
195
215
  * @public
196
216
  */
197
- declare function setNodeAttrs(options: SetNodeAttrsOptions): Command;
217
+ declare function setNodeAttrs({
218
+ type,
219
+ attrs,
220
+ pos
221
+ }: SetNodeAttrsOptions): Command;
222
+ //#endregion
223
+ //#region src/commands/set-node-attrs-between.d.ts
224
+ /**
225
+ * @public
226
+ */
227
+ interface SetNodeAttrsBetweenOptions {
228
+ /**
229
+ * The type of node to set the attributes of.
230
+ */
231
+ type: string | NodeType | string[] | NodeType[];
232
+ /**
233
+ * The attributes to set.
234
+ */
235
+ attrs: Attrs;
236
+ /**
237
+ * The position to start searching for nodes. By default, the selection from position will be used.
238
+ */
239
+ from?: number;
240
+ /**
241
+ * The position to end searching for nodes. By default, the selection to position will be used.
242
+ */
243
+ to?: number;
244
+ }
245
+ /**
246
+ * Returns a command that sets the attributes of all matching nodes between the
247
+ * `from` and `to` positions.
248
+ *
249
+ * @param options
250
+ *
251
+ * @public
252
+ */
253
+ declare function setNodeAttrsBetween(options: SetNodeAttrsBetweenOptions): Command;
198
254
  //#endregion
199
255
  //#region src/commands/toggle-mark.d.ts
200
256
  /**
@@ -255,7 +311,7 @@ interface ToggleNodeOptions {
255
311
  attrs?: Attrs | null;
256
312
  }
257
313
  /**
258
- * Returns a command that set the selected textblocks to the given node type
314
+ * Returns a command that sets the selected textblocks to the given node type
259
315
  * with the given attributes.
260
316
  *
261
317
  * @param options
@@ -342,10 +398,6 @@ interface WrapOptions {
342
398
  * The node type to wrap the selected textblock with.
343
399
  */
344
400
  type: NodeType | string;
345
- /**
346
- * @deprecated Use `nodeSpec` instead.
347
- */
348
- nodeType?: NodeType;
349
401
  /**
350
402
  * Optional attributes to apply to the node.
351
403
  */
@@ -475,8 +527,10 @@ type BaseCommandsExtension = Extension<{
475
527
  toggleWrap: [options: ToggleWrapOptions];
476
528
  setBlockType: [options: SetBlockTypeOptions];
477
529
  setNodeAttrs: [options: SetNodeAttrsOptions];
530
+ setNodeAttrsBetween: [options: SetNodeAttrsBetweenOptions];
478
531
  insertDefaultBlock: [options?: InsertDefaultBlockOptions];
479
532
  selectAll: [];
533
+ selectBlock: [];
480
534
  addMark: [options: AddMarkOptions];
481
535
  removeMark: [options: RemoveMarkOptions];
482
536
  unsetBlockType: [options?: UnsetBlockTypeOptions];
@@ -497,23 +551,9 @@ declare function defineBaseCommands(): BaseCommandsExtension;
497
551
  interface DefaultStateOptions {
498
552
  /**
499
553
  * 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.
554
+ * ProseMirror node JSON object, an HTML string, or a DOM element instance.
501
555
  */
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.
515
- */
516
- defaultHTML?: string | HTMLElement;
556
+ defaultContent?: NodeJSON | string | Element;
517
557
  /**
518
558
  * A JSON object representing the starting selection to use when creating the
519
559
  * editor. It's only used when `defaultContent` is also provided.
@@ -529,31 +569,9 @@ interface DefaultStateOptions {
529
569
  */
530
570
  declare function defineDefaultState({
531
571
  defaultSelection,
532
- defaultContent,
533
- defaultDoc,
534
- defaultHTML
572
+ defaultContent
535
573
  }: DefaultStateOptions): PlainExtension;
536
574
  //#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
575
  //#region src/extensions/events/doc-change.d.ts
558
576
  /**
559
577
  * A function that is called when the editor document is changed.
@@ -650,19 +668,6 @@ declare function defineFacet<Input, Output>(options: {
650
668
  reduce?: () => FacetReducer<Input, Output>;
651
669
  }): Facet<Input, Output>;
652
670
  //#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
671
  //#region src/facets/state.d.ts
667
672
  type StatePayload = (ctx: {
668
673
  schema: Schema;
@@ -933,24 +938,42 @@ declare const keymapFacet: Facet<KeymapPayload, PluginPayload>;
933
938
  */
934
939
  type BaseKeymapExtension = PlainExtension;
935
940
  /**
936
- * Defines some basic key bindings.
937
- *
938
941
  * @public
939
942
  */
940
- declare function defineBaseKeymap(options?: {
943
+ interface BaseKeymapOptions {
941
944
  /**
942
945
  * The priority of the keymap.
943
946
  *
944
947
  * @default Priority.low
945
948
  */
946
949
  priority?: Priority;
947
- }): BaseKeymapExtension;
950
+ /**
951
+ * If `true`, the first `Mod-a` press selects the current block that the
952
+ * cursor is in, and a second press selects the entire document.
953
+ *
954
+ * If `false`, `Mod-a` immediately selects the entire document.
955
+ *
956
+ * @default true
957
+ */
958
+ preferBlockSelection?: boolean;
959
+ }
960
+ /**
961
+ * Defines some basic key bindings.
962
+ *
963
+ * @param options
964
+ *
965
+ * @public
966
+ */
967
+ declare function defineBaseKeymap({
968
+ priority,
969
+ preferBlockSelection
970
+ }?: BaseKeymapOptions): BaseKeymapExtension;
948
971
  //#endregion
949
972
  //#region src/extensions/mark-spec.d.ts
950
973
  /**
951
974
  * @public
952
975
  */
953
- interface MarkSpecOptions<MarkName extends string = string, Attrs$1 extends AnyAttrs = AnyAttrs> extends MarkSpec {
976
+ interface MarkSpecOptions<MarkName extends string = string, Attrs extends AnyAttrs = AnyAttrs> extends MarkSpec {
954
977
  /**
955
978
  * The name of the mark type.
956
979
  */
@@ -958,7 +981,7 @@ interface MarkSpecOptions<MarkName extends string = string, Attrs$1 extends AnyA
958
981
  /**
959
982
  * The attributes that marks of this type get.
960
983
  */
961
- attrs?: { [K in keyof Attrs$1]: AttrSpec<Attrs$1[K]> };
984
+ attrs?: { [K in keyof Attrs]: AttrSpec<Attrs[K]> };
962
985
  }
963
986
  /**
964
987
  * @public
@@ -987,16 +1010,33 @@ interface MarkAttrOptions<MarkName extends string = string, AttrName extends str
987
1010
  parseDOM?: (node: HTMLElement) => AttrType;
988
1011
  }
989
1012
  /**
1013
+ * Defines a mark type into the editor schema.
1014
+ *
990
1015
  * @public
1016
+ *
1017
+ * @example
1018
+ *
1019
+ * ```ts
1020
+ * const extension = defineMarkSpec({
1021
+ * name: 'bold',
1022
+ * parseDOM: [
1023
+ * { tag: 'strong' },
1024
+ * { tag: 'b' },
1025
+ * ],
1026
+ * toDOM() {
1027
+ * return ['strong', 0]
1028
+ * },
1029
+ * })
1030
+ * ```
991
1031
  */
992
- declare function defineMarkSpec<Mark$1 extends string, Attrs$1 extends AnyAttrs = AnyAttrs>(options: MarkSpecOptions<Mark$1, Attrs$1>): Extension<{
993
- Marks: { [K in Mark$1]: Attrs$1 };
1032
+ declare function defineMarkSpec<Mark extends string, Attrs extends AnyAttrs = AnyAttrs>(options: MarkSpecOptions<Mark, Attrs>): Extension<{
1033
+ Marks: { [K in Mark]: Attrs };
994
1034
  }>;
995
1035
  /**
996
1036
  * @public
997
1037
  */
998
- declare function defineMarkAttr<MarkType$1 extends string = string, AttrName extends string = string, AttrType = any>(options: MarkAttrOptions<MarkType$1, AttrName, AttrType>): Extension<{
999
- Marks: { [K in MarkType$1]: AttrType };
1038
+ declare function defineMarkAttr<MarkType extends string = string, AttrName extends string = string, AttrType = any>(options: MarkAttrOptions<MarkType, AttrName, AttrType>): Extension<{
1039
+ Marks: { [K in MarkType]: AttrType };
1000
1040
  }>;
1001
1041
  //#endregion
1002
1042
  //#region src/extensions/mark-view.d.ts
@@ -1035,7 +1075,7 @@ declare function defineMarkViewComponent<T>(options: MarkViewComponentOptions<T>
1035
1075
  /**
1036
1076
  * @public
1037
1077
  */
1038
- interface NodeSpecOptions<NodeName extends string = string, Attrs$1 extends AnyAttrs = AnyAttrs> extends NodeSpec {
1078
+ interface NodeSpecOptions<NodeName extends string = string, Attrs extends AnyAttrs = AnyAttrs> extends NodeSpec {
1039
1079
  /**
1040
1080
  * The name of the node type.
1041
1081
  */
@@ -1048,7 +1088,7 @@ interface NodeSpecOptions<NodeName extends string = string, Attrs$1 extends AnyA
1048
1088
  /**
1049
1089
  * The attributes that nodes of this type get.
1050
1090
  */
1051
- attrs?: { [key in keyof Attrs$1]: AttrSpec<Attrs$1[key]> };
1091
+ attrs?: { [key in keyof Attrs]: AttrSpec<Attrs[key]> };
1052
1092
  }
1053
1093
  /**
1054
1094
  * @public
@@ -1085,20 +1125,34 @@ interface NodeAttrOptions<NodeName extends string = string, AttrName extends str
1085
1125
  parseDOM?: (node: HTMLElement) => AttrType;
1086
1126
  }
1087
1127
  /**
1088
- * Defines a node type.
1128
+ * Defines a node type into the editor schema.
1089
1129
  *
1090
1130
  * @public
1131
+ *
1132
+ * @example
1133
+ *
1134
+ * ```ts
1135
+ * const extension = defineNodeSpec({
1136
+ * name: 'fancyParagraph',
1137
+ * content: 'inline*',
1138
+ * group: 'block',
1139
+ * parseDOM: [{ tag: 'p.fancy' }],
1140
+ * toDOM() {
1141
+ * return ['p', { 'class': 'fancy' }, 0]
1142
+ * },
1143
+ * })
1144
+ * ```
1091
1145
  */
1092
- declare function defineNodeSpec<Node$1 extends string, Attrs$1 extends AnyAttrs = AnyAttrs>(options: NodeSpecOptions<Node$1, Attrs$1>): Extension<{
1093
- Nodes: { [K in Node$1]: Attrs$1 };
1146
+ declare function defineNodeSpec<Node extends string, Attrs extends AnyAttrs = AnyAttrs>(options: NodeSpecOptions<Node, Attrs>): Extension<{
1147
+ Nodes: { [K in Node]: Attrs };
1094
1148
  }>;
1095
1149
  /**
1096
1150
  * Defines an attribute for a node type.
1097
1151
  *
1098
1152
  * @public
1099
1153
  */
1100
- declare function defineNodeAttr<NodeType$1 extends string = string, AttrName extends string = string, AttrType = any>(options: NodeAttrOptions<NodeType$1, AttrName, AttrType>): Extension<{
1101
- Nodes: { [K in NodeType$1]: { [K in AttrName]: AttrType } };
1154
+ declare function defineNodeAttr<NodeType extends string = string, AttrName extends string = string, AttrType = any>(options: NodeAttrOptions<NodeType, AttrName, AttrType>): Extension<{
1155
+ Nodes: { [K in NodeType]: { [K in AttrName]: AttrType } };
1102
1156
  }>;
1103
1157
  //#endregion
1104
1158
  //#region src/extensions/node-view.d.ts
@@ -1133,91 +1187,12 @@ declare function defineNodeViewFactory<T>(options: NodeViewFactoryOptions<T>): E
1133
1187
  */
1134
1188
  declare function defineNodeViewComponent<T>(options: NodeViewComponentOptions<T>): Extension;
1135
1189
  //#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
1190
  //#region src/facets/facet-extension.d.ts
1189
1191
  /**
1190
1192
  * @internal
1191
1193
  */
1192
1194
  declare function defineFacetPayload<Input>(facet: Facet<Input, any>, payloads: Input[]): Extension;
1193
1195
  //#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
1196
  //#region src/utils/assert.d.ts
1222
1197
  /**
1223
1198
  * @internal
@@ -1240,32 +1215,6 @@ declare const canUseRegexLookbehind: () => boolean;
1240
1215
  */
1241
1216
  declare const clsx: (...args: Array<string | boolean | null | undefined>) => string;
1242
1217
  //#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
1218
  //#region src/utils/contains-inline-node.d.ts
1270
1219
  /**
1271
1220
  * @internal
@@ -1286,6 +1235,43 @@ declare function defaultBlockAt(match: ContentMatch): NodeType | null;
1286
1235
  */
1287
1236
  declare const isApple: boolean;
1288
1237
  //#endregion
1238
+ //#region src/utils/find-node.d.ts
1239
+ /**
1240
+ * Finds the first node that satisfies the predicate from the given document.
1241
+ *
1242
+ * @internal
1243
+ */
1244
+ declare function findNode(doc: ProseMirrorNode, predicate: (node: ProseMirrorNode) => boolean): FindNodeResult | undefined;
1245
+ /**
1246
+ * Finds all nodes that satisfy the predicate from the given document.
1247
+ *
1248
+ * @internal
1249
+ */
1250
+ declare function findNodes(doc: ProseMirrorNode, predicate: (node: ProseMirrorNode) => boolean): FindNodeResult[];
1251
+ /**
1252
+ * The result of the {@link findNode} function.
1253
+ *
1254
+ * @internal
1255
+ */
1256
+ interface FindNodeResult {
1257
+ /**
1258
+ * The node that satisfies the predicate.
1259
+ */
1260
+ node: ProseMirrorNode;
1261
+ /**
1262
+ * The position of the node.
1263
+ */
1264
+ pos: number;
1265
+ /**
1266
+ * The parent of the node.
1267
+ */
1268
+ parent: ProseMirrorNode | null;
1269
+ /**
1270
+ * The index of the node in the parent.
1271
+ */
1272
+ index: number;
1273
+ }
1274
+ //#endregion
1289
1275
  //#region src/utils/find-parent-node.d.ts
1290
1276
  /**
1291
1277
  * @public
@@ -1317,10 +1303,12 @@ declare function findParentNode(
1317
1303
  /**
1318
1304
  * The predicate to test the parent node.
1319
1305
  */
1306
+
1320
1307
  predicate: (node: ProseMirrorNode) => boolean,
1321
1308
  /**
1322
1309
  * The position to start searching from.
1323
1310
  */
1311
+
1324
1312
  $pos: ResolvedPos): FindParentNodeResult | undefined;
1325
1313
  //#endregion
1326
1314
  //#region src/utils/find-parent-node-of-type.d.ts
@@ -1333,22 +1321,14 @@ declare function findParentNodeOfType(
1333
1321
  /**
1334
1322
  * The type of the node to find.
1335
1323
  */
1336
- type: NodeType | string,
1324
+
1325
+ type: string | NodeType | string[] | NodeType[],
1337
1326
  /**
1338
1327
  * The position to start searching from.
1339
1328
  */
1329
+
1340
1330
  $pos: ResolvedPos): FindParentNodeResult | undefined;
1341
1331
  //#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
1332
  //#region src/utils/get-mark-type.d.ts
1353
1333
  /**
1354
1334
  * @internal
@@ -1462,5 +1442,5 @@ declare const OBJECT_REPLACEMENT_CHARACTER = "\uFFFC";
1462
1442
  */
1463
1443
  declare function withSkipCodeBlock(command: Command): Command;
1464
1444
  //#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 };
1445
+ 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 FindNodeResult, 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 SetNodeAttrsBetweenOptions, 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, findNode, findNodes, 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, setNodeAttrsBetween, setSelectionAround, stateFromJSON, toggleMark, toggleNode, toggleWrap, union, unsetBlockType, unsetMark, withPriority, withSkipCodeBlock, wrap };
1466
1446
  //# sourceMappingURL=prosekit-core.d.ts.map