@markput/react 0.11.0 → 0.12.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 +47 -29
- package/index.d.ts.map +1 -1
- package/index.js +170 -148
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
|
+
import * as _$react from "react";
|
|
1
2
|
import { CSSProperties, ComponentType, ElementType, ReactNode, Ref, RefObject } from "react";
|
|
2
3
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
4
|
|
|
5
|
+
//#region src/augment.d.ts
|
|
6
|
+
declare module '@markput/core' {
|
|
7
|
+
interface SlotRegistry {
|
|
8
|
+
default: ElementType;
|
|
9
|
+
}
|
|
10
|
+
} //# sourceMappingURL=augment.d.ts.map
|
|
11
|
+
//#endregion
|
|
4
12
|
//#region ../../core/src/features/parsing/parser/constants.d.ts
|
|
5
13
|
/**
|
|
6
14
|
* Constants for ParserV2 - modern markup parser with nesting support
|
|
@@ -10946,10 +10954,10 @@ declare class TextSelectionFeature {
|
|
|
10946
10954
|
//#endregion
|
|
10947
10955
|
//#region ../../core/src/features/slots/types.d.ts
|
|
10948
10956
|
interface MarkSlot {
|
|
10949
|
-
(): (token: Token) => readonly [
|
|
10957
|
+
(): (token: Token) => readonly [Slot, Record<string, unknown>];
|
|
10950
10958
|
}
|
|
10951
10959
|
interface OverlaySlot {
|
|
10952
|
-
(): (option?: CoreOption, defaultComponent?:
|
|
10960
|
+
(): (option?: CoreOption, defaultComponent?: Slot) => readonly [Slot, Record<string, unknown>];
|
|
10953
10961
|
}
|
|
10954
10962
|
//#endregion
|
|
10955
10963
|
//#region ../../core/src/store/Store.d.ts
|
|
@@ -10969,9 +10977,9 @@ declare class Store {
|
|
|
10969
10977
|
layout: Signal<"inline" | "block">;
|
|
10970
10978
|
draggable: Signal<boolean | DraggableConfig>;
|
|
10971
10979
|
showOverlayOn: Signal<OverlayTrigger>;
|
|
10972
|
-
Span: Signal<
|
|
10973
|
-
Mark: Signal<
|
|
10974
|
-
Overlay: Signal<
|
|
10980
|
+
Span: Signal<_$react.ElementType | undefined>;
|
|
10981
|
+
Mark: Signal<_$react.ElementType | undefined>;
|
|
10982
|
+
Overlay: Signal<_$react.ElementType | undefined>;
|
|
10975
10983
|
className: Signal<string | undefined>;
|
|
10976
10984
|
style: Signal<CSSProperties$1 | undefined>;
|
|
10977
10985
|
slots: Signal<CoreSlots | undefined>;
|
|
@@ -10982,6 +10990,8 @@ declare class Store {
|
|
|
10982
10990
|
previousValue: Signal<string | undefined>;
|
|
10983
10991
|
innerValue: Signal<string | undefined>;
|
|
10984
10992
|
recovery: Signal<Recovery | undefined>;
|
|
10993
|
+
container: Signal<HTMLDivElement | null>;
|
|
10994
|
+
overlay: Signal<HTMLElement | null>;
|
|
10985
10995
|
selecting: Signal<"drag" | "all" | undefined>;
|
|
10986
10996
|
overlayMatch: Signal<OverlayMatch | undefined>;
|
|
10987
10997
|
};
|
|
@@ -10991,45 +11001,38 @@ declare class Store {
|
|
|
10991
11001
|
isDraggable: Computed<boolean>;
|
|
10992
11002
|
parser: Computed<Parser | undefined>;
|
|
10993
11003
|
currentValue: Computed<string>;
|
|
10994
|
-
containerComponent: Computed<
|
|
11004
|
+
containerComponent: Computed<Slot>;
|
|
10995
11005
|
containerProps: Computed<{
|
|
10996
11006
|
className: string | undefined;
|
|
10997
11007
|
style?: CSSProperties$1;
|
|
10998
11008
|
[key: string]: unknown;
|
|
10999
11009
|
}>;
|
|
11000
|
-
blockComponent: Computed<
|
|
11010
|
+
blockComponent: Computed<Slot>;
|
|
11001
11011
|
blockProps: Computed<Record<string, unknown> | undefined>;
|
|
11002
|
-
spanComponent: Computed<
|
|
11012
|
+
spanComponent: Computed<Slot>;
|
|
11003
11013
|
spanProps: Computed<Record<string, unknown> | undefined>;
|
|
11004
11014
|
overlay: OverlaySlot;
|
|
11005
11015
|
mark: MarkSlot;
|
|
11006
11016
|
};
|
|
11007
|
-
readonly
|
|
11017
|
+
readonly emit: {
|
|
11008
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 */
|
|
11009
|
-
|
|
11010
|
-
|
|
11019
|
+
reparse: Event<void>; /** Removes a mark token from editor content */
|
|
11020
|
+
markRemove: Event<{
|
|
11011
11021
|
token: Token;
|
|
11012
11022
|
}>; /** Fires when the user selects an overlay option — annotates markup into the current input span */
|
|
11013
|
-
|
|
11023
|
+
overlaySelect: Event<{
|
|
11014
11024
|
mark: Token;
|
|
11015
11025
|
match: OverlayMatch;
|
|
11016
11026
|
}>; /** Dismisses the overlay by clearing the current `overlayMatch` */
|
|
11017
|
-
|
|
11018
|
-
|
|
11019
|
-
|
|
11020
|
-
|
|
11021
|
-
dragAction: Event<DragAction>; /** Signals the framework component has received new props — triggers conditional re-parse if value/options changed */
|
|
11022
|
-
updated: Event<void>; /** Fires after the framework has committed new token elements to the DOM — kicks off sync and focus recovery */
|
|
11023
|
-
afterTokensRendered: Event<void>; /** Lifecycle: editor component added to the DOM — enables all features */
|
|
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 */
|
|
11024
11031
|
mounted: Event<void>; /** Lifecycle: editor component removed from the DOM — disables all features and cleans up subscriptions */
|
|
11025
11032
|
unmounted: Event<void>;
|
|
11026
11033
|
};
|
|
11027
|
-
readonly refs: {
|
|
11028
|
-
container: HTMLDivElement | null;
|
|
11029
|
-
overlay: HTMLElement | null;
|
|
11030
|
-
};
|
|
11031
11034
|
readonly handler: MarkputHandler;
|
|
11032
|
-
readonly
|
|
11035
|
+
readonly feature: {
|
|
11033
11036
|
overlay: OverlayFeature;
|
|
11034
11037
|
focus: FocusFeature;
|
|
11035
11038
|
input: InputFeature;
|
|
@@ -11044,10 +11047,25 @@ declare class Store {
|
|
|
11044
11047
|
};
|
|
11045
11048
|
constructor();
|
|
11046
11049
|
setProps(values: Partial<SignalValues<typeof this.props>>): void;
|
|
11047
|
-
bumpTokens(): void;
|
|
11048
11050
|
}
|
|
11049
11051
|
//#endregion
|
|
11050
11052
|
//#region ../../core/src/shared/types.d.ts
|
|
11053
|
+
/**
|
|
11054
|
+
* Registry interface used as a module-augmentation target. Framework packages
|
|
11055
|
+
* add a `default` property whose type is the framework's component type.
|
|
11056
|
+
*
|
|
11057
|
+
* @example React augmentation
|
|
11058
|
+
* declare module '@markput/core' {
|
|
11059
|
+
* interface SlotRegistry {
|
|
11060
|
+
* default: import('react').ElementType
|
|
11061
|
+
* }
|
|
11062
|
+
* }
|
|
11063
|
+
*
|
|
11064
|
+
* Without augmentation, `Slot` falls back to `unknown`.
|
|
11065
|
+
*/
|
|
11066
|
+
interface SlotRegistry {}
|
|
11067
|
+
/** Framework-provided component type. Resolves to `unknown` unless `SlotRegistry` is augmented. */
|
|
11068
|
+
type Slot = keyof SlotRegistry extends never ? unknown : SlotRegistry[keyof SlotRegistry];
|
|
11051
11069
|
/**
|
|
11052
11070
|
* Core option for markups - Framework-agnostic configuration.
|
|
11053
11071
|
* Extended by framework-specific Option types (e.g., React Option).
|
|
@@ -11120,9 +11138,9 @@ type OverlayTrigger = Array<'change' | 'selectionChange'> | 'change' | 'selectio
|
|
|
11120
11138
|
type CSSProperties$1 = Properties<string | number>;
|
|
11121
11139
|
type DataAttributes = Record<`data${Capitalize<string>}`, string | number | boolean | undefined>;
|
|
11122
11140
|
interface CoreSlots {
|
|
11123
|
-
container?:
|
|
11124
|
-
block?:
|
|
11125
|
-
span?:
|
|
11141
|
+
container?: Slot;
|
|
11142
|
+
block?: Slot;
|
|
11143
|
+
span?: Slot;
|
|
11126
11144
|
}
|
|
11127
11145
|
interface CoreSlotProps {
|
|
11128
11146
|
container?: Record<string, unknown> & {
|
|
@@ -11156,7 +11174,7 @@ type DragAction = {
|
|
|
11156
11174
|
index: number;
|
|
11157
11175
|
};
|
|
11158
11176
|
interface DragActions {
|
|
11159
|
-
|
|
11177
|
+
drag: {
|
|
11160
11178
|
(action: DragAction): void;
|
|
11161
11179
|
};
|
|
11162
11180
|
}
|