@markput/react 0.12.1 → 0.14.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.
- package/index.d.ts +163 -103
- package/index.d.ts.map +1 -1
- package/index.js +1936 -1607
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -10763,15 +10763,108 @@ declare function annotate(markup: Markup, params: {
|
|
|
10763
10763
|
*/
|
|
10764
10764
|
declare function denote(value: string, callback: (mark: MarkToken) => string, markups: Markup[]): string;
|
|
10765
10765
|
//#endregion
|
|
10766
|
+
//#region ../../core/src/shared/editorContracts.d.ts
|
|
10767
|
+
type TokenPath = readonly number[];
|
|
10768
|
+
type TokenAddress = {
|
|
10769
|
+
readonly path: TokenPath;
|
|
10770
|
+
readonly parseGeneration: number;
|
|
10771
|
+
};
|
|
10772
|
+
type Result<T, Reason extends string> = {
|
|
10773
|
+
ok: true;
|
|
10774
|
+
value: T;
|
|
10775
|
+
} | {
|
|
10776
|
+
ok: false;
|
|
10777
|
+
reason: Reason;
|
|
10778
|
+
};
|
|
10779
|
+
type DomRef = (element: HTMLElement | null) => void;
|
|
10780
|
+
type RawRange = {
|
|
10781
|
+
readonly start: number;
|
|
10782
|
+
readonly end: number;
|
|
10783
|
+
};
|
|
10784
|
+
type RawSelection = {
|
|
10785
|
+
readonly range: RawRange;
|
|
10786
|
+
readonly direction?: 'forward' | 'backward';
|
|
10787
|
+
};
|
|
10788
|
+
type NodeLocationResult = Result<{
|
|
10789
|
+
readonly address: TokenAddress;
|
|
10790
|
+
readonly tokenElement: HTMLElement;
|
|
10791
|
+
readonly textElement?: HTMLElement;
|
|
10792
|
+
readonly rowElement?: HTMLElement;
|
|
10793
|
+
}, 'notIndexed' | 'outsideEditor' | 'control'>;
|
|
10794
|
+
type RawSelectionResult = Result<RawSelection, 'notIndexed' | 'outsideEditor' | 'control' | 'mixedBoundary' | 'invalidBoundary'>;
|
|
10795
|
+
type BoundaryPositionResult = Result<number, 'notIndexed' | 'outsideEditor' | 'control' | 'invalidBoundary' | 'composing'>;
|
|
10796
|
+
type EditResult = {
|
|
10797
|
+
ok: true;
|
|
10798
|
+
value: string;
|
|
10799
|
+
accepted: 'immediate' | 'pendingControlledEcho';
|
|
10800
|
+
} | {
|
|
10801
|
+
ok: false;
|
|
10802
|
+
reason: 'readOnly' | 'invalidRange' | 'stale';
|
|
10803
|
+
};
|
|
10804
|
+
type CaretRecovery = {
|
|
10805
|
+
readonly kind: 'caret';
|
|
10806
|
+
readonly rawPosition: number;
|
|
10807
|
+
readonly affinity?: 'before' | 'after';
|
|
10808
|
+
} | {
|
|
10809
|
+
readonly kind: 'selection';
|
|
10810
|
+
readonly selection: RawSelection;
|
|
10811
|
+
};
|
|
10812
|
+
type OptionalMarkFieldPatch = {
|
|
10813
|
+
readonly kind: 'set';
|
|
10814
|
+
readonly value: string;
|
|
10815
|
+
} | {
|
|
10816
|
+
readonly kind: 'clear';
|
|
10817
|
+
};
|
|
10818
|
+
type MarkPatch = {
|
|
10819
|
+
readonly value?: string;
|
|
10820
|
+
readonly meta?: OptionalMarkFieldPatch;
|
|
10821
|
+
readonly slot?: OptionalMarkFieldPatch;
|
|
10822
|
+
};
|
|
10823
|
+
type MarkSnapshot = {
|
|
10824
|
+
readonly value: string;
|
|
10825
|
+
readonly meta: string | undefined;
|
|
10826
|
+
readonly slot: string | undefined;
|
|
10827
|
+
readonly readOnly: boolean;
|
|
10828
|
+
};
|
|
10829
|
+
type MarkInfo = {
|
|
10830
|
+
readonly address: TokenAddress;
|
|
10831
|
+
readonly depth: number;
|
|
10832
|
+
readonly hasNestedMarks: boolean;
|
|
10833
|
+
readonly key: string;
|
|
10834
|
+
};
|
|
10835
|
+
type TokenShapeSnapshot = {
|
|
10836
|
+
readonly kind: 'text';
|
|
10837
|
+
} | {
|
|
10838
|
+
readonly kind: 'mark';
|
|
10839
|
+
readonly descriptor: MarkupDescriptor;
|
|
10840
|
+
readonly descriptorIndex: number;
|
|
10841
|
+
};
|
|
10842
|
+
type DomIndex = {
|
|
10843
|
+
readonly generation: number;
|
|
10844
|
+
};
|
|
10845
|
+
type CaretLocation = {
|
|
10846
|
+
readonly address: TokenAddress;
|
|
10847
|
+
readonly role: 'row' | 'token' | 'text' | 'markDescendant';
|
|
10848
|
+
};
|
|
10849
|
+
type DomDiagnostic = {
|
|
10850
|
+
readonly kind: 'missingRole' | 'stalePath' | 'outsideEditor' | 'controlBoundary' | 'mixedBoundary' | 'invalidBoundary' | 'renderReentry' | 'recoveryFailed' | 'missingContainer' | 'ambiguousStructure';
|
|
10851
|
+
readonly path?: TokenPath;
|
|
10852
|
+
readonly reason: string;
|
|
10853
|
+
};
|
|
10854
|
+
type EditSource = 'input' | 'paste' | 'cut' | 'overlay' | 'mark' | 'block' | 'drag';
|
|
10855
|
+
//#endregion
|
|
10766
10856
|
//#region ../../core/src/features/caret/CaretFeature.d.ts
|
|
10767
10857
|
declare class CaretFeature implements Feature {
|
|
10768
10858
|
#private;
|
|
10769
10859
|
private readonly _store;
|
|
10770
|
-
readonly recovery: Signal<
|
|
10860
|
+
readonly recovery: Signal<CaretRecovery | undefined>;
|
|
10861
|
+
readonly location: Signal<CaretLocation | undefined>;
|
|
10771
10862
|
readonly selecting: Signal<"drag" | "all" | undefined>;
|
|
10772
10863
|
constructor(_store: Store);
|
|
10773
10864
|
enable(): void;
|
|
10774
10865
|
disable(): void;
|
|
10866
|
+
placeAt(rawPosition: number, affinity?: 'before' | 'after'): Result<void, 'notIndexed' | 'invalidBoundary'>;
|
|
10867
|
+
focus(address: TokenAddress, boundary?: 'start' | 'end'): Result<void, 'notIndexed' | 'stale'>;
|
|
10775
10868
|
}
|
|
10776
10869
|
//#endregion
|
|
10777
10870
|
//#region ../../core/src/shared/signals/signal.d.ts
|
|
@@ -10855,10 +10948,22 @@ declare class ClipboardFeature {
|
|
|
10855
10948
|
declare class DomFeature {
|
|
10856
10949
|
#private;
|
|
10857
10950
|
private readonly _store;
|
|
10951
|
+
readonly index: Computed<DomIndex | undefined>;
|
|
10952
|
+
readonly container: Signal<HTMLElement | null>;
|
|
10953
|
+
readonly diagnostics: Event<DomDiagnostic>;
|
|
10858
10954
|
constructor(_store: Store);
|
|
10859
10955
|
enable(): void;
|
|
10860
10956
|
disable(): void;
|
|
10957
|
+
compositionStarted(): void;
|
|
10958
|
+
compositionEnded(): void;
|
|
10959
|
+
controlFor(ownerPath?: TokenPath): DomRef;
|
|
10960
|
+
childrenFor(ownerPath: TokenPath): DomRef;
|
|
10861
10961
|
reconcile(): void;
|
|
10962
|
+
locateNode(node: Node): NodeLocationResult;
|
|
10963
|
+
placeCaretAtRawPosition(rawPosition: number, affinity?: 'before' | 'after'): Result<void, 'notIndexed' | 'invalidBoundary'>;
|
|
10964
|
+
focusAddress(address: TokenAddress, boundary?: 'start' | 'end'): Result<void, 'notIndexed' | 'stale'>;
|
|
10965
|
+
rawPositionFromBoundary(node: Node, offset: number, affinity?: 'before' | 'after'): BoundaryPositionResult;
|
|
10966
|
+
readRawSelection(): RawSelectionResult;
|
|
10862
10967
|
}
|
|
10863
10968
|
//#endregion
|
|
10864
10969
|
//#region ../../core/src/features/drag/DragFeature.d.ts
|
|
@@ -10880,90 +10985,29 @@ declare class KeyboardFeature implements Feature {
|
|
|
10880
10985
|
disable(): void;
|
|
10881
10986
|
}
|
|
10882
10987
|
//#endregion
|
|
10883
|
-
//#region ../../core/src/shared/classes/MarkputHandler.d.ts
|
|
10884
|
-
declare class MarkputHandler {
|
|
10885
|
-
private readonly store;
|
|
10886
|
-
constructor(store: Store);
|
|
10887
|
-
get container(): HTMLDivElement | null;
|
|
10888
|
-
get overlay(): HTMLElement | null;
|
|
10889
|
-
focus(): void;
|
|
10890
|
-
}
|
|
10891
|
-
//#endregion
|
|
10892
|
-
//#region ../../core/src/shared/classes/KeyGenerator.d.ts
|
|
10893
|
-
declare class KeyGenerator {
|
|
10894
|
-
#private;
|
|
10895
|
-
get(object: object): number | undefined;
|
|
10896
|
-
}
|
|
10897
|
-
//#endregion
|
|
10898
|
-
//#region ../../core/src/shared/classes/NodeProxy.d.ts
|
|
10899
|
-
declare class NodeProxy {
|
|
10900
|
-
#private;
|
|
10901
|
-
get target(): HTMLElement | undefined;
|
|
10902
|
-
set target(value: Node | HTMLElement | EventTarget | undefined | null);
|
|
10903
|
-
get next(): NodeProxy;
|
|
10904
|
-
get prev(): NodeProxy;
|
|
10905
|
-
get isSpan(): boolean;
|
|
10906
|
-
get isMark(): boolean;
|
|
10907
|
-
get isEditable(): boolean;
|
|
10908
|
-
get isCaretAtBeginning(): boolean;
|
|
10909
|
-
get isCaretAtEnd(): boolean;
|
|
10910
|
-
get index(): number;
|
|
10911
|
-
get caret(): number;
|
|
10912
|
-
set caret(value: number);
|
|
10913
|
-
get length(): number;
|
|
10914
|
-
get content(): string;
|
|
10915
|
-
set content(value: string | undefined);
|
|
10916
|
-
get head(): HTMLElement | null;
|
|
10917
|
-
get tail(): HTMLElement | null;
|
|
10918
|
-
get isFocused(): boolean;
|
|
10919
|
-
constructor(target: Node | EventTarget | null | undefined, store: Store);
|
|
10920
|
-
setCaretToEnd(): void;
|
|
10921
|
-
focus(): void;
|
|
10922
|
-
clear(): void;
|
|
10923
|
-
}
|
|
10924
|
-
//#endregion
|
|
10925
10988
|
//#region ../../core/src/features/lifecycle/LifecycleFeature.d.ts
|
|
10926
10989
|
declare class LifecycleFeature implements Feature {
|
|
10927
|
-
private readonly _store;
|
|
10928
10990
|
readonly mounted: Event<void>;
|
|
10929
10991
|
readonly unmounted: Event<void>;
|
|
10930
10992
|
readonly rendered: Event<void>;
|
|
10931
|
-
constructor(_store: Store);
|
|
10932
10993
|
enable(): void;
|
|
10933
10994
|
disable(): void;
|
|
10934
10995
|
}
|
|
10935
10996
|
//#endregion
|
|
10936
|
-
//#region ../../core/src/features/mark/
|
|
10937
|
-
|
|
10938
|
-
current: T | null;
|
|
10939
|
-
}
|
|
10940
|
-
declare class MarkHandler<T extends HTMLElement = HTMLElement> {
|
|
10997
|
+
//#region ../../core/src/features/mark/MarkController.d.ts
|
|
10998
|
+
declare class MarkController {
|
|
10941
10999
|
#private;
|
|
10942
|
-
readonly
|
|
10943
|
-
|
|
10944
|
-
|
|
10945
|
-
|
|
10946
|
-
|
|
10947
|
-
|
|
10948
|
-
get readOnly(): boolean | undefined;
|
|
10949
|
-
set readOnly(value: boolean | undefined);
|
|
10950
|
-
get content(): string;
|
|
10951
|
-
set content(value: string);
|
|
10952
|
-
get value(): string | undefined;
|
|
10953
|
-
set value(v: string | undefined);
|
|
11000
|
+
private readonly store;
|
|
11001
|
+
private readonly address;
|
|
11002
|
+
private readonly snapshot;
|
|
11003
|
+
constructor(store: Store, address: TokenAddress, snapshot: MarkSnapshot, shape: TokenShapeSnapshot);
|
|
11004
|
+
static fromToken(store: Store, token: MarkToken): MarkController;
|
|
11005
|
+
get value(): string;
|
|
10954
11006
|
get meta(): string | undefined;
|
|
10955
|
-
set meta(v: string | undefined);
|
|
10956
11007
|
get slot(): string | undefined;
|
|
10957
|
-
get
|
|
10958
|
-
|
|
10959
|
-
|
|
10960
|
-
get tokens(): Token[];
|
|
10961
|
-
change: (props: {
|
|
10962
|
-
content: string;
|
|
10963
|
-
value?: string;
|
|
10964
|
-
meta?: string;
|
|
10965
|
-
}) => void;
|
|
10966
|
-
remove: () => void;
|
|
11008
|
+
get readOnly(): boolean;
|
|
11009
|
+
remove(): EditResult;
|
|
11010
|
+
update(patch: MarkPatch): EditResult;
|
|
10967
11011
|
}
|
|
10968
11012
|
//#endregion
|
|
10969
11013
|
//#region ../../core/src/features/slots/types.d.ts
|
|
@@ -10977,7 +11021,6 @@ interface OverlaySlot {
|
|
|
10977
11021
|
//#region ../../core/src/features/slots/SlotsFeature.d.ts
|
|
10978
11022
|
declare class SlotsFeature implements Feature {
|
|
10979
11023
|
private readonly _store;
|
|
10980
|
-
readonly container: Signal<HTMLDivElement | null>;
|
|
10981
11024
|
readonly isBlock: Computed<boolean>;
|
|
10982
11025
|
readonly isDraggable: Computed<boolean>;
|
|
10983
11026
|
readonly containerComponent: Computed<Slot>;
|
|
@@ -10997,23 +11040,14 @@ declare class SlotsFeature implements Feature {
|
|
|
10997
11040
|
//#endregion
|
|
10998
11041
|
//#region ../../core/src/features/mark/MarkFeature.d.ts
|
|
10999
11042
|
declare class MarkFeature implements Feature {
|
|
11000
|
-
#private;
|
|
11001
11043
|
private readonly _store;
|
|
11002
11044
|
readonly enabled: Computed<boolean>;
|
|
11003
11045
|
readonly slot: MarkSlot;
|
|
11004
|
-
readonly remove: Event<{
|
|
11005
|
-
token: Token;
|
|
11006
|
-
}>;
|
|
11007
11046
|
constructor(_store: Store);
|
|
11008
11047
|
enable(): void;
|
|
11009
11048
|
disable(): void;
|
|
11010
11049
|
}
|
|
11011
11050
|
//#endregion
|
|
11012
|
-
//#region ../../core/src/features/mark/types.d.ts
|
|
11013
|
-
interface MarkOptions {
|
|
11014
|
-
controlled?: boolean;
|
|
11015
|
-
}
|
|
11016
|
-
//#endregion
|
|
11017
11051
|
//#region ../../core/src/features/overlay/OverlayFeature.d.ts
|
|
11018
11052
|
declare class OverlayFeature implements Feature {
|
|
11019
11053
|
#private;
|
|
@@ -11031,40 +11065,72 @@ declare class OverlayFeature implements Feature {
|
|
|
11031
11065
|
disable(): void;
|
|
11032
11066
|
}
|
|
11033
11067
|
//#endregion
|
|
11068
|
+
//#region ../../core/src/features/parsing/tokenIndex.d.ts
|
|
11069
|
+
type TokenIndex = {
|
|
11070
|
+
readonly generation: number;
|
|
11071
|
+
pathFor(token: Token): TokenPath | undefined;
|
|
11072
|
+
addressFor(path: TokenPath): TokenAddress | undefined;
|
|
11073
|
+
resolve(path: TokenPath): Token | undefined;
|
|
11074
|
+
resolveAddress(address: TokenAddress, expected?: TokenShapeSnapshot): Result<Token, 'stale'>;
|
|
11075
|
+
key(path: TokenPath): string;
|
|
11076
|
+
equals(a: TokenPath, b: TokenPath): boolean;
|
|
11077
|
+
};
|
|
11078
|
+
//#endregion
|
|
11034
11079
|
//#region ../../core/src/features/parsing/ParseFeature.d.ts
|
|
11035
11080
|
declare class ParsingFeature implements Feature {
|
|
11036
11081
|
#private;
|
|
11037
11082
|
private readonly _store;
|
|
11038
11083
|
readonly tokens: Signal<Token[]>;
|
|
11084
|
+
readonly index: Computed<TokenIndex>;
|
|
11039
11085
|
readonly parser: Computed<Parser | undefined>;
|
|
11040
11086
|
readonly reparse: Event<void>;
|
|
11041
11087
|
constructor(_store: Store);
|
|
11088
|
+
parseValue(value: string): Token[];
|
|
11089
|
+
acceptTokens(tokens: Token[]): void;
|
|
11042
11090
|
enable(): void;
|
|
11043
11091
|
disable(): void;
|
|
11044
|
-
sync(): void;
|
|
11092
|
+
sync(value?: string): void;
|
|
11045
11093
|
}
|
|
11046
11094
|
//#endregion
|
|
11047
11095
|
//#region ../../core/src/features/value/ValueFeature.d.ts
|
|
11048
11096
|
declare class ValueFeature implements Feature {
|
|
11049
11097
|
#private;
|
|
11050
11098
|
private readonly _store;
|
|
11051
|
-
readonly
|
|
11052
|
-
readonly
|
|
11053
|
-
readonly current: Computed<string>;
|
|
11099
|
+
readonly current: Signal<string>;
|
|
11100
|
+
readonly isControlledMode: Computed<boolean>;
|
|
11054
11101
|
readonly change: Event<void>;
|
|
11055
11102
|
constructor(_store: Store);
|
|
11056
11103
|
enable(): void;
|
|
11057
11104
|
disable(): void;
|
|
11105
|
+
replaceRange(range: RawRange, replacement: string, options?: {
|
|
11106
|
+
recover?: CaretRecovery;
|
|
11107
|
+
source?: EditSource;
|
|
11108
|
+
}): EditResult;
|
|
11109
|
+
replaceAll(next: string, options?: {
|
|
11110
|
+
recover?: CaretRecovery;
|
|
11111
|
+
source?: EditSource;
|
|
11112
|
+
}): EditResult;
|
|
11113
|
+
}
|
|
11114
|
+
//#endregion
|
|
11115
|
+
//#region ../../core/src/shared/classes/MarkputHandler.d.ts
|
|
11116
|
+
declare class MarkputHandler {
|
|
11117
|
+
private readonly store;
|
|
11118
|
+
constructor(store: Store);
|
|
11119
|
+
get container(): HTMLElement | null;
|
|
11120
|
+
get overlay(): HTMLElement | null;
|
|
11121
|
+
focus(): void;
|
|
11122
|
+
}
|
|
11123
|
+
//#endregion
|
|
11124
|
+
//#region ../../core/src/shared/classes/KeyGenerator.d.ts
|
|
11125
|
+
declare class KeyGenerator {
|
|
11126
|
+
#private;
|
|
11127
|
+
get(object: object): number | undefined;
|
|
11058
11128
|
}
|
|
11059
11129
|
//#endregion
|
|
11060
11130
|
//#region ../../core/src/store/Store.d.ts
|
|
11061
11131
|
declare class Store {
|
|
11062
11132
|
readonly key: KeyGenerator;
|
|
11063
11133
|
readonly blocks: BlockRegistry;
|
|
11064
|
-
readonly nodes: {
|
|
11065
|
-
focus: NodeProxy;
|
|
11066
|
-
input: NodeProxy;
|
|
11067
|
-
};
|
|
11068
11134
|
readonly props: PropsFeature;
|
|
11069
11135
|
readonly handler: MarkputHandler;
|
|
11070
11136
|
readonly lifecycle: LifecycleFeature;
|
|
@@ -11151,21 +11217,12 @@ type OverlayMatch<TOption = CoreOption> = {
|
|
|
11151
11217
|
* Html element, in which was a overlayMatch
|
|
11152
11218
|
*/
|
|
11153
11219
|
node: Node;
|
|
11154
|
-
|
|
11155
|
-
* Start position of a overlayMatch
|
|
11156
|
-
*/
|
|
11157
|
-
index: number;
|
|
11220
|
+
range: RawRange;
|
|
11158
11221
|
/**
|
|
11159
11222
|
* OverlayMatch's option
|
|
11160
11223
|
*/
|
|
11161
11224
|
option: TOption;
|
|
11162
11225
|
};
|
|
11163
|
-
type Recovery = {
|
|
11164
|
-
anchor: NodeProxy;
|
|
11165
|
-
isNext?: boolean;
|
|
11166
|
-
caret: number;
|
|
11167
|
-
childIndex?: number;
|
|
11168
|
-
};
|
|
11169
11226
|
type OverlayTrigger = Array<'change' | 'selectionChange'> | 'change' | 'selectionChange' | 'none';
|
|
11170
11227
|
type CSSProperties$1 = Properties<string | number>;
|
|
11171
11228
|
type DataAttributes = Record<`data${Capitalize<string>}`, string | number | boolean | undefined>;
|
|
@@ -11346,7 +11403,10 @@ interface MarkedInputProps<TMarkProps = MarkProps, TOverlayProps extends CoreOpt
|
|
|
11346
11403
|
declare function MarkedInput<TMarkProps = MarkProps, TOverlayProps extends CoreOption['overlay'] = OverlayProps>(props: MarkedInputProps<TMarkProps, TOverlayProps>): _$react_jsx_runtime0.JSX.Element;
|
|
11347
11404
|
//#endregion
|
|
11348
11405
|
//#region src/lib/hooks/useMark.d.ts
|
|
11349
|
-
declare const useMark:
|
|
11406
|
+
declare const useMark: () => MarkController;
|
|
11407
|
+
//#endregion
|
|
11408
|
+
//#region src/lib/hooks/useMarkInfo.d.ts
|
|
11409
|
+
declare const useMarkInfo: () => MarkInfo;
|
|
11350
11410
|
//#endregion
|
|
11351
11411
|
//#region src/lib/hooks/useOverlay.d.ts
|
|
11352
11412
|
interface OverlayHandler {
|
|
@@ -11370,5 +11430,5 @@ type ObjectSelector = Record<string, Selectable<unknown> | unknown>;
|
|
|
11370
11430
|
declare function useMarkput<T>(selector: (store: Store) => Selectable<T>): T;
|
|
11371
11431
|
declare function useMarkput<R extends ObjectSelector>(selector: (store: Store) => R): SignalValues<R>;
|
|
11372
11432
|
//#endregion
|
|
11373
|
-
export {
|
|
11433
|
+
export { MarkController, type MarkProps, type MarkToken, MarkedInput, type MarkedInputProps, MarkputHandler, type Markup, type Option, type OverlayHandler, type OverlayProps, type TextToken, type Token, annotate, denote, useMark, useMarkInfo, useMarkput, useOverlay };
|
|
11374
11434
|
//# sourceMappingURL=index.d.ts.map
|