@lofcz/platejs-core 53.4.7 → 53.4.8
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/dist/{index-fLEDAjcC.d.ts → index-CtgFx8a9.d.ts} +55 -55
- package/dist/index.d.ts +1 -1
- package/dist/react/index.d.ts +351 -187
- package/dist/react/index.js +475 -6
- package/dist/static/index.d.ts +1 -1
- package/package.json +4 -4
package/dist/react/index.d.ts
CHANGED
|
@@ -1,49 +1,48 @@
|
|
|
1
|
-
import { Ct as NodeComponents, Et as PluginConfig, F as RenderLeafProps, I as RenderElementFn, Ii as ExtendEditor$1, J as BaseEditor, Jr as NavigationFeedbackConfig, L as RenderElementProps, M as RenderTextFn, Mi as AnySlatePlugin, Mo as HandlerReturnType, N as RenderTextProps, Ot as WithAnyKey, P as RenderLeafFn, Pa as ResolvedInputRulesMeta, Q as SlateEditor, Qa as createStaticEditor, R as RenderChunkFn, So as PlateStaticProps, St as NodeComponent, Tt as ParserOptions, U as BaseWithSlateOptions, Y as InferPlugins, _t as InferOptions, ai as
|
|
2
|
-
import * as
|
|
1
|
+
import { Ct as NodeComponents, Et as PluginConfig, F as RenderLeafProps, I as RenderElementFn, Ii as ExtendEditor$1, J as BaseEditor, Jr as NavigationFeedbackConfig, L as RenderElementProps, M as RenderTextFn, Mi as AnySlatePlugin, Mo as HandlerReturnType, N as RenderTextProps, Ot as WithAnyKey, P as RenderLeafFn, Pa as ResolvedInputRulesMeta, Q as SlateEditor, Qa as createStaticEditor, R as RenderChunkFn, So as PlateStaticProps, St as NodeComponent, Tt as ParserOptions, U as BaseWithSlateOptions, Y as InferPlugins, _t as InferOptions, ai as LiftBlockOptions, at as BasePluginContext, ba as InputRulesConfig, bt as MatchRules, ct as BaseTransformOptions, et as AnyPluginConfig, fi as AutoScrollOperationsMap, gi as WithAutoScrollOptions, gt as InferKey, hi as ScrollMode, hr as CorePluginTransforms, ht as InferApi, ia as SlatePluginContext, it as BasePlugin, j as EditableProps, kt as WithRequiredKey, li as InitOptions, mi as DomConfig, mr as CorePluginApi, mt as GetInjectNodePropsReturnType, na as SlatePlugin, nt as BaseHtmlDeserializer, pr as CorePlugin, pt as GetInjectNodePropsOptions, qr as NavigationFeedbackActiveTarget, ra as SlatePluginConfig, rt as BaseInjectProps, si as InsertExitBreakOptions, st as BaseSerializer, tt as BaseDeserializer, vt as InferSelectors, xa as InputRulesDefinition, yt as InferTransforms, z as RenderChunkProps } from "../index-CtgFx8a9";
|
|
2
|
+
import * as _platejs_slate20 from "@platejs/slate";
|
|
3
3
|
import { DecoratedRange, Descendant, DescendantIn, Editor, EditorApi, EditorTransforms, ElementEntry, NodeEntry, NodeOperation, Operation, Path, TElement, TNode, TRange, TSelection, TText, TextOperation, Value, ValueOf } from "@platejs/slate";
|
|
4
4
|
import { AnyObject, Deep2Partial, Modify, Nullable, UnionToIntersection, UnknownObject } from "@udecode/utils";
|
|
5
5
|
import { DefaultPlaceholder, Editable, RenderPlaceholderProps, Slate, useComposing, useFocused, useReadOnly, useSelected, useSlateStatic, withReact } from "slate-react";
|
|
6
|
-
import React$1, { DependencyList, HTMLAttributes } from "react";
|
|
6
|
+
import React$1, { DependencyList, HTMLAttributes, PropsWithChildren } from "react";
|
|
7
7
|
import { HotkeysEvent, HotkeysOptions, Keys } from "@udecode/react-hotkeys";
|
|
8
8
|
import * as jotai5 from "jotai";
|
|
9
9
|
import { atom } from "jotai";
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
10
|
+
import { Atom, WritableAtom, createStore } from "jotai/vanilla";
|
|
11
|
+
import { useHydrateAtoms } from "jotai/utils";
|
|
12
12
|
import * as zustand_x0 from "zustand-x";
|
|
13
13
|
import { TCreatedStoreType, TEqualityChecker, createZustandStore, useStoreSelect, useStoreState, useStoreValue, useTracked, useTrackedStore } from "zustand-x";
|
|
14
|
-
import { createStore } from "jotai/vanilla";
|
|
15
14
|
import * as jotai_vanilla_internals0 from "jotai/vanilla/internals";
|
|
16
15
|
|
|
17
16
|
//#region src/react/plugins/SlateReactExtensionPlugin.d.ts
|
|
18
17
|
declare const SlateReactExtensionPlugin: PlatePlugin<PluginConfig<"slateExtension", {
|
|
19
18
|
onNodeChange: (options: {
|
|
20
19
|
editor: SlateEditor;
|
|
21
|
-
node:
|
|
22
|
-
operation:
|
|
23
|
-
prevNode:
|
|
20
|
+
node: _platejs_slate20.Descendant;
|
|
21
|
+
operation: _platejs_slate20.NodeOperation;
|
|
22
|
+
prevNode: _platejs_slate20.Descendant;
|
|
24
23
|
}) => void;
|
|
25
24
|
onTextChange: (options: {
|
|
26
25
|
editor: SlateEditor;
|
|
27
|
-
node:
|
|
28
|
-
operation:
|
|
26
|
+
node: _platejs_slate20.Descendant;
|
|
27
|
+
operation: _platejs_slate20.TextOperation;
|
|
29
28
|
prevText: string;
|
|
30
29
|
text: string;
|
|
31
30
|
}) => void;
|
|
32
31
|
}, {
|
|
33
32
|
redecorate: (() => void) & (() => void);
|
|
34
|
-
isElementStateEmpty: (element:
|
|
33
|
+
isElementStateEmpty: (element: _platejs_slate20.TElement) => boolean;
|
|
35
34
|
}, {
|
|
36
|
-
reset: (options:
|
|
35
|
+
reset: (options: _platejs_slate20.ResetOptions | undefined) => void;
|
|
37
36
|
init: ((args_0: InitOptions) => void) & ((args_0: InitOptions) => void);
|
|
38
37
|
insertExitBreak: ((args_0?: InsertExitBreakOptions | undefined) => true | undefined) & ((args_0?: InsertExitBreakOptions | undefined) => true | undefined);
|
|
39
38
|
liftBlock: ((args_0?: LiftBlockOptions | undefined) => true | undefined) & ((args_0?: LiftBlockOptions | undefined) => true | undefined);
|
|
40
39
|
resetBlock: ((args_0?: {
|
|
41
|
-
at?:
|
|
40
|
+
at?: _platejs_slate20.Path;
|
|
42
41
|
} | undefined) => true | undefined) & ((args_0?: {
|
|
43
|
-
at?:
|
|
42
|
+
at?: _platejs_slate20.Path;
|
|
44
43
|
} | undefined) => true | undefined);
|
|
45
|
-
setValue: ((value?: string |
|
|
46
|
-
apply: <N$1 extends
|
|
44
|
+
setValue: ((value?: string | _platejs_slate20.Value | undefined) => void) & ((value?: string | _platejs_slate20.Value | undefined) => void);
|
|
45
|
+
apply: <N$1 extends _platejs_slate20.TElement | _platejs_slate20.TText>(operation: _platejs_slate20.Operation<N$1>) => void;
|
|
47
46
|
}, {}>>;
|
|
48
47
|
//#endregion
|
|
49
48
|
//#region src/react/plugins/event-editor/EventEditorPlugin.d.ts
|
|
@@ -103,7 +102,7 @@ declare const ParagraphPlugin: PlatePlugin<PluginConfig<"p", {}, {}, {}, {}>>;
|
|
|
103
102
|
declare const ReactPlugin: PlatePlugin<PluginConfig<"dom", {
|
|
104
103
|
scrollMode?: ScrollMode;
|
|
105
104
|
scrollOperations?: AutoScrollOperationsMap;
|
|
106
|
-
scrollOptions?:
|
|
105
|
+
scrollOptions?: _platejs_slate20.ScrollIntoViewOptions;
|
|
107
106
|
}, {
|
|
108
107
|
isScrolling: () => boolean;
|
|
109
108
|
}, {
|
|
@@ -817,44 +816,44 @@ declare const getPlateCorePlugins: ({
|
|
|
817
816
|
navigationFeedback
|
|
818
817
|
}?: {
|
|
819
818
|
navigationFeedback?: NavigationFeedbackConfig["options"] | boolean;
|
|
820
|
-
}) => (PlatePlugin<PluginConfig<"
|
|
819
|
+
}) => (PlatePlugin<PluginConfig<"slateExtension", {
|
|
821
820
|
onNodeChange: (options: {
|
|
822
821
|
editor: SlateEditor;
|
|
823
|
-
node:
|
|
824
|
-
operation:
|
|
825
|
-
prevNode:
|
|
822
|
+
node: _platejs_slate20.Descendant;
|
|
823
|
+
operation: _platejs_slate20.NodeOperation;
|
|
824
|
+
prevNode: _platejs_slate20.Descendant;
|
|
826
825
|
}) => void;
|
|
827
826
|
onTextChange: (options: {
|
|
828
827
|
editor: SlateEditor;
|
|
829
|
-
node:
|
|
830
|
-
operation:
|
|
828
|
+
node: _platejs_slate20.Descendant;
|
|
829
|
+
operation: _platejs_slate20.TextOperation;
|
|
831
830
|
prevText: string;
|
|
832
831
|
text: string;
|
|
833
832
|
}) => void;
|
|
834
833
|
}, {
|
|
835
834
|
redecorate: (() => void) & (() => void);
|
|
836
|
-
isElementStateEmpty: (element:
|
|
835
|
+
isElementStateEmpty: (element: _platejs_slate20.TElement) => boolean;
|
|
837
836
|
}, {
|
|
838
|
-
reset: (options:
|
|
837
|
+
reset: (options: _platejs_slate20.ResetOptions | undefined) => void;
|
|
839
838
|
init: ((args_0: InitOptions) => void) & ((args_0: InitOptions) => void);
|
|
840
839
|
insertExitBreak: ((args_0?: InsertExitBreakOptions | undefined) => true | undefined) & ((args_0?: InsertExitBreakOptions | undefined) => true | undefined);
|
|
841
840
|
liftBlock: ((args_0?: LiftBlockOptions | undefined) => true | undefined) & ((args_0?: LiftBlockOptions | undefined) => true | undefined);
|
|
842
841
|
resetBlock: ((args_0?: {
|
|
843
|
-
at?:
|
|
842
|
+
at?: _platejs_slate20.Path;
|
|
844
843
|
} | undefined) => true | undefined) & ((args_0?: {
|
|
845
|
-
at?:
|
|
844
|
+
at?: _platejs_slate20.Path;
|
|
846
845
|
} | undefined) => true | undefined);
|
|
847
|
-
setValue: ((value?: string |
|
|
848
|
-
apply: <N$1 extends
|
|
846
|
+
setValue: ((value?: string | _platejs_slate20.Value | undefined) => void) & ((value?: string | _platejs_slate20.Value | undefined) => void);
|
|
847
|
+
apply: <N$1 extends _platejs_slate20.TElement | _platejs_slate20.TText>(operation: _platejs_slate20.Operation<N$1>) => void;
|
|
849
848
|
}, {}>> | PlatePlugin<PluginConfig<"dom", {
|
|
850
849
|
scrollMode?: ScrollMode;
|
|
851
850
|
scrollOperations?: AutoScrollOperationsMap;
|
|
852
|
-
scrollOptions?:
|
|
851
|
+
scrollOptions?: _platejs_slate20.ScrollIntoViewOptions;
|
|
853
852
|
}, {
|
|
854
853
|
isScrolling: () => boolean;
|
|
855
854
|
}, {
|
|
856
855
|
withScrolling: (fn: () => void, options?: WithAutoScrollOptions | undefined) => void;
|
|
857
|
-
}, {}>> | PlatePlugin<PluginConfig<any, {}, {}, {}, {}>> | PlatePlugin<PluginConfig<"p", {}, {}, {}, {}>>)[];
|
|
856
|
+
}, {}>> | PlatePlugin<PluginConfig<"eventEditor", {}, {}, {}, {}>> | PlatePlugin<PluginConfig<any, {}, {}, {}, {}>> | PlatePlugin<PluginConfig<"p", {}, {}, {}, {}>>)[];
|
|
858
857
|
//#endregion
|
|
859
858
|
//#region src/react/editor/usePlateEditor.d.ts
|
|
860
859
|
/**
|
|
@@ -919,7 +918,7 @@ declare function getPlugin<C extends AnyPluginConfig = PluginConfig>(editor: Pla
|
|
|
919
918
|
} ? C : PlatePlugin<C>;
|
|
920
919
|
//#endregion
|
|
921
920
|
//#region src/react/plugin/omitPluginContext.d.ts
|
|
922
|
-
declare const omitPluginContext: <T extends PlatePluginContext<AnyPlatePlugin>>(ctx: T) => Omit<T, "api" | "editor" | "
|
|
921
|
+
declare const omitPluginContext: <T extends PlatePluginContext<AnyPlatePlugin>>(ctx: T) => Omit<T, "api" | "editor" | "type" | "getOption" | "tf" | "getOptions" | "setOptions" | "setOption" | "plugin">;
|
|
923
922
|
//#endregion
|
|
924
923
|
//#region src/react/plugin/toPlatePlugin.d.ts
|
|
925
924
|
type PlatePluginConfig$1<C extends AnyPluginConfig, EO = {}, EA = {}, ET = {}, ES = {}> = Omit<Partial<PlatePlugin<PluginConfig<C['key'], EO & InferOptions<C>, EA & InferApi<C>, ET & InferTransforms<C>, ES & InferSelectors<C>>>>, keyof PlatePluginMethods | 'api' | 'node' | 'options' | 'transforms'> & {
|
|
@@ -1071,6 +1070,171 @@ declare const useElementSelector: <T>(selector: <N$1 extends TElement>(state: No
|
|
|
1071
1070
|
equalityFn
|
|
1072
1071
|
}?: UseElementSelectorOptions<T>) => T;
|
|
1073
1072
|
//#endregion
|
|
1073
|
+
//#region ../udecode/jotai-x/src/createAtomStore.d.ts
|
|
1074
|
+
type JotaiStore = ReturnType<typeof createStore>;
|
|
1075
|
+
type UseAtomOptions = {
|
|
1076
|
+
scope?: string;
|
|
1077
|
+
store?: JotaiStore;
|
|
1078
|
+
delay?: number;
|
|
1079
|
+
warnIfNoStore?: boolean;
|
|
1080
|
+
};
|
|
1081
|
+
type UseAtomOptionsOrScope = UseAtomOptions | string;
|
|
1082
|
+
type StoreAtomsWithoutExtend<T> = { [K in keyof T]: T[K] extends Atom<any> ? T[K] : SimpleWritableAtom<T[K]> };
|
|
1083
|
+
type ValueTypesForAtoms<T> = { [K in keyof T]: T[K] extends Atom<infer V> ? V : never };
|
|
1084
|
+
type StoreInitialValues<T> = ValueTypesForAtoms<StoreAtomsWithoutExtend<T>>;
|
|
1085
|
+
type StoreAtoms<T, E> = StoreAtomsWithoutExtend<T> & E;
|
|
1086
|
+
type SimpleWritableAtom<T> = WritableAtom<T, [T], void>;
|
|
1087
|
+
type AtomRecord<O> = { [K in keyof O]: Atom<O[K]> };
|
|
1088
|
+
type UseNameStore<N$1 extends string = ''> = `use${Capitalize<N$1>}Store`;
|
|
1089
|
+
type NameStore<N$1 extends string = ''> = N$1 extends '' ? 'store' : `${N$1}Store`;
|
|
1090
|
+
type NameProvider<N$1 extends string = ''> = `${Capitalize<N$1>}Provider`;
|
|
1091
|
+
type UseKeyValue<K$1 extends string = ''> = `use${Capitalize<K$1>}Value`;
|
|
1092
|
+
type GetKey<K$1 extends string = ''> = `get${Capitalize<K$1>}`;
|
|
1093
|
+
type UseSetKey<K$1 extends string = ''> = `useSet${Capitalize<K$1>}`;
|
|
1094
|
+
type SetKey<K$1 extends string = ''> = `set${Capitalize<K$1>}`;
|
|
1095
|
+
type UseKeyState<K$1 extends string = ''> = `use${Capitalize<K$1>}State`;
|
|
1096
|
+
type SubscribeKey<K$1 extends string = ''> = `subscribe${Capitalize<K$1>}`;
|
|
1097
|
+
type StoreApi<T extends object, E extends AtomRecord<object>, N$1 extends string = ''> = {
|
|
1098
|
+
atom: StoreAtoms<T, E>;
|
|
1099
|
+
name: N$1;
|
|
1100
|
+
};
|
|
1101
|
+
type UseValueOptions<V$1, S> = {
|
|
1102
|
+
selector?: (v: V$1, prevSelectorOutput?: S) => S;
|
|
1103
|
+
equalityFn?: (prev: S, next: S) => boolean;
|
|
1104
|
+
} & UseAtomOptions;
|
|
1105
|
+
type UseKeyValueApis<O> = { [K in keyof O as UseKeyValue<K & string>]: {
|
|
1106
|
+
(): O[K] extends Atom<infer V> ? V : never;
|
|
1107
|
+
<S>(selector: O[K] extends Atom<infer V> ? (v: V, prevSelectorOutput?: S) => S : never, deps?: unknown[]): S;
|
|
1108
|
+
<S>(selector: (O[K] extends Atom<infer V> ? (v: V, prevSelectorOutput?: S) => S : never) | undefined, equalityFn: (prevSelectorOutput: S, selectorOutput: S) => boolean, deps?: unknown[]): S;
|
|
1109
|
+
} };
|
|
1110
|
+
type GetKeyApis<O> = { [K in keyof O as GetKey<K & string>]: O[K] extends Atom<infer V> ? () => V : never };
|
|
1111
|
+
type UseSetKeyApis<O> = { [K in keyof O as UseSetKey<K & string>]: O[K] extends WritableAtom<infer _V, infer A, infer R> ? () => (...args: A) => R : never };
|
|
1112
|
+
type SetKeyApis<O> = { [K in keyof O as SetKey<K & string>]: O[K] extends WritableAtom<infer _V, infer A, infer R> ? (...args: A) => R : never };
|
|
1113
|
+
type UseKeyStateApis<O> = { [K in keyof O as UseKeyState<K & string>]: O[K] extends WritableAtom<infer V, infer A, infer R> ? () => [V, (...args: A) => R] : never };
|
|
1114
|
+
type SubscribeKeyApis<O> = { [K in keyof O as SubscribeKey<K & string>]: O[K] extends Atom<infer V> ? (callback: (newValue: V) => void) => () => void : never };
|
|
1115
|
+
type UseParamKeyValueApi<O> = {
|
|
1116
|
+
<K$1 extends keyof O>(key: K$1): O[K$1] extends Atom<infer V> ? V : never;
|
|
1117
|
+
<K$1 extends keyof O, S>(key: K$1, selector: O[K$1] extends Atom<infer V> ? (v: V, prevSelectorOutput?: S) => S : never, deps?: unknown[]): S;
|
|
1118
|
+
<K$1 extends keyof O, S>(key: K$1, selector: (O[K$1] extends Atom<infer V> ? (v: V, prevSelectorOutput?: S) => S : never) | undefined, equalityFn: (prevSelectorOutput: S, selectorOutput: S) => boolean, deps?: unknown[]): S;
|
|
1119
|
+
};
|
|
1120
|
+
type GetParamKeyApi<O> = <K$1 extends keyof O>(key: K$1) => O[K$1] extends Atom<infer V> ? V : never;
|
|
1121
|
+
type UseSetParamKeyApi<O> = <K$1 extends keyof O>(key: K$1) => O[K$1] extends WritableAtom<infer _V, infer A, infer R> ? (...args: A) => R : never;
|
|
1122
|
+
type SetParamKeyApi<O> = <K$1 extends keyof O, A$1 extends unknown[]>(key: K$1, ...args: A$1) => O[K$1] extends WritableAtom<infer _V, A$1, infer R> ? R : never;
|
|
1123
|
+
type UseParamKeyStateApi<O> = <K$1 extends keyof O>(key: K$1) => O[K$1] extends WritableAtom<infer V, infer A, infer R> ? [V, (...args: A) => R] : never;
|
|
1124
|
+
type SubscribeParamKeyApi<O> = <K$1 extends keyof O, V$1>(key: K$1, callback: (newValue: V$1) => void) => O[K$1] extends Atom<V$1> ? () => void : never;
|
|
1125
|
+
type UseAtomParamValueApi = {
|
|
1126
|
+
<V$1>(atom: Atom<V$1>): V$1;
|
|
1127
|
+
<V$1, S = V$1>(atom: Atom<V$1>, selector: (v: V$1, prevSelectorOutput?: S) => S, deps?: unknown[]): S;
|
|
1128
|
+
<V$1, S = V$1>(atom: Atom<V$1>, selector: ((v: V$1, prevSelectorOutput?: S) => S) | undefined, equalityFn: (prevSelectorOutput: S, selectorOutput: S) => boolean, deps?: unknown[]): S;
|
|
1129
|
+
};
|
|
1130
|
+
type GetAtomParamApi = <V$1>(atom: Atom<V$1>) => V$1;
|
|
1131
|
+
type UseSetAtomParamApi = <V$1, A$1 extends unknown[], R$1>(atom: WritableAtom<V$1, A$1, R$1>) => (...args: A$1) => R$1;
|
|
1132
|
+
type SetAtomParamApi = <V$1, A$1 extends unknown[], R$1>(atom: WritableAtom<V$1, A$1, R$1>) => (...args: A$1) => R$1;
|
|
1133
|
+
type UseAtomParamStateApi = <V$1, A$1 extends unknown[], R$1>(atom: WritableAtom<V$1, A$1, R$1>) => [V$1, (...args: A$1) => R$1];
|
|
1134
|
+
type SubscribeAtomParamApi = <V$1>(atom: Atom<V$1>) => (callback: (newValue: V$1) => void) => () => void;
|
|
1135
|
+
type ReturnOfUseStoreApi<T, E> = UseKeyValueApis<StoreAtoms<T, E>> & GetKeyApis<StoreAtoms<T, E>> & UseSetKeyApis<StoreAtoms<T, E>> & SetKeyApis<StoreAtoms<T, E>> & UseKeyStateApis<StoreAtoms<T, E>> & SubscribeKeyApis<StoreAtoms<T, E>> & {
|
|
1136
|
+
/**
|
|
1137
|
+
* When providing `selector`, the atom value will be transformed using the selector function.
|
|
1138
|
+
* The selector and equalityFn MUST be memoized.
|
|
1139
|
+
*
|
|
1140
|
+
* @see https://jotai.org/docs/utilities/select#selectatom
|
|
1141
|
+
*
|
|
1142
|
+
* @example
|
|
1143
|
+
* const store = useStore()
|
|
1144
|
+
* // only rerenders when the first element of the array changes
|
|
1145
|
+
* const arrayFirst = store.useValue('array', array => array[0], [])
|
|
1146
|
+
* // only rerenders when the first element of the array changes, but returns the whole array
|
|
1147
|
+
* const array = store.useValue('array', undefined, (prev, next) => prev[0] === next[0], [])
|
|
1148
|
+
* // without dependency array, then you need to memoize the selector and equalityFn yourself
|
|
1149
|
+
* const cb = useCallback((array) => array[n], [n])
|
|
1150
|
+
* const arrayNth = store.useValue('array', cb)
|
|
1151
|
+
*
|
|
1152
|
+
* @param key The key of the atom
|
|
1153
|
+
* @param selector A function that takes the atom value and returns the value to be used. Defaults to identity function that returns the atom value.
|
|
1154
|
+
* @param equalityFnOrDeps Dependency array or a function that compares the previous selector output and the new selector output. Defaults to comparing outputs of the selector function.
|
|
1155
|
+
* @param deps Dependency array for the selector and equalityFn
|
|
1156
|
+
*/
|
|
1157
|
+
useValue: UseParamKeyValueApi<StoreAtoms<T, E>>;
|
|
1158
|
+
get: GetParamKeyApi<StoreAtoms<T, E>>;
|
|
1159
|
+
useSet: UseSetParamKeyApi<StoreAtoms<T, E>>;
|
|
1160
|
+
set: SetParamKeyApi<StoreAtoms<T, E>>;
|
|
1161
|
+
useState: UseParamKeyStateApi<StoreAtoms<T, E>>;
|
|
1162
|
+
subscribe: SubscribeParamKeyApi<StoreAtoms<T, E>>;
|
|
1163
|
+
/**
|
|
1164
|
+
* When providing `selector`, the atom value will be transformed using the selector function.
|
|
1165
|
+
* The selector and equalityFn MUST be memoized.
|
|
1166
|
+
*
|
|
1167
|
+
* @see https://jotai.org/docs/utilities/select#selectatom
|
|
1168
|
+
*
|
|
1169
|
+
* @example
|
|
1170
|
+
* const store = useStore()
|
|
1171
|
+
* // only rerenders when the first element of the array changes
|
|
1172
|
+
* const arrayFirst = store.useAtomValue(arrayAtom, array => array[0])
|
|
1173
|
+
* // only rerenders when the first element of the array changes, but returns the whole array
|
|
1174
|
+
* const array = store.useAtomValue(arrayAtom, undefined, (prev, next) => prev[0] === next[0])
|
|
1175
|
+
* // without dependency array, then you need to memoize the selector and equalityFn yourself
|
|
1176
|
+
* const cb = useCallback((array) => array[n], [n])
|
|
1177
|
+
* const arrayNth = store.useAtomValue(arrayAtom, cb)
|
|
1178
|
+
*
|
|
1179
|
+
* @param atom The atom to use
|
|
1180
|
+
* @param selector A function that takes the atom value and returns the value to be used. Defaults to identity function that returns the atom value.
|
|
1181
|
+
* @param equalityFn Dependency array or a function that compares the previous selector output and the new selector output. Defaults to comparing outputs of the selector function.
|
|
1182
|
+
* @param deps Dependency array for the selector and equalityFn
|
|
1183
|
+
*/
|
|
1184
|
+
useAtomValue: UseAtomParamValueApi;
|
|
1185
|
+
getAtom: GetAtomParamApi;
|
|
1186
|
+
useSetAtom: UseSetAtomParamApi;
|
|
1187
|
+
setAtom: SetAtomParamApi;
|
|
1188
|
+
useAtomState: UseAtomParamStateApi;
|
|
1189
|
+
subscribeAtom: SubscribeAtomParamApi;
|
|
1190
|
+
store: JotaiStore | undefined;
|
|
1191
|
+
};
|
|
1192
|
+
type UseKeyStateUtil<T, E> = <K$1 extends keyof StoreAtoms<T, E>>(key: K$1, options?: UseAtomOptionsOrScope) => StoreAtoms<T, E>[K$1] extends WritableAtom<infer V, infer A, infer R> ? [V, (...args: A) => R] : never;
|
|
1193
|
+
type UseKeyValueUtil<T, E> = <K$1 extends keyof StoreAtoms<T, E>, S = (StoreAtoms<T, E>[K$1] extends Atom<infer V> ? V : never)>(key: K$1, options?: UseValueOptions<StoreAtoms<T, E>[K$1] extends Atom<infer V> ? V : never, S>, deps?: unknown[]) => S;
|
|
1194
|
+
type UseKeySetUtil<T, E> = <K$1 extends keyof StoreAtoms<T, E>>(key: K$1, options?: UseAtomOptionsOrScope) => StoreAtoms<T, E>[K$1] extends WritableAtom<infer _V, infer A, infer R> ? (...args: A) => R : never;
|
|
1195
|
+
type AtomStoreApi<T extends object, E extends AtomRecord<object>, N$1 extends string = ''> = {
|
|
1196
|
+
name: N$1;
|
|
1197
|
+
} & { [key in keyof Record<NameProvider<N$1>, object>]: React$1.FC<ProviderProps<StoreInitialValues<T>>> } & { [key in keyof Record<NameStore<N$1>, object>]: StoreApi<T, E, N$1> } & { [key in keyof Record<UseNameStore<N$1>, object>]: UseStoreApi<T, E> } & { [key in keyof Record<`use${Capitalize<N$1>}State`, object>]: UseKeyStateUtil<T, E> } & { [key in keyof Record<`use${Capitalize<N$1>}Value`, object>]: UseKeyValueUtil<T, E> } & { [key in keyof Record<`use${Capitalize<N$1>}Set`, object>]: UseKeySetUtil<T, E> };
|
|
1198
|
+
type UseStoreApi<T, E> = (options?: UseAtomOptionsOrScope) => ReturnOfUseStoreApi<T, E>;
|
|
1199
|
+
interface CreateAtomStoreOptions<T extends object, E extends AtomRecord<object>, N$1 extends string> {
|
|
1200
|
+
name: N$1;
|
|
1201
|
+
delay?: UseAtomOptions['delay'];
|
|
1202
|
+
effect?: React$1.FC;
|
|
1203
|
+
extend?: (atomsWithoutExtend: StoreAtomsWithoutExtend<T>) => E;
|
|
1204
|
+
suppressWarnings?: boolean;
|
|
1205
|
+
}
|
|
1206
|
+
/**
|
|
1207
|
+
* Create an atom store from an initial value.
|
|
1208
|
+
* Each property will have a getter and setter.
|
|
1209
|
+
*
|
|
1210
|
+
* @example
|
|
1211
|
+
* const { exampleStore, useExampleStore, useExampleValue, useExampleState, useExampleSet } = createAtomStore({ count: 1, say: 'hello' }, { name: 'example' as const })
|
|
1212
|
+
* const [count, setCount] = useExampleState()
|
|
1213
|
+
* const say = useExampleValue('say')
|
|
1214
|
+
* const setSay = useExampleSet('say')
|
|
1215
|
+
* setSay('world')
|
|
1216
|
+
* const countAtom = exampleStore.atom.count
|
|
1217
|
+
*/
|
|
1218
|
+
declare const createAtomStore: <T extends object, E extends AtomRecord<object>, N$1 extends string = "">(initialState: T, {
|
|
1219
|
+
name,
|
|
1220
|
+
effect,
|
|
1221
|
+
extend,
|
|
1222
|
+
suppressWarnings
|
|
1223
|
+
}: CreateAtomStoreOptions<T, E, N$1>) => AtomStoreApi<T, E, N$1>;
|
|
1224
|
+
declare function useStoreAtomValue<T, E, V$1>(store: ReturnOfUseStoreApi<T, E>, atom: Atom<V$1>): V$1;
|
|
1225
|
+
declare function useStoreAtomValue<T, E, V$1, S>(store: ReturnOfUseStoreApi<T, E>, atom: Atom<V$1>, selector: (v: V$1, prevSelectorOutput?: S) => S, deps?: unknown[]): S;
|
|
1226
|
+
declare function useStoreAtomValue<T, E, V$1, S>(store: ReturnOfUseStoreApi<T, E>, atom: Atom<V$1>, selector: ((v: V$1, prevSelectorOutput?: S) => S) | undefined, equalityFn: (prevSelectorOutput: S, selectorOutput: S) => boolean, deps?: unknown[]): S;
|
|
1227
|
+
declare function useStoreSetAtom<T, E, V$1, A$1 extends unknown[], R$1>(store: ReturnOfUseStoreApi<T, E>, atom: WritableAtom<V$1, A$1, R$1>): (...args: A$1) => R$1;
|
|
1228
|
+
declare function useStoreAtomState<T, E, V$1, A$1 extends unknown[], R$1>(store: ReturnOfUseStoreApi<T, E>, atom: WritableAtom<V$1, A$1, R$1>): [V$1, (...args: A$1) => R$1];
|
|
1229
|
+
//#endregion
|
|
1230
|
+
//#region ../udecode/jotai-x/src/createAtomProvider.d.ts
|
|
1231
|
+
type ProviderProps<T extends object> = Partial<T> & PropsWithChildren<{
|
|
1232
|
+
store?: JotaiStore;
|
|
1233
|
+
scope?: string;
|
|
1234
|
+
initialValues?: Partial<T>;
|
|
1235
|
+
resetKey?: any;
|
|
1236
|
+
}>;
|
|
1237
|
+
//#endregion
|
|
1074
1238
|
//#region src/react/stores/element/useElementStore.d.ts
|
|
1075
1239
|
declare const SCOPE_ELEMENT = "element";
|
|
1076
1240
|
type ElementStoreState = {
|
|
@@ -1095,11 +1259,11 @@ type ElementRuntimeStore = {
|
|
|
1095
1259
|
setState: (nextState: ElementRuntimeState) => void;
|
|
1096
1260
|
subscribe: (listener: () => void) => () => void;
|
|
1097
1261
|
};
|
|
1098
|
-
declare const elementStore:
|
|
1262
|
+
declare const elementStore: StoreApi<ElementStoreState, object, "element">;
|
|
1099
1263
|
declare const withElementContext: <T>(context: Omit<ElementContextValue, "parent">, callback: () => T) => T;
|
|
1100
1264
|
declare const useElementContext: (scope?: string) => ElementContextValue | null;
|
|
1101
1265
|
declare const useElementStoreContext: (scope?: string) => ElementStoreContextValue | null;
|
|
1102
|
-
declare const useElementStore: (scope?: string) =>
|
|
1266
|
+
declare const useElementStore: (scope?: string) => ReturnOfUseStoreApi<ElementStoreState, object>;
|
|
1103
1267
|
declare function ElementProvider({
|
|
1104
1268
|
children,
|
|
1105
1269
|
path,
|
|
@@ -1233,7 +1397,7 @@ declare const createPlateStore: <E extends PlateEditor = PlateEditor>({
|
|
|
1233
1397
|
onTextChange,
|
|
1234
1398
|
onValueChange,
|
|
1235
1399
|
...state
|
|
1236
|
-
}?: Partial<PlateStoreState<E>>) =>
|
|
1400
|
+
}?: Partial<PlateStoreState<E>>) => AtomStoreApi<PlateStoreState<E>, {
|
|
1237
1401
|
trackedEditor: jotai5.Atom<{
|
|
1238
1402
|
editor: any;
|
|
1239
1403
|
version: number | null;
|
|
@@ -1247,12 +1411,12 @@ declare const createPlateStore: <E extends PlateEditor = PlateEditor>({
|
|
|
1247
1411
|
version: number | null;
|
|
1248
1412
|
}>;
|
|
1249
1413
|
}, "plate">;
|
|
1250
|
-
declare const PlateStoreProvider: React$1.FC<
|
|
1414
|
+
declare const PlateStoreProvider: React$1.FC<ProviderProps<{
|
|
1251
1415
|
composing: boolean | null;
|
|
1252
1416
|
decorate: ((options: {
|
|
1253
1417
|
editor: PlateEditor;
|
|
1254
|
-
entry:
|
|
1255
|
-
}) =>
|
|
1418
|
+
entry: _platejs_slate20.NodeEntry;
|
|
1419
|
+
}) => _platejs_slate20.TRange[]) | null;
|
|
1256
1420
|
isMounted: boolean | null;
|
|
1257
1421
|
primary: boolean | null;
|
|
1258
1422
|
readOnly: boolean | null;
|
|
@@ -1266,34 +1430,34 @@ declare const PlateStoreProvider: React$1.FC<jotai_x2.ProviderProps<{
|
|
|
1266
1430
|
versionValue: number | null;
|
|
1267
1431
|
onChange: ((options: {
|
|
1268
1432
|
editor: PlateEditor;
|
|
1269
|
-
value:
|
|
1433
|
+
value: _platejs_slate20.Value;
|
|
1270
1434
|
}) => void) | null;
|
|
1271
1435
|
onNodeChange: ((options: {
|
|
1272
1436
|
editor: PlateEditor;
|
|
1273
|
-
node:
|
|
1274
|
-
operation:
|
|
1275
|
-
prevNode:
|
|
1437
|
+
node: _platejs_slate20.Descendant;
|
|
1438
|
+
operation: _platejs_slate20.NodeOperation;
|
|
1439
|
+
prevNode: _platejs_slate20.Descendant;
|
|
1276
1440
|
}) => void) | null;
|
|
1277
1441
|
onSelectionChange: ((options: {
|
|
1278
1442
|
editor: PlateEditor;
|
|
1279
|
-
selection:
|
|
1443
|
+
selection: _platejs_slate20.TSelection;
|
|
1280
1444
|
}) => void) | null;
|
|
1281
1445
|
onTextChange: ((options: {
|
|
1282
1446
|
editor: PlateEditor;
|
|
1283
|
-
node:
|
|
1284
|
-
operation:
|
|
1447
|
+
node: _platejs_slate20.Descendant;
|
|
1448
|
+
operation: _platejs_slate20.TextOperation;
|
|
1285
1449
|
prevText: string;
|
|
1286
1450
|
text: string;
|
|
1287
1451
|
}) => void) | null;
|
|
1288
1452
|
onValueChange: ((options: {
|
|
1289
1453
|
editor: PlateEditor;
|
|
1290
|
-
value:
|
|
1454
|
+
value: _platejs_slate20.Value;
|
|
1291
1455
|
}) => void) | null;
|
|
1292
1456
|
id: string;
|
|
1293
1457
|
containerRef: React$1.RefObject<HTMLDivElement | null>;
|
|
1294
1458
|
editor: PlateEditor;
|
|
1295
1459
|
scrollRef: React$1.RefObject<HTMLDivElement | null>;
|
|
1296
|
-
}>>, plateStore:
|
|
1460
|
+
}>>, plateStore: StoreApi<PlateStoreState<PlateEditor>, {
|
|
1297
1461
|
trackedEditor: jotai5.Atom<{
|
|
1298
1462
|
editor: any;
|
|
1299
1463
|
version: number | null;
|
|
@@ -1306,52 +1470,52 @@ declare const PlateStoreProvider: React$1.FC<jotai_x2.ProviderProps<{
|
|
|
1306
1470
|
value: any;
|
|
1307
1471
|
version: number | null;
|
|
1308
1472
|
}>;
|
|
1309
|
-
}, "plate">, usePlateLocalSet: <K$1 extends "
|
|
1310
|
-
composing:
|
|
1311
|
-
decorate:
|
|
1473
|
+
}, "plate">, usePlateLocalSet: <K$1 extends "decorate" | "renderElement" | "renderLeaf" | "renderText" | "editor" | "id" | "onChange" | "onNodeChange" | "onTextChange" | "readOnly" | "composing" | "isMounted" | "primary" | "renderChunk" | "versionDecorate" | "versionEditor" | "versionSelection" | "versionValue" | "onSelectionChange" | "onValueChange" | "containerRef" | "scrollRef" | "trackedEditor" | "trackedSelection" | "trackedValue">(key: K$1, options?: string | UseAtomOptions) => ({
|
|
1474
|
+
composing: SimpleWritableAtom<boolean | null>;
|
|
1475
|
+
decorate: SimpleWritableAtom<((options: {
|
|
1312
1476
|
editor: PlateEditor;
|
|
1313
|
-
entry:
|
|
1314
|
-
}) =>
|
|
1315
|
-
isMounted:
|
|
1316
|
-
primary:
|
|
1317
|
-
readOnly:
|
|
1318
|
-
renderChunk:
|
|
1319
|
-
renderElement:
|
|
1320
|
-
renderLeaf:
|
|
1321
|
-
renderText:
|
|
1322
|
-
versionDecorate:
|
|
1323
|
-
versionEditor:
|
|
1324
|
-
versionSelection:
|
|
1325
|
-
versionValue:
|
|
1326
|
-
onChange:
|
|
1477
|
+
entry: _platejs_slate20.NodeEntry;
|
|
1478
|
+
}) => _platejs_slate20.TRange[]) | null>;
|
|
1479
|
+
isMounted: SimpleWritableAtom<boolean | null>;
|
|
1480
|
+
primary: SimpleWritableAtom<boolean | null>;
|
|
1481
|
+
readOnly: SimpleWritableAtom<boolean | null>;
|
|
1482
|
+
renderChunk: SimpleWritableAtom<RenderChunkFn | null>;
|
|
1483
|
+
renderElement: SimpleWritableAtom<RenderElementFn | null>;
|
|
1484
|
+
renderLeaf: SimpleWritableAtom<RenderLeafFn | null>;
|
|
1485
|
+
renderText: SimpleWritableAtom<RenderTextFn | null>;
|
|
1486
|
+
versionDecorate: SimpleWritableAtom<number | null>;
|
|
1487
|
+
versionEditor: SimpleWritableAtom<number | null>;
|
|
1488
|
+
versionSelection: SimpleWritableAtom<number | null>;
|
|
1489
|
+
versionValue: SimpleWritableAtom<number | null>;
|
|
1490
|
+
onChange: SimpleWritableAtom<((options: {
|
|
1327
1491
|
editor: PlateEditor;
|
|
1328
|
-
value:
|
|
1492
|
+
value: _platejs_slate20.Value;
|
|
1329
1493
|
}) => void) | null>;
|
|
1330
|
-
onNodeChange:
|
|
1494
|
+
onNodeChange: SimpleWritableAtom<((options: {
|
|
1331
1495
|
editor: PlateEditor;
|
|
1332
|
-
node:
|
|
1333
|
-
operation:
|
|
1334
|
-
prevNode:
|
|
1496
|
+
node: _platejs_slate20.Descendant;
|
|
1497
|
+
operation: _platejs_slate20.NodeOperation;
|
|
1498
|
+
prevNode: _platejs_slate20.Descendant;
|
|
1335
1499
|
}) => void) | null>;
|
|
1336
|
-
onSelectionChange:
|
|
1500
|
+
onSelectionChange: SimpleWritableAtom<((options: {
|
|
1337
1501
|
editor: PlateEditor;
|
|
1338
|
-
selection:
|
|
1502
|
+
selection: _platejs_slate20.TSelection;
|
|
1339
1503
|
}) => void) | null>;
|
|
1340
|
-
onTextChange:
|
|
1504
|
+
onTextChange: SimpleWritableAtom<((options: {
|
|
1341
1505
|
editor: PlateEditor;
|
|
1342
|
-
node:
|
|
1343
|
-
operation:
|
|
1506
|
+
node: _platejs_slate20.Descendant;
|
|
1507
|
+
operation: _platejs_slate20.TextOperation;
|
|
1344
1508
|
prevText: string;
|
|
1345
1509
|
text: string;
|
|
1346
1510
|
}) => void) | null>;
|
|
1347
|
-
onValueChange:
|
|
1511
|
+
onValueChange: SimpleWritableAtom<((options: {
|
|
1348
1512
|
editor: PlateEditor;
|
|
1349
|
-
value:
|
|
1513
|
+
value: _platejs_slate20.Value;
|
|
1350
1514
|
}) => void) | null>;
|
|
1351
|
-
id:
|
|
1352
|
-
containerRef:
|
|
1353
|
-
editor:
|
|
1354
|
-
scrollRef:
|
|
1515
|
+
id: SimpleWritableAtom<string>;
|
|
1516
|
+
containerRef: SimpleWritableAtom<React$1.RefObject<HTMLDivElement | null>>;
|
|
1517
|
+
editor: SimpleWritableAtom<PlateEditor>;
|
|
1518
|
+
scrollRef: SimpleWritableAtom<React$1.RefObject<HTMLDivElement | null>>;
|
|
1355
1519
|
} & {
|
|
1356
1520
|
trackedEditor: jotai5.Atom<{
|
|
1357
1521
|
editor: any;
|
|
@@ -1365,52 +1529,52 @@ declare const PlateStoreProvider: React$1.FC<jotai_x2.ProviderProps<{
|
|
|
1365
1529
|
value: any;
|
|
1366
1530
|
version: number | null;
|
|
1367
1531
|
}>;
|
|
1368
|
-
})[K$1] extends jotai5.WritableAtom<infer _V, infer A extends unknown[], infer R> ? (...args: A) => R : never, usePlateLocalState: <K$1 extends "
|
|
1369
|
-
composing:
|
|
1370
|
-
decorate:
|
|
1532
|
+
})[K$1] extends jotai5.WritableAtom<infer _V, infer A extends unknown[], infer R> ? (...args: A) => R : never, usePlateLocalState: <K$1 extends "decorate" | "renderElement" | "renderLeaf" | "renderText" | "editor" | "id" | "onChange" | "onNodeChange" | "onTextChange" | "readOnly" | "composing" | "isMounted" | "primary" | "renderChunk" | "versionDecorate" | "versionEditor" | "versionSelection" | "versionValue" | "onSelectionChange" | "onValueChange" | "containerRef" | "scrollRef" | "trackedEditor" | "trackedSelection" | "trackedValue">(key: K$1, options?: string | UseAtomOptions) => ({
|
|
1533
|
+
composing: SimpleWritableAtom<boolean | null>;
|
|
1534
|
+
decorate: SimpleWritableAtom<((options: {
|
|
1371
1535
|
editor: PlateEditor;
|
|
1372
|
-
entry:
|
|
1373
|
-
}) =>
|
|
1374
|
-
isMounted:
|
|
1375
|
-
primary:
|
|
1376
|
-
readOnly:
|
|
1377
|
-
renderChunk:
|
|
1378
|
-
renderElement:
|
|
1379
|
-
renderLeaf:
|
|
1380
|
-
renderText:
|
|
1381
|
-
versionDecorate:
|
|
1382
|
-
versionEditor:
|
|
1383
|
-
versionSelection:
|
|
1384
|
-
versionValue:
|
|
1385
|
-
onChange:
|
|
1536
|
+
entry: _platejs_slate20.NodeEntry;
|
|
1537
|
+
}) => _platejs_slate20.TRange[]) | null>;
|
|
1538
|
+
isMounted: SimpleWritableAtom<boolean | null>;
|
|
1539
|
+
primary: SimpleWritableAtom<boolean | null>;
|
|
1540
|
+
readOnly: SimpleWritableAtom<boolean | null>;
|
|
1541
|
+
renderChunk: SimpleWritableAtom<RenderChunkFn | null>;
|
|
1542
|
+
renderElement: SimpleWritableAtom<RenderElementFn | null>;
|
|
1543
|
+
renderLeaf: SimpleWritableAtom<RenderLeafFn | null>;
|
|
1544
|
+
renderText: SimpleWritableAtom<RenderTextFn | null>;
|
|
1545
|
+
versionDecorate: SimpleWritableAtom<number | null>;
|
|
1546
|
+
versionEditor: SimpleWritableAtom<number | null>;
|
|
1547
|
+
versionSelection: SimpleWritableAtom<number | null>;
|
|
1548
|
+
versionValue: SimpleWritableAtom<number | null>;
|
|
1549
|
+
onChange: SimpleWritableAtom<((options: {
|
|
1386
1550
|
editor: PlateEditor;
|
|
1387
|
-
value:
|
|
1551
|
+
value: _platejs_slate20.Value;
|
|
1388
1552
|
}) => void) | null>;
|
|
1389
|
-
onNodeChange:
|
|
1553
|
+
onNodeChange: SimpleWritableAtom<((options: {
|
|
1390
1554
|
editor: PlateEditor;
|
|
1391
|
-
node:
|
|
1392
|
-
operation:
|
|
1393
|
-
prevNode:
|
|
1555
|
+
node: _platejs_slate20.Descendant;
|
|
1556
|
+
operation: _platejs_slate20.NodeOperation;
|
|
1557
|
+
prevNode: _platejs_slate20.Descendant;
|
|
1394
1558
|
}) => void) | null>;
|
|
1395
|
-
onSelectionChange:
|
|
1559
|
+
onSelectionChange: SimpleWritableAtom<((options: {
|
|
1396
1560
|
editor: PlateEditor;
|
|
1397
|
-
selection:
|
|
1561
|
+
selection: _platejs_slate20.TSelection;
|
|
1398
1562
|
}) => void) | null>;
|
|
1399
|
-
onTextChange:
|
|
1563
|
+
onTextChange: SimpleWritableAtom<((options: {
|
|
1400
1564
|
editor: PlateEditor;
|
|
1401
|
-
node:
|
|
1402
|
-
operation:
|
|
1565
|
+
node: _platejs_slate20.Descendant;
|
|
1566
|
+
operation: _platejs_slate20.TextOperation;
|
|
1403
1567
|
prevText: string;
|
|
1404
1568
|
text: string;
|
|
1405
1569
|
}) => void) | null>;
|
|
1406
|
-
onValueChange:
|
|
1570
|
+
onValueChange: SimpleWritableAtom<((options: {
|
|
1407
1571
|
editor: PlateEditor;
|
|
1408
|
-
value:
|
|
1572
|
+
value: _platejs_slate20.Value;
|
|
1409
1573
|
}) => void) | null>;
|
|
1410
|
-
id:
|
|
1411
|
-
containerRef:
|
|
1412
|
-
editor:
|
|
1413
|
-
scrollRef:
|
|
1574
|
+
id: SimpleWritableAtom<string>;
|
|
1575
|
+
containerRef: SimpleWritableAtom<React$1.RefObject<HTMLDivElement | null>>;
|
|
1576
|
+
editor: SimpleWritableAtom<PlateEditor>;
|
|
1577
|
+
scrollRef: SimpleWritableAtom<React$1.RefObject<HTMLDivElement | null>>;
|
|
1414
1578
|
} & {
|
|
1415
1579
|
trackedEditor: jotai5.Atom<{
|
|
1416
1580
|
editor: any;
|
|
@@ -1424,7 +1588,7 @@ declare const PlateStoreProvider: React$1.FC<jotai_x2.ProviderProps<{
|
|
|
1424
1588
|
value: any;
|
|
1425
1589
|
version: number | null;
|
|
1426
1590
|
}>;
|
|
1427
|
-
})[K$1] extends jotai5.WritableAtom<infer V, infer A extends unknown[], infer R> ? [V, (...args: A) => R] : never, usePlateLocalStore:
|
|
1591
|
+
})[K$1] extends jotai5.WritableAtom<infer V, infer A extends unknown[], infer R> ? [V, (...args: A) => R] : never, usePlateLocalStore: UseStoreApi<PlateStoreState<PlateEditor>, {
|
|
1428
1592
|
trackedEditor: jotai5.Atom<{
|
|
1429
1593
|
editor: any;
|
|
1430
1594
|
version: number | null;
|
|
@@ -1437,52 +1601,52 @@ declare const PlateStoreProvider: React$1.FC<jotai_x2.ProviderProps<{
|
|
|
1437
1601
|
value: any;
|
|
1438
1602
|
version: number | null;
|
|
1439
1603
|
}>;
|
|
1440
|
-
}>, usePlateLocalValue: <K$1 extends "
|
|
1441
|
-
composing:
|
|
1442
|
-
decorate:
|
|
1604
|
+
}>, usePlateLocalValue: <K$1 extends "decorate" | "renderElement" | "renderLeaf" | "renderText" | "editor" | "id" | "onChange" | "onNodeChange" | "onTextChange" | "readOnly" | "composing" | "isMounted" | "primary" | "renderChunk" | "versionDecorate" | "versionEditor" | "versionSelection" | "versionValue" | "onSelectionChange" | "onValueChange" | "containerRef" | "scrollRef" | "trackedEditor" | "trackedSelection" | "trackedValue", S = (({
|
|
1605
|
+
composing: SimpleWritableAtom<boolean | null>;
|
|
1606
|
+
decorate: SimpleWritableAtom<((options: {
|
|
1443
1607
|
editor: PlateEditor;
|
|
1444
|
-
entry:
|
|
1445
|
-
}) =>
|
|
1446
|
-
isMounted:
|
|
1447
|
-
primary:
|
|
1448
|
-
readOnly:
|
|
1449
|
-
renderChunk:
|
|
1450
|
-
renderElement:
|
|
1451
|
-
renderLeaf:
|
|
1452
|
-
renderText:
|
|
1453
|
-
versionDecorate:
|
|
1454
|
-
versionEditor:
|
|
1455
|
-
versionSelection:
|
|
1456
|
-
versionValue:
|
|
1457
|
-
onChange:
|
|
1608
|
+
entry: _platejs_slate20.NodeEntry;
|
|
1609
|
+
}) => _platejs_slate20.TRange[]) | null>;
|
|
1610
|
+
isMounted: SimpleWritableAtom<boolean | null>;
|
|
1611
|
+
primary: SimpleWritableAtom<boolean | null>;
|
|
1612
|
+
readOnly: SimpleWritableAtom<boolean | null>;
|
|
1613
|
+
renderChunk: SimpleWritableAtom<RenderChunkFn | null>;
|
|
1614
|
+
renderElement: SimpleWritableAtom<RenderElementFn | null>;
|
|
1615
|
+
renderLeaf: SimpleWritableAtom<RenderLeafFn | null>;
|
|
1616
|
+
renderText: SimpleWritableAtom<RenderTextFn | null>;
|
|
1617
|
+
versionDecorate: SimpleWritableAtom<number | null>;
|
|
1618
|
+
versionEditor: SimpleWritableAtom<number | null>;
|
|
1619
|
+
versionSelection: SimpleWritableAtom<number | null>;
|
|
1620
|
+
versionValue: SimpleWritableAtom<number | null>;
|
|
1621
|
+
onChange: SimpleWritableAtom<((options: {
|
|
1458
1622
|
editor: PlateEditor;
|
|
1459
|
-
value:
|
|
1623
|
+
value: _platejs_slate20.Value;
|
|
1460
1624
|
}) => void) | null>;
|
|
1461
|
-
onNodeChange:
|
|
1625
|
+
onNodeChange: SimpleWritableAtom<((options: {
|
|
1462
1626
|
editor: PlateEditor;
|
|
1463
|
-
node:
|
|
1464
|
-
operation:
|
|
1465
|
-
prevNode:
|
|
1627
|
+
node: _platejs_slate20.Descendant;
|
|
1628
|
+
operation: _platejs_slate20.NodeOperation;
|
|
1629
|
+
prevNode: _platejs_slate20.Descendant;
|
|
1466
1630
|
}) => void) | null>;
|
|
1467
|
-
onSelectionChange:
|
|
1631
|
+
onSelectionChange: SimpleWritableAtom<((options: {
|
|
1468
1632
|
editor: PlateEditor;
|
|
1469
|
-
selection:
|
|
1633
|
+
selection: _platejs_slate20.TSelection;
|
|
1470
1634
|
}) => void) | null>;
|
|
1471
|
-
onTextChange:
|
|
1635
|
+
onTextChange: SimpleWritableAtom<((options: {
|
|
1472
1636
|
editor: PlateEditor;
|
|
1473
|
-
node:
|
|
1474
|
-
operation:
|
|
1637
|
+
node: _platejs_slate20.Descendant;
|
|
1638
|
+
operation: _platejs_slate20.TextOperation;
|
|
1475
1639
|
prevText: string;
|
|
1476
1640
|
text: string;
|
|
1477
1641
|
}) => void) | null>;
|
|
1478
|
-
onValueChange:
|
|
1642
|
+
onValueChange: SimpleWritableAtom<((options: {
|
|
1479
1643
|
editor: PlateEditor;
|
|
1480
|
-
value:
|
|
1644
|
+
value: _platejs_slate20.Value;
|
|
1481
1645
|
}) => void) | null>;
|
|
1482
|
-
id:
|
|
1483
|
-
containerRef:
|
|
1484
|
-
editor:
|
|
1485
|
-
scrollRef:
|
|
1646
|
+
id: SimpleWritableAtom<string>;
|
|
1647
|
+
containerRef: SimpleWritableAtom<React$1.RefObject<HTMLDivElement | null>>;
|
|
1648
|
+
editor: SimpleWritableAtom<PlateEditor>;
|
|
1649
|
+
scrollRef: SimpleWritableAtom<React$1.RefObject<HTMLDivElement | null>>;
|
|
1486
1650
|
} & {
|
|
1487
1651
|
trackedEditor: jotai5.Atom<{
|
|
1488
1652
|
editor: any;
|
|
@@ -1498,51 +1662,51 @@ declare const PlateStoreProvider: React$1.FC<jotai_x2.ProviderProps<{
|
|
|
1498
1662
|
}>;
|
|
1499
1663
|
})[K$1] extends jotai5.Atom<infer V> ? V : never)>(key: K$1, options?: ({
|
|
1500
1664
|
selector?: ((v: ({
|
|
1501
|
-
composing:
|
|
1502
|
-
decorate:
|
|
1665
|
+
composing: SimpleWritableAtom<boolean | null>;
|
|
1666
|
+
decorate: SimpleWritableAtom<((options: {
|
|
1503
1667
|
editor: PlateEditor;
|
|
1504
|
-
entry:
|
|
1505
|
-
}) =>
|
|
1506
|
-
isMounted:
|
|
1507
|
-
primary:
|
|
1508
|
-
readOnly:
|
|
1509
|
-
renderChunk:
|
|
1510
|
-
renderElement:
|
|
1511
|
-
renderLeaf:
|
|
1512
|
-
renderText:
|
|
1513
|
-
versionDecorate:
|
|
1514
|
-
versionEditor:
|
|
1515
|
-
versionSelection:
|
|
1516
|
-
versionValue:
|
|
1517
|
-
onChange:
|
|
1668
|
+
entry: _platejs_slate20.NodeEntry;
|
|
1669
|
+
}) => _platejs_slate20.TRange[]) | null>;
|
|
1670
|
+
isMounted: SimpleWritableAtom<boolean | null>;
|
|
1671
|
+
primary: SimpleWritableAtom<boolean | null>;
|
|
1672
|
+
readOnly: SimpleWritableAtom<boolean | null>;
|
|
1673
|
+
renderChunk: SimpleWritableAtom<RenderChunkFn | null>;
|
|
1674
|
+
renderElement: SimpleWritableAtom<RenderElementFn | null>;
|
|
1675
|
+
renderLeaf: SimpleWritableAtom<RenderLeafFn | null>;
|
|
1676
|
+
renderText: SimpleWritableAtom<RenderTextFn | null>;
|
|
1677
|
+
versionDecorate: SimpleWritableAtom<number | null>;
|
|
1678
|
+
versionEditor: SimpleWritableAtom<number | null>;
|
|
1679
|
+
versionSelection: SimpleWritableAtom<number | null>;
|
|
1680
|
+
versionValue: SimpleWritableAtom<number | null>;
|
|
1681
|
+
onChange: SimpleWritableAtom<((options: {
|
|
1518
1682
|
editor: PlateEditor;
|
|
1519
|
-
value:
|
|
1683
|
+
value: _platejs_slate20.Value;
|
|
1520
1684
|
}) => void) | null>;
|
|
1521
|
-
onNodeChange:
|
|
1685
|
+
onNodeChange: SimpleWritableAtom<((options: {
|
|
1522
1686
|
editor: PlateEditor;
|
|
1523
|
-
node:
|
|
1524
|
-
operation:
|
|
1525
|
-
prevNode:
|
|
1687
|
+
node: _platejs_slate20.Descendant;
|
|
1688
|
+
operation: _platejs_slate20.NodeOperation;
|
|
1689
|
+
prevNode: _platejs_slate20.Descendant;
|
|
1526
1690
|
}) => void) | null>;
|
|
1527
|
-
onSelectionChange:
|
|
1691
|
+
onSelectionChange: SimpleWritableAtom<((options: {
|
|
1528
1692
|
editor: PlateEditor;
|
|
1529
|
-
selection:
|
|
1693
|
+
selection: _platejs_slate20.TSelection;
|
|
1530
1694
|
}) => void) | null>;
|
|
1531
|
-
onTextChange:
|
|
1695
|
+
onTextChange: SimpleWritableAtom<((options: {
|
|
1532
1696
|
editor: PlateEditor;
|
|
1533
|
-
node:
|
|
1534
|
-
operation:
|
|
1697
|
+
node: _platejs_slate20.Descendant;
|
|
1698
|
+
operation: _platejs_slate20.TextOperation;
|
|
1535
1699
|
prevText: string;
|
|
1536
1700
|
text: string;
|
|
1537
1701
|
}) => void) | null>;
|
|
1538
|
-
onValueChange:
|
|
1702
|
+
onValueChange: SimpleWritableAtom<((options: {
|
|
1539
1703
|
editor: PlateEditor;
|
|
1540
|
-
value:
|
|
1704
|
+
value: _platejs_slate20.Value;
|
|
1541
1705
|
}) => void) | null>;
|
|
1542
|
-
id:
|
|
1543
|
-
containerRef:
|
|
1544
|
-
editor:
|
|
1545
|
-
scrollRef:
|
|
1706
|
+
id: SimpleWritableAtom<string>;
|
|
1707
|
+
containerRef: SimpleWritableAtom<React$1.RefObject<HTMLDivElement | null>>;
|
|
1708
|
+
editor: SimpleWritableAtom<PlateEditor>;
|
|
1709
|
+
scrollRef: SimpleWritableAtom<React$1.RefObject<HTMLDivElement | null>>;
|
|
1546
1710
|
} & {
|
|
1547
1711
|
trackedEditor: jotai5.Atom<{
|
|
1548
1712
|
editor: any;
|
|
@@ -1558,8 +1722,8 @@ declare const PlateStoreProvider: React$1.FC<jotai_x2.ProviderProps<{
|
|
|
1558
1722
|
}>;
|
|
1559
1723
|
})[K$1] extends jotai5.Atom<infer V_1> ? V_1 : never, prevSelectorOutput?: S | undefined) => S) | undefined;
|
|
1560
1724
|
equalityFn?: ((prev: S, next: S) => boolean) | undefined;
|
|
1561
|
-
} &
|
|
1562
|
-
declare const usePlateStore: (id?: string) =>
|
|
1725
|
+
} & UseAtomOptions) | undefined, deps?: unknown[]) => S;
|
|
1726
|
+
declare const usePlateStore: (id?: string) => ReturnOfUseStoreApi<PlateStoreState<PlateEditor>, {
|
|
1563
1727
|
trackedEditor: jotai5.Atom<{
|
|
1564
1728
|
editor: any;
|
|
1565
1729
|
version: number | null;
|
|
@@ -1665,11 +1829,11 @@ declare function useEditorPluginOptions<C extends AnyPluginConfig, U>(editor: Pl
|
|
|
1665
1829
|
}): U;
|
|
1666
1830
|
//#endregion
|
|
1667
1831
|
//#region src/react/stores/plate-controller/plateControllerStore.d.ts
|
|
1668
|
-
declare const PlateController: React$1.FC<
|
|
1832
|
+
declare const PlateController: React$1.FC<ProviderProps<{
|
|
1669
1833
|
activeId: string | null;
|
|
1670
1834
|
editorStores: Record<string, jotai_vanilla_internals0.INTERNAL_Store | null>;
|
|
1671
1835
|
primaryEditorIds: string[];
|
|
1672
|
-
}>>, plateControllerStore:
|
|
1836
|
+
}>>, plateControllerStore: StoreApi<{
|
|
1673
1837
|
activeId: jotai5.PrimitiveAtom<string | null> & {
|
|
1674
1838
|
init: string | null;
|
|
1675
1839
|
};
|
|
@@ -1679,7 +1843,7 @@ declare const PlateController: React$1.FC<jotai_x2.ProviderProps<{
|
|
|
1679
1843
|
primaryEditorIds: jotai5.PrimitiveAtom<string[]> & {
|
|
1680
1844
|
init: string[];
|
|
1681
1845
|
};
|
|
1682
|
-
}, object, "plateController">, _usePlateControllerStore:
|
|
1846
|
+
}, object, "plateController">, _usePlateControllerStore: UseStoreApi<{
|
|
1683
1847
|
activeId: jotai5.PrimitiveAtom<string | null> & {
|
|
1684
1848
|
init: string | null;
|
|
1685
1849
|
};
|
|
@@ -1805,7 +1969,7 @@ declare const useEditableProps: ({
|
|
|
1805
1969
|
* if another node is updated in a way that affects this node's path, this hook
|
|
1806
1970
|
* will not return the new path.
|
|
1807
1971
|
*/
|
|
1808
|
-
declare const useNodePath: (node: TNode) =>
|
|
1972
|
+
declare const useNodePath: (node: TNode) => _platejs_slate20.Path | undefined;
|
|
1809
1973
|
//#endregion
|
|
1810
1974
|
//#region src/react/hooks/useSlateProps.d.ts
|
|
1811
1975
|
type SlateComponentProps = Omit<React$1.ComponentProps<typeof Slate>, 'children'>;
|
|
@@ -1820,7 +1984,7 @@ declare const useSlateProps: ({
|
|
|
1820
1984
|
}) => PlateSlateProps;
|
|
1821
1985
|
//#endregion
|
|
1822
1986
|
//#region src/react/utils/createPlateFallbackEditor.d.ts
|
|
1823
|
-
declare const createPlateFallbackEditor: (options?: CreatePlateEditorOptions) => TPlateEditor<
|
|
1987
|
+
declare const createPlateFallbackEditor: (options?: CreatePlateEditorOptions) => TPlateEditor<_platejs_slate20.Value, PlateCorePlugin>;
|
|
1824
1988
|
//#endregion
|
|
1825
1989
|
//#region src/react/utils/dom-attributes.d.ts
|
|
1826
1990
|
declare const DOM_HANDLERS: (keyof DOMHandlers)[];
|