@octane-xplat/lexical 0.0.1 → 0.10.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
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 Alec Larson
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
13
+ all 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
21
+ THE SOFTWARE.
package/README.md CHANGED
@@ -1,4 +1,86 @@
1
- # @octane-xplat/lexical
1
+ # `@octane-xplat/lexical`
2
2
 
3
- This is a placeholder stub published to reserve the package name ahead of the
4
- first automated release. It has no supported API.
3
+ The unified rich-text facade, lexical flavor: one `LexicalEditor` component
4
+ across web and native. Web renders a fixed-plugin `LexicalComposer` through
5
+ `@octanejs/lexical`; Android renders the `@octane-xplat/richtext` leaf
6
+ (WordPress Aztec on Android, iOS stub) and layers lexical serialized editor
7
+ state on top through the DOM-free slices (`lexical`, `@lexical/html`, the
8
+ Aztec-shaped node packages) with a `zeed-dom` parse shim. DOM-bound lexical code stays out of Android execution — divergence lives at the
9
+ file-suffix boundary.
10
+
11
+ ```tsx
12
+ import { useState } from 'octane'
13
+ import { LexicalEditor, supported } from '@octane-xplat/lexical'
14
+ import { Text } from '@octane-xplat/ui'
15
+
16
+ export function Notes() {
17
+ const [html, setHtml] = useState('<p>Trip notes</p>')
18
+ return supported ? (
19
+ <LexicalEditor value={html} onChange={setHtml} />
20
+ ) : (
21
+ <Text>Editing is unavailable on this target</Text>
22
+ )
23
+ }
24
+ ```
25
+
26
+ `value`/`onChange` exchange document HTML. `getJSON`/`setJSON` exchange
27
+ lexical serialized editor state (`EditorState.toJSON()`): synchronous on
28
+ web, bridged on Android after `onJSONReady(true)` — the lazy bridge reports
29
+ `false` (and `getJSON()` returns `null`) on runtimes that cannot host the
30
+ document-model modules. On Android, HTML is the canonical interchange
31
+ format; serialized state is a best-effort mapping.
32
+
33
+ ```tsx
34
+ import { useRef, useState } from 'octane'
35
+ import { LexicalEditor, type LexicalEditorHandle } from '@octane-xplat/lexical'
36
+ import { Button } from '@octane-xplat/ui'
37
+
38
+ export function DocumentCopy() {
39
+ const editor = useRef<LexicalEditorHandle | null>(null)
40
+ const [html, setHtml] = useState('<p>Trip notes</p>')
41
+ const [jsonReady, setJsonReady] = useState(false)
42
+ return (
43
+ <>
44
+ <LexicalEditor
45
+ value={html}
46
+ onChange={setHtml}
47
+ ref={(handle) => {
48
+ editor.current = handle
49
+ }}
50
+ onReady={() => setJsonReady(editor.current?.getJSON() != null)}
51
+ onJSONReady={setJsonReady}
52
+ />
53
+ <Button
54
+ isDisabled={!jsonReady}
55
+ onPress={() => {
56
+ const document = editor.current?.getJSON()
57
+ if (document) editor.current?.setJSON(document)
58
+ }}
59
+ >
60
+ Round-trip document
61
+ </Button>
62
+ </>
63
+ )
64
+ }
65
+ ```
66
+
67
+ The facade's plugin set is fixed on purpose. Apps needing custom nodes,
68
+ plugins, or transforms import `@octanejs/lexical` directly on web — the
69
+ facade does not expose a composer/plugin surface it cannot honor on
70
+ native. There is no live `LexicalEditor` on Android: no `dispatchCommand`,
71
+ no node transforms; `native` returns the `AztecText` and the headless
72
+ editor used for conversions is an internal detail.
73
+
74
+ The lexical family pins to `0.51.0` and `@octanejs/lexical` to `0.2.0`
75
+ (peers `octane ^0.6.0`). `@lexical/link` carries a workspace patch for its
76
+ ICU-dependent URL-matcher literal. See
77
+ [`docs/app/rich-text.md`](../../docs/app/rich-text.md) for the shared contract,
78
+ format vocabulary, and known limits.
79
+
80
+ ## macOS AppKit
81
+
82
+ The macOS export mounts a bundled local editor document in WKWebView.
83
+ RichText uses StarterKit; Tiptap and Lexical use their existing web facades.
84
+ Wait for `onReady`; synchronous getters return the latest received snapshot
85
+ and commands cross WebKit asynchronously. The `native` handle is the Swift
86
+ host transport. See [AppKit setup and engine limits](../../docs/rich-text.md#macos-appkit-editing).
@@ -0,0 +1 @@
1
+ declare const html: string; export default html