@mache-hangar/lunar-editor-react 0.0.0-stage → 0.0.3

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.
Files changed (78) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +128 -2
  3. package/THIRD_PARTY_NOTICES.md +58 -0
  4. package/dist/code-editor-Cq33u9jq.cjs +2 -0
  5. package/dist/code-editor-Cq33u9jq.cjs.map +1 -0
  6. package/dist/code-editor-um45ekRh.js +78 -0
  7. package/dist/code-editor-um45ekRh.js.map +1 -0
  8. package/dist/code-editor.cjs +2 -0
  9. package/dist/code-editor.cjs.map +1 -0
  10. package/dist/code-editor.js +8 -0
  11. package/dist/code-editor.js.map +1 -0
  12. package/dist/extensions/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  13. package/dist/extensions/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
  14. package/dist/extensions/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  15. package/dist/extensions/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  16. package/dist/extensions/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  17. package/dist/extensions/fonts/KaTeX_Main-Bold.woff2 +0 -0
  18. package/dist/extensions/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
  19. package/dist/extensions/fonts/KaTeX_Main-Italic.woff2 +0 -0
  20. package/dist/extensions/fonts/KaTeX_Main-Regular.woff2 +0 -0
  21. package/dist/extensions/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  22. package/dist/extensions/fonts/KaTeX_Math-Italic.woff2 +0 -0
  23. package/dist/extensions/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  24. package/dist/extensions/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  25. package/dist/extensions/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  26. package/dist/extensions/fonts/KaTeX_Script-Regular.woff2 +0 -0
  27. package/dist/extensions/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  28. package/dist/extensions/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  29. package/dist/extensions/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  30. package/dist/extensions/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  31. package/dist/extensions/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  32. package/dist/extensions/math/index.cjs +2 -0
  33. package/dist/extensions/math/index.cjs.map +1 -0
  34. package/dist/extensions/math/index.js +285 -0
  35. package/dist/extensions/math/index.js.map +1 -0
  36. package/dist/extensions/math.css +1 -0
  37. package/dist/extensions/table/index.cjs +2 -0
  38. package/dist/extensions/table/index.cjs.map +1 -0
  39. package/dist/extensions/table/index.js +838 -0
  40. package/dist/extensions/table/index.js.map +1 -0
  41. package/dist/extensions/table-ui/index.cjs +2 -0
  42. package/dist/extensions/table-ui/index.cjs.map +1 -0
  43. package/dist/extensions/table-ui/index.js +531 -0
  44. package/dist/extensions/table-ui/index.js.map +1 -0
  45. package/dist/extensions/table-ui.css +1 -0
  46. package/dist/extensions/table.css +1 -0
  47. package/dist/index.cjs +2 -0
  48. package/dist/index.cjs.map +1 -0
  49. package/dist/index.js +10 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/rich-editor.cjs +2 -0
  52. package/dist/rich-editor.cjs.map +1 -0
  53. package/dist/rich-editor.js +67 -0
  54. package/dist/rich-editor.js.map +1 -0
  55. package/dist/styles.css +1 -0
  56. package/dist/types/code-editor-types.d.ts +5 -0
  57. package/dist/types/code-editor.d.ts +6 -0
  58. package/dist/types/controller-hooks.d.ts +6 -0
  59. package/dist/types/extensions/math/index.d.ts +3 -0
  60. package/dist/types/extensions/math/math-input.d.ts +4 -0
  61. package/dist/types/extensions/math/math-node-view.d.ts +27 -0
  62. package/dist/types/extensions/math/nodes.d.ts +9 -0
  63. package/dist/types/extensions/table/cell-drag.d.ts +14 -0
  64. package/dist/types/extensions/table/column-layout.d.ts +9 -0
  65. package/dist/types/extensions/table/commands.d.ts +67 -0
  66. package/dist/types/extensions/table/grid.d.ts +49 -0
  67. package/dist/types/extensions/table/index.d.ts +6 -0
  68. package/dist/types/extensions/table/interaction.d.ts +6 -0
  69. package/dist/types/extensions/table/resize-transaction.d.ts +4 -0
  70. package/dist/types/extensions/table/selection-state.d.ts +3 -0
  71. package/dist/types/extensions/table/table-node-view.d.ts +30 -0
  72. package/dist/types/extensions/table-ui/TableProperties.d.ts +9 -0
  73. package/dist/types/extensions/table-ui/TableTools.d.ts +14 -0
  74. package/dist/types/extensions/table-ui/index.d.ts +2 -0
  75. package/dist/types/extensions/table-ui/useTableOverlay.d.ts +24 -0
  76. package/dist/types/index.d.ts +5 -0
  77. package/dist/types/rich-editor.d.ts +25 -0
  78. package/package.json +95 -3
@@ -0,0 +1 @@
1
+ .lunar-editor__document .lunar-table-scroll{position:relative;box-sizing:border-box;width:100%;max-width:100%;overflow-x:auto;overflow-y:hidden}.lunar-editor__document .lunar-table-scroll--fixed>table>:is(thead,tbody,tfoot)>tr>:is(td,th),.lunar-editor__document .lunar-table-scroll--fixed>table>tr>:is(td,th){min-width:0;max-width:none}.lunar-editor__document .lunar-table-resize-controls{position:absolute;inset:0;pointer-events:none}.lunar-editor__document .lunar-table-scroll>.lunar-table-resize-controls,.lunar-editor__document .lunar-table-scroll>.lunar-table-resize-controls>.lunar-table-column-handle{box-sizing:border-box;margin:0;padding:0;border:0;min-width:0;min-height:0}.lunar-editor__document[contenteditable=false] .lunar-table-resize-controls{display:none}.lunar-editor__document .lunar-table-column-handle{position:absolute;z-index:3;width:10px;transform:translateX(-50%);cursor:col-resize;touch-action:none;pointer-events:auto;outline:none}.lunar-editor__document .lunar-table-column-handle::after{content:"";position:absolute;top:0;bottom:0;left:4px;width:2px;background:#7b83df;opacity:0}.lunar-editor__document .lunar-table-column-handle:hover::after,.lunar-editor__document .lunar-table-column-handle:focus-visible::after,.lunar-editor__document .lunar-table-column-handle--active::after{opacity:1;width:3px}.lunar-editor__document .lunar-table-scroll--resizing{cursor:col-resize;user-select:none}.lunar-editor__document .lunar-table-scroll--resizing .lunar-table-column-handle:not(.lunar-table-column-handle--active)::after{opacity:0}.lunar-editor__document div>.lunar-table-scroll{width:calc(100% - 24px)}.lunar-editor__document table{display:table;width:max-content;min-width:0;max-width:none;box-sizing:border-box;margin:0;color:inherit;border:1px solid #c8cdd2;border-collapse:collapse;border-spacing:0;table-layout:auto}.lunar-editor__document table td,.lunar-editor__document table th{position:relative;min-width:120px;max-width:350px;box-sizing:border-box;padding:10px;color:inherit;border:1px solid #c8cdd2;line-height:1.7;overflow-wrap:anywhere;vertical-align:top;white-space:normal;word-break:normal}.lunar-editor__document table td>*,.lunar-editor__document table th>*{margin:0;padding:0;border:0;line-height:inherit;overflow-wrap:inherit;white-space:inherit}.lunar-editor__document table td p,.lunar-editor__document table th p{border-left:none}.lunar-editor__document table th{background:rgba(0,0,0,.05);font-weight:600;letter-spacing:.05em;text-align:left}.lunar-editor__document table td{border-bottom-color:#c8cdd2}.lunar-editor__document .lunar-table-cell--selected::after{content:"";position:absolute;inset:0;background:rgba(102,126,234,.18);box-shadow:inset 0 0 0 2px rgba(102,126,234,.65);pointer-events:none}.lunar-editor__document .lunar-table-cell--selected::selection,.lunar-editor__document .lunar-table-cell--selected ::selection{background:rgba(0,0,0,0)}.lunar-editor__document.lunar-table-cell-selection::selection,.lunar-editor__document.lunar-table-cell-selection ::selection{background:rgba(0,0,0,0)}.lunar-editor__document.lunar-table-dragging .lunar-table-column-handle{pointer-events:none}
package/dist/index.cjs ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./code-editor-Cq33u9jq.cjs"),r=require("./rich-editor.cjs");exports.CodeEditor=o.CodeEditor;exports.useController=o.useController;exports.useControllerEvents=o.useControllerEvents;exports.useControllerProps=o.useControllerProps;exports.RichEditor=r.RichEditor;
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ import { C as e, u as s, a as t, b as l } from "./code-editor-um45ekRh.js";
2
+ import { RichEditor as C } from "./rich-editor.js";
3
+ export {
4
+ e as CodeEditor,
5
+ C as RichEditor,
6
+ s as useController,
7
+ t as useControllerEvents,
8
+ l as useControllerProps
9
+ };
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),o=require("react"),i=require("@mache-hangar/lunar-editor-core/lunar-editor"),l=require("@mache-hangar/lunar-editor-core/history"),f=o.forwardRef(function(e,g){const a=o.useRef(null),n=o.useRef(void 0),t=o.useRef(e),u=o.useRef({content:e.content,generation:e.sourceGeneration,revision:e.sourceRevision});return o.useLayoutEffect(()=>{t.current=e}),o.useLayoutEffect(()=>{const r=t.current,s=i.createLunarEditor(a.current,{...r,html:r.content,editable:()=>!t.current.readonly,editorClass:()=>t.current.editorClass??"rich-editor__document",onDocChanged:()=>t.current.onDocChanged?.(),onHistoryStateChange:c=>t.current.onHistoryStateChange?.(c),onSelectionFormattingChange:c=>t.current.onSelectionFormattingChange?.(c),onSourceStateChange:c=>t.current.onSourceStateChange?.(c),onTransaction:(c,h,m)=>t.current.onTransaction?.(c,h,m)});return n.current=s,u.current={content:r.content,generation:r.sourceGeneration,revision:r.sourceRevision},()=>{s.destroy(),n.current=void 0}},[e.schema,e.extensions]),o.useLayoutEffect(()=>{if(!n.current)return;const r=u.current;(r.content!==e.content||r.generation!==e.sourceGeneration||r.revision!==e.sourceRevision)&&(i.setLunarEditorHtml(n.current,e.content,e.sourceRevision,e.sourceGeneration),u.current={content:e.content,generation:e.sourceGeneration,revision:e.sourceRevision}),n.current.setProps({editable:()=>!t.current.readonly})},[e.content,e.sourceGeneration,e.sourceRevision,e.readonly]),o.useImperativeHandle(g,()=>({getView:()=>n.current,getHtml:()=>i.getLunarEditorSourceHtml(n.current),getSourceState:()=>i.getLunarEditorSourceSnapshot(n.current),undo:()=>n.current?l.runLunarHistoryCommand(n.current,"undo"):!1,redo:()=>n.current?l.runLunarHistoryCommand(n.current,"redo"):!1}),[]),d.jsx("div",{className:`rich-editor-host ${e.className??""}`,children:d.jsx("div",{className:"rich-editor__mount",ref:a})})});exports.RichEditor=f;
2
+ //# sourceMappingURL=rich-editor.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rich-editor.cjs","sources":["../src/rich-editor.tsx"],"sourcesContent":["import {\n forwardRef,\n useImperativeHandle,\n useLayoutEffect,\n useRef,\n} from 'react';\nimport {\n createLunarEditor,\n setLunarEditorHtml,\n getLunarEditorSourceHtml,\n getLunarEditorSourceSnapshot,\n type CreateLunarEditorOptions,\n} from '@mache-hangar/lunar-editor-core/lunar-editor';\nimport { runLunarHistoryCommand } from '@mache-hangar/lunar-editor-core/history';\ntype EditorView = ReturnType<typeof createLunarEditor>;\n\nexport type RichEditorProps = Omit<\n CreateLunarEditorOptions,\n 'html' | 'editable' | 'editorClass' | 'onDocChanged'\n> & {\n content: string;\n readonly?: boolean;\n className?: string;\n editorClass?: string;\n onDocChanged?: () => void;\n};\nexport type RichEditorApi = {\n getView: () => EditorView | undefined;\n getHtml: () => string;\n getSourceState: () => ReturnType<typeof getLunarEditorSourceSnapshot>;\n undo: () => boolean;\n redo: () => boolean;\n};\n\n/** Generic React adapter. Product plugins are supplied by the caller. */\nexport const RichEditor = forwardRef<RichEditorApi, RichEditorProps>(\n function RichEditor(props, ref) {\n const mount = useRef<HTMLDivElement>(null);\n const view = useRef<EditorView | undefined>(undefined);\n const latest = useRef(props);\n const applied = useRef({\n content: props.content,\n generation: props.sourceGeneration,\n revision: props.sourceRevision,\n });\n useLayoutEffect(() => {\n latest.current = props;\n });\n useLayoutEffect(() => {\n const current = latest.current;\n const engine = createLunarEditor(mount.current!, {\n ...current,\n html: current.content,\n editable: () => !latest.current.readonly,\n editorClass: () =>\n latest.current.editorClass ?? 'rich-editor__document',\n onDocChanged: () => latest.current.onDocChanged?.(),\n onHistoryStateChange: (detail) =>\n latest.current.onHistoryStateChange?.(detail),\n onSelectionFormattingChange: (detail) =>\n latest.current.onSelectionFormattingChange?.(detail),\n onSourceStateChange: (detail) =>\n latest.current.onSourceStateChange?.(detail),\n onTransaction: (before, next, transaction) =>\n latest.current.onTransaction?.(before, next, transaction),\n });\n view.current = engine;\n applied.current = {\n content: current.content,\n generation: current.sourceGeneration,\n revision: current.sourceRevision,\n };\n return () => {\n engine.destroy();\n view.current = undefined;\n };\n }, [props.schema, props.extensions]);\n useLayoutEffect(() => {\n if (!view.current) return;\n const previous = applied.current;\n if (\n previous.content !== props.content ||\n previous.generation !== props.sourceGeneration ||\n previous.revision !== props.sourceRevision\n ) {\n setLunarEditorHtml(\n view.current,\n props.content,\n props.sourceRevision,\n props.sourceGeneration\n );\n applied.current = {\n content: props.content,\n generation: props.sourceGeneration,\n revision: props.sourceRevision,\n };\n }\n view.current.setProps({ editable: () => !latest.current.readonly });\n }, [\n props.content,\n props.sourceGeneration,\n props.sourceRevision,\n props.readonly,\n ]);\n useImperativeHandle(\n ref,\n () => ({\n getView: () => view.current,\n getHtml: () => getLunarEditorSourceHtml(view.current),\n getSourceState: () => getLunarEditorSourceSnapshot(view.current),\n undo: () =>\n view.current ? runLunarHistoryCommand(view.current, 'undo') : false,\n redo: () =>\n view.current ? runLunarHistoryCommand(view.current, 'redo') : false,\n }),\n []\n );\n return (\n <div className={`rich-editor-host ${props.className ?? ''}`}>\n <div className=\"rich-editor__mount\" ref={mount} />\n </div>\n );\n }\n);\n"],"names":["RichEditor","forwardRef","props","ref","mount","useRef","view","latest","applied","useLayoutEffect","current","engine","createLunarEditor","detail","before","next","transaction","previous","setLunarEditorHtml","useImperativeHandle","getLunarEditorSourceHtml","getLunarEditorSourceSnapshot","runLunarHistoryCommand","jsx"],"mappings":"uPAmCaA,EAAaC,EAAAA,WACxB,SAAoBC,EAAOC,EAAK,CAC9B,MAAMC,EAAQC,EAAAA,OAAuB,IAAI,EACnCC,EAAOD,EAAAA,OAA+B,MAAS,EAC/CE,EAASF,EAAAA,OAAOH,CAAK,EACrBM,EAAUH,EAAAA,OAAO,CACrB,QAASH,EAAM,QACf,WAAYA,EAAM,iBAClB,SAAUA,EAAM,cAAA,CACjB,EACDO,OAAAA,EAAAA,gBAAgB,IAAM,CACpBF,EAAO,QAAUL,CACnB,CAAC,EACDO,EAAAA,gBAAgB,IAAM,CACpB,MAAMC,EAAUH,EAAO,QACjBI,EAASC,EAAAA,kBAAkBR,EAAM,QAAU,CAC/C,GAAGM,EACH,KAAMA,EAAQ,QACd,SAAU,IAAM,CAACH,EAAO,QAAQ,SAChC,YAAa,IACXA,EAAO,QAAQ,aAAe,wBAChC,aAAc,IAAMA,EAAO,QAAQ,eAAA,EACnC,qBAAuBM,GACrBN,EAAO,QAAQ,uBAAuBM,CAAM,EAC9C,4BAA8BA,GAC5BN,EAAO,QAAQ,8BAA8BM,CAAM,EACrD,oBAAsBA,GACpBN,EAAO,QAAQ,sBAAsBM,CAAM,EAC7C,cAAe,CAACC,EAAQC,EAAMC,IAC5BT,EAAO,QAAQ,gBAAgBO,EAAQC,EAAMC,CAAW,CAAA,CAC3D,EACD,OAAAV,EAAK,QAAUK,EACfH,EAAQ,QAAU,CAChB,QAASE,EAAQ,QACjB,WAAYA,EAAQ,iBACpB,SAAUA,EAAQ,cAAA,EAEb,IAAM,CACXC,EAAO,QAAA,EACPL,EAAK,QAAU,MACjB,CACF,EAAG,CAACJ,EAAM,OAAQA,EAAM,UAAU,CAAC,EACnCO,EAAAA,gBAAgB,IAAM,CACpB,GAAI,CAACH,EAAK,QAAS,OACnB,MAAMW,EAAWT,EAAQ,SAEvBS,EAAS,UAAYf,EAAM,SAC3Be,EAAS,aAAef,EAAM,kBAC9Be,EAAS,WAAaf,EAAM,kBAE5BgB,EAAAA,mBACEZ,EAAK,QACLJ,EAAM,QACNA,EAAM,eACNA,EAAM,gBAAA,EAERM,EAAQ,QAAU,CAChB,QAASN,EAAM,QACf,WAAYA,EAAM,iBAClB,SAAUA,EAAM,cAAA,GAGpBI,EAAK,QAAQ,SAAS,CAAE,SAAU,IAAM,CAACC,EAAO,QAAQ,SAAU,CACpE,EAAG,CACDL,EAAM,QACNA,EAAM,iBACNA,EAAM,eACNA,EAAM,QAAA,CACP,EACDiB,EAAAA,oBACEhB,EACA,KAAO,CACL,QAAS,IAAMG,EAAK,QACpB,QAAS,IAAMc,EAAAA,yBAAyBd,EAAK,OAAO,EACpD,eAAgB,IAAMe,EAAAA,6BAA6Bf,EAAK,OAAO,EAC/D,KAAM,IACJA,EAAK,QAAUgB,EAAAA,uBAAuBhB,EAAK,QAAS,MAAM,EAAI,GAChE,KAAM,IACJA,EAAK,QAAUgB,EAAAA,uBAAuBhB,EAAK,QAAS,MAAM,EAAI,EAAA,GAElE,CAAA,CAAC,EAGDiB,EAAAA,IAAC,MAAA,CAAI,UAAW,oBAAoBrB,EAAM,WAAa,EAAE,GACvD,SAAAqB,EAAAA,IAAC,MAAA,CAAI,UAAU,qBAAqB,IAAKnB,EAAO,EAClD,CAEJ,CACF"}
@@ -0,0 +1,67 @@
1
+ import { jsx as d } from "react/jsx-runtime";
2
+ import { forwardRef as v, useRef as c, useLayoutEffect as u, useImperativeHandle as f } from "react";
3
+ import { createLunarEditor as S, setLunarEditorHtml as C, getLunarEditorSourceSnapshot as R, getLunarEditorSourceHtml as y } from "@mache-hangar/lunar-editor-core/lunar-editor";
4
+ import { runLunarHistoryCommand as l } from "@mache-hangar/lunar-editor-core/history";
5
+ const w = v(
6
+ function(e, m) {
7
+ const a = c(null), n = c(void 0), t = c(e), i = c({
8
+ content: e.content,
9
+ generation: e.sourceGeneration,
10
+ revision: e.sourceRevision
11
+ });
12
+ return u(() => {
13
+ t.current = e;
14
+ }), u(() => {
15
+ const r = t.current, s = S(a.current, {
16
+ ...r,
17
+ html: r.content,
18
+ editable: () => !t.current.readonly,
19
+ editorClass: () => t.current.editorClass ?? "rich-editor__document",
20
+ onDocChanged: () => t.current.onDocChanged?.(),
21
+ onHistoryStateChange: (o) => t.current.onHistoryStateChange?.(o),
22
+ onSelectionFormattingChange: (o) => t.current.onSelectionFormattingChange?.(o),
23
+ onSourceStateChange: (o) => t.current.onSourceStateChange?.(o),
24
+ onTransaction: (o, g, h) => t.current.onTransaction?.(o, g, h)
25
+ });
26
+ return n.current = s, i.current = {
27
+ content: r.content,
28
+ generation: r.sourceGeneration,
29
+ revision: r.sourceRevision
30
+ }, () => {
31
+ s.destroy(), n.current = void 0;
32
+ };
33
+ }, [e.schema, e.extensions]), u(() => {
34
+ if (!n.current) return;
35
+ const r = i.current;
36
+ (r.content !== e.content || r.generation !== e.sourceGeneration || r.revision !== e.sourceRevision) && (C(
37
+ n.current,
38
+ e.content,
39
+ e.sourceRevision,
40
+ e.sourceGeneration
41
+ ), i.current = {
42
+ content: e.content,
43
+ generation: e.sourceGeneration,
44
+ revision: e.sourceRevision
45
+ }), n.current.setProps({ editable: () => !t.current.readonly });
46
+ }, [
47
+ e.content,
48
+ e.sourceGeneration,
49
+ e.sourceRevision,
50
+ e.readonly
51
+ ]), f(
52
+ m,
53
+ () => ({
54
+ getView: () => n.current,
55
+ getHtml: () => y(n.current),
56
+ getSourceState: () => R(n.current),
57
+ undo: () => n.current ? l(n.current, "undo") : !1,
58
+ redo: () => n.current ? l(n.current, "redo") : !1
59
+ }),
60
+ []
61
+ ), /* @__PURE__ */ d("div", { className: `rich-editor-host ${e.className ?? ""}`, children: /* @__PURE__ */ d("div", { className: "rich-editor__mount", ref: a }) });
62
+ }
63
+ );
64
+ export {
65
+ w as RichEditor
66
+ };
67
+ //# sourceMappingURL=rich-editor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rich-editor.js","sources":["../src/rich-editor.tsx"],"sourcesContent":["import {\n forwardRef,\n useImperativeHandle,\n useLayoutEffect,\n useRef,\n} from 'react';\nimport {\n createLunarEditor,\n setLunarEditorHtml,\n getLunarEditorSourceHtml,\n getLunarEditorSourceSnapshot,\n type CreateLunarEditorOptions,\n} from '@mache-hangar/lunar-editor-core/lunar-editor';\nimport { runLunarHistoryCommand } from '@mache-hangar/lunar-editor-core/history';\ntype EditorView = ReturnType<typeof createLunarEditor>;\n\nexport type RichEditorProps = Omit<\n CreateLunarEditorOptions,\n 'html' | 'editable' | 'editorClass' | 'onDocChanged'\n> & {\n content: string;\n readonly?: boolean;\n className?: string;\n editorClass?: string;\n onDocChanged?: () => void;\n};\nexport type RichEditorApi = {\n getView: () => EditorView | undefined;\n getHtml: () => string;\n getSourceState: () => ReturnType<typeof getLunarEditorSourceSnapshot>;\n undo: () => boolean;\n redo: () => boolean;\n};\n\n/** Generic React adapter. Product plugins are supplied by the caller. */\nexport const RichEditor = forwardRef<RichEditorApi, RichEditorProps>(\n function RichEditor(props, ref) {\n const mount = useRef<HTMLDivElement>(null);\n const view = useRef<EditorView | undefined>(undefined);\n const latest = useRef(props);\n const applied = useRef({\n content: props.content,\n generation: props.sourceGeneration,\n revision: props.sourceRevision,\n });\n useLayoutEffect(() => {\n latest.current = props;\n });\n useLayoutEffect(() => {\n const current = latest.current;\n const engine = createLunarEditor(mount.current!, {\n ...current,\n html: current.content,\n editable: () => !latest.current.readonly,\n editorClass: () =>\n latest.current.editorClass ?? 'rich-editor__document',\n onDocChanged: () => latest.current.onDocChanged?.(),\n onHistoryStateChange: (detail) =>\n latest.current.onHistoryStateChange?.(detail),\n onSelectionFormattingChange: (detail) =>\n latest.current.onSelectionFormattingChange?.(detail),\n onSourceStateChange: (detail) =>\n latest.current.onSourceStateChange?.(detail),\n onTransaction: (before, next, transaction) =>\n latest.current.onTransaction?.(before, next, transaction),\n });\n view.current = engine;\n applied.current = {\n content: current.content,\n generation: current.sourceGeneration,\n revision: current.sourceRevision,\n };\n return () => {\n engine.destroy();\n view.current = undefined;\n };\n }, [props.schema, props.extensions]);\n useLayoutEffect(() => {\n if (!view.current) return;\n const previous = applied.current;\n if (\n previous.content !== props.content ||\n previous.generation !== props.sourceGeneration ||\n previous.revision !== props.sourceRevision\n ) {\n setLunarEditorHtml(\n view.current,\n props.content,\n props.sourceRevision,\n props.sourceGeneration\n );\n applied.current = {\n content: props.content,\n generation: props.sourceGeneration,\n revision: props.sourceRevision,\n };\n }\n view.current.setProps({ editable: () => !latest.current.readonly });\n }, [\n props.content,\n props.sourceGeneration,\n props.sourceRevision,\n props.readonly,\n ]);\n useImperativeHandle(\n ref,\n () => ({\n getView: () => view.current,\n getHtml: () => getLunarEditorSourceHtml(view.current),\n getSourceState: () => getLunarEditorSourceSnapshot(view.current),\n undo: () =>\n view.current ? runLunarHistoryCommand(view.current, 'undo') : false,\n redo: () =>\n view.current ? runLunarHistoryCommand(view.current, 'redo') : false,\n }),\n []\n );\n return (\n <div className={`rich-editor-host ${props.className ?? ''}`}>\n <div className=\"rich-editor__mount\" ref={mount} />\n </div>\n );\n }\n);\n"],"names":["RichEditor","forwardRef","props","ref","mount","useRef","view","latest","applied","useLayoutEffect","current","engine","createLunarEditor","detail","before","next","transaction","previous","setLunarEditorHtml","useImperativeHandle","getLunarEditorSourceHtml","getLunarEditorSourceSnapshot","runLunarHistoryCommand","jsx"],"mappings":";;;;AAmCO,MAAMA,IAAaC;AAAA,EACxB,SAAoBC,GAAOC,GAAK;AAC9B,UAAMC,IAAQC,EAAuB,IAAI,GACnCC,IAAOD,EAA+B,MAAS,GAC/CE,IAASF,EAAOH,CAAK,GACrBM,IAAUH,EAAO;AAAA,MACrB,SAASH,EAAM;AAAA,MACf,YAAYA,EAAM;AAAA,MAClB,UAAUA,EAAM;AAAA,IAAA,CACjB;AACD,WAAAO,EAAgB,MAAM;AACpB,MAAAF,EAAO,UAAUL;AAAA,IACnB,CAAC,GACDO,EAAgB,MAAM;AACpB,YAAMC,IAAUH,EAAO,SACjBI,IAASC,EAAkBR,EAAM,SAAU;AAAA,QAC/C,GAAGM;AAAA,QACH,MAAMA,EAAQ;AAAA,QACd,UAAU,MAAM,CAACH,EAAO,QAAQ;AAAA,QAChC,aAAa,MACXA,EAAO,QAAQ,eAAe;AAAA,QAChC,cAAc,MAAMA,EAAO,QAAQ,eAAA;AAAA,QACnC,sBAAsB,CAACM,MACrBN,EAAO,QAAQ,uBAAuBM,CAAM;AAAA,QAC9C,6BAA6B,CAACA,MAC5BN,EAAO,QAAQ,8BAA8BM,CAAM;AAAA,QACrD,qBAAqB,CAACA,MACpBN,EAAO,QAAQ,sBAAsBM,CAAM;AAAA,QAC7C,eAAe,CAACC,GAAQC,GAAMC,MAC5BT,EAAO,QAAQ,gBAAgBO,GAAQC,GAAMC,CAAW;AAAA,MAAA,CAC3D;AACD,aAAAV,EAAK,UAAUK,GACfH,EAAQ,UAAU;AAAA,QAChB,SAASE,EAAQ;AAAA,QACjB,YAAYA,EAAQ;AAAA,QACpB,UAAUA,EAAQ;AAAA,MAAA,GAEb,MAAM;AACX,QAAAC,EAAO,QAAA,GACPL,EAAK,UAAU;AAAA,MACjB;AAAA,IACF,GAAG,CAACJ,EAAM,QAAQA,EAAM,UAAU,CAAC,GACnCO,EAAgB,MAAM;AACpB,UAAI,CAACH,EAAK,QAAS;AACnB,YAAMW,IAAWT,EAAQ;AACzB,OACES,EAAS,YAAYf,EAAM,WAC3Be,EAAS,eAAef,EAAM,oBAC9Be,EAAS,aAAaf,EAAM,oBAE5BgB;AAAA,QACEZ,EAAK;AAAA,QACLJ,EAAM;AAAA,QACNA,EAAM;AAAA,QACNA,EAAM;AAAA,MAAA,GAERM,EAAQ,UAAU;AAAA,QAChB,SAASN,EAAM;AAAA,QACf,YAAYA,EAAM;AAAA,QAClB,UAAUA,EAAM;AAAA,MAAA,IAGpBI,EAAK,QAAQ,SAAS,EAAE,UAAU,MAAM,CAACC,EAAO,QAAQ,UAAU;AAAA,IACpE,GAAG;AAAA,MACDL,EAAM;AAAA,MACNA,EAAM;AAAA,MACNA,EAAM;AAAA,MACNA,EAAM;AAAA,IAAA,CACP,GACDiB;AAAA,MACEhB;AAAA,MACA,OAAO;AAAA,QACL,SAAS,MAAMG,EAAK;AAAA,QACpB,SAAS,MAAMc,EAAyBd,EAAK,OAAO;AAAA,QACpD,gBAAgB,MAAMe,EAA6Bf,EAAK,OAAO;AAAA,QAC/D,MAAM,MACJA,EAAK,UAAUgB,EAAuBhB,EAAK,SAAS,MAAM,IAAI;AAAA,QAChE,MAAM,MACJA,EAAK,UAAUgB,EAAuBhB,EAAK,SAAS,MAAM,IAAI;AAAA,MAAA;AAAA,MAElE,CAAA;AAAA,IAAC,GAGD,gBAAAiB,EAAC,OAAA,EAAI,WAAW,oBAAoBrB,EAAM,aAAa,EAAE,IACvD,UAAA,gBAAAqB,EAAC,OAAA,EAAI,WAAU,sBAAqB,KAAKnB,GAAO,GAClD;AAAA,EAEJ;AACF;"}
@@ -0,0 +1 @@
1
+ .code-editor-host{display:block;width:100%;height:100%;min-height:0}.code-editor{position:relative;width:100%;height:100%;display:flex;flex-direction:column;min-height:0}.code-editor .editor-container{flex:1;width:100%;min-width:20vw;min-height:0;overflow:hidden;text-align:left}.code-editor .diff-container{width:100%;height:100%;min-width:20vw;min-height:20vh;text-align:left;position:absolute;left:0;top:0;visibility:hidden;opacity:0;z-index:1}.code-editor .diff-container .tool-bar{display:flex;justify-content:space-between}.code-editor .diff-container .cm-mergeView{height:100%;overflow:auto}.code-editor .diff-container .cm-mergeViewEditors{height:100%}.code-editor .diff-container .cm-editor{min-width:0}.code-editor .dialog-ani-rl{animation:dialog .3s cubic-bezier(0.36, 0.07, 0.19, 0.97) both}.code-editor .dialog-ani-lr{animation:dialog .3s cubic-bezier(0.36, 0.07, 0.19, 0.97) both reverse}@keyframes dialog{0%{visibility:hidden;opacity:0;transform:translateX(100%)}100%{visibility:visible;opacity:1;transform:translateX(0)}}.rich-editor-host{display:flex;position:relative;height:100%;min-height:0}.rich-editor__mount{display:flex;flex:1;min-width:0;min-height:0}.rich-editor__document{flex:1;min-width:0;overflow:auto;outline:none}
@@ -0,0 +1,5 @@
1
+ import type { CodeEditorController } from '@mache-hangar/lunar-editor-core/controllers/code-editor-controller';
2
+ export type CodeEditorApi = Pick<CodeEditorController, 'getValue' | 'setValue' | 'layout' | 'revealTarget' | 'getCurrentRevealTarget' | 'getUserSelectionVersion' | 'isChanged' | 'markClean' | 'resetHistory' | 'formatDocument' | 'diff' | 'whenReady'>;
3
+ export type CodeEditorProps = Partial<Pick<CodeEditorController, 'content' | 'readonly' | 'isShowDiff' | 'format' | 'language'>> & {
4
+ className?: string;
5
+ };
@@ -0,0 +1,6 @@
1
+ import { CodeEditorController } from '@mache-hangar/lunar-editor-core/controllers/code-editor-controller';
2
+ import type { CodeEditorApi } from './code-editor-types';
3
+ export type { CodeEditorApi, CodeEditorProps } from './code-editor-types';
4
+ export declare const CodeEditor: import("react").ForwardRefExoticComponent<Partial<Pick<CodeEditorController, "content" | "readonly" | "isShowDiff" | "format" | "language">> & {
5
+ className?: string;
6
+ } & import("react").RefAttributes<CodeEditorApi>>;
@@ -0,0 +1,6 @@
1
+ import { type EditorController } from '@mache-hangar/lunar-editor-core/controllers/controller';
2
+ export declare function useController<T extends EditorController>(create: () => T): T;
3
+ export declare function useControllerProps<T>(controller: {
4
+ updateProps(props: T): Promise<void>;
5
+ }, props: T): void;
6
+ export declare function useControllerEvents(controller: object, props: object, events: readonly string[]): void;
@@ -0,0 +1,3 @@
1
+ import type { EditorExtension } from '@mache-hangar/lunar-editor-core/extensions';
2
+ export * from './math-input';
3
+ export declare function createMathExtension(): EditorExtension;
@@ -0,0 +1,4 @@
1
+ import { Plugin, type EditorView } from '@mache-hangar/lunar-editor-core/pm';
2
+ export declare function insertBlockMathFromDollarInput(view: EditorView, from: number, to: number, text: string): boolean;
3
+ export declare function insertInlineMathFromDotDollarInput(view: EditorView, from: number, to: number, text: string): boolean;
4
+ export declare function createMathInputPlugin(): Plugin<any>;
@@ -0,0 +1,27 @@
1
+ import { type Node as ProseMirrorNode, type EditorView, type NodeView } from '@mache-hangar/lunar-editor-core/pm';
2
+ type GetPos = () => number | undefined;
3
+ export declare class MathNodeView implements NodeView {
4
+ private readonly view;
5
+ private readonly getPos;
6
+ readonly dom: HTMLElement;
7
+ private node;
8
+ private readonly mathfield;
9
+ private readonly display;
10
+ private selected;
11
+ private editing;
12
+ constructor(node: ProseMirrorNode, view: EditorView, getPos: GetPos);
13
+ private handlePointerDown;
14
+ private handleFocus;
15
+ private handleBlur;
16
+ private setEditing;
17
+ private handleChange;
18
+ private handleKeyDown;
19
+ private deleteEmptyBlock;
20
+ update(node: ProseMirrorNode): boolean;
21
+ selectNode(): void;
22
+ deselectNode(): void;
23
+ stopEvent(event: Event): boolean;
24
+ ignoreMutation(): boolean;
25
+ destroy(): void;
26
+ }
27
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { NodeSpec } from '@mache-hangar/lunar-editor-core/pm';
2
+ export declare function parseMathAttrs(element: HTMLElement): {
3
+ htmlAttrs: {
4
+ [x: string]: string;
5
+ };
6
+ latex: string;
7
+ sourceKey: string | null;
8
+ };
9
+ export declare const mathNodes: Record<string, NodeSpec>;
@@ -0,0 +1,14 @@
1
+ import { type EditorView } from '@mache-hangar/lunar-editor-core/pm';
2
+ /** One owner per gesture: text within a cell, a bounded rectangle across cells. */
3
+ export declare class CellDragSelection {
4
+ private drag?;
5
+ get active(): boolean;
6
+ start(view: EditorView, event: MouseEvent): boolean;
7
+ cancelIfStale(view: EditorView): void;
8
+ /** Clamp hit-testing to the current table and editor viewport, including on mouseup. */
9
+ private point;
10
+ private move;
11
+ private end;
12
+ cancel: () => void;
13
+ destroy: () => void;
14
+ }
@@ -0,0 +1,9 @@
1
+ /** Measure logical columns, including cells spanning rows or columns. */
2
+ export type ColumnLayout = {
3
+ widths: number[];
4
+ boundaries: number[];
5
+ direction: number;
6
+ };
7
+ export declare const MIN_COLUMN_WIDTH = 48;
8
+ export declare function measureColumns(table: HTMLTableElement): ColumnLayout | undefined;
9
+ export declare function resizeColumns(widths: readonly number[], column: number, delta: number): number[];
@@ -0,0 +1,67 @@
1
+ import { type EditorState, type EditorView, type Node as PMNode } from '@mache-hangar/lunar-editor-core/pm';
2
+ import { type Cell, type Grid, type Rect } from './grid';
3
+ export type TableAction = 'row_before' | 'row_after' | 'delete_rows' | 'column_before' | 'column_after' | 'delete_columns' | 'delete_table' | 'merge' | 'split' | 'header_row' | 'header_column' | 'caption' | 'clear_cells';
4
+ export type TableCommand = {
5
+ action: TableAction;
6
+ } | {
7
+ action: 'insert';
8
+ rows: number;
9
+ columns: number;
10
+ headerRow?: boolean;
11
+ } | {
12
+ action: 'cell_style';
13
+ textAlign?: 'left' | 'center' | 'right' | 'justify';
14
+ verticalAlign?: 'top' | 'middle' | 'bottom';
15
+ backgroundColor?: string;
16
+ } | {
17
+ action: 'table_style';
18
+ align?: 'left' | 'center' | 'right';
19
+ width?: '25%' | '50%' | '75%' | '100%';
20
+ };
21
+ export type CellRange = {
22
+ anchor: number;
23
+ head: number;
24
+ dragging?: boolean;
25
+ } | null;
26
+ export type TableState = {
27
+ available: boolean;
28
+ inTable: boolean;
29
+ valid: boolean;
30
+ inCell: boolean;
31
+ rows: number;
32
+ columns: number;
33
+ row: number;
34
+ column: number;
35
+ selectedCells: number;
36
+ canMerge: boolean;
37
+ canSplit: boolean;
38
+ headerRow: boolean;
39
+ headerColumn: boolean;
40
+ caption: boolean;
41
+ textAlign: string;
42
+ verticalAlign: string;
43
+ backgroundColor: string;
44
+ };
45
+ export declare const EMPTY_TABLE_STATE: TableState;
46
+ export declare function tableContext(state: EditorState): {
47
+ table: {
48
+ node: PMNode;
49
+ pos: number;
50
+ };
51
+ grid?: undefined;
52
+ rect?: undefined;
53
+ inCell?: undefined;
54
+ cells?: undefined;
55
+ } | {
56
+ table: {
57
+ node: PMNode;
58
+ pos: number;
59
+ };
60
+ grid: Grid;
61
+ rect: Rect;
62
+ inCell: boolean;
63
+ cells: Cell[];
64
+ } | undefined;
65
+ export declare function getTableState(view: EditorView | undefined): TableState;
66
+ /** All topology commands operate on a logical grid, including rowspan/colspan. */
67
+ export declare function runTableCommand(view: EditorView | undefined, command: TableCommand, text?: string): boolean;
@@ -0,0 +1,49 @@
1
+ import { type Node as PMNode, type ResolvedPos } from '@mache-hangar/lunar-editor-core/pm';
2
+ export type Cell = {
3
+ node: PMNode;
4
+ row: number;
5
+ col: number;
6
+ rows: number;
7
+ cols: number;
8
+ pos: number;
9
+ };
10
+ export type Row = {
11
+ node: PMNode;
12
+ section: number;
13
+ pos: number;
14
+ };
15
+ export type Grid = {
16
+ node: PMNode;
17
+ pos: number;
18
+ rows: Row[];
19
+ cells: Cell[];
20
+ matrix: Cell[][];
21
+ width: number;
22
+ };
23
+ export type Rect = {
24
+ top: number;
25
+ bottom: number;
26
+ left: number;
27
+ right: number;
28
+ };
29
+ type Column = {
30
+ node: PMNode;
31
+ group: number;
32
+ };
33
+ export declare const isCell: (node: PMNode) => boolean;
34
+ export declare const span: (value: unknown) => number;
35
+ export declare function tableAt(position: ResolvedPos): {
36
+ node: PMNode;
37
+ pos: number;
38
+ } | undefined;
39
+ /** Read the original HTML sections; never flatten thead/tbody/tfoot into a different schema. */
40
+ export declare function readGrid(node: PMNode, pos: number): Grid | undefined;
41
+ export declare function cellAt(grid: Grid, position: number): Cell | undefined;
42
+ /** Expand rectangular selection to include every intersecting merged cell in full. */
43
+ export declare function selectionRect(grid: Grid, anchor: Cell, head: Cell): Rect;
44
+ export declare function intersects(cell: Cell, rect: Rect): boolean;
45
+ export declare function blankCell(template: PMNode, row: number, col: number): Cell;
46
+ /** Rebuild only changed rows/cells and retain all other table children and source identities. */
47
+ export declare function buildTable(grid: Grid, rows: Row[], cells: Cell[], columns?: Column[]): PMNode;
48
+ export declare function editColumns(grid: Grid, at: number, count: number, remove: boolean): Column[] | undefined;
49
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { EditorExtension } from '@mache-hangar/lunar-editor-core/extensions';
2
+ import { type TableExtensionOptions } from './interaction';
3
+ export { EMPTY_TABLE_STATE, getTableState, runTableCommand } from './commands';
4
+ export type { TableAction, TableCommand, TableState } from './commands';
5
+ export type { TableExtensionOptions } from './interaction';
6
+ export declare function createTableExtension(options?: TableExtensionOptions): EditorExtension;
@@ -0,0 +1,6 @@
1
+ import { Plugin } from '@mache-hangar/lunar-editor-core/pm';
2
+ import { type CellRange, type TableState } from './commands';
3
+ export type TableExtensionOptions = {
4
+ onStateChange?: (state: TableState) => void;
5
+ };
6
+ export declare function createTableInteraction(options: TableExtensionOptions): Plugin<CellRange>;
@@ -0,0 +1,4 @@
1
+ import { type EditorView } from '@mache-hangar/lunar-editor-core/pm';
2
+ export declare function withWidth(style: string | undefined, width: number, document: Document, table?: boolean): string;
3
+ /** Commit ordinary HTML col widths through the existing source-aware transaction. */
4
+ export declare function commitColumnWidths(view: EditorView, position: number, widths: readonly number[]): void;
@@ -0,0 +1,3 @@
1
+ import { PluginKey } from '@mache-hangar/lunar-editor-core/pm';
2
+ import type { CellRange } from './commands';
3
+ export declare const tableSelectionKey: PluginKey<CellRange>;
@@ -0,0 +1,30 @@
1
+ import type { Node as ProseMirrorNode, NodeView, EditorView, ViewMutationRecord } from '@mache-hangar/lunar-editor-core/pm';
2
+ export declare class TableNodeView implements NodeView {
3
+ private readonly view;
4
+ private readonly getPos;
5
+ readonly dom: HTMLDivElement;
6
+ readonly contentDOM: HTMLTableElement;
7
+ private readonly controls;
8
+ private node;
9
+ private observer?;
10
+ private frame;
11
+ private readonly previewNodes;
12
+ private drag?;
13
+ constructor(node: ProseMirrorNode, view: EditorView, getPos: () => number | undefined);
14
+ update(node: ProseMirrorNode): boolean;
15
+ private showControls;
16
+ private hideControls;
17
+ private scheduleLayout;
18
+ private refreshControls;
19
+ private handleColumn;
20
+ private startDrag;
21
+ private moveDrag;
22
+ private endDrag;
23
+ private cancelDrag;
24
+ private onDragKeyDown;
25
+ private finishDrag;
26
+ private onHandleKeyDown;
27
+ stopEvent(event: Event): boolean;
28
+ ignoreMutation(mutation: ViewMutationRecord): boolean;
29
+ destroy(): void;
30
+ }
@@ -0,0 +1,9 @@
1
+ import type { TableCommand, TableState } from '../table/commands';
2
+ type Props = {
3
+ state: TableState;
4
+ disabled: boolean;
5
+ onCommand: (command: TableCommand) => void;
6
+ };
7
+ export declare function CellProperties({ state, disabled, onCommand }: Props): import("react/jsx-runtime").JSX.Element;
8
+ export declare function TableProperties({ state, disabled, onCommand }: Props): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,14 @@
1
+ import { type RefObject } from 'react';
2
+ import type { TableCommand, TableState } from '../table/commands';
3
+ export type TableUiProps = {
4
+ state: TableState;
5
+ disabled?: boolean;
6
+ onCommand: (command: TableCommand) => void;
7
+ };
8
+ export type TableToolbarProps = TableUiProps & {
9
+ rootRef: RefObject<HTMLElement | null>;
10
+ };
11
+ type Props = TableUiProps;
12
+ export declare function InsertTableButton({ state, disabled, onCommand }: Props): import("react/jsx-runtime").JSX.Element;
13
+ export declare function TableToolbar({ state, disabled, onCommand, rootRef }: TableToolbarProps): import("react/jsx-runtime").JSX.Element | null;
14
+ export {};
@@ -0,0 +1,2 @@
1
+ export { InsertTableButton, TableToolbar } from './TableTools';
2
+ export type { TableUiProps, TableToolbarProps } from './TableTools';
@@ -0,0 +1,24 @@
1
+ import { type RefObject } from 'react';
2
+ import type { TableState } from '../table/commands';
3
+ type Rect = {
4
+ left: number;
5
+ top: number;
6
+ right: number;
7
+ bottom: number;
8
+ width: number;
9
+ height: number;
10
+ };
11
+ type Overlay = {
12
+ element: HTMLTableElement;
13
+ table: Rect;
14
+ visible: Rect;
15
+ cell?: Rect;
16
+ toolbar: {
17
+ left: number;
18
+ top: number;
19
+ };
20
+ placement: 'above' | 'below' | 'inside';
21
+ };
22
+ /** Presentation only: overlays live outside the editable DOM and never enter exported HTML. */
23
+ export declare function useTableOverlay(rootRef: RefObject<HTMLElement | null>, toolbarRef: RefObject<HTMLDivElement | null>, state: TableState, enabled: boolean): Overlay | null;
24
+ export {};
@@ -0,0 +1,5 @@
1
+ export { CodeEditor } from './code-editor';
2
+ export type { CodeEditorApi, CodeEditorProps } from './code-editor-types';
3
+ export { useController, useControllerProps, useControllerEvents, } from './controller-hooks';
4
+ export { RichEditor } from './rich-editor';
5
+ export type { RichEditorApi, RichEditorProps } from './rich-editor';
@@ -0,0 +1,25 @@
1
+ import { createLunarEditor, getLunarEditorSourceSnapshot, type CreateLunarEditorOptions } from '@mache-hangar/lunar-editor-core/lunar-editor';
2
+ type EditorView = ReturnType<typeof createLunarEditor>;
3
+ export type RichEditorProps = Omit<CreateLunarEditorOptions, 'html' | 'editable' | 'editorClass' | 'onDocChanged'> & {
4
+ content: string;
5
+ readonly?: boolean;
6
+ className?: string;
7
+ editorClass?: string;
8
+ onDocChanged?: () => void;
9
+ };
10
+ export type RichEditorApi = {
11
+ getView: () => EditorView | undefined;
12
+ getHtml: () => string;
13
+ getSourceState: () => ReturnType<typeof getLunarEditorSourceSnapshot>;
14
+ undo: () => boolean;
15
+ redo: () => boolean;
16
+ };
17
+ /** Generic React adapter. Product plugins are supplied by the caller. */
18
+ export declare const RichEditor: import("react").ForwardRefExoticComponent<Omit<CreateLunarEditorOptions, "html" | "editable" | "editorClass" | "onDocChanged"> & {
19
+ content: string;
20
+ readonly?: boolean;
21
+ className?: string;
22
+ editorClass?: string;
23
+ onDocChanged?: () => void;
24
+ } & import("react").RefAttributes<RichEditorApi>>;
25
+ export {};
package/package.json CHANGED
@@ -1,6 +1,98 @@
1
1
  {
2
2
  "name": "@mache-hangar/lunar-editor-react",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.0.3",
4
+ "type": "module",
5
+ "description": "Native React HTML editor components backed by lunar-editor-core",
6
+ "exports": {
7
+ "./rich-editor": {
8
+ "types": "./dist/types/rich-editor.d.ts",
9
+ "import": "./dist/rich-editor.js",
10
+ "require": "./dist/rich-editor.cjs"
11
+ },
12
+ "./code-editor": {
13
+ "types": "./dist/types/code-editor.d.ts",
14
+ "import": "./dist/code-editor.js",
15
+ "require": "./dist/code-editor.cjs"
16
+ },
17
+ ".": {
18
+ "types": "./dist/types/index.d.ts",
19
+ "import": "./dist/index.js",
20
+ "require": "./dist/index.cjs"
21
+ },
22
+ "./styles.css": "./dist/styles.css",
23
+ "./extensions/math": {
24
+ "types": "./dist/types/extensions/math/index.d.ts",
25
+ "import": "./dist/extensions/math/index.js",
26
+ "require": "./dist/extensions/math/index.cjs"
27
+ },
28
+ "./extensions/math.css": "./dist/extensions/math.css",
29
+ "./extensions/table": {
30
+ "types": "./dist/types/extensions/table/index.d.ts",
31
+ "import": "./dist/extensions/table/index.js",
32
+ "require": "./dist/extensions/table/index.cjs"
33
+ },
34
+ "./extensions/table.css": "./dist/extensions/table.css",
35
+ "./extensions/table-ui": {
36
+ "types": "./dist/types/extensions/table-ui/index.d.ts",
37
+ "import": "./dist/extensions/table-ui/index.js",
38
+ "require": "./dist/extensions/table-ui/index.cjs"
39
+ },
40
+ "./extensions/table-ui.css": "./dist/extensions/table-ui.css"
41
+ },
42
+ "files": [
43
+ "dist",
44
+ "THIRD_PARTY_NOTICES.md"
45
+ ],
46
+ "dependencies": {
47
+ "mathlive": "0.110.0",
48
+ "@mache-hangar/lunar-editor-core": "0.0.2"
49
+ },
50
+ "devDependencies": {
51
+ "jsdom": "^26.1.0",
52
+ "@types/node": "^22.13.5",
53
+ "@types/react": "19.2.14",
54
+ "@types/react-dom": "19.2.3",
55
+ "react": "^19.1.1",
56
+ "react-dom": "^19.1.1",
57
+ "sass": "^1.95.0",
58
+ "typescript": "^5.9.3",
59
+ "vite": "^7.2.4",
60
+ "antd": "5.29.3",
61
+ "@mache-hangar/components": "0.1.4"
62
+ },
63
+ "peerDependencies": {
64
+ "react": "^18.0.0 || ^19.0.0",
65
+ "react-dom": "^18.0.0 || ^19.0.0",
66
+ "@mache-hangar/components": "^0.1.4",
67
+ "antd": "^5.27.6"
68
+ },
69
+ "license": "MIT",
70
+ "homepage": "https://github.com/felix007-github/web-components/tree/main/packages/lunar-editor-react#readme",
71
+ "repository": {
72
+ "type": "git",
73
+ "url": "git+https://github.com/felix007-github/web-components.git",
74
+ "directory": "packages/lunar-editor-react"
75
+ },
76
+ "bugs": {
77
+ "url": "https://github.com/felix007-github/web-components/issues"
78
+ },
79
+ "publishConfig": {
80
+ "access": "public",
81
+ "registry": "https://registry.npmjs.org/"
82
+ },
83
+ "peerDependenciesMeta": {
84
+ "@mache-hangar/components": {
85
+ "optional": true
86
+ },
87
+ "antd": {
88
+ "optional": true
89
+ }
90
+ },
91
+ "scripts": {
92
+ "build": "vite build && tsc -p tsconfig.json && node scripts/build-styles.cjs",
93
+ "typecheck": "tsc -p tsconfig.json --noEmit",
94
+ "test": "node --test --test-concurrency=1 test/*.test.cjs",
95
+ "dev": "node ../../scripts/watch-editor.mjs",
96
+ "clean": "node ../../scripts/tasks.cjs clean"
97
+ }
6
98
  }