@mp-lb/mdkit 0.1.0-main.9.1 → 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/dist/index.d.ts +0 -2
- package/dist/index.js +0 -1
- package/docs/api.md +0 -20
- package/docs/architecture.md +0 -6
- package/docs/index.md +0 -18
- package/package.json +1 -3
- package/src/styles.css +0 -35
- package/dist/markdown/MdKitView.d.ts +0 -9
- package/dist/markdown/MdKitView.js +0 -10
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ export { useMdKitDocument } from "./document/useMdKitDocument";
|
|
|
4
4
|
export { MdKitConflictPanel } from "./document/MdKitConflictPanel";
|
|
5
5
|
export { MdKitDocumentToolbar } from "./document/MdKitDocumentToolbar";
|
|
6
6
|
export { MdKitEditor } from "./markdown/MdKitEditor";
|
|
7
|
-
export { MdKitView } from "./markdown/MdKitView";
|
|
8
7
|
export { MdKitThemeEditor } from "./theme/MdKitThemeEditor";
|
|
9
8
|
export { createMdKitRestAdapter } from "./transport/rest";
|
|
10
9
|
export { createMdKitEditorThemeStyle, darkMdKitEditorTheme, defaultMdKitEditorTheme, } from "./theme/editorTheme";
|
|
@@ -17,7 +16,6 @@ export type { MdKitConflictPanelProps } from "./document/MdKitConflictPanel";
|
|
|
17
16
|
export type { MdKitDocumentToolbarProps } from "./document/MdKitDocumentToolbar";
|
|
18
17
|
export type { MdKitEditorProps } from "./markdown/MdKitEditor";
|
|
19
18
|
export type { MdKitEditorDebugEvent } from "./markdown/editorDebug";
|
|
20
|
-
export type { MdKitViewProps } from "./markdown/MdKitView";
|
|
21
19
|
export type { MdKitThemeEditorProps } from "./theme/MdKitThemeEditor";
|
|
22
20
|
export type { CreateMdKitRestAdapterOptions } from "./transport/rest";
|
|
23
21
|
export type { MdKitEditorTheme, MdKitEditorThemeStyle, } from "./theme/editorTheme";
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,6 @@ export { useMdKitDocument } from "./document/useMdKitDocument";
|
|
|
4
4
|
export { MdKitConflictPanel } from "./document/MdKitConflictPanel";
|
|
5
5
|
export { MdKitDocumentToolbar } from "./document/MdKitDocumentToolbar";
|
|
6
6
|
export { MdKitEditor } from "./markdown/MdKitEditor";
|
|
7
|
-
export { MdKitView } from "./markdown/MdKitView";
|
|
8
7
|
export { MdKitThemeEditor } from "./theme/MdKitThemeEditor";
|
|
9
8
|
export { createMdKitRestAdapter } from "./transport/rest";
|
|
10
9
|
export { createMdKitEditorThemeStyle, darkMdKitEditorTheme, defaultMdKitEditorTheme, } from "./theme/editorTheme";
|
package/docs/api.md
CHANGED
|
@@ -54,26 +54,6 @@ lists, code blocks, blockquotes, and links. Styling is controlled with CSS
|
|
|
54
54
|
variables on `.mp-lb-mdkit-markdown-editor`. See [Styling](./styling.md) for setup,
|
|
55
55
|
dark mode, fonts, sizing, and theme customization.
|
|
56
56
|
|
|
57
|
-
### `MdKitView`
|
|
58
|
-
|
|
59
|
-
Read-only markdown view that uses the same shell, sizing, and markdown styling
|
|
60
|
-
as `MdKitEditor`, but renders with `react-markdown` instead of Tiptap.
|
|
61
|
-
|
|
62
|
-
```tsx
|
|
63
|
-
<MdKitView value={markdown} />
|
|
64
|
-
<MdKitView fillHeight value={markdown} />
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
Props:
|
|
68
|
-
|
|
69
|
-
- `value: string`
|
|
70
|
-
- `placeholder?: string`
|
|
71
|
-
- `fillHeight?: boolean`
|
|
72
|
-
- `className?: string`
|
|
73
|
-
- `style?: CSSProperties`
|
|
74
|
-
|
|
75
|
-
`fillHeight` uses the same full-pane sizing contract as `MdKitEditor`.
|
|
76
|
-
|
|
77
57
|
## Document Persistence
|
|
78
58
|
|
|
79
59
|
### `useMdKitDocument`
|
package/docs/architecture.md
CHANGED
|
@@ -26,12 +26,6 @@ Collaboration needs a different editor engine internally because it is backed by
|
|
|
26
26
|
Yjs state and remote cursors, but consumers should not need a separate editor
|
|
27
27
|
component.
|
|
28
28
|
|
|
29
|
-
`MdKitView` is the read-only companion surface. It accepts a markdown `value`
|
|
30
|
-
and uses the same package styling and full-height layout contract as
|
|
31
|
-
`MdKitEditor`, but it renders markdown without Tiptap or ProseMirror. Use it
|
|
32
|
-
when consumers need previews, version snapshots, or readonly document views that
|
|
33
|
-
visually match the editor without paying the editor runtime cost.
|
|
34
|
-
|
|
35
29
|
### Headless Hooks
|
|
36
30
|
|
|
37
31
|
Storage, versioning, and collaboration controls should come from hooks and
|
package/docs/index.md
CHANGED
|
@@ -38,24 +38,6 @@ export function MarkdownEditorExample() {
|
|
|
38
38
|
|
|
39
39
|
Use this when you want a local editor, a form field, or a debug surface.
|
|
40
40
|
|
|
41
|
-
## Read-only View
|
|
42
|
-
|
|
43
|
-
`MdKitView` renders markdown with the same package stylesheet, CSS variables,
|
|
44
|
-
and `fillHeight` sizing contract as `MdKitEditor`, but it does not mount Tiptap
|
|
45
|
-
or ProseMirror.
|
|
46
|
-
|
|
47
|
-
```tsx
|
|
48
|
-
import { MdKitView } from "@mp-lb/mdkit";
|
|
49
|
-
import "@mp-lb/mdkit/styles.css";
|
|
50
|
-
|
|
51
|
-
export function MarkdownPreview({ markdown }: { markdown: string }) {
|
|
52
|
-
return <MdKitView fillHeight value={markdown} />;
|
|
53
|
-
}
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Use this for document previews, restored-version views, or any readonly markdown
|
|
57
|
-
surface that should visually match the editor.
|
|
58
|
-
|
|
59
41
|
## Connected Editor
|
|
60
42
|
|
|
61
43
|
The connected workflow combines:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mp-lb/mdkit",
|
|
3
|
-
"version": "0.1.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -78,8 +78,6 @@
|
|
|
78
78
|
"@tiptap/react": "^3.14.0",
|
|
79
79
|
"@tiptap/starter-kit": "^3.14.0",
|
|
80
80
|
"lucide-react": "^0.554.0",
|
|
81
|
-
"react-markdown": "10.1.0",
|
|
82
|
-
"remark-gfm": "4.0.1",
|
|
83
81
|
"yjs": "^13.6.24",
|
|
84
82
|
"zod": "^4.1.12"
|
|
85
83
|
},
|
package/src/styles.css
CHANGED
|
@@ -70,10 +70,6 @@
|
|
|
70
70
|
cursor: default;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
.mp-lb-mdkit-markdown-view .mp-lb-mdkit-view-content {
|
|
74
|
-
overflow-wrap: anywhere;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
73
|
.mp-lb-mdkit-markdown-editor-fill-height {
|
|
78
74
|
display: flex;
|
|
79
75
|
height: 100%;
|
|
@@ -228,37 +224,6 @@
|
|
|
228
224
|
color: var(--mp-lb-mdkit-muted-foreground);
|
|
229
225
|
}
|
|
230
226
|
|
|
231
|
-
.mp-lb-mdkit-tiptap hr {
|
|
232
|
-
height: 1px;
|
|
233
|
-
border: 0;
|
|
234
|
-
background: var(--mp-lb-mdkit-border);
|
|
235
|
-
margin: var(--mp-lb-mdkit-block-gap) 0;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
.mp-lb-mdkit-tiptap img {
|
|
239
|
-
max-width: 100%;
|
|
240
|
-
height: auto;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
.mp-lb-mdkit-tiptap table {
|
|
244
|
-
width: 100%;
|
|
245
|
-
border-collapse: collapse;
|
|
246
|
-
margin: 0 0 var(--mp-lb-mdkit-block-gap);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
.mp-lb-mdkit-tiptap th,
|
|
250
|
-
.mp-lb-mdkit-tiptap td {
|
|
251
|
-
border: 1px solid var(--mp-lb-mdkit-border);
|
|
252
|
-
padding: 0.35rem 0.5rem;
|
|
253
|
-
text-align: left;
|
|
254
|
-
vertical-align: top;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
.mp-lb-mdkit-tiptap th {
|
|
258
|
-
background: var(--mp-lb-mdkit-muted);
|
|
259
|
-
font-weight: 650;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
227
|
.mp-lb-mdkit-tiptap p.is-editor-empty:first-child::before {
|
|
263
228
|
color: var(--mp-lb-mdkit-muted-foreground);
|
|
264
229
|
content: attr(data-placeholder);
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { CSSProperties } from "react";
|
|
2
|
-
export type MdKitViewProps = {
|
|
3
|
-
className?: string;
|
|
4
|
-
fillHeight?: boolean;
|
|
5
|
-
placeholder?: string;
|
|
6
|
-
style?: CSSProperties;
|
|
7
|
-
value: string;
|
|
8
|
-
};
|
|
9
|
-
export declare const MdKitView: ({ className, fillHeight, placeholder, style, value, }: MdKitViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import ReactMarkdown from "react-markdown";
|
|
3
|
-
import remarkGfm from "remark-gfm";
|
|
4
|
-
import { joinClassNames } from "../ui/joinClassNames";
|
|
5
|
-
export const MdKitView = ({ className, fillHeight = false, placeholder, style, value, }) => {
|
|
6
|
-
const renderedValue = value.trim().length > 0 ? value : (placeholder ?? "");
|
|
7
|
-
return (_jsx("div", { className: joinClassNames("mp-lb-mdkit-markdown-editor", "mp-lb-mdkit-markdown-view", fillHeight && "mp-lb-mdkit-markdown-editor-fill-height", className), "data-read-only": "true", style: style, children: _jsx("div", { className: "mp-lb-mdkit-editor-shell", children: _jsx("div", { className: "mp-lb-mdkit-editor-surface", children: renderedValue.length > 0 ? (_jsx("div", { className: "mp-lb-mdkit-tiptap mp-lb-mdkit-view-content", children: _jsx(ReactMarkdown, { components: {
|
|
8
|
-
a: ({ children, ...linkProps }) => (_jsx("a", { ...linkProps, rel: "noopener noreferrer", target: "_blank", children: children })),
|
|
9
|
-
}, remarkPlugins: [remarkGfm], children: renderedValue }) })) : (_jsx("div", { className: "mp-lb-mdkit-editor-empty" })) }) }) }));
|
|
10
|
-
};
|