@etrepum/lexical-builder 0.0.15 → 0.0.17-nightly.20240610.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,11 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- declare module "@etrepum/lexical-builder" {
9
- interface LexicalPlanRegistry {
10
- [AutoFocusPlan.name]: typeof AutoFocusPlan;
11
- }
12
- }
13
8
  export interface AutoFocusConfig {
14
9
  /**
15
10
  * Where to move the selection when the editor is focused and there is no
@@ -21,5 +16,5 @@ export interface AutoFocusConfig {
21
16
  * A Plan to focus the LexicalEditor when the root element is set
22
17
  * (typically only when the editor is first created).
23
18
  */
24
- export declare const AutoFocusPlan: import('@etrepum/lexical-builder').LexicalPlan<AutoFocusConfig, "@etrepum/lexical-builder/AutoFocusPlan", unknown>;
19
+ export declare const AutoFocusPlan: import('./types').LexicalPlan<AutoFocusConfig, "@etrepum/lexical-builder/AutoFocusPlan", unknown>;
25
20
  //# sourceMappingURL=AutoFocusPlan.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AutoFocusPlan.d.ts","sourceRoot":"","sources":["../src/AutoFocusPlan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,QAAQ,0BAA0B,CAAC;IACxC,UAAU,mBAAmB;QAC3B,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,OAAO,aAAa,CAAC;KAC5C;CACF;AAED,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;CAC5C;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,oHAwBxB,CAAC"}
1
+ {"version":3,"file":"AutoFocusPlan.d.ts","sourceRoot":"","sources":["../src/AutoFocusPlan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;CAC5C;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,mGAwBxB,CAAC"}
@@ -9,5 +9,5 @@
9
9
  * Add Dragon speech to text input support to the editor, via the
10
10
  * @lexical/dragon module.
11
11
  */
12
- export declare const DragonPlan: import('@etrepum/lexical-builder').LexicalPlan<{}, "@lexical/dragon", unknown>;
12
+ export declare const DragonPlan: import('./types').LexicalPlan<{}, "@lexical/dragon", unknown>;
13
13
  //# sourceMappingURL=DragonPlan.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DragonPlan.d.ts","sourceRoot":"","sources":["../src/DragonPlan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;;GAGG;AACH,eAAO,MAAM,UAAU,gFAIrB,CAAC"}
1
+ {"version":3,"file":"DragonPlan.d.ts","sourceRoot":"","sources":["../src/DragonPlan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;;GAGG;AACH,eAAO,MAAM,UAAU,+DAIrB,CAAC"}
@@ -1,10 +1,5 @@
1
1
  import { HistoryState } from '@lexical/history';
2
2
 
3
- declare module "@etrepum/lexical-builder" {
4
- interface LexicalPlanRegistry {
5
- [HistoryPlan.name]: typeof HistoryPlan;
6
- }
7
- }
8
3
  export interface HistoryConfig {
9
4
  /**
10
5
  * The time (in milliseconds) the editor should delay generating a new history stack,
@@ -20,5 +15,5 @@ export interface HistoryConfig {
20
15
  * Registers necessary listeners to manage undo/redo history stack and related
21
16
  * editor commands, via the @lexical/history module.
22
17
  */
23
- export declare const HistoryPlan: import('@etrepum/lexical-builder').LexicalPlan<HistoryConfig, "@etrepum/lexical-builder/HistoryPlan", unknown>;
18
+ export declare const HistoryPlan: import('./types').LexicalPlan<HistoryConfig, "@etrepum/lexical-builder/HistoryPlan", unknown>;
24
19
  //# sourceMappingURL=HistoryPlan.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"HistoryPlan.d.ts","sourceRoot":"","sources":["../src/HistoryPlan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAEL,KAAK,YAAY,EAElB,MAAM,kBAAkB,CAAC;AAM1B,OAAO,QAAQ,0BAA0B,CAAC;IACxC,UAAU,mBAAmB;QAC3B,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,OAAO,WAAW,CAAC;KACxC;CACF;AAED,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,yBAAyB,EAAE,MAAM,YAAY,CAAC;CAC/C;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,gHAStB,CAAC"}
1
+ {"version":3,"file":"HistoryPlan.d.ts","sourceRoot":"","sources":["../src/HistoryPlan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAEL,KAAK,YAAY,EAElB,MAAM,kBAAkB,CAAC;AAK1B,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,yBAAyB,EAAE,MAAM,YAAY,CAAC;CAC/C;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,+FAStB,CAAC"}
@@ -1,4 +1,4 @@
1
- import { AnyLexicalPlan, AnyLexicalPlanArgument, EditorHandle } from './types';
1
+ import { AnyLexicalPlan, AnyLexicalPlanArgument, EditorHandle, RootPlanArgument } from './types';
2
2
  import { LexicalEditor, CreateEditorArgs } from 'lexical';
3
3
  import { PlanRep } from './PlanRep';
4
4
 
@@ -33,19 +33,23 @@ import { PlanRep } from './PlanRep';
33
33
  * );
34
34
  * ```
35
35
  */
36
- export declare function buildEditorFromPlans(plan: AnyLexicalPlanArgument, ...plans: AnyLexicalPlanArgument[]): EditorHandle;
36
+ export declare function buildEditorFromPlans(plan: AnyLexicalPlanArgument | RootPlanArgument, ...plans: (AnyLexicalPlanArgument | RootPlanArgument)[]): EditorHandle;
37
+ /** @internal */
38
+ export declare function coerceToPlanArgument(plan: AnyLexicalPlanArgument | RootPlanArgument): AnyLexicalPlanArgument;
37
39
  /** @internal */
38
40
  export declare class LexicalBuilder {
39
41
  phases: Map<AnyLexicalPlan, PlanRep<AnyLexicalPlan>>[];
40
42
  planMap: Map<AnyLexicalPlan, [number, PlanRep<AnyLexicalPlan>]>;
41
43
  planNameMap: Map<string, PlanRep<AnyLexicalPlan>>;
44
+ reverseEdges: Map<AnyLexicalPlan, Set<AnyLexicalPlan>>;
45
+ addStack: Set<AnyLexicalPlan>;
42
46
  conflicts: Map<string, string>;
43
47
  constructor();
44
48
  /** Look up the editor that was created by this LexicalBuilder or undefined */
45
49
  static fromEditor(editor: LexicalEditor): LexicalBuilder | undefined;
46
50
  buildEditor(): EditorHandle;
47
51
  getPlanRep<Plan extends AnyLexicalPlan>(plan: Plan): PlanRep<Plan> | undefined;
48
- addPlan(arg: AnyLexicalPlanArgument): number;
52
+ addPlan(arg: AnyLexicalPlanArgument, parent?: AnyLexicalPlan): number;
49
53
  sortedPlanReps(): Generator<PlanRep<AnyLexicalPlan>, void, undefined>;
50
54
  registerEditor(editor: LexicalEditor): () => void;
51
55
  buildCreateEditorArgs(): Pick<CreateEditorArgs, "disableEvents" | "namespace" | "nodes" | "theme" | "html" | "editable"> & Pick<AnyLexicalPlan, "onError" | "$initialEditorState">;
@@ -1 +1 @@
1
- {"version":3,"file":"LexicalBuilder.d.ts","sourceRoot":"","sources":["../src/LexicalBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACtB,YAAY,EAEb,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,aAAa,EAEb,KAAK,gBAAgB,EAKtB,MAAM,SAAS,CAAC;AAKjB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,sBAAsB,EAC5B,GAAG,KAAK,EAAE,sBAAsB,EAAE,GACjC,YAAY,CAOd;AA+BD,gBAAgB;AAChB,q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wBAAgB,oBAAoB,CAClC,IAAI,EAAE,sBAAsB,GAAG,gBAAgB,GAC9C,sBAAsB,CAExB;AA+BD,gBAAgB;AAChB,qBAAa,cAAc;IACzB,MAAM,EAAE,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC;IACvD,OAAO,EAAE,GAAG,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IAChE,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC;IAClD,YAAY,EAAE,GAAG,CAAC,cAAc,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC;IACvD,QAAQ,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC9B,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;;IAY/B,8EAA8E;IAC9E,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,aAAa,GAAG,cAAc,GAAG,SAAS;IAIpE,WAAW,IAAI,YAAY;IAmB3B,UAAU,CAAC,IAAI,SAAS,cAAc,EACpC,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS;IAQ5B,OAAO,CAAC,GAAG,EAAE,sBAAsB,EAAE,MAAM,CAAC,EAAE,cAAc,GAAG,MAAM;IA8FpE,cAAc;IAMf,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,IAAI;IAqBjD,qBAAqB;CAqFtB"}
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * A plan to register @lexical/plain-text behavior
3
3
  */
4
- export declare const PlainTextPlan: import('@etrepum/lexical-builder').LexicalPlan<{}, "@lexical/plain-text", unknown>;
4
+ export declare const PlainTextPlan: import('./types').LexicalPlan<{}, "@lexical/plain-text", unknown>;
5
5
  //# sourceMappingURL=PlainTextPlan.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlainTextPlan.d.ts","sourceRoot":"","sources":["../src/PlainTextPlan.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,eAAO,MAAM,aAAa,oFAKxB,CAAC"}
1
+ {"version":3,"file":"PlainTextPlan.d.ts","sourceRoot":"","sources":["../src/PlainTextPlan.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,eAAO,MAAM,aAAa,mEAKxB,CAAC"}
package/dist/PlanRep.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { LexicalBuilder } from './LexicalBuilder';
2
2
  import { AnyLexicalPlan, LexicalPlanConfig, LexicalPlanDependency, LexicalPlanOutput } from './types';
3
- import { LexicalPlanRegistry } from '@etrepum/lexical-builder';
4
3
  import { LexicalEditor } from 'lexical';
5
4
 
6
5
  /**
@@ -15,8 +14,9 @@ export declare class PlanRep<Plan extends AnyLexicalPlan> {
15
14
  plan: Plan;
16
15
  constructor(builder: LexicalBuilder, plan: Plan);
17
16
  register(editor: LexicalEditor, signal: AbortSignal): () => void;
18
- getPeer<Name extends keyof LexicalPlanRegistry>(name: string): undefined | LexicalPlanDependency<LexicalPlanRegistry[Name]>;
17
+ getPeer<PeerPlan extends AnyLexicalPlan = never>(name: PeerPlan["name"]): undefined | LexicalPlanDependency<PeerPlan>;
19
18
  getDependency<Dependency extends AnyLexicalPlan>(dep: Dependency): LexicalPlanDependency<Dependency>;
19
+ getDirectDependentNames(): string[];
20
20
  getPlanDependency(): LexicalPlanDependency<Plan>;
21
21
  getConfig(): LexicalPlanConfig<Plan>;
22
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PlanRep.d.ts","sourceRoot":"","sources":["../src/PlanRep.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAA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C;;GAEG;AACH,qBAAa,OAAO,CAAC,IAAI,SAAS,cAAc;IAC9C,OAAO,EAAE,cAAc,CAAC;IACxB,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC/C,OAAO,CAAC,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAClC,WAAW,CAAC,EAAE,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAC1C,OAAO,CAAC,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,EAAE,IAAI,CAAC;gBACC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI;IAK/C,QAAQ,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,GAAG,MAAM,IAAI;IAchE,OAAO,CAAC,QAAQ,SAAS,cAAc,GAAG,KAAK,EAC7C,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,GACrB,SAAS,GAAG,qBAAqB,CAAC,QAAQ,CAAC;IAM9C,aAAa,CAAC,UAAU,SAAS,cAAc,EAC7C,GAAG,EAAE,UAAU,GACd,qBAAqB,CAAC,UAAU,CAAC;IAWpC,uBAAuB,IAAI,MAAM,EAAE;IAOnC,iBAAiB,IAAI,qBAAqB,CAAC,IAAI,CAAC;IAchD,SAAS,IAAI,iBAAiB,CAAC,IAAI,CAAC;CAarC"}
@@ -9,5 +9,5 @@
9
9
  * A plan to register @lexical/rich-text behavior and nodes
10
10
  * ({@link HeadingNode}, {@link QuoteNode})
11
11
  */
12
- export declare const RichTextPlan: import('@etrepum/lexical-builder').LexicalPlan<{}, "@lexical/rich-text", unknown>;
12
+ export declare const RichTextPlan: import('./types').LexicalPlan<{}, "@lexical/rich-text", unknown>;
13
13
  //# sourceMappingURL=RichTextPlan.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RichTextPlan.d.ts","sourceRoot":"","sources":["../src/RichTextPlan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;;GAGG;AACH,eAAO,MAAM,YAAY,mFAMvB,CAAC"}
1
+ {"version":3,"file":"RichTextPlan.d.ts","sourceRoot":"","sources":["../src/RichTextPlan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;;GAGG;AACH,eAAO,MAAM,YAAY,kEAMvB,CAAC"}
@@ -1,4 +1,4 @@
1
- import { LexicalPlan, NormalizedLexicalPlanArgument, PlanConfigBase, RegisterCleanup } from './types';
1
+ import { AnyLexicalPlan, LexicalPlan, LexicalPlanConfig, NormalizedLexicalPlanArgument, NormalizedPeerDependency, PlanConfigBase, RegisterCleanup, RootPlan, RootPlanArgument } from './types';
2
2
 
3
3
  /**
4
4
  * Define a LexicalPlan from the given object literal. TypeScript will
@@ -39,7 +39,8 @@ export declare function definePlan<Config extends PlanConfigBase, Name extends s
39
39
  * Define a LexicalPlan from the given object literal, assigning an
40
40
  * empty config and the name "[root]". This plan must only be used
41
41
  * at most once per editor, usually as the first argument to
42
- * {@link buildEditorFromPlans}
42
+ * {@link buildEditorFromPlans} or the plan argument to
43
+ * {@link LexicalPlanComposer}.
43
44
  *
44
45
  * @param rootPlan A plan without the config or name properties
45
46
  * @returns The given plan argument, after in-place assignment of config and name
@@ -53,7 +54,7 @@ export declare function definePlan<Config extends PlanConfigBase, Name extends s
53
54
  * );
54
55
  * ```
55
56
  */
56
- export declare function defineRootPlan(rootPlan: Omit<LexicalPlan<PlanConfigBase, "[root]", unknown>, "config" | "name">): LexicalPlan<PlanConfigBase, "[root]", unknown>;
57
+ export declare function defineRootPlan<Output>(rootPlan: RootPlanArgument<Output>): RootPlan<Output>;
57
58
  /**
58
59
  * Override a partial of the configuration of a Plan, to be used
59
60
  * in the dependencies array of another plan, or as
@@ -80,4 +81,7 @@ export declare function defineRootPlan(rootPlan: Omit<LexicalPlan<PlanConfigBase
80
81
  */
81
82
  export declare function configPlan<Config extends PlanConfigBase, Name extends string, Output>(...args: NormalizedLexicalPlanArgument<Config, Name, Output>): NormalizedLexicalPlanArgument<Config, Name, Output>;
82
83
  export declare function provideOutput<Output>(output: Output, cleanup?: () => void): RegisterCleanup<Output>;
84
+ /** @internal */
85
+ export declare const PeerDependencyBrand: unique symbol;
86
+ export declare function declarePeerDependency<Plan extends AnyLexicalPlan = never>(name: Plan["name"], config?: Partial<LexicalPlanConfig<Plan>>): NormalizedPeerDependency<Plan>;
83
87
  //# sourceMappingURL=definePlan.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"definePlan.d.ts","sourceRoot":"","sources":["../src/definePlan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,6BAA6B,EAC7B,cAAc,EACd,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,UAAU,CACxB,MAAM,SAAS,cAAc,EAC7B,IAAI,SAAS,MAAM,EACnB,MAAM,EACN,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAE5E;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,IAAI,CACZ,WAAW,CAAC,cAAc,EAAE,QAAQ,EAAE,OAAO,CAAC,EAC9C,QAAQ,GAAG,MAAM,CAClB,GACA,WAAW,CAAC,cAAc,EAAE,QAAQ,EAAE,OAAO,CAAC,CAEhD;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,UAAU,CACxB,MAAM,SAAS,cAAc,EAC7B,IAAI,SAAS,MAAM,EACnB,MAAM,EAEN,GAAG,IAAI,EAAE,6BAA6B,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,GAC3D,6BAA6B,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAErD;AAED,wBAAgB,aAAa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qB,CAAC,IAAI,SAAS,cAAc,GAAG,KAAK,EACvE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAClB,MAAM,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,GACxC,wBAAwB,CAAC,IAAI,CAAC,CAEhC"}
@@ -1,5 +1,5 @@
1
1
  import { LexicalEditor } from 'lexical';
2
- import { LexicalPeerDependency } from './types';
2
+ import { AnyLexicalPlan, LexicalPlanDependency } from './types';
3
3
 
4
4
  /**
5
5
  * Get the finalized config and output of a Plan that was used to build the
@@ -10,22 +10,36 @@ import { LexicalPeerDependency } from './types';
10
10
  * config around. Use this version if you do not have a concrete reference to
11
11
  * the Plan for some reason (e.g. it is an optional peer dependency).
12
12
  *
13
+ * Both the explicit Plan type and the name are required.
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * getPeerDependencyFromEditor<typeof import("@some/plan").SomePlan>(editor, "@some/plan");
18
+ * ```
19
+
13
20
  * @param editor The editor that may have been built using plan
14
21
  * @param planName The name of the Plan
15
22
  * @returns The config and output of the Plan or undefined
16
23
  */
17
- export declare function getPeerDependencyFromEditor<Name extends string>(editor: LexicalEditor, planName: Name): LexicalPeerDependency<Name> | undefined;
24
+ export declare function getPeerDependencyFromEditor<Plan extends AnyLexicalPlan = never>(editor: LexicalEditor, planName: Plan["name"]): LexicalPlanDependency<Plan> | undefined;
18
25
  /**
19
26
  * Get the finalized config and output of a Plan that was used to build the
20
27
  * editor by name.
21
28
  *
29
+ * Both the explicit Plan type and the name are required.
30
+ *
22
31
  * This can be used from the implementation of a LexicalNode or in other
23
32
  * situation where you have an editor reference but it's not easy to pass the
24
33
  * config around. Use this version if you do not have a concrete reference to
25
34
  * the Plan for some reason (e.g. it is an optional peer dependency).
26
35
  *
36
+ * @example
37
+ * ```tsx
38
+ * $getPeerDependency<typeof import("@some/plan").SomePlan>("@some/plan")
39
+ * ```
40
+ *
27
41
  * @param planName The name of the Plan
28
42
  * @returns The config and output of the Plan or undefined
29
43
  */
30
- export declare function $getPeerDependency<Name extends string>(planName: Name): LexicalPeerDependency<Name> | undefined;
44
+ export declare function $getPeerDependency<Plan extends AnyLexicalPlan = never>(planName: Plan["name"]): LexicalPlanDependency<Plan> | undefined;
31
45
  //# sourceMappingURL=getPeerDependencyFromEditor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getPeerDependencyFromEditor.d.ts","sourceRoot":"","sources":["../src/getPeerDependencyFromEditor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,aAAa,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAKhD;;;;;;;;;;;;GAYG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,SAAS,MAAM,EAC7D,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,IAAI,GACb,qBAAqB,CAAC,IAAI,CAAC,GAAG,SAAS,CAWzC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,SAAS,MAAM,EACpD,QAAQ,EAAE,IAAI,GACb,qBAAqB,CAAC,IAAI,CAAC,GAAG,SAAS,CAEzC"}
1
+ {"version":3,"file":"getPeerDependencyFromEditor.d.ts","sourceRoot":"","sources":["../src/getPeerDependencyFromEditor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,aAAa,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAKhE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,SAAS,cAAc,GAAG,KAAK,EAEnC,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,GACrB,qBAAqB,CAAC,IAAI,CAAC,GAAG,SAAS,CAWzC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,SAAS,cAAc,GAAG,KAAK,EACpE,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,GACrB,qBAAqB,CAAC,IAAI,CAAC,GAAG,SAAS,CAEzC"}
package/dist/index.d.ts CHANGED
@@ -7,8 +7,8 @@
7
7
  */
8
8
  export { PACKAGE_VERSION } from './PACKAGE_VERSION';
9
9
  export { configPlan, definePlan, defineRootPlan, provideOutput, } from './definePlan';
10
- export { LexicalBuilder, buildEditorFromPlans } from './LexicalBuilder';
11
- export { type AnyLexicalPlan, type AnyLexicalPlanArgument, type EditorHandle, type InitialEditorStateType, type LexicalPlan, type LexicalPlanArgument, type LexicalPlanConfig, type LexicalPlanName, type LexicalPlanOutput, type LexicalPlanDependency, type LexicalPeerConfig, type LexicalPeerDependency, type LexicalPeerPlan, type NormalizedLexicalPlanArgument, type PlanConfigBase, type RegisterState, type RegisterCleanup, } from './types';
10
+ export { LexicalBuilder, buildEditorFromPlans, coerceToPlanArgument, } from './LexicalBuilder';
11
+ export { type AnyLexicalPlan, type AnyLexicalPlanArgument, type EditorHandle, type InitialEditorStateType, type LexicalPlan, type LexicalPlanArgument, type LexicalPlanConfig, type LexicalPlanName, type LexicalPlanOutput, type LexicalPlanDependency, type RootPlan, type RootPlanArgument, type NormalizedLexicalPlanArgument, type PlanConfigBase, type RegisterState, type RegisterCleanup, type NormalizedPeerDependency, } from './types';
12
12
  export { safeCast } from './safeCast';
13
13
  export { shallowMergeConfig } from './shallowMergeConfig';
14
14
  export { $getPlanDependency, getPlanDependencyFromEditor, } from './getPlanDependencyFromEditor';
@@ -18,24 +18,4 @@ export { DragonPlan } from './DragonPlan';
18
18
  export { type HistoryConfig, HistoryPlan } from './HistoryPlan';
19
19
  export { PlainTextPlan } from './PlainTextPlan';
20
20
  export { RichTextPlan } from './RichTextPlan';
21
- /**
22
- * An open interface for Name -> Config mappings. If you are defining a
23
- * plan with non-empty config and it may be used as a peerDependency then
24
- * you should extend this as follows:
25
- *
26
- * @example Extending LexicalPlanRegistry
27
- * ```ts
28
- * export const SomePlan = definePlan({
29
- * name: "@some/plan",
30
- * config: { className: "default" }
31
- * });
32
- * declare module '@etrepum/lexical-builder' {
33
- * interface LexicalPlanRegistry {
34
- * [SomePlan.name]: typeof SomePlan;
35
- * }
36
- * }
37
- * ```
38
- */
39
- export interface LexicalPlanRegistry {
40
- }
41
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EACL,UAAU,EACV,UAAU,EACV,cAAc,EACd,aAAa,GACd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,6BAA6B,EAClC,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,eAAe,GACrB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EACL,kBAAkB,EAClB,2BAA2B,GAC5B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,kBAAkB,EAClB,2BAA2B,GAC5B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,KAAK,eAAe,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,C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AAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,KAAK,aAAa,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ import { registerDragonSupport } from "@lexical/dragon";
10
10
  import { createEmptyHistoryState, registerHistory } from "@lexical/history";
11
11
  import { registerPlainText } from "@lexical/plain-text";
12
12
  import { HeadingNode, QuoteNode, registerRichText } from "@lexical/rich-text";
13
- const PACKAGE_VERSION = "0.0.15";
13
+ const PACKAGE_VERSION = "0.0.17-nightly.20240610.0";
14
14
  function definePlan(plan) {
15
15
  return plan;
16
16
  }
@@ -101,6 +101,7 @@ class PlanRep {
101
101
  const cleanup = this.plan.register(editor, this.getConfig(), {
102
102
  getPeer: this.getPeer.bind(this),
103
103
  getDependency: this.getDependency.bind(this),
104
+ getDirectDependentNames: this.getDirectDependentNames.bind(this),
104
105
  signal
105
106
  });
106
107
  this._output = cleanup.output;
@@ -120,6 +121,12 @@ class PlanRep {
120
121
  );
121
122
  return rep.getPlanDependency();
122
123
  }
124
+ getDirectDependentNames() {
125
+ return Array.from(
126
+ this.builder.reverseEdges.get(this.plan) || [],
127
+ (plan) => plan.name
128
+ );
129
+ }
123
130
  getPlanDependency() {
124
131
  if (!this._dependency) {
125
132
  invariant(
@@ -149,12 +156,15 @@ class PlanRep {
149
156
  const buildersForEditors = /* @__PURE__ */ new WeakMap();
150
157
  function buildEditorFromPlans(plan, ...plans) {
151
158
  const builder = new LexicalBuilder();
152
- builder.addPlan(plan);
159
+ builder.addPlan(coerceToPlanArgument(plan));
153
160
  for (const otherPlan of plans) {
154
- builder.addPlan(otherPlan);
161
+ builder.addPlan(coerceToPlanArgument(otherPlan));
155
162
  }
156
163
  return builder.buildEditor();
157
164
  }
165
+ function coerceToPlanArgument(plan) {
166
+ return "name" in plan || Array.isArray(plan) ? plan : defineRootPlan(plan);
167
+ }
158
168
  function noop() {
159
169
  }
160
170
  class DisposableEditorHandle {
@@ -184,11 +194,15 @@ class LexicalBuilder {
184
194
  __publicField(this, "phases");
185
195
  __publicField(this, "planMap");
186
196
  __publicField(this, "planNameMap");
197
+ __publicField(this, "reverseEdges");
198
+ __publicField(this, "addStack");
187
199
  __publicField(this, "conflicts");
188
200
  this.phases = [/* @__PURE__ */ new Map()];
189
201
  this.planMap = /* @__PURE__ */ new Map();
190
202
  this.planNameMap = /* @__PURE__ */ new Map();
191
203
  this.conflicts = /* @__PURE__ */ new Map();
204
+ this.reverseEdges = /* @__PURE__ */ new Map();
205
+ this.addStack = /* @__PURE__ */ new Set();
192
206
  }
193
207
  /** Look up the editor that was created by this LexicalBuilder or undefined */
194
208
  static fromEditor(editor) {
@@ -218,7 +232,7 @@ class LexicalBuilder {
218
232
  return rep;
219
233
  }
220
234
  }
221
- addPlan(arg) {
235
+ addPlan(arg, parent) {
222
236
  let plan;
223
237
  let configs;
224
238
  if (Array.isArray(arg)) {
@@ -227,6 +241,14 @@ class LexicalBuilder {
227
241
  plan = arg;
228
242
  configs = [];
229
243
  }
244
+ if (parent) {
245
+ let edgeSet = this.reverseEdges.get(plan);
246
+ if (!edgeSet) {
247
+ edgeSet = /* @__PURE__ */ new Set();
248
+ this.reverseEdges.set(plan, edgeSet);
249
+ }
250
+ edgeSet.add(parent);
251
+ }
230
252
  let [phase, planRep] = this.planMap.get(plan) || [0, void 0];
231
253
  if (!planRep) {
232
254
  const hasConflict = this.conflicts.get(plan.name);
@@ -247,8 +269,15 @@ class LexicalBuilder {
247
269
  );
248
270
  this.conflicts.set(name, plan.name);
249
271
  }
272
+ invariant(
273
+ !this.addStack.has(plan),
274
+ "LexicalBuilder: Circular dependency detected for Plan %s from %s",
275
+ plan.name,
276
+ (parent == null ? void 0 : parent.name) || "[unknown]"
277
+ );
278
+ this.addStack.add(plan);
250
279
  for (const dep of plan.dependencies || []) {
251
- phase = Math.max(phase, 1 + this.addPlan(dep));
280
+ phase = Math.max(phase, 1 + this.addPlan(dep, plan));
252
281
  }
253
282
  for (const [depName, cfg] of Object.entries(
254
283
  plan.peerDependencies || {}
@@ -258,7 +287,8 @@ class LexicalBuilder {
258
287
  phase = Math.max(
259
288
  phase,
260
289
  1 + this.addPlan(
261
- configPlan(dep.plan, cfg)
290
+ configPlan(dep.plan, cfg),
291
+ plan
262
292
  )
263
293
  );
264
294
  }
@@ -285,6 +315,7 @@ class LexicalBuilder {
285
315
  String(phase)
286
316
  );
287
317
  currentPhaseMap.set(plan, planRep);
318
+ this.addStack.delete(plan);
288
319
  }
289
320
  for (const config of configs) {
290
321
  planRep.configs.add(config);
@@ -485,6 +516,7 @@ export {
485
516
  PlainTextPlan,
486
517
  RichTextPlan,
487
518
  buildEditorFromPlans,
519
+ coerceToPlanArgument,
488
520
  configPlan,
489
521
  definePlan,
490
522
  defineRootPlan,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/PACKAGE_VERSION.ts","../src/definePlan.ts","../src/shared/invariant.ts","../src/deepThemeMergeInPlace.ts","../src/initializeEditor.ts","../src/shallowMergeConfig.ts","../src/PlanRep.ts","../src/LexicalBuilder.ts","../src/safeCast.ts","../src/getPlanDependencyFromEditor.ts","../src/getPeerDependencyFromEditor.ts","../src/AutoFocusPlan.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\nimport type {\n LexicalPlan,\n NormalizedLexicalPlanArgument,\n PlanConfigBase,\n RegisterCleanup,\n} from \"./types\";\n\n/**\n * Define a LexicalPlan from the given object literal. TypeScript will\n * infer Config and Name in most cases, but you may want to use\n * {@link safeCast} for config if there are default fields or varying types.\n *\n * @param plan The LexicalPlan\n * @returns The unmodified plan argument (this is only an inference helper)\n *\n * @example Basic example\n * ```ts\n * export const MyPlan = definePlan({\n * // Plan names must be unique in an editor\n * name: \"my\",\n * // Config must be an object, but an empty object is fine\n * config: {},\n * nodes: [MyNode],\n * });\n * ```\n *\n * @example Plan with optional configuration\n * ```ts\n * export interface ConfigurableConfig {\n * optional?: string;\n * required: number;\n * }\n * export const ConfigurablePlan = definePlan({\n * name: \"configurable\",\n * // The Plan's config must satisfy the full config type,\n * // but using the Plan as a dependency never requires\n * // configuration and any partial of the config can be specified\n * config: safeCast<ConfigurableConfig>({ required: 1 }),\n * });\n * ```\n */\nexport function definePlan<\n Config extends PlanConfigBase,\n Name extends string,\n Output,\n>(plan: LexicalPlan<Config, Name, Output>): LexicalPlan<Config, Name, Output> {\n return plan;\n}\n\n/**\n * Define a LexicalPlan from the given object literal, assigning an\n * empty config and the name \"[root]\". This plan must only be used\n * at most once per editor, usually as the first argument to\n * {@link buildEditorFromPlans}\n *\n * @param rootPlan A plan without the config or name properties\n * @returns The given plan argument, after in-place assignment of config and name\n *\n * @example\n * ```ts\n * const editorHandle = buildEditorFromPlans(\n * defineRootPlan({\n * dependencies: [DragonPlan, RichTextPlan, HistoryPlan],\n * }),\n * );\n * ```\n */\nexport function defineRootPlan(\n rootPlan: Omit<\n LexicalPlan<PlanConfigBase, \"[root]\", unknown>,\n \"config\" | \"name\"\n >,\n): LexicalPlan<PlanConfigBase, \"[root]\", unknown> {\n return Object.assign(rootPlan, { name: \"[root]\", config: {} }) as any;\n}\n\n/**\n * Override a partial of the configuration of a Plan, to be used\n * in the dependencies array of another plan, or as\n * an argument to {@link buildEditorFromPlans}.\n *\n * Before building the editor, configurations will be merged using\n * plan.mergeConfig(plan, config) or {@link shallowMergeConfig} if\n * this is not directly implemented by the Plan.\n *\n * @param args A plan followed by one or more config partials for that plan\n * @returns [plan, config, ...configs]\n *\n * @example\n * ```ts\n * export const ReactDecoratorPlan = definePlan({\n * name: \"react-decorator\",\n * dependencies: [\n * configPlan(ReactPlan, {\n * decorators: [<ReactDecorator />]\n * }),\n * ],\n * });\n * ```\n */\nexport function configPlan<\n Config extends PlanConfigBase,\n Name extends string,\n Output,\n>(\n ...args: NormalizedLexicalPlanArgument<Config, Name, Output>\n): NormalizedLexicalPlanArgument<Config, Name, Output> {\n return args;\n}\n\nexport function provideOutput<Output>(\n output: Output,\n cleanup?: () => void,\n): RegisterCleanup<Output> {\n return Object.assign(() => cleanup && cleanup(), { output });\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// 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 { InitialEditorStateType } from \"./types\";\n\nimport { $createParagraphNode, $getRoot, type LexicalEditor } 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 function initializeEditor(\n editor: LexicalEditor,\n $initialEditorState: InitialEditorStateType = $defaultInitializer,\n): void {\n switch (typeof $initialEditorState) {\n case \"function\": {\n editor.update(() => $initialEditorState(editor), HISTORY_MERGE_OPTIONS);\n break;\n }\n case \"string\": {\n const parsedEditorState = editor.parseEditorState($initialEditorState);\n editor.setEditorState(parsedEditorState, HISTORY_MERGE_OPTIONS);\n break;\n }\n case \"object\": {\n if ($initialEditorState) {\n editor.setEditorState($initialEditorState, HISTORY_MERGE_OPTIONS);\n }\n break;\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 { PlanConfigBase } from \"./types\";\n\n/**\n * The default merge strategy for plan configuration is a shallow merge.\n *\n * @param config A full config\n * @param overrides A partial config of overrides\n * @returns config if there are no overrides, otherwise `{...config, ...overrides}`\n */\nexport function shallowMergeConfig<T extends PlanConfigBase>(\n config: T,\n overrides?: Partial<T>,\n): T {\n if (!overrides || config === overrides) {\n return config;\n }\n for (const k in overrides) {\n if (config[k] !== overrides[k]) {\n return { ...config, ...overrides };\n }\n }\n return config;\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 { LexicalBuilder } from \"./LexicalBuilder\";\nimport type {\n AnyLexicalPlan,\n LexicalPlanConfig,\n LexicalPlanDependency,\n LexicalPlanOutput,\n} from \"./types\";\nimport type { LexicalPlanRegistry } from \"@etrepum/lexical-builder\";\n\nimport invariant from \"./shared/invariant\";\n\nimport { shallowMergeConfig } from \"./shallowMergeConfig\";\nimport type { LexicalEditor } from \"lexical\";\n\nconst noop = () => {};\n/**\n * @internal\n */\nexport class PlanRep<Plan extends AnyLexicalPlan> {\n builder: LexicalBuilder;\n configs: Set<Partial<LexicalPlanConfig<Plan>>>;\n _config?: LexicalPlanConfig<Plan>;\n _dependency?: LexicalPlanDependency<Plan>;\n _output?: LexicalPlanOutput<Plan>;\n plan: Plan;\n constructor(builder: LexicalBuilder, plan: Plan) {\n this.builder = builder;\n this.plan = plan;\n this.configs = new Set();\n }\n register(editor: LexicalEditor, signal: AbortSignal): () => void {\n if (!this.plan.register) {\n this._output = undefined;\n return noop;\n }\n const cleanup = this.plan.register(editor, this.getConfig(), {\n getPeer: this.getPeer.bind(this),\n getDependency: this.getDependency.bind(this),\n signal,\n });\n this._output = cleanup.output as LexicalPlanOutput<Plan>;\n return cleanup;\n }\n getPeer<Name extends keyof LexicalPlanRegistry>(\n name: string,\n ): undefined | LexicalPlanDependency<LexicalPlanRegistry[Name]> {\n const rep = this.builder.planNameMap.get(name);\n return rep\n ? (rep.getPlanDependency() as LexicalPlanDependency<\n LexicalPlanRegistry[Name]\n >)\n : undefined;\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 getPlanDependency(): LexicalPlanDependency<Plan> {\n if (!this._dependency) {\n invariant(\n \"_output\" in this,\n \"Plan %s used as a dependency before registration\",\n this.plan.name,\n );\n this._dependency = {\n config: this.getConfig(),\n output: this._output!,\n };\n }\n return this._dependency;\n }\n getConfig(): LexicalPlanConfig<Plan> {\n if (!this._config) {\n let config = 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 config = mergeConfig(config, cfg);\n }\n this._config = config;\n }\n return this._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 */\nimport type {\n AnyLexicalPlan,\n AnyLexicalPlanArgument,\n EditorHandle,\n LexicalPlanConfig,\n} from \"./types\";\n\nimport {\n LexicalEditor,\n createEditor,\n type CreateEditorArgs,\n type EditorThemeClasses,\n type HTMLConfig,\n type KlassConstructor,\n type LexicalNode,\n} from \"lexical\";\nimport invariant from \"./shared/invariant\";\n\nimport { deepThemeMergeInPlace } from \"./deepThemeMergeInPlace\";\nimport { initializeEditor } from \"./initializeEditor\";\nimport { PlanRep } from \"./PlanRep\";\nimport { mergeRegister } from \"@lexical/utils\";\nimport { configPlan } from \"./definePlan\";\n\nconst buildersForEditors = new WeakMap<LexicalEditor, LexicalBuilder>();\n\n/**\n * Build a LexicalEditor by combining together one or more plans, optionally\n * overriding some of their configuration.\n *\n * @param plan A plan argument (a plan, or a plan with config overrides)\n * @param plans Optional additional plan arguments\n * @returns An editor handle\n *\n * @example A single root plan with multiple dependencies\n * ```ts\n * const editorHandle = buildEditorFromPlans(\n * defineRootPlan({\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 editorHandle = buildEditorFromPlans(\n * RichTextPlan,\n * configPlan(EmojiPlan, { emojiBaseUrl: \"/assets/emoji\" }),\n * );\n * ```\n */\nexport function buildEditorFromPlans(\n plan: AnyLexicalPlanArgument,\n ...plans: AnyLexicalPlanArgument[]\n): EditorHandle {\n const builder = new LexicalBuilder();\n builder.addPlan(plan);\n for (const otherPlan of plans) {\n builder.addPlan(otherPlan);\n }\n return builder.buildEditor();\n}\n\n/** @internal */\nfunction noop() {}\n\n/** @internal */\nclass DisposableEditorHandle implements EditorHandle {\n editor: LexicalEditor;\n dispose: () => void;\n constructor(editor: LexicalEditor, dispose: () => void) {\n this.editor = editor;\n this.dispose = () => {\n try {\n dispose();\n } finally {\n this.dispose = noop;\n }\n };\n }\n // This should be safe even if the runtime doesn't have Symbol.dispose\n // because it will just be `handle[undefined] = dispose;`\n [Symbol.dispose]() {\n this.dispose();\n }\n}\n\n/** Throw the given Error */\nfunction defaultOnError(err: Error) {\n throw err;\n}\n\n/** @internal */\nexport class LexicalBuilder {\n phases: Map<AnyLexicalPlan, PlanRep<AnyLexicalPlan>>[];\n planMap: Map<AnyLexicalPlan, [number, PlanRep<AnyLexicalPlan>]>;\n planNameMap: Map<string, PlanRep<AnyLexicalPlan>>;\n conflicts: Map<string, string>;\n\n constructor() {\n // closure compiler can't handle class initializers\n this.phases = [new Map()];\n this.planMap = new Map();\n this.planNameMap = new Map();\n this.conflicts = new Map();\n }\n\n /** Look up the editor that was created by this LexicalBuilder or undefined */\n static fromEditor(editor: LexicalEditor): LexicalBuilder | undefined {\n return buildersForEditors.get(editor);\n }\n\n buildEditor(): EditorHandle {\n const { $initialEditorState, onError, ...editorConfig } =\n this.buildCreateEditorArgs();\n const editor = createEditor({\n ...editorConfig,\n ...(onError ? { onError: (err) => onError(err, editor) } : {}),\n });\n initializeEditor(editor, $initialEditorState);\n buildersForEditors.set(editor, this);\n return new DisposableEditorHandle(\n editor,\n mergeRegister(\n () => buildersForEditors.delete(editor),\n () => editor.setRootElement(null),\n this.registerEditor(editor),\n ),\n );\n }\n\n getPlanRep<Plan extends AnyLexicalPlan>(\n plan: Plan,\n ): PlanRep<Plan> | undefined {\n const pair = this.planMap.get(plan);\n if (pair) {\n const rep: PlanRep<AnyLexicalPlan> = pair[1];\n return rep as PlanRep<Plan>;\n }\n }\n\n addPlan(arg: AnyLexicalPlanArgument): number {\n let plan: AnyLexicalPlan;\n let configs: unknown[];\n if (Array.isArray(arg)) {\n [plan, ...configs] = arg;\n } else {\n plan = arg;\n configs = [];\n }\n let [phase, planRep] = this.planMap.get(plan) || [0, undefined];\n if (!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 // TODO detect circular dependencies\n for (const dep of plan.dependencies || []) {\n phase = Math.max(phase, 1 + this.addPlan(dep));\n }\n for (const [depName, cfg] of Object.entries(\n plan.peerDependencies || {},\n )) {\n const dep = this.planNameMap.get(depName);\n if (dep) {\n phase = Math.max(\n phase,\n 1 +\n this.addPlan(\n configPlan(dep.plan, cfg as LexicalPlanConfig<typeof dep.plan>),\n ),\n );\n }\n }\n invariant(\n this.phases.length >= phase,\n \"LexicalBuilder: Expected phase to be no greater than phases.length\",\n );\n if (this.phases.length === phase) {\n this.phases.push(new Map());\n }\n planRep = new PlanRep(this, plan);\n invariant(\n !this.planNameMap.has(plan.name),\n \"LexicalBuilder: Multiple plans registered with name %s, names must be unique\",\n plan.name,\n );\n this.planMap.set(plan, [phase, planRep]);\n this.planNameMap.set(plan.name, planRep);\n const currentPhaseMap = this.phases[phase];\n invariant(\n currentPhaseMap !== undefined,\n \"LexicalBuilder: Expecting phase map for phase %s\",\n String(phase),\n );\n currentPhaseMap.set(plan, planRep);\n }\n for (const config of configs) {\n planRep.configs.add(config as Partial<LexicalPlanConfig<AnyLexicalPlan>>);\n }\n return phase;\n }\n\n *sortedPlanReps() {\n for (const phase of this.phases) {\n yield* phase.values();\n }\n }\n\n registerEditor(editor: LexicalEditor): () => void {\n const cleanups: (() => void)[] = [];\n const controller = new AbortController();\n for (const planRep of this.sortedPlanReps()) {\n cleanups.push(planRep.register(editor, controller.signal));\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() {\n const config: Pick<\n CreateEditorArgs,\n \"nodes\" | \"html\" | \"theme\" | \"disableEvents\" | \"editable\" | \"namespace\"\n > &\n Pick<AnyLexicalPlan, \"$initialEditorState\" | \"onError\"> = {\n // Prefer throwing errors rather than console.error by default\n onError: defaultOnError,\n };\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 for (const planRep of this.sortedPlanReps()) {\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.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 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\n/**\n * Explicitly and safely cast a value to a specific type when inference or\n * satisfies isn't going to work as expected (often useful for the config\n * property with definePlan)\n */\nexport function safeCast<T>(value: T): T {\n return value;\n}\n","import { $getEditor, LexicalEditor } from \"lexical\";\nimport { AnyLexicalPlan, LexicalPlanDependency } from \"./types\";\nimport { LexicalBuilder } from \"./LexicalBuilder\";\nimport invariant from \"./shared/invariant\";\nimport { PACKAGE_VERSION } from \"./PACKAGE_VERSION\";\nimport { PlanRep } from \"./PlanRep\";\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 RegisterState} 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 invariant(\n builder !== undefined,\n \"getPlanFromEditor: editor was not created with this build of Lexical Builder %s\",\n PACKAGE_VERSION,\n );\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\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 RegisterState} around.\n *\n * It will throw if the Editor was not built using this Plan.\n *\n * @param plan The concrete reference to a Plan used to build this editor\n * @returns The config and outputs for that Plan\n */\nexport function $getPlanDependency<Plan extends AnyLexicalPlan>(\n plan: Plan,\n): LexicalPlanDependency<Plan> {\n return getPlanDependencyFromEditor($getEditor(), plan);\n}\n","import { $getEditor, LexicalEditor } from \"lexical\";\nimport { LexicalPeerDependency } from \"./types\";\nimport { LexicalBuilder } from \"./LexicalBuilder\";\nimport invariant from \"./shared/invariant\";\nimport { PACKAGE_VERSION } from \"./PACKAGE_VERSION\";\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).\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<Name extends string>(\n editor: LexicalEditor,\n planName: Name,\n): LexicalPeerDependency<Name> | undefined {\n const builder = LexicalBuilder.fromEditor(editor);\n invariant(\n builder !== undefined,\n \"getPeerConfigFromEditor: editor was not created with this build of Lexical Builder %s\",\n PACKAGE_VERSION,\n );\n const peer = builder.planNameMap.get(planName);\n return peer\n ? (peer.getPlanDependency() as LexicalPeerDependency<Name>)\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).\n *\n * @param planName The name of the Plan\n * @returns The config and output of the Plan or undefined\n */\nexport function $getPeerDependency<Name extends string>(\n planName: Name,\n): LexicalPeerDependency<Name> | undefined {\n return getPeerDependencyFromEditor($getEditor(), planName);\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 } from \"./definePlan\";\nimport { safeCast } from \"./safeCast\";\n\nimport type {} from \"@etrepum/lexical-builder\";\ndeclare module \"@etrepum/lexical-builder\" {\n interface LexicalPlanRegistry {\n [AutoFocusPlan.name]: typeof AutoFocusPlan;\n }\n}\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/AutoFocusPlan\",\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","/**\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\";\n\nimport { definePlan } from \"./definePlan\";\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 config: {},\n name: \"@lexical/dragon\",\n register: registerDragonSupport,\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 {\n createEmptyHistoryState,\n type HistoryState,\n registerHistory,\n} from \"@lexical/history\";\n\nimport { definePlan } from \"./definePlan\";\nimport { safeCast } from \"./safeCast\";\n\nimport type {} from \"@etrepum/lexical-builder\";\ndeclare module \"@etrepum/lexical-builder\" {\n interface LexicalPlanRegistry {\n [HistoryPlan.name]: typeof HistoryPlan;\n }\n}\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: () => 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 }),\n name: \"@etrepum/lexical-builder/HistoryPlan\",\n register(editor, { delay, createInitialHistoryState }) {\n return registerHistory(editor, createInitialHistoryState(), delay);\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\";\n\nimport { definePlan } from \"./definePlan\";\n\n/**\n * A plan to register @lexical/plain-text behavior\n */\nexport const PlainTextPlan = definePlan({\n config: {},\n conflictsWith: [\"@lexical/rich-text\"],\n name: \"@lexical/plain-text\",\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\";\n\nimport { definePlan } from \"./definePlan\";\n\n/**\n * A plan to register @lexical/rich-text behavior and nodes\n * ({@link HeadingNode}, {@link QuoteNode})\n */\nexport const RichTextPlan = definePlan({\n config: {},\n conflictsWith: [\"@lexical/plain-text\"],\n name: \"@lexical/rich-text\",\n nodes: [HeadingNode, QuoteNode],\n register: registerRichText,\n});\n"],"names":["noop"],"mappings":";;;;;;;;;;;;AACa,MAAA,kBAA0B;ACgDhC,SAAS,WAId,MAA4E;AACrE,SAAA;AACT;AAoBO,SAAS,eACd,UAIgD;AACzC,SAAA,OAAO,OAAO,UAAU,EAAE,MAAM,UAAU,QAAQ,CAAC,EAAA,CAAG;AAC/D;AA0BO,SAAS,cAKX,MACkD;AAC9C,SAAA;AACT;AAEgB,SAAA,cACd,QACA,SACyB;AAClB,SAAA,OAAO,OAAO,MAAM,WAAW,WAAW,EAAE,QAAQ;AAC7D;AChHwB,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;AC5BA,MAAM,wBAAwB,EAAE,KAAK;AAErC,SAAS,sBAAsB;AAC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AA,EACD,MAAM;AAAA,EACN,SAAS,QAAQ,EAAE,OAAO,6BAA6B;AACrD,WAAO,gBAAgB,QAAQ,0BAA0B,GAAG,KAAK;AAAA,EACnE;AACF,CAAC;AClCM,MAAM,gBAAgB,WAAW;AAAA,EACtC,QAAQ,CAAC;AAAA,EACT,eAAe,CAAC,oBAAoB;AAAA,EACpC,MAAM;AAAA,EACN,UAAU;AACZ,CAAC;ACHM,MAAM,eAAe,WAAW;AAAA,EACrC,QAAQ,CAAC;AAAA,EACT,eAAe,CAAC,qBAAqB;AAAA,EACrC,MAAM;AAAA,EACN,OAAO,CAAC,aAAa,SAAS;AAAA,EAC9B,UAAU;AACZ,CAAC;"}
1
+ {"version":3,"file":"index.js","sources":["../src/PACKAGE_VERSION.ts","../src/definePlan.ts","../src/shared/invariant.ts","../src/deepThemeMergeInPlace.ts","../src/initializeEditor.ts","../src/shallowMergeConfig.ts","../src/PlanRep.ts","../src/LexicalBuilder.ts","../src/safeCast.ts","../src/getPlanDependencyFromEditor.ts","../src/getPeerDependencyFromEditor.ts","../src/AutoFocusPlan.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\nimport type {\n AnyLexicalPlan,\n LexicalPlan,\n LexicalPlanConfig,\n NormalizedLexicalPlanArgument,\n NormalizedPeerDependency,\n PlanConfigBase,\n RegisterCleanup,\n RootPlan,\n RootPlanArgument,\n} from \"./types\";\n\n/**\n * Define a LexicalPlan from the given object literal. TypeScript will\n * infer Config and Name in most cases, but you may want to use\n * {@link safeCast} for config if there are default fields or varying types.\n *\n * @param plan The LexicalPlan\n * @returns The unmodified plan argument (this is only an inference helper)\n *\n * @example Basic example\n * ```ts\n * export const MyPlan = definePlan({\n * // Plan names must be unique in an editor\n * name: \"my\",\n * // Config must be an object, but an empty object is fine\n * config: {},\n * nodes: [MyNode],\n * });\n * ```\n *\n * @example Plan with optional configuration\n * ```ts\n * export interface ConfigurableConfig {\n * optional?: string;\n * required: number;\n * }\n * export const ConfigurablePlan = definePlan({\n * name: \"configurable\",\n * // The Plan's config must satisfy the full config type,\n * // but using the Plan as a dependency never requires\n * // configuration and any partial of the config can be specified\n * config: safeCast<ConfigurableConfig>({ required: 1 }),\n * });\n * ```\n */\nexport function definePlan<\n Config extends PlanConfigBase,\n Name extends string,\n Output,\n>(plan: LexicalPlan<Config, Name, Output>): LexicalPlan<Config, Name, Output> {\n return plan;\n}\n\n/**\n * Define a LexicalPlan from the given object literal, assigning an\n * empty config and the name \"[root]\". This plan must only be used\n * at most once per editor, usually as the first argument to\n * {@link buildEditorFromPlans} or the plan argument to\n * {@link LexicalPlanComposer}.\n *\n * @param rootPlan A plan without the config or name properties\n * @returns The given plan argument, after in-place assignment of config and name\n *\n * @example\n * ```ts\n * const editorHandle = buildEditorFromPlans(\n * defineRootPlan({\n * dependencies: [DragonPlan, RichTextPlan, HistoryPlan],\n * }),\n * );\n * ```\n */\nexport function defineRootPlan<Output>(\n rootPlan: RootPlanArgument<Output>,\n): RootPlan<Output> {\n return Object.assign(rootPlan, { name: \"[root]\", config: {} } as const);\n}\n\n/**\n * Override a partial of the configuration of a Plan, to be used\n * in the dependencies array of another plan, or as\n * an argument to {@link buildEditorFromPlans}.\n *\n * Before building the editor, configurations will be merged using\n * plan.mergeConfig(plan, config) or {@link shallowMergeConfig} if\n * this is not directly implemented by the Plan.\n *\n * @param args A plan followed by one or more config partials for that plan\n * @returns [plan, config, ...configs]\n *\n * @example\n * ```ts\n * export const ReactDecoratorPlan = definePlan({\n * name: \"react-decorator\",\n * dependencies: [\n * configPlan(ReactPlan, {\n * decorators: [<ReactDecorator />]\n * }),\n * ],\n * });\n * ```\n */\nexport function configPlan<\n Config extends PlanConfigBase,\n Name extends string,\n Output,\n>(\n ...args: NormalizedLexicalPlanArgument<Config, Name, Output>\n): NormalizedLexicalPlanArgument<Config, Name, Output> {\n return args;\n}\n\nexport function provideOutput<Output>(\n output: Output,\n cleanup?: () => void,\n): RegisterCleanup<Output> {\n return Object.assign(() => cleanup && cleanup(), { output } as const);\n}\n\n/** @internal */\nexport const PeerDependencyBrand: unique symbol = Symbol.for(\n \"@etrepum/lexical-builder/PeerDependency\",\n);\n\nexport function declarePeerDependency<Plan extends AnyLexicalPlan = never>(\n name: Plan[\"name\"],\n config?: Partial<LexicalPlanConfig<Plan>>,\n): NormalizedPeerDependency<Plan> {\n return [name, config] as NormalizedPeerDependency<Plan>;\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// 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 { InitialEditorStateType } from \"./types\";\n\nimport { $createParagraphNode, $getRoot, type LexicalEditor } 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 function initializeEditor(\n editor: LexicalEditor,\n $initialEditorState: InitialEditorStateType = $defaultInitializer,\n): void {\n switch (typeof $initialEditorState) {\n case \"function\": {\n editor.update(() => $initialEditorState(editor), HISTORY_MERGE_OPTIONS);\n break;\n }\n case \"string\": {\n const parsedEditorState = editor.parseEditorState($initialEditorState);\n editor.setEditorState(parsedEditorState, HISTORY_MERGE_OPTIONS);\n break;\n }\n case \"object\": {\n if ($initialEditorState) {\n editor.setEditorState($initialEditorState, HISTORY_MERGE_OPTIONS);\n }\n break;\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 { PlanConfigBase } from \"./types\";\n\n/**\n * The default merge strategy for plan configuration is a shallow merge.\n *\n * @param config A full config\n * @param overrides A partial config of overrides\n * @returns config if there are no overrides, otherwise `{...config, ...overrides}`\n */\nexport function shallowMergeConfig<T extends PlanConfigBase>(\n config: T,\n overrides?: Partial<T>,\n): T {\n if (!overrides || config === overrides) {\n return config;\n }\n for (const k in overrides) {\n if (config[k] !== overrides[k]) {\n return { ...config, ...overrides };\n }\n }\n return config;\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 { LexicalBuilder } from \"./LexicalBuilder\";\nimport type {\n AnyLexicalPlan,\n LexicalPlanConfig,\n LexicalPlanDependency,\n LexicalPlanOutput,\n} from \"./types\";\n\nimport invariant from \"./shared/invariant\";\n\nimport { shallowMergeConfig } from \"./shallowMergeConfig\";\nimport type { LexicalEditor } from \"lexical\";\n\nconst noop = () => {};\n/**\n * @internal\n */\nexport class PlanRep<Plan extends AnyLexicalPlan> {\n builder: LexicalBuilder;\n configs: Set<Partial<LexicalPlanConfig<Plan>>>;\n _config?: LexicalPlanConfig<Plan>;\n _dependency?: LexicalPlanDependency<Plan>;\n _output?: LexicalPlanOutput<Plan>;\n plan: Plan;\n constructor(builder: LexicalBuilder, plan: Plan) {\n this.builder = builder;\n this.plan = plan;\n this.configs = new Set();\n }\n register(editor: LexicalEditor, signal: AbortSignal): () => void {\n if (!this.plan.register) {\n this._output = undefined;\n return noop;\n }\n const cleanup = this.plan.register(editor, this.getConfig(), {\n getPeer: this.getPeer.bind(this),\n getDependency: this.getDependency.bind(this),\n getDirectDependentNames: this.getDirectDependentNames.bind(this),\n signal,\n });\n this._output = cleanup.output as LexicalPlanOutput<Plan>;\n return cleanup;\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 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 getDirectDependentNames(): string[] {\n return Array.from(\n this.builder.reverseEdges.get(this.plan) || [],\n (plan) => plan.name,\n );\n }\n\n getPlanDependency(): LexicalPlanDependency<Plan> {\n if (!this._dependency) {\n invariant(\n \"_output\" in this,\n \"Plan %s used as a dependency before registration\",\n this.plan.name,\n );\n this._dependency = {\n config: this.getConfig(),\n output: this._output!,\n };\n }\n return this._dependency;\n }\n getConfig(): LexicalPlanConfig<Plan> {\n if (!this._config) {\n let config = 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 config = mergeConfig(config, cfg);\n }\n this._config = config;\n }\n return this._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 */\nimport type {\n AnyLexicalPlan,\n AnyLexicalPlanArgument,\n EditorHandle,\n LexicalPlanConfig,\n RootPlanArgument,\n} from \"./types\";\n\nimport {\n LexicalEditor,\n createEditor,\n type CreateEditorArgs,\n type EditorThemeClasses,\n type HTMLConfig,\n type KlassConstructor,\n type LexicalNode,\n} from \"lexical\";\nimport invariant from \"./shared/invariant\";\n\nimport { deepThemeMergeInPlace } from \"./deepThemeMergeInPlace\";\nimport { initializeEditor } from \"./initializeEditor\";\nimport { PlanRep } from \"./PlanRep\";\nimport { mergeRegister } from \"@lexical/utils\";\nimport { configPlan, defineRootPlan } from \"./definePlan\";\n\nconst buildersForEditors = new WeakMap<LexicalEditor, LexicalBuilder>();\n\n/**\n * Build a LexicalEditor by combining together one or more plans, optionally\n * overriding some of their configuration.\n *\n * @param plan A plan argument (a plan, or a plan with config overrides)\n * @param plans Optional additional plan arguments\n * @returns An editor handle\n *\n * @example A single root plan with multiple dependencies\n * ```ts\n * const editorHandle = buildEditorFromPlans(\n * defineRootPlan({\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 editorHandle = buildEditorFromPlans(\n * RichTextPlan,\n * configPlan(EmojiPlan, { emojiBaseUrl: \"/assets/emoji\" }),\n * );\n * ```\n */\nexport function buildEditorFromPlans(\n plan: AnyLexicalPlanArgument | RootPlanArgument,\n ...plans: (AnyLexicalPlanArgument | RootPlanArgument)[]\n): EditorHandle {\n const builder = new LexicalBuilder();\n builder.addPlan(coerceToPlanArgument(plan));\n for (const otherPlan of plans) {\n builder.addPlan(coerceToPlanArgument(otherPlan));\n }\n return builder.buildEditor();\n}\n\n/** @internal */\nexport function coerceToPlanArgument(\n plan: AnyLexicalPlanArgument | RootPlanArgument,\n): AnyLexicalPlanArgument {\n return \"name\" in plan || Array.isArray(plan) ? plan : defineRootPlan(plan);\n}\n\n/** @internal */\nfunction noop() {}\n\n/** @internal */\nclass DisposableEditorHandle implements EditorHandle {\n editor: LexicalEditor;\n dispose: () => void;\n constructor(editor: LexicalEditor, dispose: () => void) {\n this.editor = editor;\n this.dispose = () => {\n try {\n dispose();\n } finally {\n this.dispose = noop;\n }\n };\n }\n // This should be safe even if the runtime doesn't have Symbol.dispose\n // because it will just be `handle[undefined] = dispose;`\n [Symbol.dispose]() {\n this.dispose();\n }\n}\n\n/** Throw the given Error */\nfunction defaultOnError(err: Error) {\n throw err;\n}\n\n/** @internal */\nexport class LexicalBuilder {\n phases: Map<AnyLexicalPlan, PlanRep<AnyLexicalPlan>>[];\n planMap: Map<AnyLexicalPlan, [number, PlanRep<AnyLexicalPlan>]>;\n planNameMap: Map<string, PlanRep<AnyLexicalPlan>>;\n reverseEdges: Map<AnyLexicalPlan, Set<AnyLexicalPlan>>;\n addStack: Set<AnyLexicalPlan>;\n conflicts: Map<string, string>;\n\n constructor() {\n // closure compiler can't handle class initializers\n this.phases = [new Map()];\n this.planMap = new Map();\n this.planNameMap = new Map();\n this.conflicts = new Map();\n this.reverseEdges = new Map();\n this.addStack = new Set();\n }\n\n /** Look up the editor that was created by this LexicalBuilder or undefined */\n static fromEditor(editor: LexicalEditor): LexicalBuilder | undefined {\n return buildersForEditors.get(editor);\n }\n\n buildEditor(): EditorHandle {\n const { $initialEditorState, onError, ...editorConfig } =\n this.buildCreateEditorArgs();\n const editor = createEditor({\n ...editorConfig,\n ...(onError ? { onError: (err) => onError(err, editor) } : {}),\n });\n initializeEditor(editor, $initialEditorState);\n buildersForEditors.set(editor, this);\n return new DisposableEditorHandle(\n editor,\n mergeRegister(\n () => buildersForEditors.delete(editor),\n () => editor.setRootElement(null),\n this.registerEditor(editor),\n ),\n );\n }\n\n getPlanRep<Plan extends AnyLexicalPlan>(\n plan: Plan,\n ): PlanRep<Plan> | undefined {\n const pair = this.planMap.get(plan);\n if (pair) {\n const rep: PlanRep<AnyLexicalPlan> = pair[1];\n return rep as PlanRep<Plan>;\n }\n }\n\n addPlan(arg: AnyLexicalPlanArgument, parent?: AnyLexicalPlan): number {\n let plan: AnyLexicalPlan;\n let configs: unknown[];\n if (Array.isArray(arg)) {\n [plan, ...configs] = arg;\n } else {\n plan = arg;\n configs = [];\n }\n // Track incoming dependencies\n if (parent) {\n let edgeSet = this.reverseEdges.get(plan);\n if (!edgeSet) {\n edgeSet = new Set();\n this.reverseEdges.set(plan, edgeSet);\n }\n edgeSet.add(parent);\n }\n let [phase, planRep] = this.planMap.get(plan) || [0, undefined];\n if (!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 invariant(\n !this.addStack.has(plan),\n \"LexicalBuilder: Circular dependency detected for Plan %s from %s\",\n plan.name,\n parent?.name || \"[unknown]\",\n );\n this.addStack.add(plan);\n // TODO detect circular dependencies\n for (const dep of plan.dependencies || []) {\n phase = Math.max(phase, 1 + this.addPlan(dep, plan));\n }\n for (const [depName, cfg] of Object.entries(\n plan.peerDependencies || {},\n )) {\n const dep = this.planNameMap.get(depName);\n if (dep) {\n phase = Math.max(\n phase,\n 1 +\n this.addPlan(\n configPlan(dep.plan, cfg as LexicalPlanConfig<typeof dep.plan>),\n plan,\n ),\n );\n }\n }\n invariant(\n this.phases.length >= phase,\n \"LexicalBuilder: Expected phase to be no greater than phases.length\",\n );\n if (this.phases.length === phase) {\n this.phases.push(new Map());\n }\n planRep = new PlanRep(this, plan);\n invariant(\n !this.planNameMap.has(plan.name),\n \"LexicalBuilder: Multiple plans registered with name %s, names must be unique\",\n plan.name,\n );\n this.planMap.set(plan, [phase, planRep]);\n this.planNameMap.set(plan.name, planRep);\n const currentPhaseMap = this.phases[phase];\n invariant(\n currentPhaseMap !== undefined,\n \"LexicalBuilder: Expecting phase map for phase %s\",\n String(phase),\n );\n currentPhaseMap.set(plan, planRep);\n this.addStack.delete(plan);\n }\n for (const config of configs) {\n planRep.configs.add(config as Partial<LexicalPlanConfig<AnyLexicalPlan>>);\n }\n return phase;\n }\n\n *sortedPlanReps() {\n for (const phase of this.phases) {\n yield* phase.values();\n }\n }\n\n registerEditor(editor: LexicalEditor): () => void {\n const cleanups: (() => void)[] = [];\n const controller = new AbortController();\n for (const planRep of this.sortedPlanReps()) {\n cleanups.push(planRep.register(editor, controller.signal));\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() {\n const config: Pick<\n CreateEditorArgs,\n \"nodes\" | \"html\" | \"theme\" | \"disableEvents\" | \"editable\" | \"namespace\"\n > &\n Pick<AnyLexicalPlan, \"$initialEditorState\" | \"onError\"> = {\n // Prefer throwing errors rather than console.error by default\n onError: defaultOnError,\n };\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 for (const planRep of this.sortedPlanReps()) {\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.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 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\n/**\n * Explicitly and safely cast a value to a specific type when inference or\n * satisfies isn't going to work as expected (often useful for the config\n * property with definePlan)\n */\nexport function safeCast<T>(value: T): T {\n return value;\n}\n","import { $getEditor, LexicalEditor } from \"lexical\";\nimport { AnyLexicalPlan, LexicalPlanDependency } from \"./types\";\nimport { LexicalBuilder } from \"./LexicalBuilder\";\nimport invariant from \"./shared/invariant\";\nimport { PACKAGE_VERSION } from \"./PACKAGE_VERSION\";\nimport { PlanRep } from \"./PlanRep\";\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 RegisterState} 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 invariant(\n builder !== undefined,\n \"getPlanFromEditor: editor was not created with this build of Lexical Builder %s\",\n PACKAGE_VERSION,\n );\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\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 RegisterState} around.\n *\n * It will throw if the Editor was not built using this Plan.\n *\n * @param plan The concrete reference to a Plan used to build this editor\n * @returns The config and outputs for that Plan\n */\nexport function $getPlanDependency<Plan extends AnyLexicalPlan>(\n plan: Plan,\n): LexicalPlanDependency<Plan> {\n return getPlanDependencyFromEditor($getEditor(), plan);\n}\n","import { $getEditor, LexicalEditor } from \"lexical\";\nimport { AnyLexicalPlan, LexicalPlanDependency } from \"./types\";\nimport { LexicalBuilder } from \"./LexicalBuilder\";\nimport invariant from \"./shared/invariant\";\nimport { PACKAGE_VERSION } from \"./PACKAGE_VERSION\";\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).\n *\n * Both the explicit Plan type and the name are required.\n *\n * @example\n * ```tsx\n * getPeerDependencyFromEditor<typeof import(\"@some/plan\").SomePlan>(editor, \"@some/plan\");\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 invariant(\n builder !== undefined,\n \"getPeerConfigFromEditor: editor was not created with this build of Lexical Builder %s\",\n PACKAGE_VERSION,\n );\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 * Both the explicit Plan type and the name are required.\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).\n *\n * @example\n * ```tsx\n * $getPeerDependency<typeof import(\"@some/plan\").SomePlan>(\"@some/plan\")\n * ```\n *\n * @param planName The name of the Plan\n * @returns The config and output of the Plan or undefined\n */\nexport function $getPeerDependency<Plan extends AnyLexicalPlan = never>(\n planName: Plan[\"name\"],\n): LexicalPlanDependency<Plan> | undefined {\n return getPeerDependencyFromEditor($getEditor(), planName);\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 } from \"./definePlan\";\nimport { safeCast } from \"./safeCast\";\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/AutoFocusPlan\",\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","/**\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\";\n\nimport { definePlan } from \"./definePlan\";\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 config: {},\n name: \"@lexical/dragon\",\n register: registerDragonSupport,\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 {\n createEmptyHistoryState,\n type HistoryState,\n registerHistory,\n} from \"@lexical/history\";\n\nimport { definePlan } from \"./definePlan\";\nimport { safeCast } from \"./safeCast\";\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: () => 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 }),\n name: \"@etrepum/lexical-builder/HistoryPlan\",\n register(editor, { delay, createInitialHistoryState }) {\n return registerHistory(editor, createInitialHistoryState(), delay);\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\";\n\nimport { definePlan } from \"./definePlan\";\n\n/**\n * A plan to register @lexical/plain-text behavior\n */\nexport const PlainTextPlan = definePlan({\n config: {},\n conflictsWith: [\"@lexical/rich-text\"],\n name: \"@lexical/plain-text\",\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\";\n\nimport { definePlan } from \"./definePlan\";\n\n/**\n * A plan to register @lexical/rich-text behavior and nodes\n * ({@link HeadingNode}, {@link QuoteNode})\n */\nexport const RichTextPlan = definePlan({\n config: {},\n conflictsWith: [\"@lexical/plain-text\"],\n name: \"@lexical/rich-text\",\n nodes: [HeadingNode, QuoteNode],\n register: registerRichText,\n});\n"],"names":["noop"],"mappings":";;;;;;;;;;;;AACa,MAAA,kBAA0B;ACqDhC,SAAS,WAId,MAA4E;AACrE,SAAA;AACT;AAqBO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AAA;AAAA,UAC3C;AAAA,QACF;AAAA,QACA,EAAE,iBAAiB;AAAA,MAAA;AAAA,IACrB,CACD;AAAA,EACH;AACF,CAAC;AC/BM,MAAM,aAAa,WAAW;AAAA,EACnC,QAAQ,CAAC;AAAA,EACT,MAAM;AAAA,EACN,UAAU;AACZ,CAAC;ACYM,MAAM,cAAc,WAAW;AAAA,EACpC,QAAQ,SAAwB;AAAA,IAC9B,2BAA2B;AAAA,IAC3B,OAAO;AAAA,EAAA,CACR;AAAA,EACD,MAAM;AAAA,EACN,SAAS,QAAQ,EAAE,OAAO,6BAA6B;AACrD,WAAO,gBAAgB,QAAQ,0BAA0B,GAAG,KAAK;AAAA,EACnE;AACF,CAAC;AC3BM,MAAM,gBAAgB,WAAW;AAAA,EACtC,QAAQ,CAAC;AAAA,EACT,eAAe,CAAC,oBAAoB;AAAA,EACpC,MAAM;AAAA,EACN,UAAU;AACZ,CAAC;ACHM,MAAM,eAAe,WAAW;AAAA,EACrC,QAAQ,CAAC;AAAA,EACT,eAAe,CAAC,qBAAqB;AAAA,EACrC,MAAM;AAAA,EACN,OAAO,CAAC,aAAa,SAAS;AAAA,EAC9B,UAAU;AACZ,CAAC;"}
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { CreateEditorArgs, EditorState, LexicalEditor } from 'lexical';
2
- import { LexicalPlanRegistry } from '@etrepum/lexical-builder';
2
+ import { PeerDependencyBrand } from './definePlan';
3
3
 
4
4
  /**
5
5
  * Any concrete {@link LexicalPlan}
@@ -13,6 +13,14 @@ export type AnyLexicalPlanArgument = LexicalPlanArgument<any, string, any>;
13
13
  * The default plan configuration of an empty object
14
14
  */
15
15
  export type PlanConfigBase = Record<never, never>;
16
+ export type RootPlan<Output> = LexicalPlan<PlanConfigBase, "[root]", Output>;
17
+ export type RootPlanArgument<Output = any> = Omit<RootPlan<Output>, "config" | "name">;
18
+ export type NormalizedPeerDependency<Plan extends AnyLexicalPlan> = [
19
+ Plan["name"],
20
+ Partial<LexicalPlanConfig<Plan>> | undefined
21
+ ] & {
22
+ [PeerDependencyBrand]: Plan;
23
+ };
16
24
  /**
17
25
  * A tuple of [plan, configOverride, ...configOverrides]
18
26
  */
@@ -28,12 +36,17 @@ export interface RegisterState {
28
36
  * Get the result of a peerDependency by name, if it exists
29
37
  * (must be a peerDependency of this plan)
30
38
  */
31
- getPeer<Name extends keyof LexicalPlanRegistry>(name: string): undefined | LexicalPlanDependency<LexicalPlanRegistry[Name]>;
39
+ getPeer<Plan extends AnyLexicalPlan = never>(name: Plan["name"]): undefined | LexicalPlanDependency<Plan>;
32
40
  /**
33
41
  * Get the configuration of a dependency by plan
34
42
  * (must be a direct dependency of this plan)
35
43
  */
36
44
  getDependency<Dependency extends AnyLexicalPlan>(dep: Dependency): LexicalPlanDependency<Dependency>;
45
+ /**
46
+ * Get the names of any direct dependents of this
47
+ * Plan, typically only used for error messages.
48
+ */
49
+ getDirectDependentNames(): string[];
37
50
  }
38
51
  /**
39
52
  * A {@link LexicalPlan} or {@link NormalizedLexicalPlanArgument} (plan with config overrides)
@@ -62,9 +75,7 @@ export interface LexicalPlan<Config extends PlanConfigBase = PlanConfigBase, Nam
62
75
  * Other Plans, by name, that this Plan can optionally depend on or
63
76
  * configure, if they are directly depended on by another Plan
64
77
  */
65
- peerDependencies?: {
66
- [k in keyof LexicalPlanRegistry]?: Partial<LexicalPeerConfig<k>>;
67
- };
78
+ peerDependencies?: NormalizedPeerDependency<AnyLexicalPlan>[];
68
79
  /**
69
80
  * @internal Disable root element events (for internal Meta use)
70
81
  */
@@ -162,23 +173,6 @@ export type RegisterCleanup<Output> = (() => void) & (unknown extends Output ? {
162
173
  } : {
163
174
  output: Output;
164
175
  });
165
- /**
166
- * Get the Config type of a peer Plan from {@link LexicalPlanRegistry} by
167
- * name, or the empty {@link PlanConfigBase} if it is not globally registered.
168
- */
169
- export type LexicalPeerConfig<Name extends keyof LexicalPlanRegistry | string> = LexicalPeerPlan<Name>["config"];
170
- /**
171
- * Get the Plan type of a peer Plan from {@link LexicalPlanRegistry} by
172
- * name, or an "default" Plan type if it is not globally registered.
173
- */
174
- export type LexicalPeerPlan<Name extends keyof LexicalPlanRegistry | string> = [
175
- Name
176
- ] extends [keyof LexicalPlanRegistry] ? LexicalPlanRegistry[Name] : LexicalPlan<PlanConfigBase, Name, unknown>;
177
- /**
178
- * Get the Config type of a peer Plan from {@link LexicalPlanRegistry} by
179
- * name, or the empty {@link PlanConfigBase} if it is not globally registered.
180
- */
181
- export type LexicalPeerDependency<Name extends keyof LexicalPlanRegistry | string> = LexicalPlanDependency<LexicalPeerPlan<Name>>;
182
176
  /**
183
177
  * Extract the Config type from a Plan
184
178
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE;;GAEG;AAEH,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;AAC3D;;GAEG;AAEH,MAAM,MAAM,sBAAsB,GAAG,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;AAC3E;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,6BAA6B,CACvC,MAAM,SAAS,cAAc,EAC7B,IAAI,SAAS,MAAM,EACnB,MAAM,SAAS,OAAO,IACpB,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAE/E;;;GAGG;AACH,MAA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AI,SAAS,WAAW,CAAC,MAAM,OAAO,EAAE,MAAM,KAAK,EAAE,MAAM,MAAM,CAAC,GAC9D,MAAM,GACN,OAAO,CAAC;AAEd;;GAEG;AACH,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC9C,yBAAyB;IACzB,MAAM,EAAE,aAAa,CAAC;IACtB;;;OAGG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,sBAAsB,GAC9B,IAAI,GACJ,MAAM,GACN,WAAW,GACX,CAAC,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC,CAAC"}
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "test": "vitest run",
18
18
  "test:watch": "vitest"
19
19
  },
20
- "version": "0.0.15",
20
+ "version": "0.0.17-nightly.20240610.0",
21
21
  "license": "MIT",
22
22
  "repository": {
23
23
  "type": "git",