Latest repo

This commit is contained in:
Marc
2025-06-02 16:42:16 +00:00
parent 53ddf1a329
commit cde5fae175
27907 changed files with 3875388 additions and 1 deletions

View File

@@ -0,0 +1,17 @@
import * as Registry from '../registry';
export interface AttributorOptions {
scope?: Registry.Scope;
whitelist?: string[];
}
export default class Attributor {
attrName: string;
keyName: string;
scope: Registry.Scope;
whitelist: string[] | undefined;
static keys(node: HTMLElement): string[];
constructor(attrName: string, keyName: string, options?: AttributorOptions);
add(node: HTMLElement, value: string): boolean;
canAdd(node: HTMLElement, value: any): boolean;
remove(node: HTMLElement): void;
value(node: HTMLElement): string;
}

View File

@@ -0,0 +1,8 @@
import Attributor from './attributor';
declare class ClassAttributor extends Attributor {
static keys(node: HTMLElement): string[];
add(node: HTMLElement, value: string): boolean;
remove(node: HTMLElement): void;
value(node: HTMLElement): string;
}
export default ClassAttributor;

15
node_modules/parchment/dist/src/attributor/store.d.ts generated vendored Normal file
View File

@@ -0,0 +1,15 @@
import Attributor from './attributor';
import { Formattable } from '../blot/abstract/blot';
declare class AttributorStore {
private attributes;
private domNode;
constructor(domNode: HTMLElement);
attribute(attribute: Attributor, value: any): void;
build(): void;
copy(target: Formattable): void;
move(target: Formattable): void;
values(): {
[key: string]: any;
};
}
export default AttributorStore;

View File

@@ -0,0 +1,8 @@
import Attributor from './attributor';
declare class StyleAttributor extends Attributor {
static keys(node: Element): string[];
add(node: HTMLElement, value: string): boolean;
remove(node: HTMLElement): void;
value(node: HTMLElement): string;
}
export default StyleAttributor;

View File

@@ -0,0 +1,63 @@
import LinkedList from '../../collection/linked-list';
import LinkedNode from '../../collection/linked-node';
export interface Blot extends LinkedNode {
scroll: Parent;
parent: Parent;
prev: Blot;
next: Blot;
domNode: Node;
attach(): void;
clone(): Blot;
detach(): void;
insertInto(parentBlot: Parent, refBlot?: Blot): void;
isolate(index: number, length: number): Blot;
offset(root?: Blot): number;
remove(): void;
replace(target: Blot): void;
replaceWith(name: string, value: any): Blot;
replaceWith(replacement: Blot): Blot;
split(index: number, force?: boolean): Blot;
wrap(name: string, value: any): Parent;
wrap(wrapper: Parent): Parent;
deleteAt(index: number, length: number): void;
formatAt(index: number, length: number, name: string, value: any): void;
insertAt(index: number, value: string, def?: any): void;
optimize(context: {
[key: string]: any;
}): void;
optimize(mutations: MutationRecord[], context: {
[key: string]: any;
}): void;
update(mutations: MutationRecord[], context: {
[key: string]: any;
}): void;
}
export interface Parent extends Blot {
children: LinkedList<Blot>;
domNode: HTMLElement;
appendChild(child: Blot): void;
descendant<T>(type: {
new (): T;
}, index: number): [T, number];
descendant<T>(matcher: (blot: Blot) => boolean, index: number): [T, number];
descendants<T>(type: {
new (): T;
}, index: number, length: number): T[];
descendants<T>(matcher: (blot: Blot) => boolean, index: number, length: number): T[];
insertBefore(child: Blot, refNode?: Blot): void;
moveChildren(parent: Parent, refNode?: Blot): void;
path(index: number, inclusive?: boolean): [Blot, number][];
removeChild(child: Blot): void;
unwrap(): void;
}
export interface Formattable extends Blot {
format(name: string, value: any): void;
formats(): {
[index: string]: any;
};
}
export interface Leaf extends Blot {
index(node: Node, offset: number): number;
position(index: number, inclusive: boolean): [Node, number];
value(): any;
}

View File

@@ -0,0 +1,40 @@
import { Blot, Parent } from './blot';
import LinkedList from '../../collection/linked-list';
import ShadowBlot from './shadow';
declare class ContainerBlot extends ShadowBlot implements Parent {
static defaultChild: string;
static allowedChildren: any[];
children: LinkedList<Blot>;
domNode: HTMLElement;
constructor(domNode: Node);
appendChild(other: Blot): void;
attach(): void;
build(): void;
deleteAt(index: number, length: number): void;
descendant(criteria: {
new (): Blot;
}, index: number): [Blot | null, number];
descendant(criteria: (blot: Blot) => boolean, index: number): [Blot | null, number];
descendants(criteria: {
new (): Blot;
}, index: number, length: number): Blot[];
descendants(criteria: (blot: Blot) => boolean, index: number, length: number): Blot[];
detach(): void;
formatAt(index: number, length: number, name: string, value: any): void;
insertAt(index: number, value: string, def?: any): void;
insertBefore(childBlot: Blot, refBlot?: Blot): void;
length(): number;
moveChildren(targetParent: Parent, refNode?: Blot): void;
optimize(context: {
[key: string]: any;
}): void;
path(index: number, inclusive?: boolean): [Blot, number][];
removeChild(child: Blot): void;
replace(target: Blot): void;
split(index: number, force?: boolean): Blot;
unwrap(): void;
update(mutations: MutationRecord[], context: {
[key: string]: any;
}): void;
}
export default ContainerBlot;

View File

@@ -0,0 +1,18 @@
import AttributorStore from '../../attributor/store';
import { Blot, Parent, Formattable } from './blot';
import ContainerBlot from './container';
declare class FormatBlot extends ContainerBlot implements Formattable {
protected attributes: AttributorStore;
static formats(domNode: HTMLElement): any;
constructor(domNode: Node);
format(name: string, value: any): void;
formats(): {
[index: string]: any;
};
replaceWith(name: string | Blot, value?: any): Blot;
update(mutations: MutationRecord[], context: {
[key: string]: any;
}): void;
wrap(name: string | Parent, value?: any): Parent;
}
export default FormatBlot;

View File

@@ -0,0 +1,11 @@
import { Leaf } from './blot';
import ShadowBlot from './shadow';
import * as Registry from '../../registry';
declare class LeafBlot extends ShadowBlot implements Leaf {
static scope: Registry.Scope;
static value(domNode: Node): any;
index(node: Node, offset: number): number;
position(index: number, inclusive?: boolean): [Node, number];
value(): any;
}
export default LeafBlot;

View File

@@ -0,0 +1,41 @@
import { Blot, Parent } from './blot';
import LinkedList from '../../collection/linked-list';
import ShadowBlot from './shadow';
import * as Registry from '../../registry';
declare class ParentBlot extends ShadowBlot implements Parent {
static defaultChild: Registry.BlotConstructor | null;
static allowedChildren: Registry.BlotConstructor[] | null;
children: LinkedList<Blot>;
domNode: HTMLElement;
constructor(domNode: Node);
appendChild(other: Blot): void;
attach(): void;
build(): void;
deleteAt(index: number, length: number): number;
descendant(criteria: {
new (): Blot;
}, index: number): [Blot | null, number];
descendant(criteria: (blot: Blot) => boolean, index: number): [Blot | null, number];
descendants(criteria: {
new (): Blot;
}, index: number, length: number): Blot[];
descendants(criteria: (blot: Blot) => boolean, index: number, length: number): Blot[];
detach(): void;
formatAt(index: number, length: number, name: string, value: any): void;
insertAt(index: number, value: string, def?: any): number;
insertBefore(childBlot: Blot, refBlot?: Blot | null): void;
length(): number;
moveChildren(targetParent: Parent, refNode?: Blot): void;
optimize(context: {
[key: string]: any;
}): void;
path(index: number, inclusive?: boolean): [Blot, number][];
removeChild(child: Blot): void;
replaceWith(name: string | Blot, value?: any): Blot;
split(index: number, force?: boolean): Blot | null;
unwrap(): void;
update(mutations: MutationRecord[], context: {
[key: string]: any;
}): void;
}
export default ParentBlot;

View File

@@ -0,0 +1,38 @@
import { Blot, Parent } from './blot';
import * as Registry from '../../registry';
declare class ShadowBlot implements Blot {
domNode: Node;
static blotName: string;
static className: string;
static scope: Registry.Scope;
static tagName: string;
prev: Blot;
next: Blot;
parent: Parent;
scroll: Parent;
readonly statics: any;
static create(value: any): Node;
constructor(domNode: Node);
attach(): void;
clone(): Blot;
detach(): void;
deleteAt(index: number, length: number): void;
formatAt(index: number, length: number, name: string, value: any): void;
insertAt(index: number, value: string, def?: any): void;
insertInto(parentBlot: Parent, refBlot?: Blot | null): void;
isolate(index: number, length: number): Blot;
length(): number;
offset(root?: Blot): number;
optimize(context: {
[key: string]: any;
}): void;
remove(): void;
replace(target: Blot): void;
replaceWith(name: string | Blot, value?: any): Blot;
split(index: number, force?: boolean): Blot;
update(mutations: MutationRecord[], context: {
[key: string]: any;
}): void;
wrap(name: string | Parent, value?: any): Parent;
}
export default ShadowBlot;

15
node_modules/parchment/dist/src/blot/block.d.ts generated vendored Normal file
View File

@@ -0,0 +1,15 @@
import FormatBlot from './abstract/format';
import * as Registry from '../registry';
declare class BlockBlot extends FormatBlot {
static blotName: string;
static scope: Registry.Scope;
static tagName: string;
static formats(domNode: HTMLElement): any;
format(name: string, value: any): void;
formatAt(index: number, length: number, name: string, value: any): void;
insertAt(index: number, value: string, def?: any): void;
update(mutations: MutationRecord[], context: {
[key: string]: any;
}): void;
}
export default BlockBlot;

11
node_modules/parchment/dist/src/blot/embed.d.ts generated vendored Normal file
View File

@@ -0,0 +1,11 @@
import { Formattable } from './abstract/blot';
import LeafBlot from './abstract/leaf';
declare class EmbedBlot extends LeafBlot implements Formattable {
static formats(domNode: HTMLElement): any;
format(name: string, value: any): void;
formatAt(index: number, length: number, name: string, value: any): void;
formats(): {
[index: string]: any;
};
}
export default EmbedBlot;

14
node_modules/parchment/dist/src/blot/inline.d.ts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
import FormatBlot from './abstract/format';
import * as Registry from '../registry';
declare class InlineBlot extends FormatBlot {
static blotName: string;
static scope: Registry.Scope;
static tagName: string;
static formats(domNode: HTMLElement): any;
format(name: string, value: any): void;
formatAt(index: number, length: number, name: string, value: any): void;
optimize(context: {
[key: string]: any;
}): void;
}
export default InlineBlot;

24
node_modules/parchment/dist/src/blot/scroll.d.ts generated vendored Normal file
View File

@@ -0,0 +1,24 @@
import ContainerBlot from './abstract/container';
import * as Registry from '../registry';
declare class ScrollBlot extends ContainerBlot {
static blotName: string;
static defaultChild: string;
static scope: Registry.Scope;
static tagName: string;
observer: MutationObserver;
constructor(node: HTMLDivElement);
detach(): void;
deleteAt(index: number, length: number): void;
formatAt(index: number, length: number, name: string, value: any): void;
insertAt(index: number, value: string, def?: any): void;
optimize(context: {
[key: string]: any;
}): void;
optimize(mutations: MutationRecord[], context: {
[key: string]: any;
}): void;
update(mutations?: MutationRecord[], context?: {
[key: string]: any;
}): void;
}
export default ScrollBlot;

26
node_modules/parchment/dist/src/blot/text.d.ts generated vendored Normal file
View File

@@ -0,0 +1,26 @@
import { Blot, Leaf } from './abstract/blot';
import LeafBlot from './abstract/leaf';
import * as Registry from '../registry';
declare class TextBlot extends LeafBlot implements Leaf {
static blotName: string;
static scope: Registry.Scope;
domNode: Text;
protected text: string;
static create(value: string): Text;
static value(domNode: Text): string;
constructor(node: Node);
deleteAt(index: number, length: number): void;
index(node: Node, offset: number): number;
insertAt(index: number, value: string, def?: any): void;
length(): number;
optimize(context: {
[key: string]: any;
}): void;
position(index: number, inclusive?: boolean): [Node, number];
split(index: number, force?: boolean): Blot;
update(mutations: MutationRecord[], context: {
[key: string]: any;
}): void;
value(): string;
}
export default TextBlot;

View File

@@ -0,0 +1,19 @@
import LinkedNode from './linked-node';
declare class LinkedList<T extends LinkedNode> {
head: T | null;
tail: T | null;
length: number;
constructor();
append(...nodes: T[]): void;
contains(node: T): boolean;
insertBefore(node: T | null, refNode: T | null): void;
offset(target: T): number;
remove(node: T): void;
iterator(curNode?: T | null): () => T | null;
find(index: number, inclusive?: boolean): [T | null, number];
forEach(callback: (cur: T) => void): void;
forEachAt(index: number, length: number, callback: (cur: T, offset: number, length: number) => void): void;
map(callback: (cur: T | null) => any): any[];
reduce<M>(callback: (memo: M, cur: T) => M, memo: M): M;
}
export default LinkedList;

View File

@@ -0,0 +1,6 @@
interface LinkedNode {
prev: LinkedNode | null;
next: LinkedNode | null;
length(): number;
}
export default LinkedNode;

35
node_modules/parchment/dist/src/parchment.d.ts generated vendored Normal file
View File

@@ -0,0 +1,35 @@
import ContainerBlot from './blot/abstract/container';
import FormatBlot from './blot/abstract/format';
import LeafBlot from './blot/abstract/leaf';
import ScrollBlot from './blot/scroll';
import InlineBlot from './blot/inline';
import BlockBlot from './blot/block';
import EmbedBlot from './blot/embed';
import TextBlot from './blot/text';
import Attributor from './attributor/attributor';
import ClassAttributor from './attributor/class';
import StyleAttributor from './attributor/style';
import AttributorStore from './attributor/store';
import * as Registry from './registry';
declare let Parchment: {
Scope: typeof Registry.Scope;
create: typeof Registry.create;
find: typeof Registry.find;
query: typeof Registry.query;
register: typeof Registry.register;
Container: typeof ContainerBlot;
Format: typeof FormatBlot;
Leaf: typeof LeafBlot;
Embed: typeof EmbedBlot;
Scroll: typeof ScrollBlot;
Block: typeof BlockBlot;
Inline: typeof InlineBlot;
Text: typeof TextBlot;
Attributor: {
Attribute: typeof Attributor;
Class: typeof ClassAttributor;
Style: typeof StyleAttributor;
Store: typeof AttributorStore;
};
};
export default Parchment;

31
node_modules/parchment/dist/src/registry.d.ts generated vendored Normal file
View File

@@ -0,0 +1,31 @@
import Attributor from './attributor/attributor';
import { Blot } from './blot/abstract/blot';
export interface BlotConstructor {
blotName: string;
new (node: Node, value?: any): Blot;
create(value?: any): Node;
}
export declare class ParchmentError extends Error {
message: string;
name: string;
stack: string;
constructor(message: string);
}
export declare const DATA_KEY = "__blot";
export declare enum Scope {
TYPE = 3,
LEVEL = 12,
ATTRIBUTE = 13,
BLOT = 14,
INLINE = 7,
BLOCK = 11,
BLOCK_BLOT = 10,
INLINE_BLOT = 6,
BLOCK_ATTRIBUTE = 9,
INLINE_ATTRIBUTE = 5,
ANY = 15,
}
export declare function create(input: Node | string | Scope, value?: any): Blot;
export declare function find(node: Node | null, bubble?: boolean): Blot | null;
export declare function query(query: string | Node | Scope, scope?: Scope): Attributor | BlotConstructor | null;
export declare function register(...Definitions: any[]): any;