UNPKG

@udecode/plate-list

Version:

List plugin for Plate

153 lines (147 loc) 8.22 kB
import * as _udecode_plate_core_react from '@udecode/plate-core/react'; import * as _udecode_plate_core from '@udecode/plate-core'; import { B as BaseListConfig, G as GetSiblingListOptions, L as ListStyleType } from '../BaseListPlugin-C8rmwv_L.mjs'; import * as _udecode_slate from '@udecode/slate'; import * as zustand_x from 'zustand-x'; import * as mutative from 'mutative'; import * as is_hotkey from 'is-hotkey'; import * as _udecode_utils from '@udecode/utils'; import { TElement } from '@udecode/plate'; type ListConfig = BaseListConfig; /** Enables support for indented lists with React-specific features. */ declare const ListPlugin: _udecode_plate_core_react.PlatePlugin<_udecode_plate_core.PluginConfig<"list", { getSiblingListOptions?: GetSiblingListOptions<_udecode_slate.TElement>; getListStyleType?: (element: HTMLElement) => ListStyleType; }, {}, {}, {}>>; declare const useListToolbarButtonState: ({ nodeType, }?: { nodeType?: string; }) => { nodeType: string; pressed: boolean; }; declare const useListToolbarButton: ({ nodeType, pressed, }: ReturnType<typeof useListToolbarButtonState>) => { props: { pressed: boolean; onClick: () => void; onMouseDown: (e: React.MouseEvent<HTMLButtonElement>) => void; }; }; declare const useTodoListElementState: ({ element }: { element: TElement; }) => { checked: unknown; editor: { id: string; children: _udecode_slate.Value; history: _udecode_slate.History; marks: _udecode_slate.EditorMarks | null; meta: _udecode_utils.UnknownObject; operations: _udecode_slate.Operation<TElement | _udecode_slate.TText>[]; selection: _udecode_slate.EditorSelection; } & _udecode_slate.EditorMethods<_udecode_slate.Value> & _udecode_utils.UnknownObject & { dom: { composing: boolean; currentKeyboardEvent: is_hotkey.KeyboardEventLike | null; focused: boolean; prevSelection: _udecode_slate.TRange | null; readOnly: boolean; }; meta: _udecode_slate.EditorBase["meta"] & { key: any; components: _udecode_plate_core.NodeComponents; isFallback: boolean; pluginCache: { decorate: string[]; handlers: { onChange: string[]; }; inject: { nodeProps: string[]; }; node: { isContainer: string[]; isElement: string[]; isInline: string[]; isLeaf: string[]; isMarkableVoid: string[]; isNotSelectable: string[]; isStrictSiblings: string[]; isVoid: string[]; types: Record<string, string>; }; normalizeInitialValue: string[]; render: { aboveEditable: string[]; aboveNodes: string[]; aboveSlate: string[]; afterContainer: string[]; afterEditable: string[]; beforeContainer: string[]; beforeEditable: string[]; belowNodes: string[]; belowRootNodes: string[]; }; rules: { match: string[]; }; useHooks: string[]; }; pluginList: any[]; uid?: string; }; plugins: Record<string, any>; setOptions: { <C extends _udecode_plate_core.AnyPluginConfig>(plugin: _udecode_plate_core.WithRequiredKey<C>, options: (state: mutative.Draft<Partial<_udecode_plate_core.InferOptions<C>>>) => void): void; <C extends _udecode_plate_core.AnyPluginConfig>(plugin: _udecode_plate_core.WithRequiredKey<C>, options: Partial<_udecode_plate_core.InferOptions<C>>): void; }; getInjectProps: <C extends _udecode_plate_core.AnyPluginConfig = _udecode_plate_core.PluginConfig>(plugin: _udecode_plate_core.WithRequiredKey<C>) => _udecode_plate_core.InjectNodeProps<C>; getOption: <C extends _udecode_plate_core.AnyPluginConfig, StateType extends _udecode_plate_core.InferOptions<C>, TSelectors extends _udecode_plate_core.InferSelectors<C>, K extends keyof StateType | keyof TSelectors | "state">(plugin: _udecode_plate_core.WithRequiredKey<C>, key: K, ...args: K extends keyof TSelectors ? Parameters<TSelectors[K]> : []) => K extends "state" ? StateType : K extends keyof TSelectors ? ReturnType<TSelectors[K]> : K extends keyof StateType ? StateType[K] : never; getOptions: <C extends _udecode_plate_core.AnyPluginConfig = _udecode_plate_core.PluginConfig>(plugin: _udecode_plate_core.WithRequiredKey<C>) => _udecode_plate_core.InferOptions<C>; getOptionsStore: <C extends _udecode_plate_core.AnyPluginConfig>(plugin: _udecode_plate_core.WithRequiredKey<C>) => zustand_x.TStateApi<_udecode_plate_core.InferOptions<C>, [["zustand/mutative-x", never]], {}, _udecode_plate_core.InferSelectors<C>>; getPlugin: <C extends _udecode_plate_core.AnyPluginConfig = _udecode_plate_core.PluginConfig>(plugin: _udecode_plate_core.WithRequiredKey<C>) => C extends { node: any; } ? C : _udecode_plate_core.EditorPlugin<C>; getType: (pluginKey: string) => string; setOption: <C extends _udecode_plate_core.AnyPluginConfig, K extends keyof _udecode_plate_core.InferOptions<C>>(plugin: _udecode_plate_core.WithRequiredKey<C>, optionKey: K, value: _udecode_plate_core.InferOptions<C>[K]) => void; } & { api: _udecode_slate.EditorApi & _udecode_utils.UnionToIntersection<_udecode_plate_core.InferApi<_udecode_plate_core_react.PlateCorePlugin>>; meta: _udecode_plate_core.BaseEditor["meta"] & { pluginList: _udecode_plate_core_react.AnyEditorPlatePlugin[]; shortcuts: _udecode_plate_core_react.Shortcuts; }; plugins: Record<string, _udecode_plate_core_react.AnyEditorPlatePlugin>; tf: _udecode_slate.EditorTransforms & _udecode_utils.UnionToIntersection<_udecode_plate_core.InferTransforms<_udecode_plate_core_react.PlateCorePlugin>>; transforms: _udecode_slate.EditorTransforms & _udecode_utils.UnionToIntersection<_udecode_plate_core.InferTransforms<_udecode_plate_core_react.PlateCorePlugin>>; getApi: <C extends _udecode_plate_core.AnyPluginConfig = _udecode_plate_core.PluginConfig>(plugin?: _udecode_plate_core.WithRequiredKey<C>) => _udecode_plate_core_react.PlateEditor["api"] & _udecode_plate_core.InferApi<C>; getPlugin: <C extends _udecode_plate_core.AnyPluginConfig = _udecode_plate_core.PluginConfig>(plugin: _udecode_plate_core.WithRequiredKey<C>) => C extends { node: any; } ? C : _udecode_plate_core_react.EditorPlatePlugin<C>; getTransforms: <C extends _udecode_plate_core.AnyPluginConfig = _udecode_plate_core.PluginConfig>(plugin?: _udecode_plate_core.WithRequiredKey<C>) => _udecode_plate_core_react.PlateEditor["tf"] & _udecode_plate_core.InferTransforms<C>; uid?: string; } & { store: _udecode_plate_core_react.PlateStore; }; element: TElement; readOnly: boolean; }; declare const useTodoListElement: (state: ReturnType<typeof useTodoListElementState>) => { checkboxProps: { checked: boolean; onCheckedChange: (value: boolean) => void; onMouseDown: (e: any) => void; }; }; declare const useIndentTodoToolBarButtonState: ({ nodeType, }?: { nodeType?: string; }) => { nodeType: string; pressed: boolean; }; declare const useIndentTodoToolBarButton: ({ nodeType, pressed, }: ReturnType<typeof useIndentTodoToolBarButtonState>) => { props: { pressed: boolean; onClick: () => void; onMouseDown: (e: React.MouseEvent<HTMLButtonElement>) => void; }; }; export { type ListConfig, ListPlugin, useIndentTodoToolBarButton, useIndentTodoToolBarButtonState, useListToolbarButton, useListToolbarButtonState, useTodoListElement, useTodoListElementState };