@echozedlabs/wysiwyg-lexical 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Eric Zimmerman (echozed)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # @echozedlabs/wysiwyg-lexical
2
+
3
+ Lexical-powered rich-text (WYSIWYG) Markdown surface with a formatting toolbar and Markdown ↔ rich-text transformers, for the [echozed markdown editor](https://github.com/echozulucode/markdown-editor).
4
+
5
+ Most consumers should install [`@echozedlabs/react`](https://www.npmjs.com/package/@echozedlabs/react), which wires this surface into the full multi-mode editor. `react` and `react-dom` (>=18.2) are peer dependencies.
6
+
7
+ Ships a stylesheet: `import '@echozedlabs/wysiwyg-lexical/styles.css'`.
8
+
9
+ ## License
10
+
11
+ [MIT](https://github.com/echozulucode/markdown-editor/blob/main/LICENSE) © Eric Zimmerman (echozed)
@@ -0,0 +1,53 @@
1
+ import React from 'react';
2
+ import type { ChangeMeta, MarkdownDiagnostic } from '@echozedlabs/core';
3
+ export type WysiwygTableAction = 'insert-row' | 'insert-column' | 'delete-row' | 'delete-column';
4
+ interface WysiwygRenderServices {
5
+ renderPlantUml?: (source: string, context: {
6
+ signal?: AbortSignal;
7
+ }) => Promise<{
8
+ html: string;
9
+ diagnostics?: MarkdownDiagnostic[];
10
+ }> | {
11
+ html: string;
12
+ diagnostics?: MarkdownDiagnostic[];
13
+ };
14
+ reportDiagnostics?: (diagnostics: MarkdownDiagnostic[]) => void;
15
+ }
16
+ export type WysiwygToolbarIconKey = 'bold' | 'italic' | 'inlineCode' | 'bulletedList' | 'numberedList' | 'checkboxList';
17
+ export type WysiwygToolbarIcons = Partial<Record<WysiwygToolbarIconKey, React.ReactNode>>;
18
+ export interface WysiwygLexicalEditorProps {
19
+ markdown: string;
20
+ readOnly?: boolean;
21
+ ariaLabel?: string;
22
+ placeholder?: string;
23
+ renderServices?: WysiwygRenderServices;
24
+ toolbarIcons?: WysiwygToolbarIcons;
25
+ onChange?: (markdown: string, meta: ChangeMeta) => void;
26
+ onDiagnostics?: (diagnostics: MarkdownDiagnostic[]) => void;
27
+ }
28
+ export declare function WysiwygLexicalEditor({ markdown, readOnly, ariaLabel, placeholder, renderServices, toolbarIcons, onChange, onDiagnostics, }: WysiwygLexicalEditorProps): React.ReactElement;
29
+ export declare function roundTripWysiwygMarkdown(markdown: string): string;
30
+ export interface WysiwygMarkdownListSummary {
31
+ type: 'list';
32
+ listType: 'number' | 'bullet' | 'check';
33
+ items: Array<{
34
+ checked: boolean | undefined;
35
+ text: string;
36
+ }>;
37
+ }
38
+ export interface WysiwygMarkdownTableSummary {
39
+ type: 'table';
40
+ rows: string[][];
41
+ }
42
+ export interface WysiwygTableActionTarget {
43
+ rowIndex?: number;
44
+ columnIndex?: number;
45
+ }
46
+ /** @internal Test-only semantic inspection helper; not part of the stable package API. */
47
+ export declare function inspectWysiwygMarkdownForTests(markdown: string): WysiwygMarkdownListSummary[];
48
+ /** @internal Test-only semantic inspection helper; not part of the stable package API. */
49
+ export declare function inspectWysiwygMarkdownTablesForTests(markdown: string): WysiwygMarkdownTableSummary[];
50
+ /** @internal Test-only table action helper; not part of the stable package API. */
51
+ export declare function applyWysiwygTableActionForTests(markdown: string, action: WysiwygTableAction, target?: WysiwygTableActionTarget): string;
52
+ export {};
53
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAmF1B,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAYxE,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,eAAe,GAAG,YAAY,GAAG,eAAe,CAAC;AAQjG,UAAU,qBAAqB;IAC7B,cAAc,CAAC,EAAE,CACf,MAAM,EAAE,MAAM,EACd,OAAO,EAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,KAC9B,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,kBAAkB,EAAE,CAAA;KAAE,CAAC,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,kBAAkB,EAAE,CAAA;KAAE,CAAC;IAC1H,iBAAiB,CAAC,EAAE,CAAC,WAAW,EAAE,kBAAkB,EAAE,KAAK,IAAI,CAAC;CACjE;AAueD,MAAM,MAAM,qBAAqB,GAC7B,MAAM,GACN,QAAQ,GACR,YAAY,GACZ,cAAc,GACd,cAAc,GACd,cAAc,CAAC;AAEnB,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,qBAAqB,EAAE,KAAK,CAAC,SAAS,CAAC,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