@prosekit/core 0.1.8 → 0.1.9

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.
@@ -19,6 +19,7 @@ import { NodeSelection } from '@prosekit/pm/state';
19
19
  import type { NodeSpec } from '@prosekit/pm/model';
20
20
  import { NodeType } from '@prosekit/pm/model';
21
21
  import { NodeType as NodeType_2 } from 'prosemirror-model';
22
+ import { NodeView } from '@prosekit/pm/view';
22
23
  import { NodeViewConstructor } from '@prosekit/pm/view';
23
24
  import { Options } from 'tsup';
24
25
  import { Plugin as Plugin_2 } from '@prosekit/pm/state';
@@ -93,6 +94,32 @@ export declare abstract class BaseExtension<T extends ExtensionTyping = Extensio
93
94
  abstract schema: Schema | null;
94
95
  }
95
96
 
97
+ /**
98
+ * Some basic props for custom node views.
99
+ *
100
+ * @public
101
+ */
102
+ declare interface BaseNodeViewOptions {
103
+ /**
104
+ * The wrapping DOM element for the node view. Defaults to `div` for block nodes and `span` for inline nodes.
105
+ */
106
+ as?: string | HTMLElement | ((node: ProseMirrorNode) => HTMLElement);
107
+ /**
108
+ * The wrapping DOM element for the node view's content. Defaults to `div` for block nodes and `span` for inline nodes.
109
+ */
110
+ contentAs?: string | HTMLElement | ((node: ProseMirrorNode) => HTMLElement);
111
+ update?: NodeView['update'];
112
+ ignoreMutation?: NodeView['ignoreMutation'];
113
+ selectNode?: NodeView['selectNode'];
114
+ deselectNode?: NodeView['deselectNode'];
115
+ setSelection?: NodeView['setSelection'];
116
+ stopEvent?: NodeView['stopEvent'];
117
+ destroy?: NodeView['destroy'];
118
+ onUpdate?: () => void;
119
+ }
120
+ export { BaseNodeViewOptions }
121
+ export { BaseNodeViewOptions as BaseNodeViewOptions_alias_1 }
122
+
96
123
  export declare function collectNodes(content: NodeContent): ProseMirrorNode[];
97
124
 
98
125
  export declare interface CommandApplier<Args extends any[] = any[]> {
@@ -1,4 +1,3 @@
1
- export { _getId } from './_tsup-dts-rollup';
2
1
  export { addMark } from './_tsup-dts-rollup';
3
2
  export { insertNode } from './_tsup-dts-rollup';
4
3
  export { removeMark } from './_tsup-dts-rollup';
@@ -37,6 +36,7 @@ export { defineText } from './_tsup-dts-rollup';
37
36
  export { defineUpdateHandler } from './_tsup-dts-rollup';
38
37
  export { Facet } from './_tsup-dts-rollup';
39
38
  export { FacetOptions } from './_tsup-dts-rollup';
39
+ export { BaseNodeViewOptions } from './_tsup-dts-rollup';
40
40
  export { CommandArgs } from './_tsup-dts-rollup';
41
41
  export { Extension } from './_tsup-dts-rollup';
42
42
  export { ExtractCommandAppliers } from './_tsup-dts-rollup';
@@ -50,6 +50,7 @@ export { SelectionJSON } from './_tsup-dts-rollup';
50
50
  export { StateJSON } from './_tsup-dts-rollup';
51
51
  export { Priority } from './_tsup-dts-rollup';
52
52
  export { SimplifyUnion } from './_tsup-dts-rollup';
53
+ export { _getId } from './_tsup-dts-rollup';
53
54
  export { getMarkType } from './_tsup-dts-rollup';
54
55
  export { getNodeType } from './_tsup-dts-rollup';
55
56
  export { jsonFromElement } from './_tsup-dts-rollup';
@@ -1,10 +1,3 @@
1
- // src/utils/get-id.ts
2
- var id = 0;
3
- function getId() {
4
- id = (id + 1) % Number.MAX_SAFE_INTEGER;
5
- return `id:${id}`;
6
- }
7
-
8
1
  // src/commands/add-mark.ts
9
2
  import "@prosekit/pm/model";
10
3
  import "@prosekit/pm/state";
@@ -1429,6 +1422,13 @@ var updateHandlerFacet = Facet.define({
1429
1422
  singleton: true
1430
1423
  });
1431
1424
  var pluginKey = new PluginKey2("prosekit-event-handler");
1425
+
1426
+ // src/utils/get-id.ts
1427
+ var id = 0;
1428
+ function getId() {
1429
+ id = (id + 1) % Number.MAX_SAFE_INTEGER;
1430
+ return `id:${id}`;
1431
+ }
1432
1432
  export {
1433
1433
  Editor,
1434
1434
  Facet,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/core",
3
3
  "type": "module",
4
- "version": "0.1.8",
4
+ "version": "0.1.9",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",
@@ -38,7 +38,7 @@
38
38
  "dist"
39
39
  ],
40
40
  "dependencies": {
41
- "@prosekit/pm": "^0.1.0",
41
+ "@prosekit/pm": "^0.1.1",
42
42
  "orderedmap": "^2.1.1",
43
43
  "type-fest": "^4.8.3"
44
44
  },
package/src/index.ts CHANGED
@@ -1,4 +1,3 @@
1
- export { getId as _getId } from './utils/get-id'
2
1
  export { addMark } from './commands/add-mark'
3
2
  export { insertNode } from './commands/insert-node'
4
3
  export { removeMark } from './commands/remove-mark'
@@ -38,6 +37,7 @@ export {
38
37
  export { defineText } from './extensions/text'
39
38
  export { defineUpdateHandler } from './extensions/update-handler'
40
39
  export { Facet, type FacetOptions } from './facets/facet'
40
+ export type { BaseNodeViewOptions } from './types/base-node-view-options'
41
41
  export { type CommandArgs } from './types/command'
42
42
  export {
43
43
  type Extension,
@@ -51,6 +51,7 @@ export { type ExtensionTyping } from './types/extension-typing'
51
51
  export type { NodeJSON, SelectionJSON, StateJSON } from './types/model'
52
52
  export { Priority } from './types/priority'
53
53
  export { type SimplifyUnion } from './types/simplify-union'
54
+ export { getId as _getId } from './utils/get-id'
54
55
  export { getMarkType } from './utils/get-mark-type'
55
56
  export { getNodeType } from './utils/get-node-type'
56
57
  export {