@etrepum/lexical-builder 0.0.36-nightly.20250711.0 → 0.0.36

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.
Files changed (38) hide show
  1. package/dist/{AutoFocusPlan.d.ts → AutoFocusExtension.d.ts} +3 -3
  2. package/dist/AutoFocusExtension.d.ts.map +1 -0
  3. package/dist/{DragonPlan.d.ts → DragonExtension.d.ts} +2 -2
  4. package/dist/DragonExtension.d.ts.map +1 -0
  5. package/dist/ExtensionRep.d.ts +76 -0
  6. package/dist/ExtensionRep.d.ts.map +1 -0
  7. package/dist/{HistoryPlan.d.ts → HistoryExtension.d.ts} +3 -3
  8. package/dist/HistoryExtension.d.ts.map +1 -0
  9. package/dist/InitialStateExtension.d.ts +7 -0
  10. package/dist/InitialStateExtension.d.ts.map +1 -0
  11. package/dist/LexicalBuilder.d.ts +23 -23
  12. package/dist/LexicalBuilder.d.ts.map +1 -1
  13. package/dist/PlainTextExtension.d.ts +5 -0
  14. package/dist/PlainTextExtension.d.ts.map +1 -0
  15. package/dist/RichTextExtension.d.ts +13 -0
  16. package/dist/RichTextExtension.d.ts.map +1 -0
  17. package/dist/getExtensionDependencyFromEditor.d.ts +17 -0
  18. package/dist/getExtensionDependencyFromEditor.d.ts.map +1 -0
  19. package/dist/getPeerDependencyFromEditor.d.ts +20 -20
  20. package/dist/getPeerDependencyFromEditor.d.ts.map +1 -1
  21. package/dist/index.d.ts +9 -9
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +231 -231
  24. package/dist/index.js.map +1 -1
  25. package/package.json +8 -8
  26. package/dist/AutoFocusPlan.d.ts.map +0 -1
  27. package/dist/DragonPlan.d.ts.map +0 -1
  28. package/dist/HistoryPlan.d.ts.map +0 -1
  29. package/dist/InitialStatePlan.d.ts +0 -7
  30. package/dist/InitialStatePlan.d.ts.map +0 -1
  31. package/dist/PlainTextPlan.d.ts +0 -5
  32. package/dist/PlainTextPlan.d.ts.map +0 -1
  33. package/dist/PlanRep.d.ts +0 -76
  34. package/dist/PlanRep.d.ts.map +0 -1
  35. package/dist/RichTextPlan.d.ts +0 -13
  36. package/dist/RichTextPlan.d.ts.map +0 -1
  37. package/dist/getPlanDependencyFromEditor.d.ts +0 -17
  38. package/dist/getPlanDependencyFromEditor.d.ts.map +0 -1
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/PACKAGE_VERSION.ts","../src/shared/invariant.ts","../src/deepThemeMergeInPlace.ts","../src/PlanRep.ts","../src/InitialStatePlan.ts","../src/LexicalBuilder.ts","../src/getPlanDependencyFromEditor.ts","../src/getPeerDependencyFromEditor.ts","../src/config.ts","../src/AutoFocusPlan.ts","../src/Store.ts","../src/registerStoreToggle.ts","../src/disabledToggle.ts","../src/DragonPlan.ts","../src/HistoryPlan.ts","../src/PlainTextPlan.ts","../src/RichTextPlan.ts"],"sourcesContent":["/** The build version of this package (e.g. \"0.16.0\") */\nexport const PACKAGE_VERSION: string = import.meta.env.PACKAGE_VERSION;\n","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n// invariant(condition, message) will refine types based on \"condition\", and\n// if \"condition\" is false will throw an error. This function is special-cased\n// in flow itself, so we can't name it anything else.\nexport default function invariant(\n cond?: boolean,\n message?: string,\n ...args: string[]\n): asserts cond {\n if (cond) {\n return;\n }\n\n throw new Error(\n args.reduce((msg, arg) => msg.replace(\"%s\", String(arg)), message || \"\"),\n );\n}\n","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n/**\n * Recursively merge the given theme configuration in-place.\n *\n * @returns If `a` and `b` are both objects (and `b` is not an Array) then\n * all keys in `b` are merged into `a` then `a` is returned.\n * Otherwise `b` is returned.\n *\n * @example\n * ```ts\n * const a = { a: \"a\", nested: { a: 1 } };\n * const b = { b: \"b\", nested: { b: 2 } };\n * const rval = deepThemeMergeInPlace(a, b);\n * expect(a).toBe(rval);\n * expect(a).toEqual({ a: \"a\", b: \"b\", nested: { a: 1, b: 2 } });\n * ```\n */\nexport function deepThemeMergeInPlace(a: unknown, b: unknown) {\n if (\n a &&\n b &&\n !Array.isArray(b) &&\n typeof a === \"object\" &&\n typeof b === \"object\"\n ) {\n const aObj = a as Record<string, unknown>;\n const bObj = b as Record<string, unknown>;\n for (const k in bObj) {\n aObj[k] = deepThemeMergeInPlace(aObj[k], bObj[k]);\n }\n return a;\n }\n return b;\n}\n","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport type {\n AnyLexicalPlan,\n InitialEditorConfig,\n LexicalPlanConfig,\n LexicalPlanDependency,\n LexicalPlanInit,\n LexicalPlanOutput,\n RegisterCleanup,\n PlanInitState,\n PlanRegisterState,\n} from \"@etrepum/lexical-builder-core\";\nimport { shallowMergeConfig } from \"@etrepum/lexical-builder-core\";\nimport type { LexicalEditor } from \"lexical\";\nimport invariant from \"./shared/invariant\";\nimport type { LexicalBuilder } from \"./LexicalBuilder\";\n\nexport const PlanRepStateIds = {\n unmarked: 0,\n temporary: 1,\n permanent: 2,\n configured: 3,\n initialized: 4,\n registered: 5,\n afterInitialization: 6,\n} as const;\ninterface UnmarkedState {\n id: (typeof PlanRepStateIds)[\"unmarked\"];\n}\ninterface TemporaryState extends Omit<UnmarkedState, \"id\"> {\n id: (typeof PlanRepStateIds)[\"temporary\"];\n}\ninterface PermanentState extends Omit<TemporaryState, \"id\"> {\n id: (typeof PlanRepStateIds)[\"permanent\"];\n}\ninterface ConfiguredState<Plan extends AnyLexicalPlan>\n extends Omit<PermanentState, \"id\"> {\n id: (typeof PlanRepStateIds)[\"configured\"];\n config: LexicalPlanConfig<Plan>;\n registerState: PlanInitState;\n}\ninterface InitializedState<Plan extends AnyLexicalPlan>\n extends Omit<ConfiguredState<Plan>, \"id\" | \"registerState\"> {\n id: (typeof PlanRepStateIds)[\"initialized\"];\n initResult: LexicalPlanInit<Plan>;\n registerState: PlanRegisterState<LexicalPlanInit<Plan>>;\n}\ninterface RegisteredState<Plan extends AnyLexicalPlan>\n extends Omit<InitializedState<Plan>, \"id\"> {\n id: (typeof PlanRepStateIds)[\"registered\"];\n output: LexicalPlanOutput<Plan>;\n}\ninterface AfterInitializationState<Plan extends AnyLexicalPlan>\n extends Omit<RegisteredState<Plan>, \"id\"> {\n id: (typeof PlanRepStateIds)[\"afterInitialization\"];\n}\n\nexport type PlanRepState<Plan extends AnyLexicalPlan> =\n | UnmarkedState\n | TemporaryState\n | PermanentState\n | ConfiguredState<Plan>\n | InitializedState<Plan>\n | RegisteredState<Plan>\n | AfterInitializationState<Plan>;\n\nexport function isExactlyUnmarkedPlanRepState<Plan extends AnyLexicalPlan>(\n state: PlanRepState<Plan>,\n): state is UnmarkedState {\n return state.id === PlanRepStateIds.unmarked;\n}\nfunction isExactlyTemporaryPlanRepState<Plan extends AnyLexicalPlan>(\n state: PlanRepState<Plan>,\n): state is TemporaryState {\n return state.id === PlanRepStateIds.temporary;\n}\nexport function isExactlyPermanentPlanRepState<Plan extends AnyLexicalPlan>(\n state: PlanRepState<Plan>,\n): state is PermanentState {\n return state.id === PlanRepStateIds.permanent;\n}\nfunction isInitializedPlanRepState<Plan extends AnyLexicalPlan>(\n state: PlanRepState<Plan>,\n): state is\n | InitializedState<Plan>\n | RegisteredState<Plan>\n | AfterInitializationState<Plan> {\n return state.id >= PlanRepStateIds.initialized;\n}\nfunction isConfiguredPlanRepState<Plan extends AnyLexicalPlan>(\n state: PlanRepState<Plan>,\n): state is\n | ConfiguredState<Plan>\n | InitializedState<Plan>\n | RegisteredState<Plan>\n | AfterInitializationState<Plan> {\n return state.id >= PlanRepStateIds.configured;\n}\nfunction isRegisteredPlanRepState<Plan extends AnyLexicalPlan>(\n state: PlanRepState<Plan>,\n): state is RegisteredState<Plan> | AfterInitializationState<Plan> {\n return state.id >= PlanRepStateIds.registered;\n}\nfunction isAfterInitializationState<Plan extends AnyLexicalPlan>(\n state: PlanRepState<Plan>,\n): state is AfterInitializationState<Plan> {\n return state.id >= PlanRepStateIds.afterInitialization;\n}\nexport function applyTemporaryMark<Plan extends AnyLexicalPlan>(\n state: PlanRepState<Plan>,\n): TemporaryState {\n invariant(\n isExactlyUnmarkedPlanRepState(state),\n \"LexicalBuilder: Can not apply a temporary mark to state\",\n );\n return Object.assign(state, { id: PlanRepStateIds.temporary });\n}\nexport function applyPermanentMark<Plan extends AnyLexicalPlan>(\n state: PlanRepState<Plan>,\n): PermanentState {\n invariant(\n isExactlyTemporaryPlanRepState(state),\n \"LexicalBuilder: Can not apply a permanent mark to state\",\n );\n return Object.assign(state, { id: PlanRepStateIds.permanent });\n}\nexport function applyConfiguredState<Plan extends AnyLexicalPlan>(\n state: PermanentState,\n config: LexicalPlanConfig<Plan>,\n registerState: PlanInitState,\n): ConfiguredState<Plan> {\n return Object.assign(state, {\n id: PlanRepStateIds.configured,\n config,\n registerState,\n });\n}\nexport function applyInitializedState<Plan extends AnyLexicalPlan>(\n state: ConfiguredState<Plan>,\n initResult: LexicalPlanInit<Plan>,\n registerState: PlanRegisterState<Plan>,\n): InitializedState<Plan> {\n return Object.assign(state, {\n id: PlanRepStateIds.initialized,\n initResult,\n registerState,\n });\n}\nexport function applyRegisteredState<Plan extends AnyLexicalPlan>(\n state: InitializedState<Plan>,\n cleanup?: RegisterCleanup<LexicalPlanOutput<Plan>> | undefined,\n) {\n return Object.assign(state, {\n id: PlanRepStateIds.registered,\n output: cleanup ? cleanup.output : undefined,\n });\n}\nexport function applyAfterInitializationState<Plan extends AnyLexicalPlan>(\n state: RegisteredState<Plan>,\n): AfterInitializationState<Plan> {\n return Object.assign(state, { id: PlanRepStateIds.afterInitialization });\n}\n\nconst emptySet: ReadonlySet<string> = new Set();\n\n/**\n * @internal\n */\nexport class PlanRep<Plan extends AnyLexicalPlan> {\n builder: LexicalBuilder;\n configs: Set<Partial<LexicalPlanConfig<Plan>>>;\n _dependency?: LexicalPlanDependency<Plan>;\n _output?: LexicalPlanOutput<Plan>;\n _peerNameSet?: Set<string>;\n plan: Plan;\n state: PlanRepState<Plan>;\n constructor(builder: LexicalBuilder, plan: Plan) {\n this.builder = builder;\n this.plan = plan;\n this.configs = new Set();\n this.state = { id: PlanRepStateIds.unmarked };\n }\n\n afterInitialization(editor: LexicalEditor): undefined | (() => void) {\n const state = this.state;\n invariant(\n state.id === PlanRepStateIds.registered,\n \"PlanRep: afterInitialization called in state id %s (expected %s registered)\",\n String(state.id),\n String(PlanRepStateIds.registered),\n );\n let rval: undefined | (() => void);\n if (this.plan.afterInitialization) {\n rval = this.plan.afterInitialization(\n editor,\n state.config,\n state.registerState,\n );\n }\n this.state = applyAfterInitializationState(state);\n return rval;\n }\n register(editor: LexicalEditor): undefined | (() => void) {\n const state = this.state;\n invariant(\n state.id === PlanRepStateIds.initialized,\n \"PlanRep: register called in state id %s (expected %s initialized)\",\n String(state.id),\n String(PlanRepStateIds.initialized),\n );\n let cleanup: undefined | RegisterCleanup<LexicalPlanOutput<Plan>>;\n if (this.plan.register) {\n cleanup = this.plan.register(\n editor,\n state.config,\n state.registerState,\n ) as RegisterCleanup<LexicalPlanOutput<Plan>>;\n }\n this.state = applyRegisteredState(state, cleanup);\n return cleanup;\n }\n init(editorConfig: InitialEditorConfig, signal: AbortSignal) {\n const initialState = this.state;\n invariant(\n isExactlyPermanentPlanRepState(initialState),\n \"LexicalBuilder: Can not configure from state id %s\",\n String(initialState.id),\n );\n const initState: PlanInitState = {\n signal,\n getDirectDependentNames: this.getDirectDependentNames.bind(this),\n getPeerNameSet: this.getPeerNameSet.bind(this),\n getPeer: this.getInitPeer.bind(this),\n getDependency: this.getInitDependency.bind(this),\n };\n const registerState: PlanRegisterState<Plan> = {\n ...initState,\n getPeer: this.getPeer.bind(this),\n getDependency: this.getDependency.bind(this),\n getInitResult: this.getInitResult.bind(this),\n };\n const state = applyConfiguredState(\n initialState,\n this.mergeConfigs(),\n initState,\n );\n this.state = state;\n let initResult: LexicalPlanInit<Plan> | undefined;\n if (this.plan.init) {\n initResult = this.plan.init(\n editorConfig,\n state.config,\n initState,\n ) as LexicalPlanInit<Plan>;\n }\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion -- false positive\n this.state = applyInitializedState(state, initResult!, registerState);\n }\n getInitResult(): LexicalPlanInit<Plan> {\n invariant(\n this.plan.init !== undefined,\n \"PlanRep: getInitResult() called for Plan %s that does not define init\",\n this.plan.name,\n );\n const state = this.state;\n invariant(\n isInitializedPlanRepState(state),\n \"PlanRep: getInitResult() called for PlanRep in state id %s < %s (initialized)\",\n String(state.id),\n String(PlanRepStateIds.initialized),\n );\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return -- any\n return state.initResult;\n }\n\n getInitPeer<PeerPlan extends AnyLexicalPlan = never>(\n name: PeerPlan[\"name\"],\n ): undefined | Omit<LexicalPlanDependency<PeerPlan>, \"output\"> {\n const rep = this.builder.planNameMap.get(name);\n return rep ? rep.getPlanInitDependency() : undefined;\n }\n\n getPlanInitDependency(): Omit<LexicalPlanDependency<Plan>, \"output\"> {\n const state = this.state;\n invariant(\n isConfiguredPlanRepState(state),\n \"LexicalPlanBuilder: getPlanInitDependency called in state id %s (expected >= %s configured)\",\n String(state.id),\n String(PlanRepStateIds.configured),\n );\n return { config: state.config };\n }\n\n getPeer<PeerPlan extends AnyLexicalPlan = never>(\n name: PeerPlan[\"name\"],\n ): undefined | LexicalPlanDependency<PeerPlan> {\n const rep = this.builder.planNameMap.get(name);\n return rep\n ? (rep.getPlanDependency() as LexicalPlanDependency<PeerPlan>)\n : undefined;\n }\n\n getInitDependency<Dependency extends AnyLexicalPlan>(\n dep: Dependency,\n ): Omit<LexicalPlanDependency<Dependency>, \"output\"> {\n const rep = this.builder.getPlanRep(dep);\n invariant(\n rep !== undefined,\n \"LexicalPlanBuilder: Plan %s missing dependency plan %s to be in registry\",\n this.plan.name,\n dep.name,\n );\n return rep.getPlanInitDependency();\n }\n\n getDependency<Dependency extends AnyLexicalPlan>(\n dep: Dependency,\n ): LexicalPlanDependency<Dependency> {\n const rep = this.builder.getPlanRep(dep);\n invariant(\n rep !== undefined,\n \"LexicalPlanBuilder: Plan %s missing dependency plan %s to be in registry\",\n this.plan.name,\n dep.name,\n );\n return rep.getPlanDependency();\n }\n\n getState(): AfterInitializationState<Plan> {\n const state = this.state;\n invariant(\n isAfterInitializationState(state),\n \"PlanRep getState called in state id %s (expected %s afterInitialization)\",\n String(state.id),\n String(PlanRepStateIds.afterInitialization),\n );\n return state;\n }\n\n getDirectDependentNames(): ReadonlySet<string> {\n return this.builder.incomingEdges.get(this.plan.name) || emptySet;\n }\n\n getPeerNameSet(): ReadonlySet<string> {\n let s = this._peerNameSet;\n if (!s) {\n s = new Set((this.plan.peerDependencies || []).map(([name]) => name));\n this._peerNameSet = s;\n }\n return s;\n }\n\n getPlanDependency(): LexicalPlanDependency<Plan> {\n if (!this._dependency) {\n const state = this.state;\n invariant(\n isRegisteredPlanRepState(state),\n \"Plan %s used as a dependency before registration\",\n this.plan.name,\n );\n this._dependency = {\n config: state.config,\n output: state.output,\n };\n }\n return this._dependency;\n }\n mergeConfigs(): LexicalPlanConfig<Plan> {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- LexicalPlanConfig<Plan> is any\n let config: LexicalPlanConfig<Plan> = this.plan.config || {};\n const mergeConfig = this.plan.mergeConfig\n ? this.plan.mergeConfig.bind(this.plan)\n : shallowMergeConfig;\n for (const cfg of this.configs) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- LexicalPlanConfig<Plan> is any\n config = mergeConfig(config, cfg);\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return -- any\n return config;\n }\n}\n","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { definePlan, safeCast } from \"@etrepum/lexical-builder-core\";\nimport {\n $createParagraphNode,\n $getRoot,\n LineBreakNode,\n ParagraphNode,\n RootNode,\n TabNode,\n TextNode,\n type EditorSetOptions,\n type EditorUpdateOptions,\n} from \"lexical\";\n\nconst HISTORY_MERGE_OPTIONS = { tag: \"history-merge\" };\n\nfunction $defaultInitializer() {\n const root = $getRoot();\n if (root.isEmpty()) {\n root.append($createParagraphNode());\n }\n}\n\nexport interface InitialStateConfig {\n updateOptions: EditorUpdateOptions;\n setOptions: EditorSetOptions;\n}\n\nexport const InitialStatePlan = definePlan({\n name: \"@etrepum/lexical-builder/InitialState\",\n // These are automatically added by createEditor, we add them here so they are\n // visible during planRep.init so plans can see all known types before the\n // editor is created.\n // (excluding ArtificialNode__DO_NOT_USE because it isn't really public API\n // and shouldn't change anything)\n nodes: [RootNode, TextNode, LineBreakNode, TabNode, ParagraphNode],\n config: safeCast<InitialStateConfig>({\n updateOptions: HISTORY_MERGE_OPTIONS,\n setOptions: HISTORY_MERGE_OPTIONS,\n }),\n init({ $initialEditorState = $defaultInitializer }) {\n return $initialEditorState;\n },\n afterInitialization(editor, { updateOptions, setOptions }, state) {\n const $initialEditorState = state.getInitResult();\n switch (typeof $initialEditorState) {\n case \"function\": {\n editor.update(() => {\n $initialEditorState(editor);\n }, updateOptions);\n break;\n }\n case \"string\": {\n const parsedEditorState = editor.parseEditorState($initialEditorState);\n editor.setEditorState(parsedEditorState, setOptions);\n break;\n }\n case \"object\": {\n if ($initialEditorState) {\n editor.setEditorState($initialEditorState, setOptions);\n }\n break;\n }\n default: {\n /* noop */\n }\n }\n return () => {\n /* noop */\n };\n },\n});\n","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\nimport type {\n AnyLexicalPlan,\n AnyLexicalPlanArgument,\n LexicalEditorWithDispose,\n InitialEditorConfig,\n LexicalPlanConfig,\n AnyNormalizedLexicalPlanArgument,\n} from \"@etrepum/lexical-builder-core\";\nimport {\n type LexicalEditor,\n createEditor,\n type CreateEditorArgs,\n type EditorThemeClasses,\n type HTMLConfig,\n type KlassConstructor,\n type LexicalNode,\n} from \"lexical\";\nimport { mergeRegister } from \"@lexical/utils\";\nimport invariant from \"./shared/invariant\";\nimport { deepThemeMergeInPlace } from \"./deepThemeMergeInPlace\";\nimport {\n PlanRep,\n applyPermanentMark,\n applyTemporaryMark,\n isExactlyPermanentPlanRepState,\n isExactlyUnmarkedPlanRepState,\n} from \"./PlanRep\";\nimport { PACKAGE_VERSION } from \"./PACKAGE_VERSION\";\nimport { InitialStatePlan } from \"./InitialStatePlan\";\n\n/** @internal Use a well-known symbol for dev tools purposes */\nexport const builderSymbol = Symbol.for(\"@etrepum/lexical-builder\");\n\n/**\n * Build a LexicalEditor by combining together one or more plans, optionally\n * overriding some of their configuration.\n *\n * @param plans - Plan arguments (plans or plans with config overrides)\n * @returns An editor handle\n *\n * @example A single root plan with multiple dependencies\n * ```ts\n * const editor = buildEditorFromPlans(\n * definePlan({\n * name: \"[root]\",\n * dependencies: [\n * RichTextPlan,\n * configPlan(EmojiPlan, { emojiBaseUrl: \"/assets/emoji\" }),\n * ],\n * register: (editor: LexicalEditor) => {\n * console.log(\"Editor Created\");\n * return () => console.log(\"Editor Disposed\");\n * },\n * }),\n * );\n * ```\n * @example A very similar minimal configuration without the register hook\n * ```ts\n * const editor = buildEditorFromPlans(\n * RichTextPlan,\n * configPlan(EmojiPlan, { emojiBaseUrl: \"/assets/emoji\" }),\n * );\n * ```\n */\nexport function buildEditorFromPlans(\n ...plans: AnyLexicalPlanArgument[]\n): LexicalEditorWithDispose {\n return LexicalBuilder.fromPlans(plans).buildEditor();\n}\n\n/** @internal */\nfunction noop() {\n /*empty*/\n}\n\n/** Throw the given Error */\nfunction defaultOnError(err: Error) {\n throw err;\n}\n\ninterface WithBuilder {\n [builderSymbol]?: LexicalBuilder | undefined;\n}\n\n/** @internal */\nfunction maybeWithBuilder(editor: LexicalEditor): LexicalEditor & WithBuilder {\n return editor;\n}\n\nfunction normalizePlanArgument(\n arg: AnyLexicalPlanArgument,\n): AnyNormalizedLexicalPlanArgument {\n return Array.isArray(arg) ? arg : [arg];\n}\n\n/** @internal */\nexport class LexicalBuilder {\n roots: readonly AnyNormalizedLexicalPlanArgument[];\n planNameMap: Map<string, PlanRep<AnyLexicalPlan>>;\n outgoingConfigEdges: Map<\n string,\n Map<string, LexicalPlanConfig<AnyLexicalPlan>[]>\n >;\n incomingEdges: Map<string, Set<string>>;\n conflicts: Map<string, string>;\n _sortedPlanReps?: readonly PlanRep<AnyLexicalPlan>[];\n PACKAGE_VERSION: string;\n\n constructor(roots: AnyNormalizedLexicalPlanArgument[]) {\n this.outgoingConfigEdges = new Map();\n this.incomingEdges = new Map();\n this.planNameMap = new Map();\n this.conflicts = new Map();\n this.PACKAGE_VERSION = PACKAGE_VERSION;\n this.roots = roots;\n for (const plan of roots) {\n this.addPlan(plan);\n }\n }\n\n static fromPlans(plans: AnyLexicalPlanArgument[]): LexicalBuilder {\n const roots = [normalizePlanArgument(InitialStatePlan)];\n for (const plan of plans) {\n roots.push(normalizePlanArgument(plan));\n }\n return new LexicalBuilder(roots);\n }\n\n /** Look up the editor that was created by this LexicalBuilder or throw */\n static fromEditor(editor: LexicalEditor): LexicalBuilder {\n const builder = maybeWithBuilder(editor)[builderSymbol];\n invariant(\n builder && typeof builder === \"object\",\n \"LexicalBuilder.fromEditor: The given editor was not created with LexicalBuilder, or has been disposed\",\n );\n // The dev tools variant of this will relax some of these invariants\n invariant(\n builder.PACKAGE_VERSION === PACKAGE_VERSION,\n \"LexicalBuilder.fromEditor: The given editor was created with LexicalBuilder %s but this version is %s. A project should have exactly one copy of LexicalBuilder\",\n builder.PACKAGE_VERSION,\n PACKAGE_VERSION,\n );\n invariant(\n builder instanceof LexicalBuilder,\n \"LexicalBuilder.fromEditor: There are multiple copies of the same version of LexicalBuilder in your project, and this editor was created with another one. Your project, or one of its dependencies, has its package.json and/or bundler configured incorrectly.\",\n );\n return builder;\n }\n\n buildEditor(): LexicalEditorWithDispose {\n const controller = new AbortController();\n const {\n $initialEditorState: _$initialEditorState,\n onError,\n ...editorConfig\n } = this.buildCreateEditorArgs(controller.signal);\n let disposeOnce = noop;\n function dispose() {\n try {\n disposeOnce();\n } finally {\n disposeOnce = noop;\n }\n }\n const editor: LexicalEditorWithDispose & WithBuilder = Object.assign(\n createEditor({\n ...editorConfig,\n ...(onError\n ? {\n onError: (err) => {\n onError(err, editor);\n },\n }\n : {}),\n }),\n { [builderSymbol]: this, dispose, [Symbol.dispose]: dispose },\n );\n disposeOnce = mergeRegister(\n () => {\n maybeWithBuilder(editor)[builderSymbol] = undefined;\n },\n () => {\n editor.setRootElement(null);\n },\n this.registerEditor(editor, controller),\n );\n return editor;\n }\n\n getPlanRep<Plan extends AnyLexicalPlan>(\n plan: Plan,\n ): PlanRep<Plan> | undefined {\n const rep = this.planNameMap.get(plan.name);\n if (rep) {\n invariant(\n rep.plan === plan,\n \"LexicalBuilder: A registered plan with name %s exists but does not match the given plan\",\n plan.name,\n );\n return rep as PlanRep<Plan>;\n }\n }\n\n addEdge(\n fromPlanName: string,\n toPlanName: string,\n configs: LexicalPlanConfig<AnyLexicalPlan>[],\n ) {\n const outgoing = this.outgoingConfigEdges.get(fromPlanName);\n if (outgoing) {\n outgoing.set(toPlanName, configs);\n } else {\n this.outgoingConfigEdges.set(\n fromPlanName,\n new Map([[toPlanName, configs]]),\n );\n }\n const incoming = this.incomingEdges.get(toPlanName);\n if (incoming) {\n incoming.add(fromPlanName);\n } else {\n this.incomingEdges.set(toPlanName, new Set([fromPlanName]));\n }\n }\n\n addPlan(arg: AnyLexicalPlanArgument) {\n invariant(\n this._sortedPlanReps === undefined,\n \"LexicalBuilder: addPlan called after finalization\",\n );\n const normalized = normalizePlanArgument(arg);\n const [plan] = normalized;\n invariant(\n typeof plan.name === \"string\",\n \"LexicalBuilder: plan name must be string, not %s\",\n typeof plan.name,\n );\n let planRep = this.planNameMap.get(plan.name);\n invariant(\n planRep === undefined || planRep.plan === plan,\n \"LexicalBuilder: Multiple plans registered with name %s, names must be unique\",\n plan.name,\n );\n if (!planRep) {\n planRep = new PlanRep(this, plan);\n this.planNameMap.set(plan.name, planRep);\n const hasConflict = this.conflicts.get(plan.name);\n if (typeof hasConflict === \"string\") {\n invariant(\n false,\n \"LexicalBuilder: plan %s conflicts with %s\",\n plan.name,\n hasConflict,\n );\n }\n for (const name of plan.conflictsWith || []) {\n invariant(\n !this.planNameMap.has(name),\n \"LexicalBuilder: plan %s conflicts with %s\",\n plan.name,\n name,\n );\n this.conflicts.set(name, plan.name);\n }\n for (const dep of plan.dependencies || []) {\n const normDep = normalizePlanArgument(dep);\n this.addEdge(plan.name, normDep[0].name, normDep.slice(1));\n this.addPlan(normDep);\n }\n for (const [depName, config] of plan.peerDependencies || []) {\n this.addEdge(plan.name, depName, config ? [config] : []);\n }\n }\n }\n\n sortedPlanReps(): readonly PlanRep<AnyLexicalPlan>[] {\n if (this._sortedPlanReps) {\n return this._sortedPlanReps;\n }\n // depth-first search based topological DAG sort\n // https://en.wikipedia.org/wiki/Topological_sorting\n const sortedPlanReps: PlanRep<AnyLexicalPlan>[] = [];\n const visit = (rep: PlanRep<AnyLexicalPlan>, fromPlanName?: string) => {\n let mark = rep.state;\n if (isExactlyPermanentPlanRepState(mark)) {\n return;\n }\n const planName = rep.plan.name;\n invariant(\n isExactlyUnmarkedPlanRepState(mark),\n \"LexicalBuilder: Circular dependency detected for Plan %s from %s\",\n planName,\n fromPlanName || \"[unknown]\",\n );\n mark = applyTemporaryMark(mark);\n rep.state = mark;\n const outgoingConfigEdges = this.outgoingConfigEdges.get(planName);\n if (outgoingConfigEdges) {\n for (const toPlanName of outgoingConfigEdges.keys()) {\n const toRep = this.planNameMap.get(toPlanName);\n // may be undefined for an optional peer dependency\n if (toRep) {\n visit(toRep, planName);\n }\n }\n }\n mark = applyPermanentMark(mark);\n rep.state = mark;\n sortedPlanReps.push(rep);\n };\n for (const rep of this.planNameMap.values()) {\n if (isExactlyUnmarkedPlanRepState(rep.state)) {\n visit(rep);\n }\n }\n for (const rep of sortedPlanReps) {\n for (const [toPlanName, configs] of this.outgoingConfigEdges.get(\n rep.plan.name,\n ) || []) {\n if (configs.length > 0) {\n const toRep = this.planNameMap.get(toPlanName);\n if (toRep) {\n for (const config of configs) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument -- any\n toRep.configs.add(config);\n }\n }\n }\n }\n }\n for (const [plan, ...configs] of this.roots) {\n if (configs.length > 0) {\n const toRep = this.planNameMap.get(plan.name);\n invariant(\n toRep !== undefined,\n \"LexicalBuilder: Expecting existing PlanRep for %s\",\n plan.name,\n );\n for (const config of configs) {\n toRep.configs.add(config);\n }\n }\n }\n this._sortedPlanReps = sortedPlanReps;\n return this._sortedPlanReps;\n }\n\n registerEditor(\n editor: LexicalEditor,\n controller: AbortController,\n ): () => void {\n const cleanups: (() => void)[] = [];\n const planReps = this.sortedPlanReps();\n for (const planRep of planReps) {\n const cleanup = planRep.register(editor);\n if (cleanup) {\n cleanups.push(cleanup);\n }\n }\n for (const planRep of planReps) {\n const cleanup = planRep.afterInitialization(editor);\n if (cleanup) {\n cleanups.push(cleanup);\n }\n }\n return () => {\n for (let i = cleanups.length - 1; i >= 0; i--) {\n const cleanupFun = cleanups[i];\n invariant(\n cleanupFun !== undefined,\n \"LexicalBuilder: Expecting cleanups[%s] to be defined\",\n String(i),\n );\n cleanupFun();\n }\n cleanups.length = 0;\n controller.abort();\n };\n }\n\n buildCreateEditorArgs(signal: AbortSignal) {\n const config: InitialEditorConfig = {};\n const nodes = new Set<NonNullable<CreateEditorArgs[\"nodes\"]>[number]>();\n const replacedNodes = new Map<\n KlassConstructor<typeof LexicalNode>,\n PlanRep<AnyLexicalPlan>\n >();\n const htmlExport: NonNullable<HTMLConfig[\"export\"]> = new Map();\n const htmlImport: NonNullable<HTMLConfig[\"import\"]> = {};\n const theme: EditorThemeClasses = {};\n const planReps = this.sortedPlanReps();\n for (const planRep of planReps) {\n const { plan } = planRep;\n if (plan.onError !== undefined) {\n config.onError = plan.onError;\n }\n if (plan.disableEvents !== undefined) {\n config.disableEvents = plan.disableEvents;\n }\n if (plan.parentEditor !== undefined) {\n config.parentEditor = plan.parentEditor;\n }\n if (plan.editable !== undefined) {\n config.editable = plan.editable;\n }\n if (plan.namespace !== undefined) {\n config.namespace = plan.namespace;\n }\n if (plan.$initialEditorState !== undefined) {\n config.$initialEditorState = plan.$initialEditorState;\n }\n if (plan.nodes) {\n for (const node of plan.nodes) {\n if (typeof node !== \"function\") {\n const conflictPlan = replacedNodes.get(node.replace);\n if (conflictPlan) {\n invariant(\n false,\n \"LexicalBuilder: Plan %s can not register replacement for node %s because %s already did\",\n plan.name,\n node.replace.name,\n conflictPlan.plan.name,\n );\n }\n replacedNodes.set(node.replace, planRep);\n }\n nodes.add(node);\n }\n }\n if (plan.html) {\n if (plan.html.export) {\n for (const [k, v] of plan.html.export.entries()) {\n htmlExport.set(k, v);\n }\n }\n if (plan.html.import) {\n Object.assign(htmlImport, plan.html.import);\n }\n }\n if (plan.theme) {\n deepThemeMergeInPlace(theme, plan.theme);\n }\n }\n if (Object.keys(theme).length > 0) {\n config.theme = theme;\n }\n if (nodes.size) {\n config.nodes = [...nodes];\n }\n const hasImport = Object.keys(htmlImport).length > 0;\n const hasExport = htmlExport.size > 0;\n if (hasImport || hasExport) {\n config.html = {};\n if (hasImport) {\n config.html.import = htmlImport;\n }\n if (hasExport) {\n config.html.export = htmlExport;\n }\n }\n for (const planRep of planReps) {\n planRep.init(config, signal);\n }\n if (!config.onError) {\n config.onError = defaultOnError;\n }\n return config;\n }\n}\n","import type { LexicalEditor } from \"lexical\";\nimport type {\n AnyLexicalPlan,\n LexicalPlanDependency,\n} from \"@etrepum/lexical-builder-core\";\nimport { LexicalBuilder } from \"./LexicalBuilder\";\nimport invariant from \"./shared/invariant\";\n\n/**\n * Get the finalized config and output of a Plan that was used to build the editor.\n *\n * This is useful in the implementation of a LexicalNode or in other\n * situations where you have an editor reference but it's not easy to\n * pass the config or {@link PlanRegisterState} around.\n *\n * It will throw if the Editor was not built using this Plan.\n *\n * @param editor - The editor that was built using plan\n * @param plan - The concrete reference to a Plan used to build this editor\n * @returns The config and output for that Plan\n */\nexport function getPlanDependencyFromEditor<Plan extends AnyLexicalPlan>(\n editor: LexicalEditor,\n plan: Plan,\n): LexicalPlanDependency<Plan> {\n const builder = LexicalBuilder.fromEditor(editor);\n const rep = builder.getPlanRep(plan);\n invariant(\n rep !== undefined,\n \"getPlanFromEditor: Plan %s was not built when creating this editor\",\n plan.name,\n );\n return rep.getPlanDependency();\n}\n","import type { LexicalEditor } from \"lexical\";\nimport type {\n AnyLexicalPlan,\n LexicalPlanDependency,\n} from \"@etrepum/lexical-builder-core\";\nimport { LexicalBuilder } from \"./LexicalBuilder\";\nimport invariant from \"./shared/invariant\";\n\n/**\n * Get the finalized config and output of a Plan that was used to build the\n * editor by name.\n *\n * This can be used from the implementation of a LexicalNode or in other\n * situation where you have an editor reference but it's not easy to pass the\n * config around. Use this version if you do not have a concrete reference to\n * the Plan for some reason (e.g. it is an optional peer dependency, or you\n * are avoiding a circular import).\n *\n * Both the explicit Plan type and the name are required.\n *\n * @example\n * ```tsx\n * import type { EmojiPlan } from \"@etrepum/lexical-emoji-plan\";\n * getPeerDependencyFromEditor<typeof EmojiPlan>(editor, \"@etrepum/lexical-emoji-plan/Emoji\");\n * ```\n\n * @param editor - The editor that may have been built using plan\n * @param planName - The name of the Plan\n * @returns The config and output of the Plan or undefined\n */\nexport function getPeerDependencyFromEditor<\n Plan extends AnyLexicalPlan = never,\n>(\n editor: LexicalEditor,\n planName: Plan[\"name\"],\n): LexicalPlanDependency<Plan> | undefined {\n const builder = LexicalBuilder.fromEditor(editor);\n const peer = builder.planNameMap.get(planName);\n return peer\n ? (peer.getPlanDependency() as LexicalPlanDependency<Plan>)\n : undefined;\n}\n\n/**\n * Get the finalized config and output of a Plan that was used to build the\n * editor by name.\n *\n * This can be used from the implementation of a LexicalNode or in other\n * situation where you have an editor reference but it's not easy to pass the\n * config around. Use this version if you do not have a concrete reference to\n * the Plan for some reason (e.g. it is an optional peer dependency, or you\n * are avoiding a circular import).\n *\n * Both the explicit Plan type and the name are required.\n *\n * @example\n * ```tsx\n * import type { EmojiPlan } from \"./EmojiPlan\";\n * export class EmojiNode extends TextNode {\n * // other implementation details not included\n * createDOM(\n * config: EditorConfig,\n * editor?: LexicalEditor | undefined\n * ): HTMLElement {\n * const dom = super.createDOM(config, editor);\n * addClassNamesToElement(\n * dom,\n * getPeerDependencyFromEditorOrThrow<typeof EmojiPlan>(\n * editor || $getEditor(),\n * \"@etrepum/lexical-emoji-plan/Emoji\",\n * ).config.emojiClass,\n * );\n * return dom;\n * }\n * }\n * ```\n\n * @param editor - The editor that may have been built using plan\n * @param planName - The name of the Plan\n * @returns The config and output of the Plan\n */\nexport function getPeerDependencyFromEditorOrThrow<\n Plan extends AnyLexicalPlan = never,\n>(editor: LexicalEditor, planName: Plan[\"name\"]): LexicalPlanDependency<Plan> {\n const dep = getPeerDependencyFromEditor<Plan>(editor, planName);\n invariant(\n dep !== undefined,\n \"getPeerDependencyFromEditorOrThrow: Editor was not build with Plan %s\",\n planName,\n );\n return dep;\n}\n","import type { InitialEditorConfig } from \"@etrepum/lexical-builder-core\";\nimport type { KlassConstructor, LexicalNode } from \"lexical\";\n\nexport interface KnownTypesAndNodes {\n types: Set<string>;\n nodes: Set<KlassConstructor<typeof LexicalNode>>;\n}\nexport function getKnownTypesAndNodes(config: InitialEditorConfig) {\n const types: KnownTypesAndNodes[\"types\"] = new Set();\n const nodes: KnownTypesAndNodes[\"nodes\"] = new Set();\n for (const klassOrReplacement of config.nodes ?? []) {\n const klass =\n typeof klassOrReplacement === \"function\"\n ? klassOrReplacement\n : klassOrReplacement.replace;\n types.add(klass.getType());\n nodes.add(klass);\n }\n return { types, nodes };\n}\n","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { definePlan, safeCast } from \"@etrepum/lexical-builder-core\";\n\nexport interface AutoFocusConfig {\n /**\n * Where to move the selection when the editor is focused and there is no\n * existing selection. Can be \"rootStart\" or \"rootEnd\" (the default).\n */\n defaultSelection?: \"rootStart\" | \"rootEnd\";\n}\n\n/**\n * A Plan to focus the LexicalEditor when the root element is set\n * (typically only when the editor is first created).\n */\nexport const AutoFocusPlan = definePlan({\n config: safeCast<AutoFocusConfig>({}),\n name: \"@etrepum/lexical-builder/AutoFocus\",\n register(editor, { defaultSelection }) {\n return editor.registerRootListener((rootElement) => {\n editor.focus(\n () => {\n // If we try and move selection to the same point with setBaseAndExtent, it won't\n // trigger a re-focus on the element. So in the case this occurs, we'll need to correct it.\n // Normally this is fine, Selection API !== Focus API, but fore the intents of the naming\n // of this plugin, which should preserve focus too.\n const activeElement = document.activeElement;\n if (\n rootElement !== null &&\n (activeElement === null || !rootElement.contains(activeElement))\n ) {\n // Note: preventScroll won't work in Webkit.\n rootElement.focus({ preventScroll: true });\n }\n },\n { defaultSelection },\n );\n });\n },\n});\n","export type StoreSubscriber<T> = (value: T) => void;\nexport interface ReadableStore<T> {\n get: () => T;\n subscribe: (callback: StoreSubscriber<T>) => () => void;\n}\nexport interface WritableStore<T> extends ReadableStore<T> {\n set: (value: T) => void;\n}\n\nexport class Store<T> implements WritableStore<T>, Disposable {\n __value: T;\n __listeners: Map<symbol, StoreSubscriber<T>>;\n __eq?: (a: T, b: T) => boolean;\n constructor(value: T, eq?: (a: T, b: T) => boolean) {\n this.__value = value;\n this.__listeners = new Map();\n this.__eq = eq;\n }\n get() {\n return this.__value;\n }\n set(value: T): void {\n if (this.__eq ? !this.__eq(this.__value, value) : this.__value !== value) {\n this.__value = value;\n for (const cb of this.__listeners.values()) {\n cb(value);\n }\n }\n }\n [Symbol.dispose]() {\n this.dispose();\n }\n dispose() {\n this.__listeners.clear();\n }\n subscribe(\n callback: StoreSubscriber<T>,\n skipInitialization = false,\n ): () => void {\n const key = Symbol(\"unsubscribe\");\n this.__listeners.set(key, callback);\n if (!skipInitialization) {\n callback(this.__value);\n }\n return () => {\n this.__listeners.delete(key);\n };\n }\n}\n","import { mergeRegister } from \"@lexical/utils\";\nimport type { ReadableStore } from \"./Store\";\n\nexport function registerStoreToggle<T>(\n store: ReadableStore<T>,\n isEnabled: (value: T) => boolean,\n register: () => () => void,\n): () => void {\n let cleanup: null | (() => void) = null;\n const performCleanup = () => {\n cleanup?.();\n cleanup = null;\n };\n return mergeRegister(\n performCleanup,\n store.subscribe((value) => {\n performCleanup();\n if (isEnabled(value)) {\n cleanup = register();\n }\n }),\n );\n}\n","import { Store, type WritableStore } from \"./Store\";\nimport { registerStoreToggle } from \"./registerStoreToggle\";\n\nexport interface DisabledToggleOptions {\n disabled?: boolean;\n register: () => () => void;\n}\nexport interface DisabledToggleOutput {\n disabled: WritableStore<boolean>;\n}\nexport function disabledToggle(\n opts: DisabledToggleOptions,\n): [DisabledToggleOutput, () => void] {\n const disabled = new Store(Boolean(opts.disabled));\n return [\n { disabled },\n registerStoreToggle(disabled, (v) => !v, opts.register),\n ];\n}\n","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { registerDragonSupport } from \"@lexical/dragon\";\nimport {\n definePlan,\n provideOutput,\n safeCast,\n} from \"@etrepum/lexical-builder-core\";\nimport { disabledToggle, type DisabledToggleOutput } from \"./disabledToggle\";\n\nexport interface DragonConfig {\n disabled: boolean;\n}\nexport type DragonOutput = DisabledToggleOutput;\n\n/**\n * Add Dragon speech to text input support to the editor, via the\n * \\@lexical/dragon module.\n */\nexport const DragonPlan = definePlan({\n name: \"@lexical/dragon\",\n config: safeCast<DragonConfig>({ disabled: typeof window === \"undefined\" }),\n register: (editor, config) =>\n provideOutput<DragonOutput>(\n ...disabledToggle({\n disabled: config.disabled,\n register: () => registerDragonSupport(editor),\n }),\n ),\n});\n","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\nimport { type LexicalEditor } from \"lexical\";\nimport {\n createEmptyHistoryState,\n type HistoryState,\n registerHistory,\n} from \"@lexical/history\";\nimport {\n configPlan,\n definePlan,\n provideOutput,\n safeCast,\n} from \"@etrepum/lexical-builder-core\";\nimport { disabledToggle, type DisabledToggleOutput } from \"./disabledToggle\";\nimport { getPeerDependencyFromEditor } from \"./getPeerDependencyFromEditor\";\n\nexport interface HistoryConfig {\n /**\n * The time (in milliseconds) the editor should delay generating a new history stack,\n * instead of merging the current changes with the current stack. The default is 300ms.\n */\n delay: number;\n /**\n * The initial history state, the default is {@link createEmptyHistoryState}.\n */\n createInitialHistoryState: (editor: LexicalEditor) => HistoryState;\n /**\n * Whether history is disabled or not\n */\n disabled: boolean;\n}\n\nexport interface HistoryOutput extends DisabledToggleOutput {\n getHistoryState: () => HistoryState;\n}\n\n/**\n * Registers necessary listeners to manage undo/redo history stack and related\n * editor commands, via the \\@lexical/history module.\n */\nexport const HistoryPlan = definePlan({\n config: safeCast<HistoryConfig>({\n createInitialHistoryState: createEmptyHistoryState,\n delay: 300,\n disabled: typeof window === \"undefined\",\n }),\n name: \"@etrepum/lexical-builder/History\",\n register: (editor, { delay, createInitialHistoryState, disabled }) => {\n const historyState = createInitialHistoryState(editor);\n const [output, cleanup] = disabledToggle({\n disabled,\n register: () => registerHistory(editor, historyState, delay),\n });\n return provideOutput<HistoryOutput>(\n { ...output, getHistoryState: () => historyState },\n cleanup,\n );\n },\n});\n\nfunction getHistoryPeer(editor: LexicalEditor | null | undefined) {\n return editor\n ? getPeerDependencyFromEditor<typeof HistoryPlan>(editor, HistoryPlan.name)\n : null;\n}\n\n/**\n * Registers necessary listeners to manage undo/redo history stack and related\n * editor commands, via the \\@lexical/history module, only if the parent editor\n * has a history plugin implementation.\n */\nexport const SharedHistoryPlan = definePlan({\n name: \"@etrepum/lexical-builder/SharedHistory\",\n dependencies: [configPlan(HistoryPlan, { disabled: true })],\n init(editorConfig, _config, state) {\n // Configure the peer dependency based on the parent editor's history\n const { config } = state.getDependency(HistoryPlan);\n const parentPeer = getHistoryPeer(editorConfig.parentEditor);\n // Default is disabled by config above, we will enable it based\n // on the parent editor's history plan\n if (parentPeer) {\n config.delay = parentPeer.config.delay;\n config.createInitialHistoryState = () =>\n parentPeer.output.getHistoryState();\n }\n return parentPeer;\n },\n register(_editor, _config, state) {\n const parentPeer = state.getInitResult();\n if (!parentPeer) {\n return () => {\n /* noop */\n };\n }\n const disabled = state.getDependency(HistoryPlan).output.disabled;\n return parentPeer.output.disabled.subscribe(disabled.set.bind(disabled));\n },\n});\n","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\nimport { registerPlainText } from \"@lexical/plain-text\";\nimport { definePlan } from \"@etrepum/lexical-builder-core\";\nimport { DragonPlan } from \"./DragonPlan\";\n\n/**\n * A plan to register \\@lexical/plain-text behavior\n */\nexport const PlainTextPlan = definePlan({\n conflictsWith: [\"@lexical/rich-text\"],\n name: \"@lexical/plain-text\",\n dependencies: [DragonPlan],\n register: registerPlainText,\n});\n","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { HeadingNode, QuoteNode, registerRichText } from \"@lexical/rich-text\";\nimport { definePlan } from \"@etrepum/lexical-builder-core\";\nimport { DragonPlan } from \"./DragonPlan\";\n\n/**\n * A plan to register \\@lexical/rich-text behavior and nodes\n * ({@link HeadingNode}, {@link QuoteNode})\n */\nexport const RichTextPlan = definePlan({\n conflictsWith: [\"@lexical/plain-text\"],\n name: \"@lexical/rich-text\",\n nodes: [HeadingNode, QuoteNode],\n dependencies: [DragonPlan],\n register: registerRichText,\n});\n"],"names":[],"mappings":";;;;;;;;;;;AACa,MAAA,kBAA0B;ACUf,SAAA,UACtB,MACA,YACG,MACW;AACd,MAAI,MAAM;AACR;AAAA,EACF;AAEA,QAAM,IAAI;AAAA,IACR,KAAK,OAAO,CAAC,KAAK,QAAQ,IAAI,QAAQ,MAAM,OAAO,GAAG,CAAC,GAAG,WAAW,EAAE;AAAA,EAAA;AAE3E;ACCgB,SAAA,sBAAsB,GAAY,GAAY;AAC5D,MACE,KACA,KACA,CAAC,MAAM,QAAQ,CAAC,KAChB,OAAO,MAAM,YACb,OAAO,MAAM,UACb;AACA,UAAM,OAAO;AACb,UAAM,OAAO;AACb,eAAW,KAAK,MAAM;AACf,WAAA,CAAC,IAAI,sBAAsB,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC;AAAA,IAClD;AACO,WAAA;AAAA,EACT;AACO,SAAA;AACT;AChBO,MAAM,kBAAkB;AAAA,EAC7B,UAAU;AAAA,EACV,WAAW;AAAA,EACX,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,qBAAqB;AACvB;AAyCO,SAAS,8BACd,OACwB;AACjB,SAAA,MAAM,OAAO,gBAAgB;AACtC;AACA,SAAS,+BACP,OACyB;AAClB,SAAA,MAAM,OAAO,gBAAgB;AACtC;AACO,SAAS,+BACd,OACyB;AAClB,SAAA,MAAM,OAAO,gBAAgB;AACtC;AACA,SAAS,0BACP,OAIiC;AAC1B,SAAA,MAAM,MAAM,gBAAgB;AACrC;AACA,SAAS,yBACP,OAKiC;AAC1B,SAAA,MAAM,MAAM,gBAAgB;AACrC;AACA,SAAS,yBACP,OACiE;AAC1D,SAAA,MAAM,MAAM,gBAAgB;AACrC;AACA,SAAS,2BACP,OACyC;AAClC,SAAA,MAAM,MAAM,gBAAgB;AACrC;AACO,SAAS,mBACd,OACgB;AAChB;AAAA,IACE,8BAA8B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EAC9B,cAAc,CAAC,UAAU;AAAA,EACzB,UAAU;AACZ,CAAC;"}
1
+ {"version":3,"file":"index.js","sources":["../src/PACKAGE_VERSION.ts","../src/shared/invariant.ts","../src/deepThemeMergeInPlace.ts","../src/ExtensionRep.ts","../src/InitialStateExtension.ts","../src/LexicalBuilder.ts","../src/getExtensionDependencyFromEditor.ts","../src/getPeerDependencyFromEditor.ts","../src/config.ts","../src/AutoFocusExtension.ts","../src/Store.ts","../src/registerStoreToggle.ts","../src/disabledToggle.ts","../src/DragonExtension.ts","../src/HistoryExtension.ts","../src/PlainTextExtension.ts","../src/RichTextExtension.ts"],"sourcesContent":["/** The build version of this package (e.g. \"0.16.0\") */\nexport const PACKAGE_VERSION: string = import.meta.env.PACKAGE_VERSION;\n","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n// invariant(condition, message) will refine types based on \"condition\", and\n// if \"condition\" is false will throw an error. This function is special-cased\n// in flow itself, so we can't name it anything else.\nexport default function invariant(\n cond?: boolean,\n message?: string,\n ...args: string[]\n): asserts cond {\n if (cond) {\n return;\n }\n\n throw new Error(\n args.reduce((msg, arg) => msg.replace(\"%s\", String(arg)), message || \"\"),\n );\n}\n","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n/**\n * Recursively merge the given theme configuration in-place.\n *\n * @returns If `a` and `b` are both objects (and `b` is not an Array) then\n * all keys in `b` are merged into `a` then `a` is returned.\n * Otherwise `b` is returned.\n *\n * @example\n * ```ts\n * const a = { a: \"a\", nested: { a: 1 } };\n * const b = { b: \"b\", nested: { b: 2 } };\n * const rval = deepThemeMergeInPlace(a, b);\n * expect(a).toBe(rval);\n * expect(a).toEqual({ a: \"a\", b: \"b\", nested: { a: 1, b: 2 } });\n * ```\n */\nexport function deepThemeMergeInPlace(a: unknown, b: unknown) {\n if (\n a &&\n b &&\n !Array.isArray(b) &&\n typeof a === \"object\" &&\n typeof b === \"object\"\n ) {\n const aObj = a as Record<string, unknown>;\n const bObj = b as Record<string, unknown>;\n for (const k in bObj) {\n aObj[k] = deepThemeMergeInPlace(aObj[k], bObj[k]);\n }\n return a;\n }\n return b;\n}\n","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport type {\n AnyLexicalExtension,\n InitialEditorConfig,\n LexicalExtensionConfig,\n LexicalExtensionDependency,\n LexicalExtensionInit,\n LexicalExtensionOutput,\n RegisterCleanup,\n ExtensionInitState,\n ExtensionRegisterState,\n} from \"@etrepum/lexical-builder-core\";\nimport { shallowMergeConfig } from \"@etrepum/lexical-builder-core\";\nimport type { LexicalEditor } from \"lexical\";\nimport invariant from \"./shared/invariant\";\nimport type { LexicalBuilder } from \"./LexicalBuilder\";\n\nexport const ExtensionRepStateIds = {\n unmarked: 0,\n temporary: 1,\n permanent: 2,\n configured: 3,\n initialized: 4,\n registered: 5,\n afterInitialization: 6,\n} as const;\ninterface UnmarkedState {\n id: (typeof ExtensionRepStateIds)[\"unmarked\"];\n}\ninterface TemporaryState extends Omit<UnmarkedState, \"id\"> {\n id: (typeof ExtensionRepStateIds)[\"temporary\"];\n}\ninterface PermanentState extends Omit<TemporaryState, \"id\"> {\n id: (typeof ExtensionRepStateIds)[\"permanent\"];\n}\ninterface ConfiguredState<Extension extends AnyLexicalExtension>\n extends Omit<PermanentState, \"id\"> {\n id: (typeof ExtensionRepStateIds)[\"configured\"];\n config: LexicalExtensionConfig<Extension>;\n registerState: ExtensionInitState;\n}\ninterface InitializedState<Extension extends AnyLexicalExtension>\n extends Omit<ConfiguredState<Extension>, \"id\" | \"registerState\"> {\n id: (typeof ExtensionRepStateIds)[\"initialized\"];\n initResult: LexicalExtensionInit<Extension>;\n registerState: ExtensionRegisterState<LexicalExtensionInit<Extension>>;\n}\ninterface RegisteredState<Extension extends AnyLexicalExtension>\n extends Omit<InitializedState<Extension>, \"id\"> {\n id: (typeof ExtensionRepStateIds)[\"registered\"];\n output: LexicalExtensionOutput<Extension>;\n}\ninterface AfterInitializationState<Extension extends AnyLexicalExtension>\n extends Omit<RegisteredState<Extension>, \"id\"> {\n id: (typeof ExtensionRepStateIds)[\"afterInitialization\"];\n}\n\nexport type ExtensionRepState<Extension extends AnyLexicalExtension> =\n | UnmarkedState\n | TemporaryState\n | PermanentState\n | ConfiguredState<Extension>\n | InitializedState<Extension>\n | RegisteredState<Extension>\n | AfterInitializationState<Extension>;\n\nexport function isExactlyUnmarkedExtensionRepState<Extension extends AnyLexicalExtension>(\n state: ExtensionRepState<Extension>,\n): state is UnmarkedState {\n return state.id === ExtensionRepStateIds.unmarked;\n}\nfunction isExactlyTemporaryExtensionRepState<Extension extends AnyLexicalExtension>(\n state: ExtensionRepState<Extension>,\n): state is TemporaryState {\n return state.id === ExtensionRepStateIds.temporary;\n}\nexport function isExactlyPermanentExtensionRepState<Extension extends AnyLexicalExtension>(\n state: ExtensionRepState<Extension>,\n): state is PermanentState {\n return state.id === ExtensionRepStateIds.permanent;\n}\nfunction isInitializedExtensionRepState<Extension extends AnyLexicalExtension>(\n state: ExtensionRepState<Extension>,\n): state is\n | InitializedState<Extension>\n | RegisteredState<Extension>\n | AfterInitializationState<Extension> {\n return state.id >= ExtensionRepStateIds.initialized;\n}\nfunction isConfiguredExtensionRepState<Extension extends AnyLexicalExtension>(\n state: ExtensionRepState<Extension>,\n): state is\n | ConfiguredState<Extension>\n | InitializedState<Extension>\n | RegisteredState<Extension>\n | AfterInitializationState<Extension> {\n return state.id >= ExtensionRepStateIds.configured;\n}\nfunction isRegisteredExtensionRepState<Extension extends AnyLexicalExtension>(\n state: ExtensionRepState<Extension>,\n): state is RegisteredState<Extension> | AfterInitializationState<Extension> {\n return state.id >= ExtensionRepStateIds.registered;\n}\nfunction isAfterInitializationState<Extension extends AnyLexicalExtension>(\n state: ExtensionRepState<Extension>,\n): state is AfterInitializationState<Extension> {\n return state.id >= ExtensionRepStateIds.afterInitialization;\n}\nexport function applyTemporaryMark<Extension extends AnyLexicalExtension>(\n state: ExtensionRepState<Extension>,\n): TemporaryState {\n invariant(\n isExactlyUnmarkedExtensionRepState(state),\n \"LexicalBuilder: Can not apply a temporary mark to state\",\n );\n return Object.assign(state, { id: ExtensionRepStateIds.temporary });\n}\nexport function applyPermanentMark<Extension extends AnyLexicalExtension>(\n state: ExtensionRepState<Extension>,\n): PermanentState {\n invariant(\n isExactlyTemporaryExtensionRepState(state),\n \"LexicalBuilder: Can not apply a permanent mark to state\",\n );\n return Object.assign(state, { id: ExtensionRepStateIds.permanent });\n}\nexport function applyConfiguredState<Extension extends AnyLexicalExtension>(\n state: PermanentState,\n config: LexicalExtensionConfig<Extension>,\n registerState: ExtensionInitState,\n): ConfiguredState<Extension> {\n return Object.assign(state, {\n id: ExtensionRepStateIds.configured,\n config,\n registerState,\n });\n}\nexport function applyInitializedState<Extension extends AnyLexicalExtension>(\n state: ConfiguredState<Extension>,\n initResult: LexicalExtensionInit<Extension>,\n registerState: ExtensionRegisterState<Extension>,\n): InitializedState<Extension> {\n return Object.assign(state, {\n id: ExtensionRepStateIds.initialized,\n initResult,\n registerState,\n });\n}\nexport function applyRegisteredState<Extension extends AnyLexicalExtension>(\n state: InitializedState<Extension>,\n cleanup?: RegisterCleanup<LexicalExtensionOutput<Extension>> | undefined,\n) {\n return Object.assign(state, {\n id: ExtensionRepStateIds.registered,\n output: cleanup ? cleanup.output : undefined,\n });\n}\nexport function applyAfterInitializationState<Extension extends AnyLexicalExtension>(\n state: RegisteredState<Extension>,\n): AfterInitializationState<Extension> {\n return Object.assign(state, { id: ExtensionRepStateIds.afterInitialization });\n}\n\nconst emptySet: ReadonlySet<string> = new Set();\n\n/**\n * @internal\n */\nexport class ExtensionRep<Extension extends AnyLexicalExtension> {\n builder: LexicalBuilder;\n configs: Set<Partial<LexicalExtensionConfig<Extension>>>;\n _dependency?: LexicalExtensionDependency<Extension>;\n _output?: LexicalExtensionOutput<Extension>;\n _peerNameSet?: Set<string>;\n extension: Extension;\n state: ExtensionRepState<Extension>;\n constructor(builder: LexicalBuilder, extension: Extension) {\n this.builder = builder;\n this.extension = extension;\n this.configs = new Set();\n this.state = { id: ExtensionRepStateIds.unmarked };\n }\n\n afterInitialization(editor: LexicalEditor): undefined | (() => void) {\n const state = this.state;\n invariant(\n state.id === ExtensionRepStateIds.registered,\n \"ExtensionRep: afterInitialization called in state id %s (expected %s registered)\",\n String(state.id),\n String(ExtensionRepStateIds.registered),\n );\n let rval: undefined | (() => void);\n if (this.extension.afterInitialization) {\n rval = this.extension.afterInitialization(\n editor,\n state.config,\n state.registerState,\n );\n }\n this.state = applyAfterInitializationState(state);\n return rval;\n }\n register(editor: LexicalEditor): undefined | (() => void) {\n const state = this.state;\n invariant(\n state.id === ExtensionRepStateIds.initialized,\n \"ExtensionRep: register called in state id %s (expected %s initialized)\",\n String(state.id),\n String(ExtensionRepStateIds.initialized),\n );\n let cleanup: undefined | RegisterCleanup<LexicalExtensionOutput<Extension>>;\n if (this.extension.register) {\n cleanup = this.extension.register(\n editor,\n state.config,\n state.registerState,\n ) as RegisterCleanup<LexicalExtensionOutput<Extension>>;\n }\n this.state = applyRegisteredState(state, cleanup);\n return cleanup;\n }\n init(editorConfig: InitialEditorConfig, signal: AbortSignal) {\n const initialState = this.state;\n invariant(\n isExactlyPermanentExtensionRepState(initialState),\n \"LexicalBuilder: Can not configure from state id %s\",\n String(initialState.id),\n );\n const initState: ExtensionInitState = {\n signal,\n getDirectDependentNames: this.getDirectDependentNames.bind(this),\n getPeerNameSet: this.getPeerNameSet.bind(this),\n getPeer: this.getInitPeer.bind(this),\n getDependency: this.getInitDependency.bind(this),\n };\n const registerState: ExtensionRegisterState<Extension> = {\n ...initState,\n getPeer: this.getPeer.bind(this),\n getDependency: this.getDependency.bind(this),\n getInitResult: this.getInitResult.bind(this),\n };\n const state = applyConfiguredState(\n initialState,\n this.mergeConfigs(),\n initState,\n );\n this.state = state;\n let initResult: LexicalExtensionInit<Extension> | undefined;\n if (this.extension.init) {\n initResult = this.extension.init(\n editorConfig,\n state.config,\n initState,\n ) as LexicalExtensionInit<Extension>;\n }\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion -- false positive\n this.state = applyInitializedState(state, initResult!, registerState);\n }\n getInitResult(): LexicalExtensionInit<Extension> {\n invariant(\n this.extension.init !== undefined,\n \"ExtensionRep: getInitResult() called for Extension %s that does not define init\",\n this.extension.name,\n );\n const state = this.state;\n invariant(\n isInitializedExtensionRepState(state),\n \"ExtensionRep: getInitResult() called for ExtensionRep in state id %s < %s (initialized)\",\n String(state.id),\n String(ExtensionRepStateIds.initialized),\n );\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return -- any\n return state.initResult;\n }\n\n getInitPeer<PeerExtension extends AnyLexicalExtension = never>(\n name: PeerExtension[\"name\"],\n ): undefined | Omit<LexicalExtensionDependency<PeerExtension>, \"output\"> {\n const rep = this.builder.extensionNameMap.get(name);\n return rep ? rep.getExtensionInitDependency() : undefined;\n }\n\n getExtensionInitDependency(): Omit<LexicalExtensionDependency<Extension>, \"output\"> {\n const state = this.state;\n invariant(\n isConfiguredExtensionRepState(state),\n \"LexicalExtensionBuilder: getExtensionInitDependency called in state id %s (expected >= %s configured)\",\n String(state.id),\n String(ExtensionRepStateIds.configured),\n );\n return { config: state.config };\n }\n\n getPeer<PeerExtension extends AnyLexicalExtension = never>(\n name: PeerExtension[\"name\"],\n ): undefined | LexicalExtensionDependency<PeerExtension> {\n const rep = this.builder.extensionNameMap.get(name);\n return rep\n ? (rep.getExtensionDependency() as LexicalExtensionDependency<PeerExtension>)\n : undefined;\n }\n\n getInitDependency<Dependency extends AnyLexicalExtension>(\n dep: Dependency,\n ): Omit<LexicalExtensionDependency<Dependency>, \"output\"> {\n const rep = this.builder.getExtensionRep(dep);\n invariant(\n rep !== undefined,\n \"LexicalExtensionBuilder: Extension %s missing dependency extension %s to be in registry\",\n this.extension.name,\n dep.name,\n );\n return rep.getExtensionInitDependency();\n }\n\n getDependency<Dependency extends AnyLexicalExtension>(\n dep: Dependency,\n ): LexicalExtensionDependency<Dependency> {\n const rep = this.builder.getExtensionRep(dep);\n invariant(\n rep !== undefined,\n \"LexicalExtensionBuilder: Extension %s missing dependency extension %s to be in registry\",\n this.extension.name,\n dep.name,\n );\n return rep.getExtensionDependency();\n }\n\n getState(): AfterInitializationState<Extension> {\n const state = this.state;\n invariant(\n isAfterInitializationState(state),\n \"ExtensionRep getState called in state id %s (expected %s afterInitialization)\",\n String(state.id),\n String(ExtensionRepStateIds.afterInitialization),\n );\n return state;\n }\n\n getDirectDependentNames(): ReadonlySet<string> {\n return this.builder.incomingEdges.get(this.extension.name) || emptySet;\n }\n\n getPeerNameSet(): ReadonlySet<string> {\n let s = this._peerNameSet;\n if (!s) {\n s = new Set((this.extension.peerDependencies || []).map(([name]) => name));\n this._peerNameSet = s;\n }\n return s;\n }\n\n getExtensionDependency(): LexicalExtensionDependency<Extension> {\n if (!this._dependency) {\n const state = this.state;\n invariant(\n isRegisteredExtensionRepState(state),\n \"Extension %s used as a dependency before registration\",\n this.extension.name,\n );\n this._dependency = {\n config: state.config,\n output: state.output,\n };\n }\n return this._dependency;\n }\n mergeConfigs(): LexicalExtensionConfig<Extension> {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- LexicalExtensionConfig<Extension> is any\n let config: LexicalExtensionConfig<Extension> = this.extension.config || {};\n const mergeConfig = this.extension.mergeConfig\n ? this.extension.mergeConfig.bind(this.extension)\n : shallowMergeConfig;\n for (const cfg of this.configs) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- LexicalExtensionConfig<Extension> is any\n config = mergeConfig(config, cfg);\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return -- any\n return config;\n }\n}\n","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { defineExtension, safeCast } from \"@etrepum/lexical-builder-core\";\nimport {\n $createParagraphNode,\n $getRoot,\n LineBreakNode,\n ParagraphNode,\n RootNode,\n TabNode,\n TextNode,\n type EditorSetOptions,\n type EditorUpdateOptions,\n} from \"lexical\";\n\nconst HISTORY_MERGE_OPTIONS = { tag: \"history-merge\" };\n\nfunction $defaultInitializer() {\n const root = $getRoot();\n if (root.isEmpty()) {\n root.append($createParagraphNode());\n }\n}\n\nexport interface InitialStateConfig {\n updateOptions: EditorUpdateOptions;\n setOptions: EditorSetOptions;\n}\n\nexport const InitialStateExtension = defineExtension({\n name: \"@etrepum/lexical-builder/InitialState\",\n // These are automatically added by createEditor, we add them here so they are\n // visible during extensionRep.init so extensions can see all known types before the\n // editor is created.\n // (excluding ArtificialNode__DO_NOT_USE because it isn't really public API\n // and shouldn't change anything)\n nodes: [RootNode, TextNode, LineBreakNode, TabNode, ParagraphNode],\n config: safeCast<InitialStateConfig>({\n updateOptions: HISTORY_MERGE_OPTIONS,\n setOptions: HISTORY_MERGE_OPTIONS,\n }),\n init({ $initialEditorState = $defaultInitializer }) {\n return $initialEditorState;\n },\n afterInitialization(editor, { updateOptions, setOptions }, state) {\n const $initialEditorState = state.getInitResult();\n switch (typeof $initialEditorState) {\n case \"function\": {\n editor.update(() => {\n $initialEditorState(editor);\n }, updateOptions);\n break;\n }\n case \"string\": {\n const parsedEditorState = editor.parseEditorState($initialEditorState);\n editor.setEditorState(parsedEditorState, setOptions);\n break;\n }\n case \"object\": {\n if ($initialEditorState) {\n editor.setEditorState($initialEditorState, setOptions);\n }\n break;\n }\n default: {\n /* noop */\n }\n }\n return () => {\n /* noop */\n };\n },\n});\n","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\nimport type {\n AnyLexicalExtension,\n AnyLexicalExtensionArgument,\n LexicalEditorWithDispose,\n InitialEditorConfig,\n LexicalExtensionConfig,\n AnyNormalizedLexicalExtensionArgument,\n} from \"@etrepum/lexical-builder-core\";\nimport {\n type LexicalEditor,\n createEditor,\n type CreateEditorArgs,\n type EditorThemeClasses,\n type HTMLConfig,\n type KlassConstructor,\n type LexicalNode,\n} from \"lexical\";\nimport { mergeRegister } from \"@lexical/utils\";\nimport invariant from \"./shared/invariant\";\nimport { deepThemeMergeInPlace } from \"./deepThemeMergeInPlace\";\nimport {\n ExtensionRep,\n applyPermanentMark,\n applyTemporaryMark,\n isExactlyPermanentExtensionRepState,\n isExactlyUnmarkedExtensionRepState,\n} from \"./ExtensionRep\";\nimport { PACKAGE_VERSION } from \"./PACKAGE_VERSION\";\nimport { InitialStateExtension } from \"./InitialStateExtension\";\n\n/** @internal Use a well-known symbol for dev tools purposes */\nexport const builderSymbol = Symbol.for(\"@etrepum/lexical-builder\");\n\n/**\n * Build a LexicalEditor by combining together one or more extensions, optionally\n * overriding some of their configuration.\n *\n * @param extensions - Extension arguments (extensions or extensions with config overrides)\n * @returns An editor handle\n *\n * @example A single root extension with multiple dependencies\n * ```ts\n * const editor = buildEditorFromExtensions(\n * defineExtension({\n * name: \"[root]\",\n * dependencies: [\n * RichTextExtension,\n * configExtension(EmojiExtension, { emojiBaseUrl: \"/assets/emoji\" }),\n * ],\n * register: (editor: LexicalEditor) => {\n * console.log(\"Editor Created\");\n * return () => console.log(\"Editor Disposed\");\n * },\n * }),\n * );\n * ```\n * @example A very similar minimal configuration without the register hook\n * ```ts\n * const editor = buildEditorFromExtensions(\n * RichTextExtension,\n * configExtension(EmojiExtension, { emojiBaseUrl: \"/assets/emoji\" }),\n * );\n * ```\n */\nexport function buildEditorFromExtensions(\n ...extensions: AnyLexicalExtensionArgument[]\n): LexicalEditorWithDispose {\n return LexicalBuilder.fromExtensions(extensions).buildEditor();\n}\n\n/** @internal */\nfunction noop() {\n /*empty*/\n}\n\n/** Throw the given Error */\nfunction defaultOnError(err: Error) {\n throw err;\n}\n\ninterface WithBuilder {\n [builderSymbol]?: LexicalBuilder | undefined;\n}\n\n/** @internal */\nfunction maybeWithBuilder(editor: LexicalEditor): LexicalEditor & WithBuilder {\n return editor;\n}\n\nfunction normalizeExtensionArgument(\n arg: AnyLexicalExtensionArgument,\n): AnyNormalizedLexicalExtensionArgument {\n return Array.isArray(arg) ? arg : [arg];\n}\n\n/** @internal */\nexport class LexicalBuilder {\n roots: readonly AnyNormalizedLexicalExtensionArgument[];\n extensionNameMap: Map<string, ExtensionRep<AnyLexicalExtension>>;\n outgoingConfigEdges: Map<\n string,\n Map<string, LexicalExtensionConfig<AnyLexicalExtension>[]>\n >;\n incomingEdges: Map<string, Set<string>>;\n conflicts: Map<string, string>;\n _sortedExtensionReps?: readonly ExtensionRep<AnyLexicalExtension>[];\n PACKAGE_VERSION: string;\n\n constructor(roots: AnyNormalizedLexicalExtensionArgument[]) {\n this.outgoingConfigEdges = new Map();\n this.incomingEdges = new Map();\n this.extensionNameMap = new Map();\n this.conflicts = new Map();\n this.PACKAGE_VERSION = PACKAGE_VERSION;\n this.roots = roots;\n for (const extension of roots) {\n this.addExtension(extension);\n }\n }\n\n static fromExtensions(extensions: AnyLexicalExtensionArgument[]): LexicalBuilder {\n const roots = [normalizeExtensionArgument(InitialStateExtension)];\n for (const extension of extensions) {\n roots.push(normalizeExtensionArgument(extension));\n }\n return new LexicalBuilder(roots);\n }\n\n /** Look up the editor that was created by this LexicalBuilder or throw */\n static fromEditor(editor: LexicalEditor): LexicalBuilder {\n const builder = maybeWithBuilder(editor)[builderSymbol];\n invariant(\n builder && typeof builder === \"object\",\n \"LexicalBuilder.fromEditor: The given editor was not created with LexicalBuilder, or has been disposed\",\n );\n // The dev tools variant of this will relax some of these invariants\n invariant(\n builder.PACKAGE_VERSION === PACKAGE_VERSION,\n \"LexicalBuilder.fromEditor: The given editor was created with LexicalBuilder %s but this version is %s. A project should have exactly one copy of LexicalBuilder\",\n builder.PACKAGE_VERSION,\n PACKAGE_VERSION,\n );\n invariant(\n builder instanceof LexicalBuilder,\n \"LexicalBuilder.fromEditor: There are multiple copies of the same version of LexicalBuilder in your project, and this editor was created with another one. Your project, or one of its dependencies, has its package.json and/or bundler configured incorrectly.\",\n );\n return builder;\n }\n\n buildEditor(): LexicalEditorWithDispose {\n const controller = new AbortController();\n const {\n $initialEditorState: _$initialEditorState,\n onError,\n ...editorConfig\n } = this.buildCreateEditorArgs(controller.signal);\n let disposeOnce = noop;\n function dispose() {\n try {\n disposeOnce();\n } finally {\n disposeOnce = noop;\n }\n }\n const editor: LexicalEditorWithDispose & WithBuilder = Object.assign(\n createEditor({\n ...editorConfig,\n ...(onError\n ? {\n onError: (err) => {\n onError(err, editor);\n },\n }\n : {}),\n }),\n { [builderSymbol]: this, dispose, [Symbol.dispose]: dispose },\n );\n disposeOnce = mergeRegister(\n () => {\n maybeWithBuilder(editor)[builderSymbol] = undefined;\n },\n () => {\n editor.setRootElement(null);\n },\n this.registerEditor(editor, controller),\n );\n return editor;\n }\n\n getExtensionRep<Extension extends AnyLexicalExtension>(\n extension: Extension,\n ): ExtensionRep<Extension> | undefined {\n const rep = this.extensionNameMap.get(extension.name);\n if (rep) {\n invariant(\n rep.extension === extension,\n \"LexicalBuilder: A registered extension with name %s exists but does not match the given extension\",\n extension.name,\n );\n return rep as ExtensionRep<Extension>;\n }\n }\n\n addEdge(\n fromExtensionName: string,\n toExtensionName: string,\n configs: LexicalExtensionConfig<AnyLexicalExtension>[],\n ) {\n const outgoing = this.outgoingConfigEdges.get(fromExtensionName);\n if (outgoing) {\n outgoing.set(toExtensionName, configs);\n } else {\n this.outgoingConfigEdges.set(\n fromExtensionName,\n new Map([[toExtensionName, configs]]),\n );\n }\n const incoming = this.incomingEdges.get(toExtensionName);\n if (incoming) {\n incoming.add(fromExtensionName);\n } else {\n this.incomingEdges.set(toExtensionName, new Set([fromExtensionName]));\n }\n }\n\n addExtension(arg: AnyLexicalExtensionArgument) {\n invariant(\n this._sortedExtensionReps === undefined,\n \"LexicalBuilder: addExtension called after finalization\",\n );\n const normalized = normalizeExtensionArgument(arg);\n const [extension] = normalized;\n invariant(\n typeof extension.name === \"string\",\n \"LexicalBuilder: extension name must be string, not %s\",\n typeof extension.name,\n );\n let extensionRep = this.extensionNameMap.get(extension.name);\n invariant(\n extensionRep === undefined || extensionRep.extension === extension,\n \"LexicalBuilder: Multiple extensions registered with name %s, names must be unique\",\n extension.name,\n );\n if (!extensionRep) {\n extensionRep = new ExtensionRep(this, extension);\n this.extensionNameMap.set(extension.name, extensionRep);\n const hasConflict = this.conflicts.get(extension.name);\n if (typeof hasConflict === \"string\") {\n invariant(\n false,\n \"LexicalBuilder: extension %s conflicts with %s\",\n extension.name,\n hasConflict,\n );\n }\n for (const name of extension.conflictsWith || []) {\n invariant(\n !this.extensionNameMap.has(name),\n \"LexicalBuilder: extension %s conflicts with %s\",\n extension.name,\n name,\n );\n this.conflicts.set(name, extension.name);\n }\n for (const dep of extension.dependencies || []) {\n const normDep = normalizeExtensionArgument(dep);\n this.addEdge(extension.name, normDep[0].name, normDep.slice(1));\n this.addExtension(normDep);\n }\n for (const [depName, config] of extension.peerDependencies || []) {\n this.addEdge(extension.name, depName, config ? [config] : []);\n }\n }\n }\n\n sortedExtensionReps(): readonly ExtensionRep<AnyLexicalExtension>[] {\n if (this._sortedExtensionReps) {\n return this._sortedExtensionReps;\n }\n // depth-first search based topological DAG sort\n // https://en.wikipedia.org/wiki/Topological_sorting\n const sortedExtensionReps: ExtensionRep<AnyLexicalExtension>[] = [];\n const visit = (rep: ExtensionRep<AnyLexicalExtension>, fromExtensionName?: string) => {\n let mark = rep.state;\n if (isExactlyPermanentExtensionRepState(mark)) {\n return;\n }\n const extensionName = rep.extension.name;\n invariant(\n isExactlyUnmarkedExtensionRepState(mark),\n \"LexicalBuilder: Circular dependency detected for Extension %s from %s\",\n extensionName,\n fromExtensionName || \"[unknown]\",\n );\n mark = applyTemporaryMark(mark);\n rep.state = mark;\n const outgoingConfigEdges = this.outgoingConfigEdges.get(extensionName);\n if (outgoingConfigEdges) {\n for (const toExtensionName of outgoingConfigEdges.keys()) {\n const toRep = this.extensionNameMap.get(toExtensionName);\n // may be undefined for an optional peer dependency\n if (toRep) {\n visit(toRep, extensionName);\n }\n }\n }\n mark = applyPermanentMark(mark);\n rep.state = mark;\n sortedExtensionReps.push(rep);\n };\n for (const rep of this.extensionNameMap.values()) {\n if (isExactlyUnmarkedExtensionRepState(rep.state)) {\n visit(rep);\n }\n }\n for (const rep of sortedExtensionReps) {\n for (const [toExtensionName, configs] of this.outgoingConfigEdges.get(\n rep.extension.name,\n ) || []) {\n if (configs.length > 0) {\n const toRep = this.extensionNameMap.get(toExtensionName);\n if (toRep) {\n for (const config of configs) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument -- any\n toRep.configs.add(config);\n }\n }\n }\n }\n }\n for (const [extension, ...configs] of this.roots) {\n if (configs.length > 0) {\n const toRep = this.extensionNameMap.get(extension.name);\n invariant(\n toRep !== undefined,\n \"LexicalBuilder: Expecting existing ExtensionRep for %s\",\n extension.name,\n );\n for (const config of configs) {\n toRep.configs.add(config);\n }\n }\n }\n this._sortedExtensionReps = sortedExtensionReps;\n return this._sortedExtensionReps;\n }\n\n registerEditor(\n editor: LexicalEditor,\n controller: AbortController,\n ): () => void {\n const cleanups: (() => void)[] = [];\n const extensionReps = this.sortedExtensionReps();\n for (const extensionRep of extensionReps) {\n const cleanup = extensionRep.register(editor);\n if (cleanup) {\n cleanups.push(cleanup);\n }\n }\n for (const extensionRep of extensionReps) {\n const cleanup = extensionRep.afterInitialization(editor);\n if (cleanup) {\n cleanups.push(cleanup);\n }\n }\n return () => {\n for (let i = cleanups.length - 1; i >= 0; i--) {\n const cleanupFun = cleanups[i];\n invariant(\n cleanupFun !== undefined,\n \"LexicalBuilder: Expecting cleanups[%s] to be defined\",\n String(i),\n );\n cleanupFun();\n }\n cleanups.length = 0;\n controller.abort();\n };\n }\n\n buildCreateEditorArgs(signal: AbortSignal) {\n const config: InitialEditorConfig = {};\n const nodes = new Set<NonNullable<CreateEditorArgs[\"nodes\"]>[number]>();\n const replacedNodes = new Map<\n KlassConstructor<typeof LexicalNode>,\n ExtensionRep<AnyLexicalExtension>\n >();\n const htmlExport: NonNullable<HTMLConfig[\"export\"]> = new Map();\n const htmlImport: NonNullable<HTMLConfig[\"import\"]> = {};\n const theme: EditorThemeClasses = {};\n const extensionReps = this.sortedExtensionReps();\n for (const extensionRep of extensionReps) {\n const { extension } = extensionRep;\n if (extension.onError !== undefined) {\n config.onError = extension.onError;\n }\n if (extension.disableEvents !== undefined) {\n config.disableEvents = extension.disableEvents;\n }\n if (extension.parentEditor !== undefined) {\n config.parentEditor = extension.parentEditor;\n }\n if (extension.editable !== undefined) {\n config.editable = extension.editable;\n }\n if (extension.namespace !== undefined) {\n config.namespace = extension.namespace;\n }\n if (extension.$initialEditorState !== undefined) {\n config.$initialEditorState = extension.$initialEditorState;\n }\n if (extension.nodes) {\n for (const node of extension.nodes) {\n if (typeof node !== \"function\") {\n const conflictExtension = replacedNodes.get(node.replace);\n if (conflictExtension) {\n invariant(\n false,\n \"LexicalBuilder: Extension %s can not register replacement for node %s because %s already did\",\n extension.name,\n node.replace.name,\n conflictExtension.extension.name,\n );\n }\n replacedNodes.set(node.replace, extensionRep);\n }\n nodes.add(node);\n }\n }\n if (extension.html) {\n if (extension.html.export) {\n for (const [k, v] of extension.html.export.entries()) {\n htmlExport.set(k, v);\n }\n }\n if (extension.html.import) {\n Object.assign(htmlImport, extension.html.import);\n }\n }\n if (extension.theme) {\n deepThemeMergeInPlace(theme, extension.theme);\n }\n }\n if (Object.keys(theme).length > 0) {\n config.theme = theme;\n }\n if (nodes.size) {\n config.nodes = [...nodes];\n }\n const hasImport = Object.keys(htmlImport).length > 0;\n const hasExport = htmlExport.size > 0;\n if (hasImport || hasExport) {\n config.html = {};\n if (hasImport) {\n config.html.import = htmlImport;\n }\n if (hasExport) {\n config.html.export = htmlExport;\n }\n }\n for (const extensionRep of extensionReps) {\n extensionRep.init(config, signal);\n }\n if (!config.onError) {\n config.onError = defaultOnError;\n }\n return config;\n }\n}\n","import type { LexicalEditor } from \"lexical\";\nimport type {\n AnyLexicalExtension,\n LexicalExtensionDependency,\n} from \"@etrepum/lexical-builder-core\";\nimport { LexicalBuilder } from \"./LexicalBuilder\";\nimport invariant from \"./shared/invariant\";\n\n/**\n * Get the finalized config and output of an Extension that was used to build the editor.\n *\n * This is useful in the implementation of a LexicalNode or in other\n * situations where you have an editor reference but it's not easy to\n * pass the config or {@link ExtensionRegisterState} around.\n *\n * It will throw if the Editor was not built using this Extension.\n *\n * @param editor - The editor that was built using extension\n * @param extension - The concrete reference to an Extension used to build this editor\n * @returns The config and output for that Extension\n */\nexport function getExtensionDependencyFromEditor<Extension extends AnyLexicalExtension>(\n editor: LexicalEditor,\n extension: Extension,\n): LexicalExtensionDependency<Extension> {\n const builder = LexicalBuilder.fromEditor(editor);\n const rep = builder.getExtensionRep(extension);\n invariant(\n rep !== undefined,\n \"getExtensionFromEditor: Extension %s was not built when creating this editor\",\n extension.name,\n );\n return rep.getExtensionDependency();\n}\n","import type { LexicalEditor } from \"lexical\";\nimport type {\n AnyLexicalExtension,\n LexicalExtensionDependency,\n} from \"@etrepum/lexical-builder-core\";\nimport { LexicalBuilder } from \"./LexicalBuilder\";\nimport invariant from \"./shared/invariant\";\n\n/**\n * Get the finalized config and output of an Extension that was used to build the\n * editor by name.\n *\n * This can be used from the implementation of a LexicalNode or in other\n * situation where you have an editor reference but it's not easy to pass the\n * config around. Use this version if you do not have a concrete reference to\n * the Extension for some reason (e.g. it is an optional peer dependency, or you\n * are avoiding a circular import).\n *\n * Both the explicit Extension type and the name are required.\n *\n * @example\n * ```tsx\n * import type { EmojiExtension } from \"@etrepum/lexical-emoji-extension\";\n * getPeerDependencyFromEditor<typeof EmojiExtension>(editor, \"@etrepum/lexical-emoji-extension/Emoji\");\n * ```\n\n * @param editor - The editor that may have been built using extension\n * @param extensionName - The name of the Extension\n * @returns The config and output of the Extension or undefined\n */\nexport function getPeerDependencyFromEditor<\n Extension extends AnyLexicalExtension = never,\n>(\n editor: LexicalEditor,\n extensionName: Extension[\"name\"],\n): LexicalExtensionDependency<Extension> | undefined {\n const builder = LexicalBuilder.fromEditor(editor);\n const peer = builder.extensionNameMap.get(extensionName);\n return peer\n ? (peer.getExtensionDependency() as LexicalExtensionDependency<Extension>)\n : undefined;\n}\n\n/**\n * Get the finalized config and output of an Extension that was used to build the\n * editor by name.\n *\n * This can be used from the implementation of a LexicalNode or in other\n * situation where you have an editor reference but it's not easy to pass the\n * config around. Use this version if you do not have a concrete reference to\n * the Extension for some reason (e.g. it is an optional peer dependency, or you\n * are avoiding a circular import).\n *\n * Both the explicit Extension type and the name are required.\n *\n * @example\n * ```tsx\n * import type { EmojiExtension } from \"./EmojiExtension\";\n * export class EmojiNode extends TextNode {\n * // other implementation details not included\n * createDOM(\n * config: EditorConfig,\n * editor?: LexicalEditor | undefined\n * ): HTMLElement {\n * const dom = super.createDOM(config, editor);\n * addClassNamesToElement(\n * dom,\n * getPeerDependencyFromEditorOrThrow<typeof EmojiExtension>(\n * editor || $getEditor(),\n * \"@etrepum/lexical-emoji-extension/Emoji\",\n * ).config.emojiClass,\n * );\n * return dom;\n * }\n * }\n * ```\n\n * @param editor - The editor that may have been built using extension\n * @param extensionName - The name of the Extension\n * @returns The config and output of the Extension\n */\nexport function getPeerDependencyFromEditorOrThrow<\n Extension extends AnyLexicalExtension = never,\n>(editor: LexicalEditor, extensionName: Extension[\"name\"]): LexicalExtensionDependency<Extension> {\n const dep = getPeerDependencyFromEditor<Extension>(editor, extensionName);\n invariant(\n dep !== undefined,\n \"getPeerDependencyFromEditorOrThrow: Editor was not build with Extension %s\",\n extensionName,\n );\n return dep;\n}\n","import type { InitialEditorConfig } from \"@etrepum/lexical-builder-core\";\nimport type { KlassConstructor, LexicalNode } from \"lexical\";\n\nexport interface KnownTypesAndNodes {\n types: Set<string>;\n nodes: Set<KlassConstructor<typeof LexicalNode>>;\n}\nexport function getKnownTypesAndNodes(config: InitialEditorConfig) {\n const types: KnownTypesAndNodes[\"types\"] = new Set();\n const nodes: KnownTypesAndNodes[\"nodes\"] = new Set();\n for (const klassOrReplacement of config.nodes ?? []) {\n const klass =\n typeof klassOrReplacement === \"function\"\n ? klassOrReplacement\n : klassOrReplacement.replace;\n types.add(klass.getType());\n nodes.add(klass);\n }\n return { types, nodes };\n}\n","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { defineExtension, safeCast } from \"@etrepum/lexical-builder-core\";\n\nexport interface AutoFocusConfig {\n /**\n * Where to move the selection when the editor is focused and there is no\n * existing selection. Can be \"rootStart\" or \"rootEnd\" (the default).\n */\n defaultSelection?: \"rootStart\" | \"rootEnd\";\n}\n\n/**\n * An Extension to focus the LexicalEditor when the root element is set\n * (typically only when the editor is first created).\n */\nexport const AutoFocusExtension = defineExtension({\n config: safeCast<AutoFocusConfig>({}),\n name: \"@etrepum/lexical-builder/AutoFocus\",\n register(editor, { defaultSelection }) {\n return editor.registerRootListener((rootElement) => {\n editor.focus(\n () => {\n // If we try and move selection to the same point with setBaseAndExtent, it won't\n // trigger a re-focus on the element. So in the case this occurs, we'll need to correct it.\n // Normally this is fine, Selection API !== Focus API, but fore the intents of the naming\n // of this plugin, which should preserve focus too.\n const activeElement = document.activeElement;\n if (\n rootElement !== null &&\n (activeElement === null || !rootElement.contains(activeElement))\n ) {\n // Note: preventScroll won't work in Webkit.\n rootElement.focus({ preventScroll: true });\n }\n },\n { defaultSelection },\n );\n });\n },\n});\n","export type StoreSubscriber<T> = (value: T) => void;\nexport interface ReadableStore<T> {\n get: () => T;\n subscribe: (callback: StoreSubscriber<T>) => () => void;\n}\nexport interface WritableStore<T> extends ReadableStore<T> {\n set: (value: T) => void;\n}\n\nexport class Store<T> implements WritableStore<T>, Disposable {\n __value: T;\n __listeners: Map<symbol, StoreSubscriber<T>>;\n __eq?: (a: T, b: T) => boolean;\n constructor(value: T, eq?: (a: T, b: T) => boolean) {\n this.__value = value;\n this.__listeners = new Map();\n this.__eq = eq;\n }\n get() {\n return this.__value;\n }\n set(value: T): void {\n if (this.__eq ? !this.__eq(this.__value, value) : this.__value !== value) {\n this.__value = value;\n for (const cb of this.__listeners.values()) {\n cb(value);\n }\n }\n }\n [Symbol.dispose]() {\n this.dispose();\n }\n dispose() {\n this.__listeners.clear();\n }\n subscribe(\n callback: StoreSubscriber<T>,\n skipInitialization = false,\n ): () => void {\n const key = Symbol(\"unsubscribe\");\n this.__listeners.set(key, callback);\n if (!skipInitialization) {\n callback(this.__value);\n }\n return () => {\n this.__listeners.delete(key);\n };\n }\n}\n","import { mergeRegister } from \"@lexical/utils\";\nimport type { ReadableStore } from \"./Store\";\n\nexport function registerStoreToggle<T>(\n store: ReadableStore<T>,\n isEnabled: (value: T) => boolean,\n register: () => () => void,\n): () => void {\n let cleanup: null | (() => void) = null;\n const performCleanup = () => {\n cleanup?.();\n cleanup = null;\n };\n return mergeRegister(\n performCleanup,\n store.subscribe((value) => {\n performCleanup();\n if (isEnabled(value)) {\n cleanup = register();\n }\n }),\n );\n}\n","import { Store, type WritableStore } from \"./Store\";\nimport { registerStoreToggle } from \"./registerStoreToggle\";\n\nexport interface DisabledToggleOptions {\n disabled?: boolean;\n register: () => () => void;\n}\nexport interface DisabledToggleOutput {\n disabled: WritableStore<boolean>;\n}\nexport function disabledToggle(\n opts: DisabledToggleOptions,\n): [DisabledToggleOutput, () => void] {\n const disabled = new Store(Boolean(opts.disabled));\n return [\n { disabled },\n registerStoreToggle(disabled, (v) => !v, opts.register),\n ];\n}\n","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { registerDragonSupport } from \"@lexical/dragon\";\nimport {\n defineExtension,\n provideOutput,\n safeCast,\n} from \"@etrepum/lexical-builder-core\";\nimport { disabledToggle, type DisabledToggleOutput } from \"./disabledToggle\";\n\nexport interface DragonConfig {\n disabled: boolean;\n}\nexport type DragonOutput = DisabledToggleOutput;\n\n/**\n * Add Dragon speech to text input support to the editor, via the\n * \\@lexical/dragon module.\n */\nexport const DragonExtension = defineExtension({\n name: \"@lexical/dragon\",\n config: safeCast<DragonConfig>({ disabled: typeof window === \"undefined\" }),\n register: (editor, config) =>\n provideOutput<DragonOutput>(\n ...disabledToggle({\n disabled: config.disabled,\n register: () => registerDragonSupport(editor),\n }),\n ),\n});\n","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\nimport { type LexicalEditor } from \"lexical\";\nimport {\n createEmptyHistoryState,\n type HistoryState,\n registerHistory,\n} from \"@lexical/history\";\nimport {\n configExtension,\n defineExtension,\n provideOutput,\n safeCast,\n} from \"@etrepum/lexical-builder-core\";\nimport { disabledToggle, type DisabledToggleOutput } from \"./disabledToggle\";\nimport { getPeerDependencyFromEditor } from \"./getPeerDependencyFromEditor\";\n\nexport interface HistoryConfig {\n /**\n * The time (in milliseconds) the editor should delay generating a new history stack,\n * instead of merging the current changes with the current stack. The default is 300ms.\n */\n delay: number;\n /**\n * The initial history state, the default is {@link createEmptyHistoryState}.\n */\n createInitialHistoryState: (editor: LexicalEditor) => HistoryState;\n /**\n * Whether history is disabled or not\n */\n disabled: boolean;\n}\n\nexport interface HistoryOutput extends DisabledToggleOutput {\n getHistoryState: () => HistoryState;\n}\n\n/**\n * Registers necessary listeners to manage undo/redo history stack and related\n * editor commands, via the \\@lexical/history module.\n */\nexport const HistoryExtension = defineExtension({\n config: safeCast<HistoryConfig>({\n createInitialHistoryState: createEmptyHistoryState,\n delay: 300,\n disabled: typeof window === \"undefined\",\n }),\n name: \"@etrepum/lexical-builder/History\",\n register: (editor, { delay, createInitialHistoryState, disabled }) => {\n const historyState = createInitialHistoryState(editor);\n const [output, cleanup] = disabledToggle({\n disabled,\n register: () => registerHistory(editor, historyState, delay),\n });\n return provideOutput<HistoryOutput>(\n { ...output, getHistoryState: () => historyState },\n cleanup,\n );\n },\n});\n\nfunction getHistoryPeer(editor: LexicalEditor | null | undefined) {\n return editor\n ? getPeerDependencyFromEditor<typeof HistoryExtension>(editor, HistoryExtension.name)\n : null;\n}\n\n/**\n * Registers necessary listeners to manage undo/redo history stack and related\n * editor commands, via the \\@lexical/history module, only if the parent editor\n * has a history plugin implementation.\n */\nexport const SharedHistoryExtension = defineExtension({\n name: \"@etrepum/lexical-builder/SharedHistory\",\n dependencies: [configExtension(HistoryExtension, { disabled: true })],\n init(editorConfig, _config, state) {\n // Configure the peer dependency based on the parent editor's history\n const { config } = state.getDependency(HistoryExtension);\n const parentPeer = getHistoryPeer(editorConfig.parentEditor);\n // Default is disabled by config above, we will enable it based\n // on the parent editor's history extension\n if (parentPeer) {\n config.delay = parentPeer.config.delay;\n config.createInitialHistoryState = () =>\n parentPeer.output.getHistoryState();\n }\n return parentPeer;\n },\n register(_editor, _config, state) {\n const parentPeer = state.getInitResult();\n if (!parentPeer) {\n return () => {\n /* noop */\n };\n }\n const disabled = state.getDependency(HistoryExtension).output.disabled;\n return parentPeer.output.disabled.subscribe(disabled.set.bind(disabled));\n },\n});\n","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\nimport { registerPlainText } from \"@lexical/plain-text\";\nimport { defineExtension } from \"@etrepum/lexical-builder-core\";\nimport { DragonExtension } from \"./DragonExtension\";\n\n/**\n * An extension to register \\@lexical/plain-text behavior\n */\nexport const PlainTextExtension = defineExtension({\n conflictsWith: [\"@lexical/rich-text\"],\n name: \"@lexical/plain-text\",\n dependencies: [DragonExtension],\n register: registerPlainText,\n});\n","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { HeadingNode, QuoteNode, registerRichText } from \"@lexical/rich-text\";\nimport { defineExtension } from \"@etrepum/lexical-builder-core\";\nimport { DragonExtension } from \"./DragonExtension\";\n\n/**\n * An extension to register \\@lexical/rich-text behavior and nodes\n * ({@link HeadingNode}, {@link QuoteNode})\n */\nexport const RichTextExtension = defineExtension({\n conflictsWith: [\"@lexical/plain-text\"],\n name: \"@lexical/rich-text\",\n nodes: [HeadingNode, QuoteNode],\n dependencies: [DragonExtension],\n register: registerRichText,\n});\n"],"names":[],"mappings":";;;;;;;;;;;AACa,MAAA,kBAA0B;ACUf,SAAA,UACtB,MACA,YACG,MACW;AACd,MAAI,MAAM;AACR;AAAA,EACF;AAEA,QAAM,IAAI;AAAA,IACR,KAAK,OAAO,CAAC,KAAK,QAAQ,IAAI,QAAQ,MAAM,OAAO,GAAG,CAAC,GAAG,WAAW,EAAE;AAAA,EAAA;AAE3E;ACCgB,SAAA,sBAAsB,GAAY,GAAY;AAC5D,MACE,KACA,KACA,CAAC,MAAM,QAAQ,CAAC,KAChB,OAAO,MAAM,YACb,OAAO,MAAM,UACb;AACA,UAAM,OAAO;AACb,UAAM,OAAO;AACb,eAAW,KAAK,MAAM;AACf,WAAA,CAAC,IAAI,sBAAsB,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC;AAAA,IAClD;AACO,WAAA;AAAA,EACT;AACO,SAAA;AACT;AChBO,MAAM,uBAAuB;AAAA,EAClC,UAAU;AAAA,EACV,WAAW;AAAA,EACX,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,qBAAqB;AACvB;AAyCO,SAAS,mCACd,OACwB;AACjB,SAAA,MAAM,OAAO,qBAAqB;AAC3C;AACA,SAAS,oCACP,OACyB;AAClB,SAAA,MAAM,OAAO,qBAAqB;AAC3C;AACO,SAAS,oCACd,OACyB;AAClB,SAAA,MAAM,OAAO,qBAAqB;AAC3C;AACA,SAAS,+BACP,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;AAAA,IAGf;AACA,UAAM,WAAW,MAAM,cAAc,gBAAgB,EAAE,OAAO;AACvD,WAAA,WAAW,OAAO,SAAS,UAAU,SAAS,IAAI,KAAK,QAAQ,CAAC;AAAA,EACzE;AACF,CAAC;ACzFM,MAAM,qBAAqB,gBAAgB;AAAA,EAChD,eAAe,CAAC,oBAAoB;AAAA,EACpC,MAAM;AAAA,EACN,cAAc,CAAC,eAAe;AAAA,EAC9B,UAAU;AACZ,CAAC;ACHM,MAAM,oBAAoB,gBAAgB;AAAA,EAC/C,eAAe,CAAC,qBAAqB;AAAA,EACrC,MAAM;AAAA,EACN,OAAO,CAAC,aAAa,SAAS;AAAA,EAC9B,cAAc,CAAC,eAAe;AAAA,EAC9B,UAAU;AACZ,CAAC;"}
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "test:watch": "vitest",
19
19
  "lint": "eslint"
20
20
  },
21
- "version": "0.0.36-nightly.20250711.0",
21
+ "version": "0.0.36",
22
22
  "license": "MIT",
23
23
  "repository": {
24
24
  "type": "git",
@@ -33,13 +33,13 @@
33
33
  "@etrepum/lexical-builder-core": "*"
34
34
  },
35
35
  "peerDependencies": {
36
- "@lexical/dragon": ">=0.31.0 || >=0.31.1-nightly.0",
37
- "@lexical/history": ">=0.31.0 || >=0.31.1-nightly.0",
38
- "@lexical/plain-text": ">=0.31.0 || >=0.31.1-nightly.0",
39
- "@lexical/rich-text": ">=0.31.0 || >=0.31.1-nightly.0",
40
- "@lexical/text": ">=0.31.0 || >=0.31.1-nightly.0",
41
- "@lexical/utils": ">=0.31.0 || >=0.31.1-nightly.0",
42
- "lexical": ">=0.31.0 || >=0.31.1-nightly.0"
36
+ "@lexical/dragon": ">=0.33.1 || >=0.33.2-nightly.0",
37
+ "@lexical/history": ">=0.33.1 || >=0.33.2-nightly.0",
38
+ "@lexical/plain-text": ">=0.33.1 || >=0.33.2-nightly.0",
39
+ "@lexical/rich-text": ">=0.33.1 || >=0.33.2-nightly.0",
40
+ "@lexical/text": ">=0.33.1 || >=0.33.2-nightly.0",
41
+ "@lexical/utils": ">=0.33.1 || >=0.33.2-nightly.0",
42
+ "lexical": ">=0.33.1 || >=0.33.2-nightly.0"
43
43
  },
44
44
  "sideEffects": false,
45
45
  "devDependencies": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"AutoFocusPlan.d.ts","sourceRoot":"","sources":["../src/AutoFocusPlan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;CAC5C;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,8HAwBxB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"DragonPlan.d.ts","sourceRoot":"","sources":["../src/DragonPlan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,OAAO,EAAkB,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7E,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,OAAO,CAAC;CACnB;AACD,MAAM,MAAM,YAAY,GAAG,oBAAoB,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,UAAU,qHAUrB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"HistoryPlan.d.ts","sourceRoot":"","sources":["../src/HistoryPlan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAEL,KAAK,YAAY,EAElB,MAAM,kBAAkB,CAAC;AAO1B,OAAO,EAAkB,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAG7E,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,yBAAyB,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,YAAY,CAAC;IACnE;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,aAAc,SAAQ,oBAAoB;IACzD,eAAe,EAAE,MAAM,YAAY,CAAC;CACrC;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,gIAkBtB,CAAC;AAQH;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,kXA0B5B,CAAC"}
@@ -1,7 +0,0 @@
1
- import { EditorSetOptions, EditorUpdateOptions } from 'lexical';
2
- export interface InitialStateConfig {
3
- updateOptions: EditorUpdateOptions;
4
- setOptions: EditorSetOptions;
5
- }
6
- export declare const InitialStatePlan: import('@etrepum/lexical-builder-core').LexicalPlan<InitialStateConfig, "@etrepum/lexical-builder/InitialState", unknown, import('@etrepum/lexical-builder-core').InitialEditorStateType>;
7
- //# sourceMappingURL=InitialStatePlan.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InitialStatePlan.d.ts","sourceRoot":"","sources":["../src/InitialStatePlan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAQL,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACzB,MAAM,SAAS,CAAC;AAWjB,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,mBAAmB,CAAC;IACnC,UAAU,EAAE,gBAAgB,CAAC;CAC9B;AAED,eAAO,MAAM,gBAAgB,2LA2C3B,CAAC"}
@@ -1,5 +0,0 @@
1
- /**
2
- * A plan to register \@lexical/plain-text behavior
3
- */
4
- export declare const PlainTextPlan: import('@etrepum/lexical-builder-core').LexicalPlan<import('@etrepum/lexical-builder-core').PlanConfigBase, "@lexical/plain-text", unknown, unknown>;
5
- //# sourceMappingURL=PlainTextPlan.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlainTextPlan.d.ts","sourceRoot":"","sources":["../src/PlainTextPlan.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,eAAO,MAAM,aAAa,sJAKxB,CAAC"}
package/dist/PlanRep.d.ts DELETED
@@ -1,76 +0,0 @@
1
- import { AnyLexicalPlan, InitialEditorConfig, LexicalPlanConfig, LexicalPlanDependency, LexicalPlanInit, LexicalPlanOutput, RegisterCleanup, PlanInitState, PlanRegisterState } from '@etrepum/lexical-builder-core';
2
- import { LexicalEditor } from 'lexical';
3
- import { LexicalBuilder } from './LexicalBuilder';
4
- export declare const PlanRepStateIds: {
5
- readonly unmarked: 0;
6
- readonly temporary: 1;
7
- readonly permanent: 2;
8
- readonly configured: 3;
9
- readonly initialized: 4;
10
- readonly registered: 5;
11
- readonly afterInitialization: 6;
12
- };
13
- interface UnmarkedState {
14
- id: (typeof PlanRepStateIds)["unmarked"];
15
- }
16
- interface TemporaryState extends Omit<UnmarkedState, "id"> {
17
- id: (typeof PlanRepStateIds)["temporary"];
18
- }
19
- interface PermanentState extends Omit<TemporaryState, "id"> {
20
- id: (typeof PlanRepStateIds)["permanent"];
21
- }
22
- interface ConfiguredState<Plan extends AnyLexicalPlan> extends Omit<PermanentState, "id"> {
23
- id: (typeof PlanRepStateIds)["configured"];
24
- config: LexicalPlanConfig<Plan>;
25
- registerState: PlanInitState;
26
- }
27
- interface InitializedState<Plan extends AnyLexicalPlan> extends Omit<ConfiguredState<Plan>, "id" | "registerState"> {
28
- id: (typeof PlanRepStateIds)["initialized"];
29
- initResult: LexicalPlanInit<Plan>;
30
- registerState: PlanRegisterState<LexicalPlanInit<Plan>>;
31
- }
32
- interface RegisteredState<Plan extends AnyLexicalPlan> extends Omit<InitializedState<Plan>, "id"> {
33
- id: (typeof PlanRepStateIds)["registered"];
34
- output: LexicalPlanOutput<Plan>;
35
- }
36
- interface AfterInitializationState<Plan extends AnyLexicalPlan> extends Omit<RegisteredState<Plan>, "id"> {
37
- id: (typeof PlanRepStateIds)["afterInitialization"];
38
- }
39
- export type PlanRepState<Plan extends AnyLexicalPlan> = UnmarkedState | TemporaryState | PermanentState | ConfiguredState<Plan> | InitializedState<Plan> | RegisteredState<Plan> | AfterInitializationState<Plan>;
40
- export declare function isExactlyUnmarkedPlanRepState<Plan extends AnyLexicalPlan>(state: PlanRepState<Plan>): state is UnmarkedState;
41
- export declare function isExactlyPermanentPlanRepState<Plan extends AnyLexicalPlan>(state: PlanRepState<Plan>): state is PermanentState;
42
- export declare function applyTemporaryMark<Plan extends AnyLexicalPlan>(state: PlanRepState<Plan>): TemporaryState;
43
- export declare function applyPermanentMark<Plan extends AnyLexicalPlan>(state: PlanRepState<Plan>): PermanentState;
44
- export declare function applyConfiguredState<Plan extends AnyLexicalPlan>(state: PermanentState, config: LexicalPlanConfig<Plan>, registerState: PlanInitState): ConfiguredState<Plan>;
45
- export declare function applyInitializedState<Plan extends AnyLexicalPlan>(state: ConfiguredState<Plan>, initResult: LexicalPlanInit<Plan>, registerState: PlanRegisterState<Plan>): InitializedState<Plan>;
46
- export declare function applyRegisteredState<Plan extends AnyLexicalPlan>(state: InitializedState<Plan>, cleanup?: RegisterCleanup<LexicalPlanOutput<Plan>> | undefined): never;
47
- export declare function applyAfterInitializationState<Plan extends AnyLexicalPlan>(state: RegisteredState<Plan>): AfterInitializationState<Plan>;
48
- /**
49
- * @internal
50
- */
51
- export declare class PlanRep<Plan extends AnyLexicalPlan> {
52
- builder: LexicalBuilder;
53
- configs: Set<Partial<LexicalPlanConfig<Plan>>>;
54
- _dependency?: LexicalPlanDependency<Plan>;
55
- _output?: LexicalPlanOutput<Plan>;
56
- _peerNameSet?: Set<string>;
57
- plan: Plan;
58
- state: PlanRepState<Plan>;
59
- constructor(builder: LexicalBuilder, plan: Plan);
60
- afterInitialization(editor: LexicalEditor): undefined | (() => void);
61
- register(editor: LexicalEditor): undefined | (() => void);
62
- init(editorConfig: InitialEditorConfig, signal: AbortSignal): void;
63
- getInitResult(): LexicalPlanInit<Plan>;
64
- getInitPeer<PeerPlan extends AnyLexicalPlan = never>(name: PeerPlan["name"]): undefined | Omit<LexicalPlanDependency<PeerPlan>, "output">;
65
- getPlanInitDependency(): Omit<LexicalPlanDependency<Plan>, "output">;
66
- getPeer<PeerPlan extends AnyLexicalPlan = never>(name: PeerPlan["name"]): undefined | LexicalPlanDependency<PeerPlan>;
67
- getInitDependency<Dependency extends AnyLexicalPlan>(dep: Dependency): Omit<LexicalPlanDependency<Dependency>, "output">;
68
- getDependency<Dependency extends AnyLexicalPlan>(dep: Dependency): LexicalPlanDependency<Dependency>;
69
- getState(): AfterInitializationState<Plan>;
70
- getDirectDependentNames(): ReadonlySet<string>;
71
- getPeerNameSet(): ReadonlySet<string>;
72
- getPlanDependency(): LexicalPlanDependency<Plan>;
73
- mergeConfigs(): LexicalPlanConfig<Plan>;
74
- }
75
- export {};
76
- //# sourceMappingURL=PlanRep.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlanRep.d.ts","sourceRoot":"","sources":["../src/PlanRep.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,iBAAiB,EAClB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,eAAO,MAAM,eAAe;;;;;;;;CAQlB,CAAC;AACX,UAAU,aAAa;IACrB,EAAE,EAAE,CAAC,OAAO,eAAe,CAAC,CAAC,UAAU,CAAC,CAAC;CAC1C;AACD,UAAU,cAAe,SAAQ,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC;IACxD,EAAE,EAAE,CAAC,OAAO,eAAe,CAAC,CAAC,WAAW,CAAC,CAAC;CAC3C;AACD,UAAU,cAAe,SAAQ,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC;IACzD,EAAE,EAAE,CAAC,OAAO,eAAe,CAAC,CAAC,WAAW,CAAC,CAAC;CAC3C;AACD,UAAU,eAAe,CAAC,IAAI,SAAS,cAAc,CACnD,SAAQ,IAAI,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;IAW1C,uBAAuB,IAAI,WAAW,CAAC,MAAM,CAAC;IAI9C,cAAc,IAAI,WAAW,CAAC,MAAM,CAAC;IASrC,iBAAiB,IAAI,qBAAqB,CAAC,IAAI,CAAC;IAehD,YAAY,IAAI,iBAAiB,CAAC,IAAI,CAAC;CAaxC"}
@@ -1,13 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- /**
9
- * A plan to register \@lexical/rich-text behavior and nodes
10
- * ({@link HeadingNode}, {@link QuoteNode})
11
- */
12
- export declare const RichTextPlan: import('@etrepum/lexical-builder-core').LexicalPlan<import('@etrepum/lexical-builder-core').PlanConfigBase, "@lexical/rich-text", unknown, unknown>;
13
- //# sourceMappingURL=RichTextPlan.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RichTextPlan.d.ts","sourceRoot":"","sources":["../src/RichTextPlan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;;GAGG;AACH,eAAO,MAAM,YAAY,qJAMvB,CAAC"}
@@ -1,17 +0,0 @@
1
- import { LexicalEditor } from 'lexical';
2
- import { AnyLexicalPlan, LexicalPlanDependency } from '@etrepum/lexical-builder-core';
3
- /**
4
- * Get the finalized config and output of a Plan that was used to build the editor.
5
- *
6
- * This is useful in the implementation of a LexicalNode or in other
7
- * situations where you have an editor reference but it's not easy to
8
- * pass the config or {@link PlanRegisterState} around.
9
- *
10
- * It will throw if the Editor was not built using this Plan.
11
- *
12
- * @param editor - The editor that was built using plan
13
- * @param plan - The concrete reference to a Plan used to build this editor
14
- * @returns The config and output for that Plan
15
- */
16
- export declare function getPlanDependencyFromEditor<Plan extends AnyLexicalPlan>(editor: LexicalEditor, plan: Plan): LexicalPlanDependency<Plan>;
17
- //# sourceMappingURL=getPlanDependencyFromEditor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getPlanDependencyFromEditor.d.ts","sourceRoot":"","sources":["../src/getPlanDependencyFromEditor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACtB,MAAM,+BAA+B,CAAC;AAIvC;;;;;;;;;;;;GAYG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,SAAS,cAAc,EACrE,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,IAAI,GACT,qBAAqB,CAAC,IAAI,CAAC,CAS7B"}