@markput/react 0.12.0 → 0.12.1

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 CHANGED
@@ -10763,22 +10763,51 @@ 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/features/arrownav/ArrowNavFeature.d.ts
10767
- declare class ArrowNavFeature {
10766
+ //#region ../../core/src/features/caret/CaretFeature.d.ts
10767
+ declare class CaretFeature implements Feature {
10768
10768
  #private;
10769
- private readonly store;
10770
- constructor(store: Store);
10769
+ private readonly _store;
10770
+ readonly recovery: Signal<Recovery | undefined>;
10771
+ readonly selecting: Signal<"drag" | "all" | undefined>;
10772
+ constructor(_store: Store);
10771
10773
  enable(): void;
10772
10774
  disable(): void;
10773
10775
  }
10774
10776
  //#endregion
10775
- //#region ../../core/src/features/block-editing/BlockEditFeature.d.ts
10776
- declare class BlockEditFeature {
10777
- #private;
10778
- private readonly store;
10779
- constructor(store: Store);
10780
- enable(): void;
10781
- disable(): void;
10777
+ //#region ../../core/src/shared/signals/signal.d.ts
10778
+ interface Signal<T> {
10779
+ (): T;
10780
+ (value: T | undefined): void;
10781
+ }
10782
+ type SignalValues<T> = { [K in keyof T]: T[K] extends Signal<infer V> | Computed<infer V> ? V : T[K] };
10783
+ interface Computed<T> {
10784
+ (): T;
10785
+ }
10786
+ interface Event<T = void> {
10787
+ (payload: T): void;
10788
+ read(): T | undefined;
10789
+ }
10790
+ //#endregion
10791
+ //#region ../../core/src/features/props/PropsFeature.d.ts
10792
+ declare class PropsFeature {
10793
+ private readonly _store;
10794
+ readonly value: Signal<string | undefined>;
10795
+ readonly defaultValue: Signal<string | undefined>;
10796
+ readonly onChange: Signal<((value: string) => void) | undefined>;
10797
+ readonly options: Signal<CoreOption[]>;
10798
+ readonly readOnly: Signal<boolean>;
10799
+ readonly layout: Signal<"inline" | "block">;
10800
+ readonly draggable: Signal<boolean | DraggableConfig>;
10801
+ readonly showOverlayOn: Signal<OverlayTrigger>;
10802
+ readonly Span: Signal<_$react.ElementType | undefined>;
10803
+ readonly Mark: Signal<_$react.ElementType | undefined>;
10804
+ readonly Overlay: Signal<_$react.ElementType | undefined>;
10805
+ readonly className: Signal<string | undefined>;
10806
+ readonly style: Signal<CSSProperties$1 | undefined>;
10807
+ readonly slots: Signal<CoreSlots | undefined>;
10808
+ readonly slotProps: Signal<CoreSlotProps | undefined>;
10809
+ constructor(_store: Store);
10810
+ set(values: Partial<SignalValues<typeof this>>): void;
10782
10811
  }
10783
10812
  //#endregion
10784
10813
  //#region ../../core/src/store/BlockStore.d.ts
@@ -10813,17 +10842,8 @@ declare class BlockRegistry {
10813
10842
  get(token: object): BlockStore;
10814
10843
  }
10815
10844
  //#endregion
10816
- //#region ../../core/src/features/clipboard/CopyFeature.d.ts
10817
- declare class CopyFeature {
10818
- #private;
10819
- private readonly store;
10820
- constructor(store: Store);
10821
- enable(): void;
10822
- disable(): void;
10823
- }
10824
- //#endregion
10825
- //#region ../../core/src/features/drag/DragFeature.d.ts
10826
- declare class DragFeature {
10845
+ //#region ../../core/src/features/clipboard/ClipboardFeature.d.ts
10846
+ declare class ClipboardFeature {
10827
10847
  #private;
10828
10848
  private readonly store;
10829
10849
  constructor(store: Store);
@@ -10831,30 +10851,31 @@ declare class DragFeature {
10831
10851
  disable(): void;
10832
10852
  }
10833
10853
  //#endregion
10834
- //#region ../../core/src/features/editable/ContentEditableFeature.d.ts
10835
- declare class ContentEditableFeature {
10854
+ //#region ../../core/src/features/dom/DomFeature.d.ts
10855
+ declare class DomFeature {
10836
10856
  #private;
10837
- private readonly store;
10838
- constructor(store: Store);
10857
+ private readonly _store;
10858
+ constructor(_store: Store);
10839
10859
  enable(): void;
10840
10860
  disable(): void;
10841
- sync(): void;
10861
+ reconcile(): void;
10842
10862
  }
10843
10863
  //#endregion
10844
- //#region ../../core/src/features/events/SystemListenerFeature.d.ts
10845
- declare class SystemListenerFeature {
10864
+ //#region ../../core/src/features/drag/DragFeature.d.ts
10865
+ declare class DragFeature {
10846
10866
  #private;
10847
10867
  private readonly store;
10868
+ readonly action: Event<DragAction>;
10848
10869
  constructor(store: Store);
10849
10870
  enable(): void;
10850
10871
  disable(): void;
10851
10872
  }
10852
10873
  //#endregion
10853
- //#region ../../core/src/features/focus/FocusFeature.d.ts
10854
- declare class FocusFeature {
10874
+ //#region ../../core/src/features/keyboard/KeyboardFeature.d.ts
10875
+ declare class KeyboardFeature implements Feature {
10855
10876
  #private;
10856
- private readonly store;
10857
- constructor(store: Store);
10877
+ private readonly _store;
10878
+ constructor(_store: Store);
10858
10879
  enable(): void;
10859
10880
  disable(): void;
10860
10881
  }
@@ -10901,65 +10922,141 @@ declare class NodeProxy {
10901
10922
  clear(): void;
10902
10923
  }
10903
10924
  //#endregion
10904
- //#region ../../core/src/shared/signals/signal.d.ts
10905
- interface Signal<T> {
10906
- (): T;
10907
- (value: T | undefined): void;
10925
+ //#region ../../core/src/features/lifecycle/LifecycleFeature.d.ts
10926
+ declare class LifecycleFeature implements Feature {
10927
+ private readonly _store;
10928
+ readonly mounted: Event<void>;
10929
+ readonly unmounted: Event<void>;
10930
+ readonly rendered: Event<void>;
10931
+ constructor(_store: Store);
10932
+ enable(): void;
10933
+ disable(): void;
10908
10934
  }
10909
- type SignalValues<T> = { [K in keyof T]: T[K] extends Signal<infer V> | Computed<infer V> ? V : T[K] };
10910
- interface Computed<T> {
10911
- (): T;
10935
+ //#endregion
10936
+ //#region ../../core/src/features/mark/MarkHandler.d.ts
10937
+ interface RefAccessor<T> {
10938
+ current: T | null;
10912
10939
  }
10913
- interface Event<T = void> {
10914
- (payload: T): void;
10915
- read(): T | undefined;
10940
+ declare class MarkHandler<T extends HTMLElement = HTMLElement> {
10941
+ #private;
10942
+ readonly ref: RefAccessor<T>;
10943
+ constructor(param: {
10944
+ ref: RefAccessor<T>;
10945
+ store: Store;
10946
+ token: MarkToken;
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);
10954
+ get meta(): string | undefined;
10955
+ set meta(v: string | undefined);
10956
+ get slot(): string | undefined;
10957
+ get depth(): number;
10958
+ get hasChildren(): boolean;
10959
+ get parent(): MarkToken | undefined;
10960
+ get tokens(): Token[];
10961
+ change: (props: {
10962
+ content: string;
10963
+ value?: string;
10964
+ meta?: string;
10965
+ }) => void;
10966
+ remove: () => void;
10916
10967
  }
10917
10968
  //#endregion
10918
- //#region ../../core/src/features/input/InputFeature.d.ts
10919
- declare class InputFeature {
10969
+ //#region ../../core/src/features/slots/types.d.ts
10970
+ interface MarkSlot {
10971
+ (): (token: Token) => readonly [Slot, Record<string, unknown>];
10972
+ }
10973
+ interface OverlaySlot {
10974
+ (): (option?: CoreOption, defaultComponent?: Slot) => readonly [Slot, Record<string, unknown>];
10975
+ }
10976
+ //#endregion
10977
+ //#region ../../core/src/features/slots/SlotsFeature.d.ts
10978
+ declare class SlotsFeature implements Feature {
10979
+ private readonly _store;
10980
+ readonly container: Signal<HTMLDivElement | null>;
10981
+ readonly isBlock: Computed<boolean>;
10982
+ readonly isDraggable: Computed<boolean>;
10983
+ readonly containerComponent: Computed<Slot>;
10984
+ readonly containerProps: Computed<{
10985
+ className: string | undefined;
10986
+ style?: CSSProperties$1;
10987
+ [key: string]: unknown;
10988
+ }>;
10989
+ readonly blockComponent: Computed<Slot>;
10990
+ readonly blockProps: Computed<Record<string, unknown> | undefined>;
10991
+ readonly spanComponent: Computed<Slot>;
10992
+ readonly spanProps: Computed<Record<string, unknown> | undefined>;
10993
+ constructor(_store: Store);
10994
+ enable(): void;
10995
+ disable(): void;
10996
+ }
10997
+ //#endregion
10998
+ //#region ../../core/src/features/mark/MarkFeature.d.ts
10999
+ declare class MarkFeature implements Feature {
10920
11000
  #private;
10921
- private readonly store;
10922
- constructor(store: Store);
11001
+ private readonly _store;
11002
+ readonly enabled: Computed<boolean>;
11003
+ readonly slot: MarkSlot;
11004
+ readonly remove: Event<{
11005
+ token: Token;
11006
+ }>;
11007
+ constructor(_store: Store);
10923
11008
  enable(): void;
10924
11009
  disable(): void;
10925
11010
  }
10926
11011
  //#endregion
11012
+ //#region ../../core/src/features/mark/types.d.ts
11013
+ interface MarkOptions {
11014
+ controlled?: boolean;
11015
+ }
11016
+ //#endregion
10927
11017
  //#region ../../core/src/features/overlay/OverlayFeature.d.ts
10928
- declare class OverlayFeature {
11018
+ declare class OverlayFeature implements Feature {
10929
11019
  #private;
10930
- private readonly store;
10931
- constructor(store: Store);
11020
+ private readonly _store;
11021
+ readonly match: Signal<OverlayMatch | undefined>;
11022
+ readonly element: Signal<HTMLElement | null>;
11023
+ readonly slot: OverlaySlot;
11024
+ readonly select: Event<{
11025
+ mark: Token;
11026
+ match: OverlayMatch;
11027
+ }>;
11028
+ readonly close: Event<void>;
11029
+ constructor(_store: Store);
10932
11030
  enable(): void;
10933
11031
  disable(): void;
10934
11032
  }
10935
11033
  //#endregion
10936
11034
  //#region ../../core/src/features/parsing/ParseFeature.d.ts
10937
- declare class ParseFeature {
11035
+ declare class ParsingFeature implements Feature {
10938
11036
  #private;
10939
- private readonly store;
10940
- constructor(store: Store);
11037
+ private readonly _store;
11038
+ readonly tokens: Signal<Token[]>;
11039
+ readonly parser: Computed<Parser | undefined>;
11040
+ readonly reparse: Event<void>;
11041
+ constructor(_store: Store);
10941
11042
  enable(): void;
10942
11043
  disable(): void;
10943
11044
  sync(): void;
10944
11045
  }
10945
11046
  //#endregion
10946
- //#region ../../core/src/features/selection/TextSelectionFeature.d.ts
10947
- declare class TextSelectionFeature {
11047
+ //#region ../../core/src/features/value/ValueFeature.d.ts
11048
+ declare class ValueFeature implements Feature {
10948
11049
  #private;
10949
- private readonly store;
10950
- constructor(store: Store);
11050
+ private readonly _store;
11051
+ readonly last: Signal<string | undefined>;
11052
+ readonly next: Signal<string | undefined>;
11053
+ readonly current: Computed<string>;
11054
+ readonly change: Event<void>;
11055
+ constructor(_store: Store);
10951
11056
  enable(): void;
10952
11057
  disable(): void;
10953
11058
  }
10954
11059
  //#endregion
10955
- //#region ../../core/src/features/slots/types.d.ts
10956
- interface MarkSlot {
10957
- (): (token: Token) => readonly [Slot, Record<string, unknown>];
10958
- }
10959
- interface OverlaySlot {
10960
- (): (option?: CoreOption, defaultComponent?: Slot) => readonly [Slot, Record<string, unknown>];
10961
- }
10962
- //#endregion
10963
11060
  //#region ../../core/src/store/Store.d.ts
10964
11061
  declare class Store {
10965
11062
  readonly key: KeyGenerator;
@@ -10968,85 +11065,20 @@ declare class Store {
10968
11065
  focus: NodeProxy;
10969
11066
  input: NodeProxy;
10970
11067
  };
10971
- readonly props: {
10972
- value: Signal<string | undefined>;
10973
- defaultValue: Signal<string | undefined>;
10974
- onChange: Signal<((value: string) => void) | undefined>;
10975
- options: Signal<CoreOption[]>;
10976
- readOnly: Signal<boolean>;
10977
- layout: Signal<"inline" | "block">;
10978
- draggable: Signal<boolean | DraggableConfig>;
10979
- showOverlayOn: Signal<OverlayTrigger>;
10980
- Span: Signal<_$react.ElementType | undefined>;
10981
- Mark: Signal<_$react.ElementType | undefined>;
10982
- Overlay: Signal<_$react.ElementType | undefined>;
10983
- className: Signal<string | undefined>;
10984
- style: Signal<CSSProperties$1 | undefined>;
10985
- slots: Signal<CoreSlots | undefined>;
10986
- slotProps: Signal<CoreSlotProps | undefined>;
10987
- };
10988
- readonly state: {
10989
- tokens: Signal<Token[]>;
10990
- previousValue: Signal<string | undefined>;
10991
- innerValue: Signal<string | undefined>;
10992
- recovery: Signal<Recovery | undefined>;
10993
- container: Signal<HTMLDivElement | null>;
10994
- overlay: Signal<HTMLElement | null>;
10995
- selecting: Signal<"drag" | "all" | undefined>;
10996
- overlayMatch: Signal<OverlayMatch | undefined>;
10997
- };
10998
- readonly computed: {
10999
- hasMark: Computed<boolean>;
11000
- isBlock: Computed<boolean>;
11001
- isDraggable: Computed<boolean>;
11002
- parser: Computed<Parser | undefined>;
11003
- currentValue: Computed<string>;
11004
- containerComponent: Computed<Slot>;
11005
- containerProps: Computed<{
11006
- className: string | undefined;
11007
- style?: CSSProperties$1;
11008
- [key: string]: unknown;
11009
- }>;
11010
- blockComponent: Computed<Slot>;
11011
- blockProps: Computed<Record<string, unknown> | undefined>;
11012
- spanComponent: Computed<Slot>;
11013
- spanProps: Computed<Record<string, unknown> | undefined>;
11014
- overlay: OverlaySlot;
11015
- mark: MarkSlot;
11016
- };
11017
- readonly emit: {
11018
- /** Fires after user input or programmatic mark change — triggers serialization, `onChange`, and re-parse */change: Event<void>; /** Triggers a re-parse of tokens from the current content */
11019
- reparse: Event<void>; /** Removes a mark token from editor content */
11020
- markRemove: Event<{
11021
- token: Token;
11022
- }>; /** Fires when the user selects an overlay option — annotates markup into the current input span */
11023
- overlaySelect: Event<{
11024
- mark: Token;
11025
- match: OverlayMatch;
11026
- }>; /** Dismisses the overlay by clearing the current `overlayMatch` */
11027
- overlayClose: Event<void>; /** Post-render DOM alignment: aligns `contentEditable` attributes and `textContent` of child elements to token state. Emitted synchronously by `FocusFeature` inside the `rendered` handler (framework layout-effect phase). Load-bearing for post-commit DOM consistency — do not delete without reproducing this timing. */
11028
- sync: Event<void>; /** Dispatches drag-mode row operations (reorder, add, delete, duplicate) */
11029
- drag: Event<DragAction>; /** Fires after the framework has committed new token elements to the DOM — kicks off sync and focus recovery */
11030
- rendered: Event<void>; /** Lifecycle: editor component added to the DOM — enables all features */
11031
- mounted: Event<void>; /** Lifecycle: editor component removed from the DOM — disables all features and cleans up subscriptions */
11032
- unmounted: Event<void>;
11033
- };
11068
+ readonly props: PropsFeature;
11034
11069
  readonly handler: MarkputHandler;
11035
- readonly feature: {
11036
- overlay: OverlayFeature;
11037
- focus: FocusFeature;
11038
- input: InputFeature;
11039
- blockEditing: BlockEditFeature;
11040
- arrowNav: ArrowNavFeature;
11041
- system: SystemListenerFeature;
11042
- textSelection: TextSelectionFeature;
11043
- contentEditable: ContentEditableFeature;
11044
- drag: DragFeature;
11045
- copy: CopyFeature;
11046
- parse: ParseFeature;
11047
- };
11070
+ readonly lifecycle: LifecycleFeature;
11071
+ readonly value: ValueFeature;
11072
+ readonly mark: MarkFeature;
11073
+ readonly overlay: OverlayFeature;
11074
+ readonly slots: SlotsFeature;
11075
+ readonly caret: CaretFeature;
11076
+ readonly keyboard: KeyboardFeature;
11077
+ readonly dom: DomFeature;
11078
+ readonly drag: DragFeature;
11079
+ readonly clipboard: ClipboardFeature;
11080
+ readonly parsing: ParsingFeature;
11048
11081
  constructor();
11049
- setProps(values: Partial<SignalValues<typeof this.props>>): void;
11050
11082
  }
11051
11083
  //#endregion
11052
11084
  //#region ../../core/src/shared/types.d.ts
@@ -11174,47 +11206,13 @@ type DragAction = {
11174
11206
  index: number;
11175
11207
  };
11176
11208
  interface DragActions {
11177
- drag: {
11209
+ action: {
11178
11210
  (action: DragAction): void;
11179
11211
  };
11180
11212
  }
11181
- //#endregion
11182
- //#region ../../core/src/features/mark/MarkHandler.d.ts
11183
- interface RefAccessor<T> {
11184
- current: T | null;
11185
- }
11186
- declare class MarkHandler<T extends HTMLElement = HTMLElement> {
11187
- #private;
11188
- readonly ref: RefAccessor<T>;
11189
- constructor(param: {
11190
- ref: RefAccessor<T>;
11191
- store: Store;
11192
- token: MarkToken;
11193
- });
11194
- get readOnly(): boolean | undefined;
11195
- set readOnly(value: boolean | undefined);
11196
- get content(): string;
11197
- set content(value: string);
11198
- get value(): string | undefined;
11199
- set value(v: string | undefined);
11200
- get meta(): string | undefined;
11201
- set meta(v: string | undefined);
11202
- get slot(): string | undefined;
11203
- get depth(): number;
11204
- get hasChildren(): boolean;
11205
- get parent(): MarkToken | undefined;
11206
- get tokens(): Token[];
11207
- change: (props: {
11208
- content: string;
11209
- value?: string;
11210
- meta?: string;
11211
- }) => void;
11212
- remove: () => void;
11213
- }
11214
- //#endregion
11215
- //#region ../../core/src/features/mark/types.d.ts
11216
- interface MarkOptions {
11217
- controlled?: boolean;
11213
+ interface Feature {
11214
+ enable(): void;
11215
+ disable(): void;
11218
11216
  }
11219
11217
  //#endregion
11220
11218
  //#region src/types.d.ts