lexical 0.35.1-nightly.20250924.0 → 0.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Lexical.dev.js CHANGED
@@ -54,7 +54,7 @@ const IS_CHROME = CAN_USE_DOM && /^(?=.*Chrome).*/i.test(navigator.userAgent);
54
54
  // export const canUseTextInputEvent: boolean = CAN_USE_DOM && 'TextEvent' in window && !documentMode;
55
55
 
56
56
  const IS_ANDROID_CHROME = CAN_USE_DOM && IS_ANDROID && IS_CHROME;
57
- const IS_APPLE_WEBKIT = CAN_USE_DOM && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && !IS_CHROME;
57
+ const IS_APPLE_WEBKIT = CAN_USE_DOM && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && IS_APPLE && !IS_CHROME;
58
58
 
59
59
  /**
60
60
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -552,26 +552,26 @@ function initMutationObserver(editor) {
552
552
  */
553
553
  class StateConfig {
554
554
  /** The string key used when serializing this state to JSON */
555
-
555
+ key;
556
556
  /** The parse function from the StateValueConfig passed to createState */
557
-
557
+ parse;
558
558
  /**
559
559
  * The unparse function from the StateValueConfig passed to createState,
560
560
  * with a default that is simply a pass-through that assumes the value is
561
561
  * JSON serializable.
562
562
  */
563
-
563
+ unparse;
564
564
  /**
565
565
  * An equality function from the StateValueConfig, with a default of
566
566
  * Object.is.
567
567
  */
568
-
568
+ isEqual;
569
569
  /**
570
570
  * The result of `stateValueConfig.parse(undefined)`, which is computed only
571
571
  * once and used as the default value. When the current value `isEqual` to
572
572
  * the `defaultValue`, it will not be serialized to JSON.
573
573
  */
574
-
574
+ defaultValue;
575
575
  constructor(key, stateValueConfig) {
576
576
  this.key = key;
577
577
  this.parse = stateValueConfig.parse.bind(stateValueConfig);
@@ -608,6 +608,8 @@ class StateConfig {
608
608
  * @param key The key to use
609
609
  * @param valueConfig Configuration for the value type
610
610
  * @returns a StateConfig
611
+ *
612
+ * @__NO_SIDE_EFFECTS__
611
613
  */
612
614
  function createState(key, valueConfig) {
613
615
  return new StateConfig(key, valueConfig);
@@ -782,6 +784,7 @@ class NodeState {
782
784
  * will trigger a copy of the prevNode's NodeState with the node property
783
785
  * updated.
784
786
  */
787
+ node;
785
788
 
786
789
  /**
787
790
  * @internal
@@ -792,6 +795,7 @@ class NodeState {
792
795
  * Note that it uses StateConfig, so in addition to (1) the CURRENT VALUE, it has access to
793
796
  * (2) the State key (3) the DEFAULT VALUE and (4) the PARSE FUNCTION
794
797
  */
798
+ knownState;
795
799
 
796
800
  /**
797
801
  * @internal
@@ -809,6 +813,7 @@ class NodeState {
809
813
  * an old version of your code doesnt erase metadata that was
810
814
  * set by a newer version of your code.
811
815
  */
816
+ unknownState;
812
817
 
813
818
  /**
814
819
  * @internal
@@ -817,13 +822,14 @@ class NodeState {
817
822
  * node type in an editor and remains writable. It is how keys are resolved
818
823
  * to configuration.
819
824
  */
820
-
825
+ sharedNodeState;
821
826
  /**
822
827
  * @internal
823
828
  *
824
829
  * The count of known or unknown keys in this state, ignoring the
825
830
  * intersection between the two sets.
826
831
  */
832
+ size;
827
833
 
828
834
  /**
829
835
  * @internal
@@ -1904,6 +1910,16 @@ function warnOnlyOnce(message) {
1904
1910
  *
1905
1911
  */
1906
1912
 
1913
+ /**
1914
+ * Crete a command that can be used with `editor.dispatchCommand` and
1915
+ * `editor.registerCommand`. Commands are used by unique reference, not by
1916
+ * name.
1917
+ *
1918
+ * @param type A string to identify the command, very helpful for debugging
1919
+ * @returns A new LexicalCommand
1920
+ *
1921
+ * @__NO_SIDE_EFFECTS__
1922
+ */
1907
1923
  function createCommand(type) {
1908
1924
  return {
1909
1925
  type
@@ -3147,23 +3163,21 @@ function buildImportMap(importMap) {
3147
3163
  return importMap;
3148
3164
  }
3149
3165
  class LexicalNode {
3150
- /**
3151
- * @internal
3152
- * Allow us to look up the type including static props
3153
- */
3166
+ /** @internal Allow us to look up the type including static props */
3154
3167
 
3155
3168
  /** @internal */
3156
-
3169
+ __type;
3157
3170
  /** @internal */
3158
3171
  //@ts-ignore We set the key in the constructor.
3159
-
3172
+ __key;
3160
3173
  /** @internal */
3161
-
3174
+ __parent;
3162
3175
  /** @internal */
3163
-
3176
+ __prev;
3164
3177
  /** @internal */
3165
-
3178
+ __next;
3166
3179
  /** @internal */
3180
+ __state;
3167
3181
 
3168
3182
  // Flow doesn't support abstract classes unfortunately, so we can't _force_
3169
3183
  // subclasses of Node to implement statics. All subclasses of Node should have
@@ -3295,7 +3309,7 @@ class LexicalNode {
3295
3309
  }
3296
3310
 
3297
3311
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3298
-
3312
+ static importDOM;
3299
3313
  constructor(key) {
3300
3314
  this.__type = this.constructor.getType();
3301
3315
  this.__parent = null;
@@ -4427,14 +4441,15 @@ function wrapElementWith(element, tag) {
4427
4441
  class TextNode extends LexicalNode {
4428
4442
  /** @internal */
4429
4443
 
4444
+ __text;
4430
4445
  /** @internal */
4431
-
4446
+ __format;
4432
4447
  /** @internal */
4433
-
4448
+ __style;
4434
4449
  /** @internal */
4435
-
4450
+ __mode;
4436
4451
  /** @internal */
4437
-
4452
+ __detail;
4438
4453
  static getType() {
4439
4454
  return 'text';
4440
4455
  }
@@ -5485,6 +5500,10 @@ function $isTabNode(node) {
5485
5500
  }
5486
5501
 
5487
5502
  class Point {
5503
+ key;
5504
+ offset;
5505
+ type;
5506
+ _selection;
5488
5507
  constructor(key, offset, type) {
5489
5508
  {
5490
5509
  // This prevents a circular reference error when serialized as JSON,
@@ -5611,6 +5630,9 @@ function $transferStartingElementPointToTextPoint(start, end, format, style) {
5611
5630
  start.set(textNode.__key, 0, 'text');
5612
5631
  }
5613
5632
  class NodeSelection {
5633
+ _nodes;
5634
+ _cachedNodes;
5635
+ dirty;
5614
5636
  constructor(objects) {
5615
5637
  this._cachedNodes = null;
5616
5638
  this._nodes = objects;
@@ -5734,6 +5756,12 @@ function $isRangeSelection(x) {
5734
5756
  return x instanceof RangeSelection;
5735
5757
  }
5736
5758
  class RangeSelection {
5759
+ format;
5760
+ style;
5761
+ anchor;
5762
+ focus;
5763
+ _cachedNodes;
5764
+ dirty;
5737
5765
  constructor(anchor, focus, format, style) {
5738
5766
  this.anchor = anchor;
5739
5767
  this.focus = focus;
@@ -6445,7 +6473,7 @@ class RangeSelection {
6445
6473
  }
6446
6474
  const firstPoint = this.isBackward() ? this.focus : this.anchor;
6447
6475
  const firstNode = firstPoint.getNode();
6448
- const firstBlock = $getAncestor(firstNode, INTERNAL_$isBlock);
6476
+ const firstBlock = $findMatchingParent(firstNode, INTERNAL_$isBlock);
6449
6477
  const last = nodes[nodes.length - 1];
6450
6478
 
6451
6479
  // CASE 1: insert inside a code block
@@ -6494,7 +6522,7 @@ class RangeSelection {
6494
6522
  }
6495
6523
  insertRangeAfter(firstBlock, firstToInsert);
6496
6524
  }
6497
- const lastInsertedBlock = $getAncestor(nodeToSelect, INTERNAL_$isBlock);
6525
+ const lastInsertedBlock = $findMatchingParent(nodeToSelect, INTERNAL_$isBlock);
6498
6526
  if (insertedParagraph && $isElementNode(lastInsertedBlock) && (insertedParagraph.canMergeWhenEmpty() || INTERNAL_$isBlock(lastToInsert))) {
6499
6527
  lastInsertedBlock.append(...insertedParagraph.getChildren());
6500
6528
  insertedParagraph.remove();
@@ -6524,7 +6552,7 @@ class RangeSelection {
6524
6552
  return paragraph;
6525
6553
  }
6526
6554
  const index = $removeTextAndSplitBlock(this);
6527
- const block = $getAncestor(this.anchor.getNode(), INTERNAL_$isBlock);
6555
+ const block = $findMatchingParent(this.anchor.getNode(), INTERNAL_$isBlock);
6528
6556
  if (!$isElementNode(block)) {
6529
6557
  formatDevErrorMessage(`Expected ancestor to be a block ElementNode`);
6530
6558
  }
@@ -8653,6 +8681,9 @@ function updateEditor(editor, updateFn, options) {
8653
8681
  * A utility class for managing the DOM children of an ElementNode
8654
8682
  */
8655
8683
  class ElementDOMSlot {
8684
+ element;
8685
+ before;
8686
+ after;
8656
8687
  constructor(/** The element returned by createDOM */
8657
8688
  element, /** All managed children will be inserted before this node, if defined */
8658
8689
  before, /** All managed children will be inserted after this node, if defined */
@@ -8738,7 +8769,7 @@ class ElementDOMSlot {
8738
8769
  if (lineBreakType === null) {
8739
8770
  this.removeManagedLineBreak();
8740
8771
  } else {
8741
- const webkitHack = lineBreakType === 'decorator' && (IS_IOS || IS_SAFARI);
8772
+ const webkitHack = lineBreakType === 'decorator' && (IS_APPLE_WEBKIT || IS_IOS || IS_SAFARI);
8742
8773
  this.insertManagedLineBreak(webkitHack);
8743
8774
  }
8744
8775
  }
@@ -8842,23 +8873,23 @@ class ElementNode extends LexicalNode {
8842
8873
  /** @internal */
8843
8874
 
8844
8875
  /** @internal */
8845
-
8876
+ __first;
8846
8877
  /** @internal */
8847
-
8878
+ __last;
8848
8879
  /** @internal */
8849
-
8880
+ __size;
8850
8881
  /** @internal */
8851
-
8882
+ __format;
8852
8883
  /** @internal */
8853
-
8884
+ __style;
8854
8885
  /** @internal */
8855
-
8886
+ __indent;
8856
8887
  /** @internal */
8857
-
8888
+ __dir;
8858
8889
  /** @internal */
8859
-
8890
+ __textFormat;
8860
8891
  /** @internal */
8861
-
8892
+ __textStyle;
8862
8893
  constructor(key) {
8863
8894
  super(key);
8864
8895
  this.__first = null;
@@ -9469,6 +9500,15 @@ function isPointRemoved(point, nodesToRemoveKeySet, nodesToInsertKeySet) {
9469
9500
  return false;
9470
9501
  }
9471
9502
 
9503
+ /**
9504
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
9505
+ *
9506
+ * This source code is licensed under the MIT license found in the
9507
+ * LICENSE file in the root directory of this source tree.
9508
+ *
9509
+ */
9510
+
9511
+
9472
9512
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
9473
9513
 
9474
9514
  /** @noInheritDoc */
@@ -9480,9 +9520,7 @@ class DecoratorNode extends LexicalNode {
9480
9520
  * The returned value is added to the LexicalEditor._decorators
9481
9521
  */
9482
9522
  decorate(editor, config) {
9483
- {
9484
- formatDevErrorMessage(`decorate: base method not extended`);
9485
- }
9523
+ return null;
9486
9524
  }
9487
9525
  isIsolated() {
9488
9526
  return false;
@@ -9501,7 +9539,7 @@ function $isDecoratorNode(node) {
9501
9539
  /** @noInheritDoc */
9502
9540
  class RootNode extends ElementNode {
9503
9541
  /** @internal */
9504
-
9542
+ __cachedText;
9505
9543
  static getType() {
9506
9544
  return 'root';
9507
9545
  }
@@ -9623,7 +9661,17 @@ function exportNodeToJSON(node) {
9623
9661
  // @ts-expect-error
9624
9662
  return serializedNode;
9625
9663
  }
9664
+ /**
9665
+ * Type guard that returns true if the argument is an EditorState
9666
+ */
9667
+ function $isEditorState(x) {
9668
+ return x instanceof EditorState;
9669
+ }
9626
9670
  class EditorState {
9671
+ _nodeMap;
9672
+ _selection;
9673
+ _flushSync;
9674
+ _readOnly;
9627
9675
  constructor(nodeMap, selection) {
9628
9676
  this._nodeMap = nodeMap;
9629
9677
  this._selection = selection || null;
@@ -10018,7 +10066,6 @@ function createEditor(editorConfig) {
10018
10066
  // uses LexicalNode in an otherwise incorrect way
10019
10067
  // by mocking its static getType
10020
10068
  klass !== LexicalNode) {
10021
- const proto = klass.prototype;
10022
10069
  ['getType', 'clone'].forEach(method => {
10023
10070
  if (!hasOwnStaticMethod(klass, method)) {
10024
10071
  console.warn(`${name} must implement static "${method}" method`);
@@ -10027,11 +10074,6 @@ function createEditor(editorConfig) {
10027
10074
  if (!hasOwnStaticMethod(klass, 'importDOM') && hasOwnExportDOM(klass)) {
10028
10075
  console.warn(`${name} should implement "importDOM" if using a custom "exportDOM" method to ensure HTML serialization (important for copy & paste) works as expected`);
10029
10076
  }
10030
- if ($isDecoratorNode(proto)) {
10031
- if (proto.decorate === DecoratorNode.prototype.decorate) {
10032
- console.warn(`${proto.constructor.name} must implement "decorate" method`);
10033
- }
10034
- }
10035
10077
  if (!hasOwnStaticMethod(klass, 'importJSON')) {
10036
10078
  console.warn(`${name} should implement "importJSON" method to ensure JSON and default HTML serialization works as expected`);
10037
10079
  }
@@ -10071,66 +10113,68 @@ class LexicalEditor {
10071
10113
  /** @internal */
10072
10114
 
10073
10115
  /** The version with build identifiers for this editor (since 0.17.1) */
10116
+ static version;
10074
10117
 
10075
10118
  /** @internal */
10076
-
10119
+ _headless;
10077
10120
  /** @internal */
10078
-
10121
+ _parentEditor;
10079
10122
  /** @internal */
10080
-
10123
+ _rootElement;
10081
10124
  /** @internal */
10082
-
10125
+ _editorState;
10083
10126
  /** @internal */
10084
-
10127
+ _pendingEditorState;
10085
10128
  /** @internal */
10086
-
10129
+ _compositionKey;
10087
10130
  /** @internal */
10088
-
10131
+ _deferred;
10089
10132
  /** @internal */
10090
-
10133
+ _keyToDOMMap;
10091
10134
  /** @internal */
10092
-
10135
+ _updates;
10093
10136
  /** @internal */
10094
-
10137
+ _updating;
10095
10138
  /** @internal */
10096
-
10139
+ _listeners;
10097
10140
  /** @internal */
10098
-
10141
+ _commands;
10099
10142
  /** @internal */
10100
-
10143
+ _nodes;
10101
10144
  /** @internal */
10102
-
10145
+ _decorators;
10103
10146
  /** @internal */
10104
-
10147
+ _pendingDecorators;
10105
10148
  /** @internal */
10106
-
10149
+ _config;
10107
10150
  /** @internal */
10108
-
10151
+ _dirtyType;
10109
10152
  /** @internal */
10110
-
10153
+ _cloneNotNeeded;
10111
10154
  /** @internal */
10112
-
10155
+ _dirtyLeaves;
10113
10156
  /** @internal */
10114
-
10157
+ _dirtyElements;
10115
10158
  /** @internal */
10116
-
10159
+ _normalizedNodes;
10117
10160
  /** @internal */
10118
-
10161
+ _updateTags;
10119
10162
  /** @internal */
10120
-
10163
+ _observer;
10121
10164
  /** @internal */
10122
-
10165
+ _key;
10123
10166
  /** @internal */
10124
-
10167
+ _onError;
10125
10168
  /** @internal */
10126
-
10169
+ _htmlConversions;
10127
10170
  /** @internal */
10128
-
10171
+ _window;
10129
10172
  /** @internal */
10130
-
10173
+ _editable;
10131
10174
  /** @internal */
10132
-
10175
+ _blockCursorElement;
10133
10176
  /** @internal */
10177
+ _createEditorArgs;
10134
10178
 
10135
10179
  /** @internal */
10136
10180
  constructor(editorState, parentEditor, nodes, config, onError, htmlConversions, editable, createEditorArgs) {
@@ -10742,7 +10786,7 @@ class LexicalEditor {
10742
10786
  };
10743
10787
  }
10744
10788
  }
10745
- LexicalEditor.version = "0.35.1-nightly.20250924.0+dev.cjs";
10789
+ LexicalEditor.version = "0.36.0+dev.cjs";
10746
10790
 
10747
10791
  let pendingNodeToClone = null;
10748
10792
  function setPendingNodeToClone(pendingNode) {
@@ -10780,6 +10824,8 @@ function getRegisteredNodeOrThrow(editor, nodeType) {
10780
10824
  function getRegisteredNode(editor, nodeType) {
10781
10825
  return editor._nodes.get(nodeType);
10782
10826
  }
10827
+
10828
+ /** @internal */
10783
10829
  const scheduleMicroTask = typeof queueMicrotask === 'function' ? queueMicrotask : fn => {
10784
10830
  // No window prefix intended (#1400)
10785
10831
  Promise.resolve().then(fn);
@@ -12067,13 +12113,6 @@ function INTERNAL_$isBlock(node) {
12067
12113
  const isLeafElement = firstChild === null || $isLineBreakNode(firstChild) || $isTextNode(firstChild) || firstChild.isInline();
12068
12114
  return !node.isInline() && node.canBeEmpty() !== false && isLeafElement;
12069
12115
  }
12070
- function $getAncestor(node, predicate) {
12071
- let parent = node;
12072
- while (parent !== null && parent.getParent() !== null && !predicate(parent)) {
12073
- parent = parent.getParentOrThrow();
12074
- }
12075
- return predicate(parent) ? parent : null;
12076
- }
12077
12116
 
12078
12117
  /**
12079
12118
  * Utility function for accessing current active editor instance.
@@ -12433,6 +12472,7 @@ const FLIP_DIRECTION = {
12433
12472
  */
12434
12473
 
12435
12474
  class AbstractCaret {
12475
+ origin;
12436
12476
  constructor(origin) {
12437
12477
  this.origin = origin;
12438
12478
  }
@@ -12615,6 +12655,7 @@ class AbstractSiblingCaret extends AbstractCaret {
12615
12655
  }
12616
12656
  class AbstractTextPointCaret extends AbstractCaret {
12617
12657
  type = 'text';
12658
+ offset;
12618
12659
  constructor(origin, offset) {
12619
12660
  super(origin);
12620
12661
  this.offset = offset;
@@ -12831,6 +12872,9 @@ function $getAdjacentChildCaret(caret) {
12831
12872
  }
12832
12873
  class CaretRangeImpl {
12833
12874
  type = 'node-caret-range';
12875
+ direction;
12876
+ anchor;
12877
+ focus;
12834
12878
  constructor(anchor, focus, direction) {
12835
12879
  this.anchor = anchor;
12836
12880
  this.focus = focus;
@@ -12882,6 +12926,8 @@ class CaretRangeImpl {
12882
12926
  }
12883
12927
  class TextPointCaretSliceImpl {
12884
12928
  type = 'slice';
12929
+ caret;
12930
+ distance;
12885
12931
  constructor(caret, distance) {
12886
12932
  this.caret = caret;
12887
12933
  this.distance = distance;
@@ -13675,6 +13721,165 @@ function $splitAtPointCaretNext(pointCaret, {
13675
13721
  return parentCaret;
13676
13722
  }
13677
13723
 
13724
+ /**
13725
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
13726
+ *
13727
+ * This source code is licensed under the MIT license found in the
13728
+ * LICENSE file in the root directory of this source tree.
13729
+ *
13730
+ */
13731
+
13732
+ /**
13733
+ * @experimental
13734
+ * Define a LexicalExtension from the given object literal. TypeScript will
13735
+ * infer Config and Name in most cases, but you may want to use
13736
+ * {@link safeCast} for config if there are default fields or varying types.
13737
+ *
13738
+ * @param extension - The LexicalExtension
13739
+ * @returns The unmodified extension argument (this is only an inference helper)
13740
+ *
13741
+ * @example
13742
+ * Basic example
13743
+ * ```ts
13744
+ * export const MyExtension = defineExtension({
13745
+ * // Extension names must be unique in an editor
13746
+ * name: "my",
13747
+ * nodes: [MyNode],
13748
+ * });
13749
+ * ```
13750
+ *
13751
+ * @example
13752
+ * Extension with optional configuration
13753
+ * ```ts
13754
+ * export interface ConfigurableConfig {
13755
+ * optional?: string;
13756
+ * required: number;
13757
+ * }
13758
+ * export const ConfigurableExtension = defineExtension({
13759
+ * name: "configurable",
13760
+ * // The Extension's config must satisfy the full config type,
13761
+ * // but using the Extension as a dependency never requires
13762
+ * // configuration and any partial of the config can be specified
13763
+ * config: safeCast<ConfigurableConfig>({ required: 1 }),
13764
+ * });
13765
+ * ```
13766
+ *
13767
+ * @__NO_SIDE_EFFECTS__
13768
+ */
13769
+ function defineExtension(extension) {
13770
+ return extension;
13771
+ }
13772
+
13773
+ /**
13774
+ * @experimental
13775
+ * Override a partial of the configuration of an Extension, to be used
13776
+ * in the dependencies array of another extension, or as
13777
+ * an argument to {@link buildEditorFromExtensions}.
13778
+ *
13779
+ * Before building the editor, configurations will be merged using
13780
+ * `extension.mergeConfig(extension, config)` or {@link shallowMergeConfig} if
13781
+ * this is not directly implemented by the Extension.
13782
+ *
13783
+ * @param args - An extension followed by one or more config partials for that extension
13784
+ * @returns `[extension, config, ...configs]`
13785
+ *
13786
+ * @example
13787
+ * ```ts
13788
+ * export const ReactDecoratorExtension = defineExtension({
13789
+ * name: "react-decorator",
13790
+ * dependencies: [
13791
+ * configExtension(ReactExtension, {
13792
+ * decorators: [<ReactDecorator />]
13793
+ * }),
13794
+ * ],
13795
+ * });
13796
+ * ```
13797
+ *
13798
+ * @__NO_SIDE_EFFECTS__
13799
+ */
13800
+ function configExtension(...args) {
13801
+ return args;
13802
+ }
13803
+
13804
+ /**
13805
+ * @experimental
13806
+ * Used to declare a peer dependency of an extension in a type-safe way,
13807
+ * requires the type parameter. The most common use case for peer dependencies
13808
+ * is to avoid a direct import dependency, so you would want to use a
13809
+ * type import or the import type (shown in below examples).
13810
+ *
13811
+ * @param name - The extension's name
13812
+ * @param config - An optional config override
13813
+ * @returns NormalizedPeerDependency
13814
+ *
13815
+ * @example
13816
+ * ```ts
13817
+ * import type {FooExtension} from "foo";
13818
+ *
13819
+ * export const PeerExtension = defineExtension({
13820
+ * name: 'PeerExtension',
13821
+ * peerDependencies: [
13822
+ * declarePeerDependency<FooExtension>("foo"),
13823
+ * declarePeerDependency<typeof import("bar").BarExtension>("bar", {config: "bar"}),
13824
+ * ],
13825
+ * });
13826
+ * ```
13827
+ *
13828
+ * @__NO_SIDE_EFFECTS__
13829
+ */
13830
+ function declarePeerDependency(name, config) {
13831
+ return [name, config];
13832
+ }
13833
+
13834
+ /**
13835
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
13836
+ *
13837
+ * This source code is licensed under the MIT license found in the
13838
+ * LICENSE file in the root directory of this source tree.
13839
+ *
13840
+ */
13841
+
13842
+ /**
13843
+ * Explicitly and safely cast a value to a specific type when inference or
13844
+ * satisfies isn't going to work as expected (often useful for the config
13845
+ * property with {@link defineExtension})
13846
+ *
13847
+ * @__NO_SIDE_EFFECTS__
13848
+ */
13849
+ function safeCast(value) {
13850
+ return value;
13851
+ }
13852
+
13853
+ /**
13854
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
13855
+ *
13856
+ * This source code is licensed under the MIT license found in the
13857
+ * LICENSE file in the root directory of this source tree.
13858
+ *
13859
+ */
13860
+
13861
+ /**
13862
+ * The default merge strategy for extension configuration is a shallow merge.
13863
+ *
13864
+ * @param config - A full config
13865
+ * @param overrides - A partial config of overrides
13866
+ * @returns config if there are no overrides, otherwise `{...config, ...overrides}`
13867
+ */
13868
+ function shallowMergeConfig(config, overrides) {
13869
+ if (!overrides || config === overrides) {
13870
+ return config;
13871
+ }
13872
+ for (const k in overrides) {
13873
+ if (config[k] !== overrides[k]) {
13874
+ return {
13875
+ ...config,
13876
+ ...overrides
13877
+ };
13878
+ }
13879
+ }
13880
+ return config;
13881
+ }
13882
+
13678
13883
  exports.$addUpdateTag = $addUpdateTag;
13679
13884
  exports.$applyNodeReplacement = $applyNodeReplacement;
13680
13885
  exports.$caretFromPoint = $caretFromPoint;
@@ -13711,6 +13916,7 @@ exports.$getNearestNodeFromDOMNode = $getNearestNodeFromDOMNode;
13711
13916
  exports.$getNearestRootOrShadowRoot = $getNearestRootOrShadowRoot;
13712
13917
  exports.$getNodeByKey = $getNodeByKey;
13713
13918
  exports.$getNodeByKeyOrThrow = $getNodeByKeyOrThrow;
13919
+ exports.$getNodeFromDOMNode = $getNodeFromDOMNode;
13714
13920
  exports.$getPreviousSelection = $getPreviousSelection;
13715
13921
  exports.$getRoot = $getRoot;
13716
13922
  exports.$getSelection = $getSelection;
@@ -13728,6 +13934,7 @@ exports.$insertNodes = $insertNodes;
13728
13934
  exports.$isBlockElementNode = $isBlockElementNode;
13729
13935
  exports.$isChildCaret = $isChildCaret;
13730
13936
  exports.$isDecoratorNode = $isDecoratorNode;
13937
+ exports.$isEditorState = $isEditorState;
13731
13938
  exports.$isElementNode = $isElementNode;
13732
13939
  exports.$isExtendableTextPointCaret = $isExtendableTextPointCaret;
13733
13940
  exports.$isInlineElementOrDecoratorNode = $isInlineElementOrDecoratorNode;
@@ -13841,10 +14048,13 @@ exports.TabNode = TabNode;
13841
14048
  exports.TextNode = TextNode;
13842
14049
  exports.UNDO_COMMAND = UNDO_COMMAND;
13843
14050
  exports.buildImportMap = buildImportMap;
14051
+ exports.configExtension = configExtension;
13844
14052
  exports.createCommand = createCommand;
13845
14053
  exports.createEditor = createEditor;
13846
14054
  exports.createSharedNodeState = createSharedNodeState;
13847
14055
  exports.createState = createState;
14056
+ exports.declarePeerDependency = declarePeerDependency;
14057
+ exports.defineExtension = defineExtension;
13848
14058
  exports.flipDirection = flipDirection;
13849
14059
  exports.getDOMOwnerDocument = getDOMOwnerDocument;
13850
14060
  exports.getDOMSelection = getDOMSelection;
@@ -13873,5 +14083,7 @@ exports.isSelectionWithinEditor = isSelectionWithinEditor;
13873
14083
  exports.makeStepwiseIterator = makeStepwiseIterator;
13874
14084
  exports.removeFromParent = removeFromParent;
13875
14085
  exports.resetRandomKey = resetRandomKey;
14086
+ exports.safeCast = safeCast;
13876
14087
  exports.setDOMUnmanaged = setDOMUnmanaged;
13877
14088
  exports.setNodeIndentFromDOM = setNodeIndentFromDOM;
14089
+ exports.shallowMergeConfig = shallowMergeConfig;