@prosekit/core
Advanced tools
Comparing version 0.0.16 to 0.0.17
@@ -59,2 +59,4 @@ import { Attrs } from '@prosekit/pm/model'; | ||
export declare function attrsMatch(nodeOrMark: ProseMirrorNode | Mark, attrs: Attrs): boolean; | ||
export declare function collectNodes(content: NodeContent): ProseMirrorNode[]; | ||
@@ -67,3 +69,5 @@ | ||
/** @internal */ | ||
/** | ||
* @internal | ||
*/ | ||
declare interface CommandArgs { | ||
@@ -89,3 +93,5 @@ [name: string]: any[]; | ||
/** @public */ | ||
/** | ||
* @public | ||
*/ | ||
declare function createEditor<E extends Extension>({ extension, defaultDoc, defaultSelection, }: EditorOptions<E>): Editor<E>; | ||
@@ -148,3 +154,5 @@ export { createEditor } | ||
/** @public */ | ||
/** | ||
* @public | ||
*/ | ||
declare function defineBaseKeymap(): Extension<ExtensionTyping<string, string, CommandArgs>>; | ||
@@ -166,3 +174,5 @@ export { defineBaseKeymap } | ||
/** @public */ | ||
/** | ||
* @public | ||
*/ | ||
declare function defineDoc(): Extension< { | ||
@@ -204,3 +214,5 @@ NODES: "doc"; | ||
/** @public */ | ||
/** | ||
* @public | ||
*/ | ||
declare function defineKeymap(keymap: Keymap): Extension; | ||
@@ -270,3 +282,5 @@ export { defineKeymap } | ||
/** @public */ | ||
/** | ||
* @public | ||
*/ | ||
declare function defineText(): Extension< { | ||
@@ -278,3 +292,5 @@ NODES: "text"; | ||
/** @public */ | ||
/** | ||
* @public | ||
*/ | ||
declare class Editor<E extends Extension = any> { | ||
@@ -284,3 +300,5 @@ private instance; | ||
private afterMounted; | ||
/** @internal */ | ||
/** | ||
* @internal | ||
*/ | ||
static create(instance: any): Editor<any>; | ||
@@ -308,3 +326,5 @@ get mounted(): boolean; | ||
/** @public */ | ||
/** | ||
* @public | ||
*/ | ||
declare interface EditorOptions<E extends Extension> { | ||
@@ -404,15 +424,27 @@ /** | ||
/** @public */ | ||
/** | ||
* @public | ||
*/ | ||
declare class Facet<Input, Output> { | ||
/** @internal */ | ||
/** | ||
* @internal | ||
*/ | ||
readonly index: number; | ||
/** @internal */ | ||
/** | ||
* @internal | ||
*/ | ||
readonly converter: () => FacetConverter<Input, Output>; | ||
/** @internal */ | ||
/** | ||
* @internal | ||
*/ | ||
readonly next: Facet<Output, any> | null; | ||
/** @internal */ | ||
/** | ||
* @internal | ||
*/ | ||
readonly singleton: boolean; | ||
private constructor(); | ||
static define<Input, Output>({ converter: converter, convert: convert, next, singleton, }: FacetOptions<Input, Output>): Facet<Input, Output>; | ||
/** @internal */ | ||
/** | ||
* @internal | ||
*/ | ||
static defineRootFacet<Input>(options: Omit<FacetOptions<Input, Input>, 'next'>): Facet<Input, Input>; | ||
@@ -424,3 +456,5 @@ extension(payloads: Input[]): FacetExtension<Input, Output>; | ||
/** @public */ | ||
/** | ||
* @public | ||
*/ | ||
export declare interface FacetConverter<Input = any, Output = any> { | ||
@@ -431,3 +465,5 @@ create: (inputs: Input[]) => Output; | ||
/** @public */ | ||
/** | ||
* @public | ||
*/ | ||
declare class FacetExtension<Input, Output> { | ||
@@ -442,3 +478,5 @@ readonly facet: Facet<Input, Output>; | ||
/** @public */ | ||
/** | ||
* @public | ||
*/ | ||
declare interface FacetOptions<Input, Output> { | ||
@@ -457,3 +495,5 @@ convert?: (payloads: Input[]) => Output; | ||
/** @internal */ | ||
/** | ||
* @internal | ||
*/ | ||
declare function getMarkType(schema: Schema, type: string | MarkType): MarkType; | ||
@@ -463,3 +503,5 @@ export { getMarkType } | ||
/** @internal */ | ||
/** | ||
* @internal | ||
*/ | ||
declare function getNodeType(schema: Schema, type: string | NodeType): NodeType; | ||
@@ -503,3 +545,5 @@ export { getNodeType } | ||
/** @public */ | ||
/** | ||
* @public | ||
*/ | ||
declare interface Keymap { | ||
@@ -588,3 +632,5 @@ [key: string]: Command; | ||
/** @internal */ | ||
/** | ||
* @internal | ||
*/ | ||
declare const pluginFacet: Facet<PluginPayload, StatePayload>; | ||
@@ -594,3 +640,5 @@ export { pluginFacet } | ||
/** @internal */ | ||
/** | ||
* @internal | ||
*/ | ||
declare type PluginPayload = (context: { | ||
@@ -746,3 +794,5 @@ schema: Schema; | ||
/** @public */ | ||
/** | ||
* @public | ||
*/ | ||
declare function withPriority<T extends Extension>(extension: T, priority: Priority): T; | ||
@@ -749,0 +799,0 @@ export { withPriority } |
@@ -157,28 +157,9 @@ // src/commands/add-mark.ts | ||
// src/utils/object-euqal.ts | ||
function objectEqual(a, b) { | ||
if (a === b) { | ||
return true; | ||
} | ||
if (typeof a !== "object" || typeof b !== "object") { | ||
return false; | ||
} | ||
if (a === null || b === null) { | ||
return false; | ||
} | ||
if (Array.isArray(a) || Array.isArray(b)) { | ||
return false; | ||
} | ||
const aKeys = Object.keys(a); | ||
const bKeys = Object.keys(b); | ||
if (aKeys.length !== bKeys.length) { | ||
return false; | ||
} | ||
for (const key of aKeys) { | ||
if (!bKeys.includes(key)) { | ||
// src/utils/attrs-match.ts | ||
function attrsMatch(nodeOrMark, attrs) { | ||
const currentAttrs = nodeOrMark.attrs; | ||
for (const [key, value] of Object.entries(attrs)) { | ||
if (currentAttrs[key] !== value) { | ||
return false; | ||
} | ||
if (!objectEqual(a[key], b[key])) { | ||
return false; | ||
} | ||
} | ||
@@ -194,3 +175,3 @@ return true; | ||
const node = $pos.node(depth); | ||
if (node.type === nodeType && (!attrs || objectEqual(attrs, node.attrs))) { | ||
if (node.type === nodeType && (!attrs || attrsMatch(node, attrs))) { | ||
return true; | ||
@@ -257,3 +238,5 @@ } | ||
constructor(converter, next, singleton) { | ||
/** @internal */ | ||
/** | ||
* @internal | ||
*/ | ||
this.index = facetCount++; | ||
@@ -279,3 +262,5 @@ this.converter = converter; | ||
} | ||
/** @internal */ | ||
/** | ||
* @internal | ||
*/ | ||
static defineRootFacet(options) { | ||
@@ -812,3 +797,5 @@ return _Facet.define(options); | ||
} | ||
/** @internal */ | ||
/** | ||
* @internal | ||
*/ | ||
static create(instance) { | ||
@@ -815,0 +802,0 @@ if (!(instance instanceof EditorInstance)) { |
{ | ||
"name": "@prosekit/core", | ||
"type": "module", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"private": false, | ||
@@ -41,3 +41,3 @@ "author": { | ||
"dependencies": { | ||
"@prosekit/pm": "^0.0.6", | ||
"@prosekit/pm": "^0.0.7", | ||
"orderedmap": "^2.1.1", | ||
@@ -44,0 +44,0 @@ "type-fest": "^4.6.0" |
Sorry, the diff of this file is not supported yet
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
62125
7
1992
+ Added@prosekit/pm@0.0.7(transitive)
- Removed@prosekit/pm@0.0.6(transitive)
Updated@prosekit/pm@^0.0.7