@lexical/react 0.50.1-nightly.20260916.0 → 0.51.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.
@@ -6,7 +6,7 @@
6
6
  *
7
7
  */
8
8
  import type { JSX } from 'react';
9
- import { DecoratorNode, type ElementFormatType, type LexicalNode, type LexicalUpdateJSON, type NodeKey, type SerializedLexicalNode, type Spread } from 'lexical';
9
+ import { DecoratorNode, type ElementFormatType, type LexicalNode, type LexicalParseJSON, type NodeKey, type SerializedLexicalNode, type SerializedPartial, type Spread } from 'lexical';
10
10
  /**
11
11
  * The serialized form of a {@link DecoratorBlockNode}: the base serialized node
12
12
  * data plus the block's element `format` (alignment).
@@ -14,6 +14,11 @@ import { DecoratorNode, type ElementFormatType, type LexicalNode, type LexicalUp
14
14
  export type SerializedDecoratorBlockNode = Spread<{
15
15
  format: ElementFormatType;
16
16
  }, SerializedLexicalNode>;
17
+ export interface DecoratorBlockNode {
18
+ exportJSON(compact?: false): SerializedDecoratorBlockNode;
19
+ exportJSON(compact: boolean): SerializedPartial<SerializedDecoratorBlockNode>;
20
+ updateFromJSON(serializedNode: LexicalParseJSON<SerializedDecoratorBlockNode>): this;
21
+ }
17
22
  /**
18
23
  * A base class for block-level {@link DecoratorNode}s (decorator nodes rendered
19
24
  * on their own line rather than inline). It stores an {@link ElementFormatType}
@@ -24,9 +29,13 @@ export type SerializedDecoratorBlockNode = Spread<{
24
29
  export declare class DecoratorBlockNode extends DecoratorNode<JSX.Element> {
25
30
  __format: ElementFormatType;
26
31
  constructor(format?: ElementFormatType, key?: NodeKey);
27
- afterCloneFrom(prevNode: this): void;
28
- exportJSON(): SerializedDecoratorBlockNode;
29
- updateFromJSON(serializedNode: LexicalUpdateJSON<SerializedDecoratorBlockNode>): this;
32
+ $config(): import("lexical").BaseStaticNodeConfig & import("lexical").StaticNodeConfigAccessor<{
33
+ readonly extends: typeof DecoratorNode;
34
+ readonly generated: import("lexical").GeneratedJSONFactory;
35
+ readonly json: import("lexical").NodeSerializationSchema<DecoratorBlockNode, {
36
+ readonly format?: "" | "left" | "start" | "center" | "right" | "end" | "justify" | undefined;
37
+ }>;
38
+ }>;
30
39
  canIndent(): false;
31
40
  createDOM(): HTMLElement;
32
41
  updateDOM(): false;
@@ -6,7 +6,69 @@
6
6
  *
7
7
  */
8
8
 
9
- import { DecoratorNode, $getDocument } from 'lexical';
9
+ import { DecoratorNode, $getDocument, nodeSchema, withField, enumValue } from 'lexical';
10
+
11
+ /**
12
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
13
+ *
14
+ * This source code is licensed under the MIT license found in the
15
+ * LICENSE file in the root directory of this source tree.
16
+ *
17
+ */
18
+
19
+ // @generated by scripts/generate-node-json.mjs from each class's `json`
20
+ // schema. Run `pnpm run generate-node-json` to regenerate; do not edit.
21
+
22
+ // Keys are emitted in the order the schema-driven walk writes them, so the two
23
+ // produce byte-identical JSON. That order is the schema's, not alphabetical.
24
+ /* eslint-disable sort-keys-fix/sort-keys-fix */
25
+
26
+ /**
27
+ * DecoratorBlockNode's schema-declared fields, for a clone. Generated from that
28
+ * schema; do not edit by hand.
29
+ *
30
+ * @internal
31
+ */
32
+ function afterCloneDecoratorBlockNode(node, prevNode) {
33
+ node.__format = prevNode.__format;
34
+ }
35
+
36
+ /** DecoratorBlockNode's generated implementations, for its `$config`. @internal */
37
+ const GENERATED_DECORATORBLOCK = () => {
38
+ /** Generated from DecoratorBlockNode's serialization schema. Do not edit by hand. */
39
+ function exportDecoratorBlockNode(node) {
40
+ return {
41
+ format: node.__format,
42
+ type: node.__type,
43
+ version: 1
44
+ };
45
+ }
46
+
47
+ /** Generated from DecoratorBlockNode's serialization schema. Do not edit by hand. */
48
+ function exportCompactDecoratorBlockNode(node) {
49
+ const json = {
50
+ type: node.__type
51
+ };
52
+ const format = node.__format;
53
+ if (format !== undefined && format !== '') {
54
+ json.format = format;
55
+ }
56
+ return json;
57
+ }
58
+
59
+ /** Generated from DecoratorBlockNode's serialization schema. Do not edit by hand. */
60
+ function updateDecoratorBlockNode(node, json) {
61
+ const format = json.format;
62
+ node.__format = format === '' || format === 'left' || format === 'start' || format === 'center' || format === 'right' || format === 'end' || format === 'justify' ? format : '';
63
+ return node;
64
+ }
65
+ return {
66
+ exportJSON: exportDecoratorBlockNode,
67
+ exportCompactJSON: exportCompactDecoratorBlockNode,
68
+ updateFromJSON: updateDecoratorBlockNode,
69
+ afterCloneFrom: afterCloneDecoratorBlockNode
70
+ };
71
+ };
10
72
 
11
73
  /**
12
74
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -22,6 +84,19 @@ import { DecoratorNode, $getDocument } from 'lexical';
22
84
  * data plus the block's element `format` (alignment).
23
85
  */
24
86
 
87
+ // Single source of truth for parsing the node-specific properties of a
88
+ // SerializedDecoratorBlockNode. DecoratorBlockNode is an abstract base (it has
89
+ // no concrete node type) so it publishes its schema on `$config` under the
90
+ // well-known `Symbol.for('DecoratorBlockNode')` key; concrete subclasses
91
+ // compose it with their own.
92
+ const decoratorBlockNodeSchema = /* @__PURE__ */nodeSchema()({
93
+ format: /* @__PURE__ */withField(/* @__PURE__ */enumValue(['', 'left', 'start', 'center', 'right', 'end', 'justify']), {
94
+ field: '__format'
95
+ })
96
+ });
97
+
98
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
99
+
25
100
  /**
26
101
  * A base class for block-level {@link DecoratorNode}s (decorator nodes rendered
27
102
  * on their own line rather than inline). It stores an {@link ElementFormatType}
@@ -29,24 +104,25 @@ import { DecoratorNode, $getDocument } from 'lexical';
29
104
  * block embeds such as images, videos, or tweets, typically pairing it with
30
105
  * {@link BlockWithAlignableContents} to handle selection and alignment.
31
106
  */
107
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
32
108
  class DecoratorBlockNode extends DecoratorNode {
33
109
  __format;
34
110
  constructor(format, key) {
35
111
  super(key);
36
112
  this.__format = format || '';
37
113
  }
38
- afterCloneFrom(prevNode) {
39
- super.afterCloneFrom(prevNode);
40
- this.__format = prevNode.__format;
41
- }
42
- exportJSON() {
43
- return {
44
- ...super.exportJSON(),
45
- format: this.__format || ''
46
- };
47
- }
48
- updateFromJSON(serializedNode) {
49
- return super.updateFromJSON(serializedNode).setFormat(serializedNode.format || '');
114
+ $config() {
115
+ return this.config(Symbol.for('DecoratorBlockNode'), {
116
+ // Named explicitly, as every abstract config in the tree is: this class
117
+ // carries the only declaration of `format` that its concrete subclasses
118
+ // inherit, and composeSchema honors an explicit `extends` where a
119
+ // severed static prototype chain (Babel's loose class transform) would
120
+ // otherwise stop the walk here and drop the property from both
121
+ // directions.
122
+ extends: DecoratorNode,
123
+ generated: GENERATED_DECORATORBLOCK,
124
+ json: decoratorBlockNodeSchema
125
+ });
50
126
  }
51
127
  canIndent() {
52
128
  return false;
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- import{DecoratorNode as t,$getDocument as r}from"lexical";class e extends t{__format;constructor(t,r){super(r),this.__format=t||""}afterCloneFrom(t){super.afterCloneFrom(t),this.__format=t.__format}exportJSON(){return{...super.exportJSON(),format:this.__format||""}}updateFromJSON(t){return super.updateFromJSON(t).setFormat(t.format||"")}canIndent(){return!1}createDOM(){return r().createElement("div")}updateDOM(){return!1}setFormat(t){const r=this.getWritable();return r.__format=t,r}getFormat(){return this.getLatest().__format}isInline(){return!1}}function o(t){return t instanceof e}export{o as $isDecoratorBlockNode,e as DecoratorBlockNode};
9
+ import{DecoratorNode as t,$getDocument as r,nodeSchema as e,withField as o,enumValue as n}from"lexical";function a(t,r){t.__format=r.__format}const f=()=>({exportJSON:function(t){return{format:t.__format,type:t.__type,version:1}},exportCompactJSON:function(t){const r={type:t.__type},e=t.__format;return void 0!==e&&""!==e&&(r.format=e),r},updateFromJSON:function(t,r){const e=r.format;return t.__format=""===e||"left"===e||"start"===e||"center"===e||"right"===e||"end"===e||"justify"===e?e:"",t},afterCloneFrom:a}),i=/* @__PURE__ */e()({format:/* @__PURE__ */o(/* @__PURE__ */n(["","left","start","center","right","end","justify"]),{field:"__format"})});class c extends t{__format;constructor(t,r){super(r),this.__format=t||""}$config(){return this.config(Symbol.for("DecoratorBlockNode"),{extends:t,generated:f,json:i})}canIndent(){return!1}createDOM(){return r().createElement("div")}updateDOM(){return!1}setFormat(t){const r=this.getWritable();return r.__format=t,r}getFormat(){return this.getLatest().__format}isInline(){return!1}}function s(t){return t instanceof c}export{s as $isDecoratorBlockNode,c as DecoratorBlockNode};
@@ -15,6 +15,25 @@ export { $isHorizontalRuleNode, INSERT_HORIZONTAL_RULE_COMMAND, type SerializedH
15
15
  export declare class HorizontalRuleNode extends BaseHorizontalRuleNode {
16
16
  $config(): import("lexical").BaseStaticNodeConfig & {
17
17
  readonly horizontalrule?: {
18
+ readonly extends: typeof import("lexical").DecoratorNode;
19
+ readonly importDOM: {
20
+ readonly hr: () => {
21
+ conversion: () => DOMConversionOutput;
22
+ priority: 0;
23
+ };
24
+ };
25
+ } | undefined;
26
+ } & import("lexical").StaticNodeTypeAccessor<"horizontalrule"> & import("lexical").StaticNodeConfigAccessor<{
27
+ readonly extends: typeof import("lexical").DecoratorNode;
28
+ readonly importDOM: {
29
+ readonly hr: () => {
30
+ conversion: () => DOMConversionOutput;
31
+ priority: 0;
32
+ };
33
+ };
34
+ }> & {
35
+ readonly horizontalrule?: {
36
+ readonly extends: typeof BaseHorizontalRuleNode;
18
37
  readonly importDOM: {
19
38
  readonly hr: () => {
20
39
  conversion: typeof $convertHorizontalRuleElement;
@@ -22,7 +41,15 @@ export declare class HorizontalRuleNode extends BaseHorizontalRuleNode {
22
41
  };
23
42
  };
24
43
  } | undefined;
25
- };
44
+ } & import("lexical").StaticNodeConfigAccessor<{
45
+ readonly extends: typeof BaseHorizontalRuleNode;
46
+ readonly importDOM: {
47
+ readonly hr: () => {
48
+ conversion: typeof $convertHorizontalRuleElement;
49
+ priority: 0;
50
+ };
51
+ };
52
+ }>;
26
53
  decorate(): JSX.Element;
27
54
  }
28
55
  declare function $convertHorizontalRuleElement(): DOMConversionOutput;
@@ -59,11 +59,12 @@ function HorizontalRuleComponent({
59
59
  */
60
60
  class HorizontalRuleNode extends HorizontalRuleNode$1 {
61
61
  $config() {
62
- // `extends` is left to the runtime default (the prototype parent,
63
- // BaseHorizontalRuleNode) so this deprecated subclass infers a `$config()`
64
- // shape compatible with the base node it reuses the 'horizontalrule' type
65
- // from.
62
+ // Named rather than left to the runtime default, for the reason the base
63
+ // node names its own: it is what carries this config on the record the
64
+ // composed serialization types walk. The shape still matches the base
65
+ // node's, whose 'horizontalrule' type this deprecated subclass reuses.
66
66
  return this.config('horizontalrule', {
67
+ extends: HorizontalRuleNode$1,
67
68
  importDOM: {
68
69
  hr: () => ({
69
70
  conversion: $convertHorizontalRuleElement,
@@ -6,5 +6,5 @@
6
6
  *
7
7
  */
8
8
 
9
- import{HorizontalRuleNode as e}from"@lexical/extension/HorizontalRuleExtension";export{$isHorizontalRuleNode,INSERT_HORIZONTAL_RULE_COMMAND}from"@lexical/extension/HorizontalRuleExtension";import{useLexicalComposerContext as o}from"@lexical/react/LexicalComposerContext";import{useLexicalNodeSelection as t}from"@lexical/react/useLexicalNodeSelection";import{$applyNodeReplacement as r,mergeRegister as n,CLICK_COMMAND as i,getComposedEventTarget as l,COMMAND_PRIORITY_LOW as c,addClassNamesToElement as m,removeClassNamesFromElement as s}from"lexical";import{useEffect as a}from"react";import{jsx as u}from"react/jsx-runtime";function x({nodeKey:e}){const[r]=o(),[u,x,f]=t(e);return a(()=>n(r.registerCommand(i,o=>{const t=r.getElementByKey(e);return l(o)===t&&(o.shiftKey||f(),x(!u),!0)},c)),[f,r,u,e,x]),a(()=>{const o=r.getElementByKey(e),t=r._config.theme.hrSelected??"selected";null!==o&&(u?m(o,t):s(o,t))},[r,u,e]),null}class f extends e{$config(){return this.config("horizontalrule",{importDOM:{hr:()=>({conversion:d,priority:0})}})}decorate(){
9
+ import{HorizontalRuleNode as e}from"@lexical/extension/HorizontalRuleExtension";export{$isHorizontalRuleNode,INSERT_HORIZONTAL_RULE_COMMAND}from"@lexical/extension/HorizontalRuleExtension";import{useLexicalComposerContext as o}from"@lexical/react/LexicalComposerContext";import{useLexicalNodeSelection as t}from"@lexical/react/useLexicalNodeSelection";import{$applyNodeReplacement as r,mergeRegister as n,CLICK_COMMAND as i,getComposedEventTarget as l,COMMAND_PRIORITY_LOW as c,addClassNamesToElement as s,removeClassNamesFromElement as m}from"lexical";import{useEffect as a}from"react";import{jsx as u}from"react/jsx-runtime";function x({nodeKey:e}){const[r]=o(),[u,x,f]=t(e);return a(()=>n(r.registerCommand(i,o=>{const t=r.getElementByKey(e);return l(o)===t&&(o.shiftKey||f(),x(!u),!0)},c)),[f,r,u,e,x]),a(()=>{const o=r.getElementByKey(e),t=r._config.theme.hrSelected??"selected";null!==o&&(u?s(o,t):m(o,t))},[r,u,e]),null}class f extends e{$config(){return this.config("horizontalrule",{extends:e,importDOM:{hr:()=>({conversion:d,priority:0})}})}decorate(){
10
10
  return u(x,{nodeKey:this.__key})}}function d(){return{node:p()}}function p(){return r(new f)}export{p as $createHorizontalRuleNode,f as HorizontalRuleNode};
@@ -10,3 +10,12 @@
10
10
  /**
11
11
  * LexicalReactProviderExtension
12
12
  */
13
+
14
+ import type {ExtensionConfigBase, LexicalExtension} from 'lexical';
15
+
16
+ declare export var ReactProviderExtension: LexicalExtension<
17
+ ExtensionConfigBase,
18
+ '@lexical/react/ReactProvider',
19
+ void,
20
+ void,
21
+ >;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import type { DecoratorBlockNode } from '../LexicalDecoratorBlockNode.js';
9
+ import type { GeneratedJSONFactory } from 'lexical';
10
+ /**
11
+ * DecoratorBlockNode's schema-declared fields, for a clone. Generated from that
12
+ * schema; do not edit by hand.
13
+ *
14
+ * @internal
15
+ */
16
+ export declare function afterCloneDecoratorBlockNode(node: DecoratorBlockNode, prevNode: DecoratorBlockNode): void;
17
+ /** DecoratorBlockNode's generated implementations, for its `$config`. @internal */
18
+ export declare const GENERATED_DECORATORBLOCK: GeneratedJSONFactory;
package/package.json CHANGED
@@ -8,28 +8,28 @@
8
8
  "rich-text"
9
9
  ],
10
10
  "license": "MIT",
11
- "version": "0.50.1-nightly.20260916.0",
11
+ "version": "0.51.0",
12
12
  "dependencies": {
13
13
  "@floating-ui/react": "^0.27.19",
14
- "@lexical/a11y": "0.50.1-nightly.20260916.0",
15
- "@lexical/devtools-core": "0.50.1-nightly.20260916.0",
16
- "@lexical/dragon": "0.50.1-nightly.20260916.0",
17
- "@lexical/extension": "0.50.1-nightly.20260916.0",
18
- "@lexical/hashtag": "0.50.1-nightly.20260916.0",
19
- "@lexical/history": "0.50.1-nightly.20260916.0",
20
- "@lexical/internal": "0.50.1-nightly.20260916.0",
21
- "@lexical/link": "0.50.1-nightly.20260916.0",
22
- "@lexical/list": "0.50.1-nightly.20260916.0",
23
- "@lexical/mark": "0.50.1-nightly.20260916.0",
24
- "@lexical/markdown": "0.50.1-nightly.20260916.0",
25
- "@lexical/overflow": "0.50.1-nightly.20260916.0",
26
- "@lexical/plain-text": "0.50.1-nightly.20260916.0",
27
- "@lexical/rich-text": "0.50.1-nightly.20260916.0",
28
- "@lexical/table": "0.50.1-nightly.20260916.0",
29
- "@lexical/text": "0.50.1-nightly.20260916.0",
30
- "@lexical/utils": "0.50.1-nightly.20260916.0",
31
- "@lexical/yjs": "0.50.1-nightly.20260916.0",
32
- "lexical": "0.50.1-nightly.20260916.0"
14
+ "@lexical/a11y": "0.51.0",
15
+ "@lexical/devtools-core": "0.51.0",
16
+ "@lexical/dragon": "0.51.0",
17
+ "@lexical/extension": "0.51.0",
18
+ "@lexical/hashtag": "0.51.0",
19
+ "@lexical/history": "0.51.0",
20
+ "@lexical/internal": "0.51.0",
21
+ "@lexical/link": "0.51.0",
22
+ "@lexical/list": "0.51.0",
23
+ "@lexical/mark": "0.51.0",
24
+ "@lexical/markdown": "0.51.0",
25
+ "@lexical/overflow": "0.51.0",
26
+ "@lexical/plain-text": "0.51.0",
27
+ "@lexical/rich-text": "0.51.0",
28
+ "@lexical/table": "0.51.0",
29
+ "@lexical/text": "0.51.0",
30
+ "@lexical/utils": "0.51.0",
31
+ "@lexical/yjs": "0.51.0",
32
+ "lexical": "0.51.0"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "react": ">=18.x",
@@ -12,13 +12,19 @@ import {
12
12
  $getDocument,
13
13
  DecoratorNode,
14
14
  type ElementFormatType,
15
+ enumValue,
15
16
  type LexicalNode,
16
- type LexicalUpdateJSON,
17
+ type LexicalParseJSON,
17
18
  type NodeKey,
19
+ nodeSchema,
18
20
  type SerializedLexicalNode,
21
+ type SerializedPartial,
19
22
  type Spread,
23
+ withField,
20
24
  } from 'lexical';
21
25
 
26
+ import {GENERATED_DECORATORBLOCK} from './shared/LexicalReactGeneratedJSON';
27
+
22
28
  /**
23
29
  * The serialized form of a {@link DecoratorBlockNode}: the base serialized node
24
30
  * data plus the block's element `format` (alignment).
@@ -30,6 +36,27 @@ export type SerializedDecoratorBlockNode = Spread<
30
36
  SerializedLexicalNode
31
37
  >;
32
38
 
39
+ // Single source of truth for parsing the node-specific properties of a
40
+ // SerializedDecoratorBlockNode. DecoratorBlockNode is an abstract base (it has
41
+ // no concrete node type) so it publishes its schema on `$config` under the
42
+ // well-known `Symbol.for('DecoratorBlockNode')` key; concrete subclasses
43
+ // compose it with their own.
44
+ const decoratorBlockNodeSchema = nodeSchema<DecoratorBlockNode>()({
45
+ format: withField(
46
+ enumValue(['', 'left', 'start', 'center', 'right', 'end', 'justify']),
47
+ {field: '__format'},
48
+ ),
49
+ });
50
+
51
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
52
+ export interface DecoratorBlockNode {
53
+ exportJSON(compact?: false): SerializedDecoratorBlockNode;
54
+ exportJSON(compact: boolean): SerializedPartial<SerializedDecoratorBlockNode>;
55
+ updateFromJSON(
56
+ serializedNode: LexicalParseJSON<SerializedDecoratorBlockNode>,
57
+ ): this;
58
+ }
59
+
33
60
  /**
34
61
  * A base class for block-level {@link DecoratorNode}s (decorator nodes rendered
35
62
  * on their own line rather than inline). It stores an {@link ElementFormatType}
@@ -37,6 +64,7 @@ export type SerializedDecoratorBlockNode = Spread<
37
64
  * block embeds such as images, videos, or tweets, typically pairing it with
38
65
  * {@link BlockWithAlignableContents} to handle selection and alignment.
39
66
  */
67
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
40
68
  export class DecoratorBlockNode extends DecoratorNode<JSX.Element> {
41
69
  __format: ElementFormatType;
42
70
 
@@ -45,24 +73,18 @@ export class DecoratorBlockNode extends DecoratorNode<JSX.Element> {
45
73
  this.__format = format || '';
46
74
  }
47
75
 
48
- afterCloneFrom(prevNode: this): void {
49
- super.afterCloneFrom(prevNode);
50
- this.__format = prevNode.__format;
51
- }
52
-
53
- exportJSON(): SerializedDecoratorBlockNode {
54
- return {
55
- ...super.exportJSON(),
56
- format: this.__format || '',
57
- };
58
- }
59
-
60
- updateFromJSON(
61
- serializedNode: LexicalUpdateJSON<SerializedDecoratorBlockNode>,
62
- ): this {
63
- return super
64
- .updateFromJSON(serializedNode)
65
- .setFormat(serializedNode.format || '');
76
+ $config() {
77
+ return this.config(Symbol.for('DecoratorBlockNode'), {
78
+ // Named explicitly, as every abstract config in the tree is: this class
79
+ // carries the only declaration of `format` that its concrete subclasses
80
+ // inherit, and composeSchema honors an explicit `extends` where a
81
+ // severed static prototype chain (Babel's loose class transform) would
82
+ // otherwise stop the walk here and drop the property from both
83
+ // directions.
84
+ extends: DecoratorNode,
85
+ generated: GENERATED_DECORATORBLOCK,
86
+ json: decoratorBlockNodeSchema,
87
+ });
66
88
  }
67
89
 
68
90
  canIndent(): false {
@@ -82,11 +82,12 @@ function HorizontalRuleComponent({nodeKey}: {nodeKey: NodeKey}) {
82
82
  */
83
83
  export class HorizontalRuleNode extends BaseHorizontalRuleNode {
84
84
  $config() {
85
- // `extends` is left to the runtime default (the prototype parent,
86
- // BaseHorizontalRuleNode) so this deprecated subclass infers a `$config()`
87
- // shape compatible with the base node it reuses the 'horizontalrule' type
88
- // from.
85
+ // Named rather than left to the runtime default, for the reason the base
86
+ // node names its own: it is what carries this config on the record the
87
+ // composed serialization types walk. The shape still matches the base
88
+ // node's, whose 'horizontalrule' type this deprecated subclass reuses.
89
89
  return this.config('horizontalrule', {
90
+ extends: BaseHorizontalRuleNode,
90
91
  importDOM: {
91
92
  hr: () => ({
92
93
  conversion: $convertHorizontalRuleElement,
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ // @generated by scripts/generate-node-json.mjs from each class's `json`
10
+ // schema. Run `pnpm run generate-node-json` to regenerate; do not edit.
11
+
12
+ // Keys are emitted in the order the schema-driven walk writes them, so the two
13
+ // produce byte-identical JSON. That order is the schema's, not alphabetical.
14
+ /* eslint-disable sort-keys-fix/sort-keys-fix */
15
+
16
+ import type {DecoratorBlockNode} from '../LexicalDecoratorBlockNode';
17
+ import type {GeneratedJSONFactory} from 'lexical';
18
+
19
+ /**
20
+ * DecoratorBlockNode's schema-declared fields, for a clone. Generated from that
21
+ * schema; do not edit by hand.
22
+ *
23
+ * @internal
24
+ */
25
+ export function afterCloneDecoratorBlockNode(
26
+ node: DecoratorBlockNode,
27
+ prevNode: DecoratorBlockNode,
28
+ ): void {
29
+ node.__format = prevNode.__format;
30
+ }
31
+
32
+ /** DecoratorBlockNode's generated implementations, for its `$config`. @internal */
33
+ export const GENERATED_DECORATORBLOCK: GeneratedJSONFactory = () => {
34
+ /** Generated from DecoratorBlockNode's serialization schema. Do not edit by hand. */
35
+ function exportDecoratorBlockNode(node: DecoratorBlockNode): {
36
+ [key: string]: unknown;
37
+ } {
38
+ return {
39
+ format: node.__format,
40
+ type: node.__type,
41
+ version: 1,
42
+ };
43
+ }
44
+
45
+ /** Generated from DecoratorBlockNode's serialization schema. Do not edit by hand. */
46
+ function exportCompactDecoratorBlockNode(node: DecoratorBlockNode): {
47
+ [key: string]: unknown;
48
+ } {
49
+ const json: {[key: string]: unknown} = {type: node.__type};
50
+ const format = node.__format;
51
+ if (format !== undefined && format !== '') {
52
+ json.format = format;
53
+ }
54
+ return json;
55
+ }
56
+
57
+ /** Generated from DecoratorBlockNode's serialization schema. Do not edit by hand. */
58
+ function updateDecoratorBlockNode(
59
+ node: DecoratorBlockNode,
60
+ json: {readonly [key: string]: unknown},
61
+ ): DecoratorBlockNode {
62
+ const format = json.format;
63
+ node.__format =
64
+ format === '' ||
65
+ format === 'left' ||
66
+ format === 'start' ||
67
+ format === 'center' ||
68
+ format === 'right' ||
69
+ format === 'end' ||
70
+ format === 'justify'
71
+ ? format
72
+ : '';
73
+ return node;
74
+ }
75
+
76
+ return {
77
+ exportJSON: exportDecoratorBlockNode,
78
+ exportCompactJSON: exportCompactDecoratorBlockNode,
79
+ updateFromJSON: updateDecoratorBlockNode,
80
+ afterCloneFrom: afterCloneDecoratorBlockNode,
81
+ };
82
+ };