@prosekit/core
Advanced tools
Comparing version 0.0.0-next-20240715071354 to 0.0.0-next-20240724155246
@@ -5,6 +5,6 @@ import { | ||
assert, | ||
createMarkBuilders, | ||
createNodeBuilders, | ||
createMarkActions, | ||
createNodeActions, | ||
setupEditorExtension | ||
} from "./chunk-UDQXAK7F.js"; | ||
} from "./chunk-MOSGJZHV.js"; | ||
@@ -86,12 +86,4 @@ // src/test/test-editor.ts | ||
super(extension); | ||
this.nodeBuilders = createNodeBuilders( | ||
this.schema, | ||
this.getState, | ||
createNodeForTest | ||
); | ||
this.markBuilders = createMarkBuilders( | ||
this.schema, | ||
this.getState, | ||
applyMarkForTest | ||
); | ||
this.nodes = createNodeActions(this.schema, this.getState, createNodeForTest); | ||
this.marks = createMarkActions(this.schema, this.getState, applyMarkForTest); | ||
} | ||
@@ -98,0 +90,0 @@ }; |
@@ -25,4 +25,7 @@ export { addMark } from './_tsup-dts-rollup'; | ||
export { WrapOptions } from './_tsup-dts-rollup'; | ||
export { MarkAction } from './_tsup-dts-rollup'; | ||
export { MarkBuilder } from './_tsup-dts-rollup'; | ||
export { NodeAction } from './_tsup-dts-rollup'; | ||
export { NodeBuilder } from './_tsup-dts-rollup'; | ||
export { NodeChild } from './_tsup-dts-rollup'; | ||
export { Editor } from './_tsup-dts-rollup'; | ||
@@ -105,11 +108,21 @@ export { createEditor } from './_tsup-dts-rollup'; | ||
export { defineFacetPayload } from './_tsup-dts-rollup'; | ||
export { AnyAttrs } from './_tsup-dts-rollup'; | ||
export { AttrSpec } from './_tsup-dts-rollup'; | ||
export { BaseNodeViewOptions } from './_tsup-dts-rollup'; | ||
export { CommandTyping } from './_tsup-dts-rollup'; | ||
export { Extension } from './_tsup-dts-rollup'; | ||
export { ExtensionTyping } from './_tsup-dts-rollup'; | ||
export { ExtractCommandActions } from './_tsup-dts-rollup'; | ||
export { ExtractCommandAppliers } from './_tsup-dts-rollup'; | ||
export { ExtractCommandCreators } from './_tsup-dts-rollup'; | ||
export { ExtractMarkActions } from './_tsup-dts-rollup'; | ||
export { ExtractMarks } from './_tsup-dts-rollup'; | ||
export { ExtractNodeActions } from './_tsup-dts-rollup'; | ||
export { ExtractNodes } from './_tsup-dts-rollup'; | ||
export { UnionExtension } from './_tsup-dts-rollup'; | ||
export { CommandAction } from './_tsup-dts-rollup'; | ||
export { CommandTyping } from './_tsup-dts-rollup'; | ||
export { MarkTyping } from './_tsup-dts-rollup'; | ||
export { ToMarkAction } from './_tsup-dts-rollup'; | ||
export { NodeTyping } from './_tsup-dts-rollup'; | ||
export { ToNodeAction } from './_tsup-dts-rollup'; | ||
export { NodeJSON } from './_tsup-dts-rollup'; | ||
@@ -119,3 +132,5 @@ export { SelectionJSON } from './_tsup-dts-rollup'; | ||
export { StepJSON } from './_tsup-dts-rollup'; | ||
export { PickSubType } from './_tsup-dts-rollup'; | ||
export { Priority } from './_tsup-dts-rollup'; | ||
export { SimplifyDeeper } from './_tsup-dts-rollup'; | ||
export { SimplifyUnion } from './_tsup-dts-rollup'; | ||
@@ -127,2 +142,3 @@ export { assert } from './_tsup-dts-rollup'; | ||
export { NodeContent } from './_tsup-dts-rollup'; | ||
export { containsInlineNode } from './_tsup-dts-rollup'; | ||
export { defaultBlockAt } from './_tsup-dts-rollup'; | ||
@@ -129,0 +145,0 @@ export { isApple } from './_tsup-dts-rollup'; |
@@ -38,7 +38,6 @@ import { | ||
union | ||
} from "./chunk-UDQXAK7F.js"; | ||
} from "./chunk-MOSGJZHV.js"; | ||
// src/commands/add-mark.ts | ||
import "@prosekit/pm/model"; | ||
import "@prosekit/pm/state"; | ||
function addMark(options) { | ||
@@ -112,3 +111,2 @@ return (state, dispatch) => { | ||
// src/commands/insert-node.ts | ||
import "@prosekit/pm/state"; | ||
import { insertPoint } from "@prosekit/pm/transform"; | ||
@@ -148,3 +146,2 @@ | ||
import "@prosekit/pm/model"; | ||
import "@prosekit/pm/state"; | ||
function removeMark(options) { | ||
@@ -198,5 +195,2 @@ return (state, dispatch) => { | ||
// src/commands/set-block-type.ts | ||
import "@prosekit/pm/state"; | ||
// src/utils/get-custom-selection.ts | ||
@@ -373,3 +367,2 @@ import { TextSelection as TextSelection3 } from "@prosekit/pm/state"; | ||
import "@prosekit/pm/model"; | ||
import "@prosekit/pm/state"; | ||
function toggleNode({ type, attrs }) { | ||
@@ -434,3 +427,2 @@ return (state, dispatch, view) => { | ||
// src/commands/unset-mark.ts | ||
import "@prosekit/pm/state"; | ||
function unsetMark(options) { | ||
@@ -449,3 +441,2 @@ return (state, dispatch) => { | ||
import "@prosekit/pm/model"; | ||
import "@prosekit/pm/state"; | ||
import { findWrapping } from "@prosekit/pm/transform"; | ||
@@ -564,3 +555,3 @@ function wrap({ nodeType, attrs }) { | ||
reducer: (payloads) => { | ||
let nodes = OrderedMap2.from({}); | ||
let specs = OrderedMap2.from({}); | ||
let topNodeName = void 0; | ||
@@ -570,7 +561,7 @@ const specPayloads = payloads.map((input) => input[0]).filter(isNotNull); | ||
for (const { name, topNode, ...spec } of specPayloads) { | ||
assert(!nodes.get(name), `Node type ${name} can only be defined once`); | ||
assert(!specs.get(name), `Node type ${name} can only be defined once`); | ||
if (topNode) { | ||
topNodeName = name; | ||
} | ||
nodes = nodes.addToStart(name, spec); | ||
specs = specs.addToStart(name, spec); | ||
} | ||
@@ -585,3 +576,3 @@ for (const { | ||
} of attrPayloads) { | ||
const spec = nodes.get(type); | ||
const spec = specs.get(type); | ||
assert(spec, `Node type ${type} must be defined`); | ||
@@ -651,3 +642,3 @@ if (!spec.attrs) { | ||
} | ||
return { nodes, topNode: topNodeName }; | ||
return { nodes: specs, topNode: topNodeName }; | ||
}, | ||
@@ -1085,2 +1076,3 @@ parent: schemaSpecFacet, | ||
// src/extensions/mark-spec.ts | ||
import OrderedMap3 from "orderedmap"; | ||
function defineMarkSpec(options) { | ||
@@ -1096,10 +1088,8 @@ const payload = [options, void 0]; | ||
reducer: (payloads) => { | ||
const marks = {}; | ||
let specs = OrderedMap3.from({}); | ||
const specPayloads = payloads.map((input) => input[0]).filter(isNotNull); | ||
const attrPayloads = payloads.map((input) => input[1]).filter(isNotNull); | ||
for (const { name, ...spec } of specPayloads) { | ||
if (marks[name]) { | ||
throw new ProseKitError(`Mark type ${name} has already been defined`); | ||
} | ||
marks[name] = spec; | ||
assert(!specs.get(name), `Mark type ${name} can only be defined once`); | ||
specs = specs.addToStart(name, spec); | ||
} | ||
@@ -1113,8 +1103,4 @@ for (const { | ||
} of attrPayloads) { | ||
const spec = marks[type]; | ||
if (!spec) { | ||
throw new ProseKitError( | ||
`Mark type ${type} must be defined before defining attributes` | ||
); | ||
} | ||
const spec = specs.get(type); | ||
assert(spec, `Mark type ${type} must be defined`); | ||
if (!spec.attrs) { | ||
@@ -1172,3 +1158,3 @@ spec.attrs = {}; | ||
} | ||
return { marks, nodes: {} }; | ||
return { marks: specs, nodes: {} }; | ||
}, | ||
@@ -1181,3 +1167,2 @@ parent: schemaSpecFacet, | ||
import { PluginKey as PluginKey5, ProseMirrorPlugin as ProseMirrorPlugin5 } from "@prosekit/pm/state"; | ||
import "@prosekit/pm/view"; | ||
function defineNodeView(options) { | ||
@@ -1206,3 +1191,2 @@ return defineFacetPayload(nodeViewFacet, [options]); | ||
import { PluginKey as PluginKey6, ProseMirrorPlugin as ProseMirrorPlugin6 } from "@prosekit/pm/state"; | ||
import "@prosekit/pm/view"; | ||
function defineNodeViewFactory(options) { | ||
@@ -1305,2 +1289,12 @@ const input = [options, null]; | ||
// src/utils/contains-inline-node.ts | ||
function containsInlineNode(doc, from, to) { | ||
let found = false; | ||
doc.nodesBetween(from, to, (node) => { | ||
if (found) return false; | ||
if (node.isInline) found = true; | ||
}); | ||
return found; | ||
} | ||
// src/utils/default-block-at.ts | ||
@@ -1367,2 +1361,3 @@ function defaultBlockAt(match) { | ||
collectNodes, | ||
containsInlineNode, | ||
createEditor, | ||
@@ -1369,0 +1364,0 @@ defaultBlockAt, |
{ | ||
"name": "@prosekit/core", | ||
"type": "module", | ||
"version": "0.0.0-next-20240715071354", | ||
"version": "0.0.0-next-20240724155246", | ||
"private": false, | ||
@@ -46,9 +46,9 @@ "author": { | ||
"prosemirror-splittable": "^0.1.1", | ||
"type-fest": "^4.21.0", | ||
"@prosekit/pm": "^0.0.0-next-20240715071354" | ||
"type-fest": "^4.23.0", | ||
"@prosekit/pm": "^0.0.0-next-20240724155246" | ||
}, | ||
"devDependencies": { | ||
"tsup": "^8.1.0", | ||
"tsup": "^8.2.2", | ||
"typescript": "^5.5.3", | ||
"vitest": "^2.0.2", | ||
"vitest": "^2.0.4", | ||
"@prosekit/dev": "0.0.0" | ||
@@ -55,0 +55,0 @@ }, |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
160411
5080
Updatedtype-fest@^4.23.0