@lexical/list 0.44.1-nightly.20260519.0 → 0.45.1-dev.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.
@@ -7,25 +7,16 @@
7
7
  */
8
8
  import type { SerializedListItemNode } from './LexicalListItemNode';
9
9
  import type { ListNodeTagType, ListType, SerializedListNode } from './LexicalListNode';
10
- import type { LexicalCommand, LexicalEditor, NodeKey } from 'lexical';
10
+ import type { LexicalEditor } from 'lexical';
11
11
  import { INSERT_CHECK_LIST_COMMAND, registerCheckList } from './checkList';
12
12
  import { $handleListInsertParagraph, $insertList, $removeList } from './formatList';
13
13
  import { $createListItemNode, $isListItemNode, ListItemNode } from './LexicalListItemNode';
14
14
  import { $createListNode, $isListNode, ListNode } from './LexicalListNode';
15
15
  import { $getListDepth } from './utils';
16
+ export { type CheckListConfig, CheckListExtension, type ListConfig, ListExtension, } from './LexicalListExtension';
17
+ export { ListImportExtension, ListImportRules, ListSchema, } from './ListImportExtension';
18
+ export { INSERT_ORDERED_LIST_COMMAND, INSERT_UNORDERED_LIST_COMMAND, registerList, type RegisterListOptions, registerListStrictIndentTransform, REMOVE_LIST_COMMAND, UPDATE_LIST_START_COMMAND, } from './registerList';
16
19
  export { $createListItemNode, $createListNode, $getListDepth, $handleListInsertParagraph, $insertList, $isListItemNode, $isListNode, $removeList, INSERT_CHECK_LIST_COMMAND, ListItemNode, ListNode, ListNodeTagType, ListType, registerCheckList, SerializedListItemNode, SerializedListNode, };
17
- export declare const UPDATE_LIST_START_COMMAND: LexicalCommand<{
18
- listNodeKey: NodeKey;
19
- newStart: number;
20
- }>;
21
- export declare const INSERT_UNORDERED_LIST_COMMAND: LexicalCommand<void>;
22
- export declare const INSERT_ORDERED_LIST_COMMAND: LexicalCommand<void>;
23
- export declare const REMOVE_LIST_COMMAND: LexicalCommand<void>;
24
- export interface RegisterListOptions {
25
- restoreNumbering?: boolean;
26
- }
27
- export declare function registerList(editor: LexicalEditor, options?: RegisterListOptions): () => void;
28
- export declare function registerListStrictIndentTransform(editor: LexicalEditor): () => void;
29
20
  /**
30
21
  * @deprecated use {@link $insertList} from an update or command listener.
31
22
  *
@@ -49,27 +40,3 @@ export declare function insertList(editor: LexicalEditor, listType: ListType): v
49
40
  * @param editor - The lexical editor.
50
41
  */
51
42
  export declare function removeList(editor: LexicalEditor): void;
52
- export interface ListConfig {
53
- /**
54
- * When `true`, enforces strict indentation rules for list items, ensuring consistent structure.
55
- * When `false` (default), indentation is more flexible.
56
- */
57
- hasStrictIndent: boolean;
58
- shouldPreserveNumbering: boolean;
59
- }
60
- /**
61
- * Configures {@link ListNode}, {@link ListItemNode} and registers
62
- * the strict indent transform if `hasStrictIndent` is true (default false).
63
- */
64
- export declare const ListExtension: import("lexical").LexicalExtension<ListConfig, "@lexical/list/List", import("@lexical/extension").NamedSignalsOutput<ListConfig>, unknown>;
65
- export interface CheckListConfig {
66
- disableTakeFocusOnClick: boolean;
67
- }
68
- /**
69
- * Registers checklist functionality for {@link ListNode} and
70
- * {@link ListItemNode} with a
71
- * {@link INSERT_CHECK_LIST_COMMAND} listener and
72
- * the expected keyboard and mouse interactions for
73
- * checkboxes.
74
- */
75
- export declare const CheckListExtension: import("lexical").LexicalExtension<CheckListConfig, "@lexical/list/CheckList", import("@lexical/extension").NamedSignalsOutput<CheckListConfig>, unknown>;
@@ -0,0 +1,20 @@
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 { LexicalCommand, LexicalEditor, NodeKey } from 'lexical';
9
+ export declare const UPDATE_LIST_START_COMMAND: LexicalCommand<{
10
+ listNodeKey: NodeKey;
11
+ newStart: number;
12
+ }>;
13
+ export declare const INSERT_UNORDERED_LIST_COMMAND: LexicalCommand<void>;
14
+ export declare const INSERT_ORDERED_LIST_COMMAND: LexicalCommand<void>;
15
+ export declare const REMOVE_LIST_COMMAND: LexicalCommand<void>;
16
+ export interface RegisterListOptions {
17
+ restoreNumbering?: boolean;
18
+ }
19
+ export declare function registerList(editor: LexicalEditor, options?: RegisterListOptions): () => void;
20
+ export declare function registerListStrictIndentTransform(editor: LexicalEditor): () => void;
package/package.json CHANGED
@@ -8,36 +8,52 @@
8
8
  "list"
9
9
  ],
10
10
  "license": "MIT",
11
- "version": "0.44.1-nightly.20260519.0",
12
- "main": "LexicalList.js",
13
- "types": "index.d.ts",
11
+ "version": "0.45.1-dev.0",
12
+ "main": "./dist/LexicalList.js",
13
+ "types": "./dist/index.d.ts",
14
14
  "dependencies": {
15
- "@lexical/extension": "0.44.1-nightly.20260519.0",
16
- "@lexical/utils": "0.44.1-nightly.20260519.0",
17
- "lexical": "0.44.1-nightly.20260519.0"
15
+ "@lexical/extension": "0.45.1-dev.0",
16
+ "@lexical/internal": "0.45.1-dev.0",
17
+ "@lexical/html": "0.45.1-dev.0",
18
+ "@lexical/utils": "0.45.1-dev.0",
19
+ "lexical": "0.45.1-dev.0"
18
20
  },
19
21
  "repository": {
20
22
  "type": "git",
21
23
  "url": "git+https://github.com/facebook/lexical.git",
22
24
  "directory": "packages/lexical-list"
23
25
  },
24
- "module": "LexicalList.mjs",
26
+ "module": "./dist/LexicalList.mjs",
25
27
  "sideEffects": false,
26
28
  "exports": {
27
29
  ".": {
30
+ "source": "./src/index.ts",
28
31
  "import": {
29
- "types": "./index.d.ts",
30
- "development": "./LexicalList.dev.mjs",
31
- "production": "./LexicalList.prod.mjs",
32
- "node": "./LexicalList.node.mjs",
33
- "default": "./LexicalList.mjs"
32
+ "types": "./dist/index.d.ts",
33
+ "development": "./dist/LexicalList.dev.mjs",
34
+ "production": "./dist/LexicalList.prod.mjs",
35
+ "node": "./dist/LexicalList.node.mjs",
36
+ "default": "./dist/LexicalList.mjs"
34
37
  },
35
38
  "require": {
36
- "types": "./index.d.ts",
37
- "development": "./LexicalList.dev.js",
38
- "production": "./LexicalList.prod.js",
39
- "default": "./LexicalList.js"
39
+ "types": "./dist/index.d.ts",
40
+ "development": "./dist/LexicalList.dev.js",
41
+ "production": "./dist/LexicalList.prod.js",
42
+ "default": "./dist/LexicalList.js"
40
43
  }
41
44
  }
42
- }
45
+ },
46
+ "files": [
47
+ "dist",
48
+ "src",
49
+ "!src/__tests__",
50
+ "!src/__bench__",
51
+ "!src/__mocks__",
52
+ "!src/**/*.test.ts",
53
+ "!src/**/*.test.tsx",
54
+ "!src/**/*.bench.ts",
55
+ "!src/**/*.bench.tsx",
56
+ "README.md",
57
+ "LICENSE"
58
+ ]
43
59
  }
@@ -0,0 +1,76 @@
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
+ import {effect, namedSignals} from '@lexical/extension';
10
+ import {mergeRegister} from '@lexical/utils';
11
+ import {defineExtension, safeCast} from 'lexical';
12
+
13
+ import {registerCheckList} from './checkList';
14
+ import {ListItemNode} from './LexicalListItemNode';
15
+ import {ListNode} from './LexicalListNode';
16
+ import {registerList, registerListStrictIndentTransform} from './registerList';
17
+
18
+ export interface ListConfig {
19
+ /**
20
+ * When `true`, enforces strict indentation rules for list items, ensuring consistent structure.
21
+ * When `false` (default), indentation is more flexible.
22
+ */
23
+ hasStrictIndent: boolean;
24
+ shouldPreserveNumbering: boolean;
25
+ }
26
+
27
+ /**
28
+ * Configures {@link ListNode}, {@link ListItemNode} and registers
29
+ * the strict indent transform if `hasStrictIndent` is true (default false).
30
+ */
31
+ export const ListExtension = defineExtension({
32
+ build(editor, config, state) {
33
+ return namedSignals(config);
34
+ },
35
+ config: safeCast<ListConfig>({
36
+ hasStrictIndent: false,
37
+ shouldPreserveNumbering: false,
38
+ }),
39
+ name: '@lexical/list/List',
40
+ nodes: () => [ListNode, ListItemNode],
41
+ register(editor, config, state) {
42
+ const stores = state.getOutput();
43
+ return mergeRegister(
44
+ effect(() => {
45
+ return registerList(editor, {
46
+ restoreNumbering: stores.shouldPreserveNumbering.value,
47
+ });
48
+ }),
49
+ effect(() =>
50
+ stores.hasStrictIndent.value
51
+ ? registerListStrictIndentTransform(editor)
52
+ : undefined,
53
+ ),
54
+ );
55
+ },
56
+ });
57
+
58
+ export interface CheckListConfig {
59
+ disableTakeFocusOnClick: boolean;
60
+ }
61
+
62
+ /**
63
+ * Registers checklist functionality for {@link ListNode} and
64
+ * {@link ListItemNode} with a `INSERT_CHECK_LIST_COMMAND` listener and
65
+ * the expected keyboard and mouse interactions for checkboxes.
66
+ */
67
+ export const CheckListExtension = defineExtension({
68
+ build: (editor, config) => namedSignals(config),
69
+ config: safeCast<CheckListConfig>({
70
+ disableTakeFocusOnClick: false,
71
+ }),
72
+ dependencies: [ListExtension],
73
+ name: '@lexical/list/CheckList',
74
+ register: (editor, config, state) =>
75
+ registerCheckList(editor, state.getOutput()),
76
+ });