@markput/react 0.10.1 → 0.11.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 +68 -68
- package/index.d.ts.map +1 -1
- package/index.js +561 -648
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -10758,7 +10758,7 @@ declare function denote(value: string, callback: (mark: MarkToken) => string, ma
|
|
|
10758
10758
|
//#region ../../core/src/features/arrownav/ArrowNavFeature.d.ts
|
|
10759
10759
|
declare class ArrowNavFeature {
|
|
10760
10760
|
#private;
|
|
10761
|
-
private store;
|
|
10761
|
+
private readonly store;
|
|
10762
10762
|
constructor(store: Store);
|
|
10763
10763
|
enable(): void;
|
|
10764
10764
|
disable(): void;
|
|
@@ -10767,7 +10767,7 @@ declare class ArrowNavFeature {
|
|
|
10767
10767
|
//#region ../../core/src/features/block-editing/BlockEditFeature.d.ts
|
|
10768
10768
|
declare class BlockEditFeature {
|
|
10769
10769
|
#private;
|
|
10770
|
-
private store;
|
|
10770
|
+
private readonly store;
|
|
10771
10771
|
constructor(store: Store);
|
|
10772
10772
|
enable(): void;
|
|
10773
10773
|
disable(): void;
|
|
@@ -10808,7 +10808,7 @@ declare class BlockRegistry {
|
|
|
10808
10808
|
//#region ../../core/src/features/clipboard/CopyFeature.d.ts
|
|
10809
10809
|
declare class CopyFeature {
|
|
10810
10810
|
#private;
|
|
10811
|
-
private store;
|
|
10811
|
+
private readonly store;
|
|
10812
10812
|
constructor(store: Store);
|
|
10813
10813
|
enable(): void;
|
|
10814
10814
|
disable(): void;
|
|
@@ -10817,7 +10817,7 @@ declare class CopyFeature {
|
|
|
10817
10817
|
//#region ../../core/src/features/drag/DragFeature.d.ts
|
|
10818
10818
|
declare class DragFeature {
|
|
10819
10819
|
#private;
|
|
10820
|
-
private store;
|
|
10820
|
+
private readonly store;
|
|
10821
10821
|
constructor(store: Store);
|
|
10822
10822
|
enable(): void;
|
|
10823
10823
|
disable(): void;
|
|
@@ -10826,7 +10826,7 @@ declare class DragFeature {
|
|
|
10826
10826
|
//#region ../../core/src/features/editable/ContentEditableFeature.d.ts
|
|
10827
10827
|
declare class ContentEditableFeature {
|
|
10828
10828
|
#private;
|
|
10829
|
-
private store;
|
|
10829
|
+
private readonly store;
|
|
10830
10830
|
constructor(store: Store);
|
|
10831
10831
|
enable(): void;
|
|
10832
10832
|
disable(): void;
|
|
@@ -10836,7 +10836,7 @@ declare class ContentEditableFeature {
|
|
|
10836
10836
|
//#region ../../core/src/features/events/SystemListenerFeature.d.ts
|
|
10837
10837
|
declare class SystemListenerFeature {
|
|
10838
10838
|
#private;
|
|
10839
|
-
private store;
|
|
10839
|
+
private readonly store;
|
|
10840
10840
|
constructor(store: Store);
|
|
10841
10841
|
enable(): void;
|
|
10842
10842
|
disable(): void;
|
|
@@ -10845,7 +10845,7 @@ declare class SystemListenerFeature {
|
|
|
10845
10845
|
//#region ../../core/src/features/focus/FocusFeature.d.ts
|
|
10846
10846
|
declare class FocusFeature {
|
|
10847
10847
|
#private;
|
|
10848
|
-
private store;
|
|
10848
|
+
private readonly store;
|
|
10849
10849
|
constructor(store: Store);
|
|
10850
10850
|
enable(): void;
|
|
10851
10851
|
disable(): void;
|
|
@@ -10853,7 +10853,7 @@ declare class FocusFeature {
|
|
|
10853
10853
|
//#endregion
|
|
10854
10854
|
//#region ../../core/src/shared/classes/MarkputHandler.d.ts
|
|
10855
10855
|
declare class MarkputHandler {
|
|
10856
|
-
private store;
|
|
10856
|
+
private readonly store;
|
|
10857
10857
|
constructor(store: Store);
|
|
10858
10858
|
get container(): HTMLDivElement | null;
|
|
10859
10859
|
get overlay(): HTMLElement | null;
|
|
@@ -10876,8 +10876,8 @@ declare class NodeProxy {
|
|
|
10876
10876
|
get isSpan(): boolean;
|
|
10877
10877
|
get isMark(): boolean;
|
|
10878
10878
|
get isEditable(): boolean;
|
|
10879
|
-
get isCaretAtBeginning(): boolean
|
|
10880
|
-
get isCaretAtEnd(): boolean
|
|
10879
|
+
get isCaretAtBeginning(): boolean;
|
|
10880
|
+
get isCaretAtEnd(): boolean;
|
|
10881
10881
|
get index(): number;
|
|
10882
10882
|
get caret(): number;
|
|
10883
10883
|
set caret(value: number);
|
|
@@ -10897,30 +10897,20 @@ declare class NodeProxy {
|
|
|
10897
10897
|
interface Signal<T> {
|
|
10898
10898
|
(): T;
|
|
10899
10899
|
(value: T | undefined): void;
|
|
10900
|
-
use(): T;
|
|
10901
10900
|
}
|
|
10902
|
-
|
|
10903
|
-
* Derives a plain-value object type from an object of signals.
|
|
10904
|
-
* `{ foo: Signal<string>, bar: Signal<number> }` → `{ foo: string, bar: number }`
|
|
10905
|
-
*/
|
|
10906
|
-
type SignalValues<T> = { [K in keyof T]: T[K] extends Signal<infer V> | Computed<infer V> ? V : never };
|
|
10901
|
+
type SignalValues<T> = { [K in keyof T]: T[K] extends Signal<infer V> | Computed<infer V> ? V : T[K] };
|
|
10907
10902
|
interface Computed<T> {
|
|
10908
10903
|
(): T;
|
|
10909
|
-
use(): T;
|
|
10910
10904
|
}
|
|
10911
10905
|
interface Event<T = void> {
|
|
10912
|
-
/** Emit — always fires even when payload reference is unchanged. */
|
|
10913
10906
|
(payload: T): void;
|
|
10914
|
-
/** Read/subscribe — auto-tracks inside effects. Returns latest payload or undefined. */
|
|
10915
10907
|
read(): T | undefined;
|
|
10916
|
-
/** Framework hook bridge. */
|
|
10917
|
-
use(): T | undefined;
|
|
10918
10908
|
}
|
|
10919
10909
|
//#endregion
|
|
10920
10910
|
//#region ../../core/src/features/input/InputFeature.d.ts
|
|
10921
10911
|
declare class InputFeature {
|
|
10922
10912
|
#private;
|
|
10923
|
-
private store;
|
|
10913
|
+
private readonly store;
|
|
10924
10914
|
constructor(store: Store);
|
|
10925
10915
|
enable(): void;
|
|
10926
10916
|
disable(): void;
|
|
@@ -10929,7 +10919,7 @@ declare class InputFeature {
|
|
|
10929
10919
|
//#region ../../core/src/features/overlay/OverlayFeature.d.ts
|
|
10930
10920
|
declare class OverlayFeature {
|
|
10931
10921
|
#private;
|
|
10932
|
-
private store;
|
|
10922
|
+
private readonly store;
|
|
10933
10923
|
constructor(store: Store);
|
|
10934
10924
|
enable(): void;
|
|
10935
10925
|
disable(): void;
|
|
@@ -10938,23 +10928,30 @@ declare class OverlayFeature {
|
|
|
10938
10928
|
//#region ../../core/src/features/parsing/ParseFeature.d.ts
|
|
10939
10929
|
declare class ParseFeature {
|
|
10940
10930
|
#private;
|
|
10941
|
-
private store;
|
|
10931
|
+
private readonly store;
|
|
10942
10932
|
constructor(store: Store);
|
|
10943
10933
|
enable(): void;
|
|
10944
10934
|
disable(): void;
|
|
10945
10935
|
sync(): void;
|
|
10946
|
-
hasChanged(): boolean;
|
|
10947
10936
|
}
|
|
10948
10937
|
//#endregion
|
|
10949
10938
|
//#region ../../core/src/features/selection/TextSelectionFeature.d.ts
|
|
10950
10939
|
declare class TextSelectionFeature {
|
|
10951
10940
|
#private;
|
|
10952
|
-
private store;
|
|
10941
|
+
private readonly store;
|
|
10953
10942
|
constructor(store: Store);
|
|
10954
10943
|
enable(): void;
|
|
10955
10944
|
disable(): void;
|
|
10956
10945
|
}
|
|
10957
10946
|
//#endregion
|
|
10947
|
+
//#region ../../core/src/features/slots/types.d.ts
|
|
10948
|
+
interface MarkSlot {
|
|
10949
|
+
(): (token: Token) => readonly [unknown, unknown];
|
|
10950
|
+
}
|
|
10951
|
+
interface OverlaySlot {
|
|
10952
|
+
(): (option?: CoreOption, defaultComponent?: unknown) => readonly [unknown, unknown];
|
|
10953
|
+
}
|
|
10954
|
+
//#endregion
|
|
10958
10955
|
//#region ../../core/src/store/Store.d.ts
|
|
10959
10956
|
declare class Store {
|
|
10960
10957
|
readonly key: KeyGenerator;
|
|
@@ -10963,23 +10960,15 @@ declare class Store {
|
|
|
10963
10960
|
focus: NodeProxy;
|
|
10964
10961
|
input: NodeProxy;
|
|
10965
10962
|
};
|
|
10966
|
-
readonly
|
|
10967
|
-
tokens: Signal<Token[]>;
|
|
10963
|
+
readonly props: {
|
|
10968
10964
|
value: Signal<string | undefined>;
|
|
10969
10965
|
defaultValue: Signal<string | undefined>;
|
|
10970
|
-
previousValue: Signal<string | undefined>;
|
|
10971
|
-
innerValue: Signal<string | undefined>;
|
|
10972
|
-
recovery: Signal<Recovery | undefined>;
|
|
10973
|
-
selecting: Signal<"drag" | "all" | undefined>;
|
|
10974
|
-
drag: Signal<boolean | {
|
|
10975
|
-
alwaysShowHandle: boolean;
|
|
10976
|
-
}>;
|
|
10977
|
-
overlayMatch: Signal<OverlayMatch | undefined>;
|
|
10978
|
-
overlayTrigger: Signal<((option: CoreOption) => string | undefined) | undefined>;
|
|
10979
|
-
showOverlayOn: Signal<OverlayTrigger>;
|
|
10980
10966
|
onChange: Signal<((value: string) => void) | undefined>;
|
|
10981
10967
|
options: Signal<CoreOption[]>;
|
|
10982
10968
|
readOnly: Signal<boolean>;
|
|
10969
|
+
layout: Signal<"inline" | "block">;
|
|
10970
|
+
draggable: Signal<boolean | DraggableConfig>;
|
|
10971
|
+
showOverlayOn: Signal<OverlayTrigger>;
|
|
10983
10972
|
Span: Signal<unknown>;
|
|
10984
10973
|
Mark: Signal<unknown>;
|
|
10985
10974
|
Overlay: Signal<unknown>;
|
|
@@ -10988,16 +10977,30 @@ declare class Store {
|
|
|
10988
10977
|
slots: Signal<CoreSlots | undefined>;
|
|
10989
10978
|
slotProps: Signal<CoreSlotProps | undefined>;
|
|
10990
10979
|
};
|
|
10980
|
+
readonly state: {
|
|
10981
|
+
tokens: Signal<Token[]>;
|
|
10982
|
+
previousValue: Signal<string | undefined>;
|
|
10983
|
+
innerValue: Signal<string | undefined>;
|
|
10984
|
+
recovery: Signal<Recovery | undefined>;
|
|
10985
|
+
selecting: Signal<"drag" | "all" | undefined>;
|
|
10986
|
+
overlayMatch: Signal<OverlayMatch | undefined>;
|
|
10987
|
+
};
|
|
10991
10988
|
readonly computed: {
|
|
10992
10989
|
hasMark: Computed<boolean>;
|
|
10990
|
+
isBlock: Computed<boolean>;
|
|
10991
|
+
isDraggable: Computed<boolean>;
|
|
10993
10992
|
parser: Computed<Parser | undefined>;
|
|
10994
|
-
|
|
10995
|
-
|
|
10996
|
-
|
|
10997
|
-
|
|
10998
|
-
|
|
10999
|
-
|
|
11000
|
-
|
|
10993
|
+
currentValue: Computed<string>;
|
|
10994
|
+
containerComponent: Computed<unknown>;
|
|
10995
|
+
containerProps: Computed<{
|
|
10996
|
+
className: string | undefined;
|
|
10997
|
+
style?: CSSProperties$1;
|
|
10998
|
+
[key: string]: unknown;
|
|
10999
|
+
}>;
|
|
11000
|
+
blockComponent: Computed<unknown>;
|
|
11001
|
+
blockProps: Computed<Record<string, unknown> | undefined>;
|
|
11002
|
+
spanComponent: Computed<unknown>;
|
|
11003
|
+
spanProps: Computed<Record<string, unknown> | undefined>;
|
|
11001
11004
|
overlay: OverlaySlot;
|
|
11002
11005
|
mark: MarkSlot;
|
|
11003
11006
|
};
|
|
@@ -11040,7 +11043,8 @@ declare class Store {
|
|
|
11040
11043
|
parse: ParseFeature;
|
|
11041
11044
|
};
|
|
11042
11045
|
constructor();
|
|
11043
|
-
|
|
11046
|
+
setProps(values: Partial<SignalValues<typeof this.props>>): void;
|
|
11047
|
+
bumpTokens(): void;
|
|
11044
11048
|
}
|
|
11045
11049
|
//#endregion
|
|
11046
11050
|
//#region ../../core/src/shared/types.d.ts
|
|
@@ -11134,6 +11138,9 @@ interface CoreSlotProps {
|
|
|
11134
11138
|
style?: CSSProperties$1;
|
|
11135
11139
|
};
|
|
11136
11140
|
}
|
|
11141
|
+
interface DraggableConfig {
|
|
11142
|
+
alwaysShowHandle?: boolean;
|
|
11143
|
+
}
|
|
11137
11144
|
type DragAction = {
|
|
11138
11145
|
type: 'reorder';
|
|
11139
11146
|
source: number;
|
|
@@ -11154,20 +11161,6 @@ interface DragActions {
|
|
|
11154
11161
|
};
|
|
11155
11162
|
}
|
|
11156
11163
|
//#endregion
|
|
11157
|
-
//#region ../../core/src/features/slots/types.d.ts
|
|
11158
|
-
interface Slot {
|
|
11159
|
-
use(): readonly unknown[];
|
|
11160
|
-
get(): readonly unknown[];
|
|
11161
|
-
}
|
|
11162
|
-
interface MarkSlot {
|
|
11163
|
-
use(token: Token): readonly unknown[];
|
|
11164
|
-
get(token: Token): readonly unknown[];
|
|
11165
|
-
}
|
|
11166
|
-
interface OverlaySlot {
|
|
11167
|
-
use(option?: CoreOption, defaultComponent?: unknown): readonly unknown[];
|
|
11168
|
-
get(option?: CoreOption, defaultComponent?: unknown): readonly unknown[];
|
|
11169
|
-
}
|
|
11170
|
-
//#endregion
|
|
11171
11164
|
//#region ../../core/src/features/mark/MarkHandler.d.ts
|
|
11172
11165
|
interface RefAccessor<T> {
|
|
11173
11166
|
current: T | null;
|
|
@@ -11325,13 +11318,14 @@ interface MarkedInputProps<TMarkProps = MarkProps, TOverlayProps extends CoreOpt
|
|
|
11325
11318
|
onChange?: (value: string) => void;
|
|
11326
11319
|
/** Read-only mode */
|
|
11327
11320
|
readOnly?: boolean;
|
|
11328
|
-
/**
|
|
11329
|
-
*
|
|
11330
|
-
* Adjacent marks need no separator; adjacent text rows are separated by `\n\n`.
|
|
11321
|
+
/** Layout mode: 'inline' renders tokens in a single flow, 'block' stacks each token as its own row.
|
|
11322
|
+
* @default 'inline'
|
|
11331
11323
|
*/
|
|
11332
|
-
|
|
11333
|
-
|
|
11334
|
-
|
|
11324
|
+
layout?: 'inline' | 'block';
|
|
11325
|
+
/** Enable drag interaction on block rows. Only effective when layout='block'.
|
|
11326
|
+
* @default false
|
|
11327
|
+
*/
|
|
11328
|
+
draggable?: boolean | DraggableConfig;
|
|
11335
11329
|
}
|
|
11336
11330
|
declare function MarkedInput<TMarkProps = MarkProps, TOverlayProps extends CoreOption['overlay'] = OverlayProps>(props: MarkedInputProps<TMarkProps, TOverlayProps>): _$react_jsx_runtime0.JSX.Element;
|
|
11337
11331
|
//#endregion
|
|
@@ -11349,10 +11343,16 @@ interface OverlayHandler {
|
|
|
11349
11343
|
value: string;
|
|
11350
11344
|
meta?: string;
|
|
11351
11345
|
}) => void;
|
|
11352
|
-
match: OverlayMatch<Option
|
|
11346
|
+
match: OverlayMatch<Option> | undefined;
|
|
11353
11347
|
ref: RefObject<HTMLElement | null>;
|
|
11354
11348
|
}
|
|
11355
11349
|
declare function useOverlay(): OverlayHandler;
|
|
11356
11350
|
//#endregion
|
|
11357
|
-
|
|
11351
|
+
//#region src/lib/hooks/useMarkput.d.ts
|
|
11352
|
+
type Selectable<T> = Signal<T> | Computed<T>;
|
|
11353
|
+
type ObjectSelector = Record<string, Selectable<unknown> | unknown>;
|
|
11354
|
+
declare function useMarkput<T>(selector: (store: Store) => Selectable<T>): T;
|
|
11355
|
+
declare function useMarkput<R extends ObjectSelector>(selector: (store: Store) => R): SignalValues<R>;
|
|
11356
|
+
//#endregion
|
|
11357
|
+
export { MarkHandler, type MarkProps, type MarkToken, MarkedInput, type MarkedInputProps, MarkputHandler, type Markup, type Option, type OverlayHandler, type OverlayProps, type TextToken, type Token, annotate, denote, useMark, useMarkput, useOverlay };
|
|
11358
11358
|
//# sourceMappingURL=index.d.ts.map
|