comark-ui 0.0.0 → 0.7.1
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 +69 -0
- package/README.md +69 -1
- package/dist/client.d.mts +12 -0
- package/dist/client.mjs +26 -0
- package/dist/editor-BAdok66p.mjs +835 -0
- package/dist/editor-CNivEuMH.d.mts +131 -0
- package/dist/editor-vue.d.mts +57 -0
- package/dist/editor-vue.mjs +85 -0
- package/dist/editor.d.mts +2 -0
- package/dist/editor.mjs +1 -0
- package/dist/html.d.mts +7 -0
- package/dist/html.mjs +90 -0
- package/dist/index-B0YvApci.d.mts +173 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.mjs +3 -0
- package/dist/nuxt-ui.d.mts +17 -0
- package/dist/nuxt-ui.mjs +488 -0
- package/dist/react.d.mts +8 -0
- package/dist/react.mjs +83 -0
- package/dist/skills/comark-ui/SKILL.md +138 -0
- package/dist/skills/comark-ui/agents/openai.yaml +3 -0
- package/dist/skills/comark-ui/references/annotate.md +65 -0
- package/dist/skills/comark-ui/references/badge.md +52 -0
- package/dist/skills/comark-ui/references/cards.md +57 -0
- package/dist/skills/comark-ui/references/carousel.md +31 -0
- package/dist/skills/comark-ui/references/cast.md +48 -0
- package/dist/skills/comark-ui/references/charts.md +80 -0
- package/dist/skills/comark-ui/references/chat.md +25 -0
- package/dist/skills/comark-ui/references/chips.md +33 -0
- package/dist/skills/comark-ui/references/cjk.md +23 -0
- package/dist/skills/comark-ui/references/code-notes.md +34 -0
- package/dist/skills/comark-ui/references/code.md +84 -0
- package/dist/skills/comark-ui/references/colors.md +33 -0
- package/dist/skills/comark-ui/references/critic.md +30 -0
- package/dist/skills/comark-ui/references/deflist.md +38 -0
- package/dist/skills/comark-ui/references/details.md +49 -0
- package/dist/skills/comark-ui/references/diagrams.md +45 -0
- package/dist/skills/comark-ui/references/diff.md +43 -0
- package/dist/skills/comark-ui/references/embed.md +40 -0
- package/dist/skills/comark-ui/references/fields.md +48 -0
- package/dist/skills/comark-ui/references/figure.md +25 -0
- package/dist/skills/comark-ui/references/file-tree.md +42 -0
- package/dist/skills/comark-ui/references/footnotes.md +26 -0
- package/dist/skills/comark-ui/references/github.md +44 -0
- package/dist/skills/comark-ui/references/icon.md +28 -0
- package/dist/skills/comark-ui/references/include.md +44 -0
- package/dist/skills/comark-ui/references/keys.md +28 -0
- package/dist/skills/comark-ui/references/links.md +43 -0
- package/dist/skills/comark-ui/references/lint.md +96 -0
- package/dist/skills/comark-ui/references/magic-move.md +34 -0
- package/dist/skills/comark-ui/references/mark.md +22 -0
- package/dist/skills/comark-ui/references/math.md +25 -0
- package/dist/skills/comark-ui/references/media.md +29 -0
- package/dist/skills/comark-ui/references/metrics.md +34 -0
- package/dist/skills/comark-ui/references/outline.md +36 -0
- package/dist/skills/comark-ui/references/properties.md +32 -0
- package/dist/skills/comark-ui/references/qr.md +20 -0
- package/dist/skills/comark-ui/references/quiz.md +45 -0
- package/dist/skills/comark-ui/references/reading-time.md +32 -0
- package/dist/skills/comark-ui/references/sources.md +24 -0
- package/dist/skills/comark-ui/references/steps.md +34 -0
- package/dist/skills/comark-ui/references/table.md +48 -0
- package/dist/skills/comark-ui/references/tabs.md +46 -0
- package/dist/skills/comark-ui/references/tests.md +59 -0
- package/dist/skills/comark-ui/references/ui.md +54 -0
- package/dist/skills/comark-ui/references/xref.md +48 -0
- package/dist/skills/comark-ui/references/zoom.md +35 -0
- package/dist/src-DROB05U6.mjs +119 -0
- package/dist/svelte/Typeset.svelte +7 -0
- package/dist/svelte/index.d.ts +9 -0
- package/dist/svelte/index.js +84 -0
- package/dist/typeset-css-DPB0S1bV.mjs +202 -0
- package/dist/typeset-css-DdOGL7WF.d.mts +10 -0
- package/dist/vue.d.mts +7 -0
- package/dist/vue.mjs +86 -0
- package/package.json +170 -4
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { ComarkPlugin } from "comark";
|
|
2
|
+
import { AnyExtension, Extension, JSONContent, Node } from "@tiptap/core";
|
|
3
|
+
import { StarterKitOptions } from "@tiptap/starter-kit";
|
|
4
|
+
import { EditorState, Plugin, PluginKey, Transaction } from "@tiptap/pm/state";
|
|
5
|
+
import { DecorationSet } from "@tiptap/pm/view";
|
|
6
|
+
//#region src/editor/kit.d.ts
|
|
7
|
+
interface ComarkKitOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Passed to StarterKit. A collaborative editor turns `undoRedo` off, since Yjs keeps its own history. Comark has no
|
|
10
|
+
* underline syntax, so `underline` is always off.
|
|
11
|
+
*/
|
|
12
|
+
starterKit?: Partial<StarterKitOptions>;
|
|
13
|
+
}
|
|
14
|
+
/** Markdown's image, inline as Comark parses it, drawn as a player when comark-media would play it. */
|
|
15
|
+
declare const ComarkImage: Node<import("@tiptap/extension-image").ImageOptions, any>;
|
|
16
|
+
/** A block component, `::name`, or a block of raw HTML. Its children are blocks and its `#slot`s. */
|
|
17
|
+
declare const ComarkBlock: Node<any, any>;
|
|
18
|
+
/** A component's named slot, `#name`. */
|
|
19
|
+
declare const ComarkSlot: Node<any, any>;
|
|
20
|
+
/** An inline component, `:name[text]{props}`, or inline raw HTML. */
|
|
21
|
+
declare const ComarkInline: Node<any, any>;
|
|
22
|
+
/** An HTML comment between blocks. */
|
|
23
|
+
declare const ComarkComment: Node<any, any>;
|
|
24
|
+
/**
|
|
25
|
+
* The schema `fromMarkdown` and `toMarkdown` read and write: StarterKit's nodes and marks, task lists, inline images,
|
|
26
|
+
* tables, and Comark's components, slots, and comments. It needs no DOM, so a server can load it to convert a document
|
|
27
|
+
* for a collaborative room.
|
|
28
|
+
*/
|
|
29
|
+
declare const ComarkKit: Extension<ComarkKitOptions, any>;
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/editor/markdown.d.ts
|
|
32
|
+
interface EditorDocument {
|
|
33
|
+
/** The document as Tiptap JSON, for `setContent` or a collaborative room. */
|
|
34
|
+
doc: JSONContent;
|
|
35
|
+
/** The front matter, which stays outside the editor: a collaborative room keeps only the body. */
|
|
36
|
+
frontmatter: Record<string, unknown>;
|
|
37
|
+
/** The Markdown holds something the editor can't keep, so writing it back would change more than the edit. */
|
|
38
|
+
lossy: boolean;
|
|
39
|
+
}
|
|
40
|
+
/** Reads Markdown into the editor's document. */
|
|
41
|
+
declare function fromMarkdown(markdown: string): Promise<EditorDocument>;
|
|
42
|
+
/** Writes the editor's document, such as `editor.getJSON()`, back to Markdown. */
|
|
43
|
+
declare function toMarkdown(doc: JSONContent, options?: {
|
|
44
|
+
frontmatter?: Record<string, unknown>;
|
|
45
|
+
}): Promise<string>;
|
|
46
|
+
type MarkdownCheck = {
|
|
47
|
+
editable: true;
|
|
48
|
+
/** The Markdown as the editor writes it, which the first save produces. */ markdown: string;
|
|
49
|
+
} | {
|
|
50
|
+
editable: false;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Whether the editor can open this Markdown and save it without changing what readers see. Pass the parse plugins the
|
|
54
|
+
* page renders with, so syntax only they read, such as footnote definitions, counts too.
|
|
55
|
+
*/
|
|
56
|
+
declare function checkMarkdown(markdown: string, options?: {
|
|
57
|
+
plugins?: readonly ComarkPlugin<any, any>[];
|
|
58
|
+
}): Promise<MarkdownCheck>;
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/editor/upload.d.ts
|
|
61
|
+
interface UploadOptions {
|
|
62
|
+
/**
|
|
63
|
+
* Sends one file and resolves with the URL the document links to. Call `progress` with a fraction from 0 to 1 as the
|
|
64
|
+
* bytes go; `fetch` can't report them, so use XMLHttpRequest's `upload.onprogress`. Without it, nothing uploads.
|
|
65
|
+
*/
|
|
66
|
+
upload?: (file: File, progress: (fraction: number) => void) => Promise<string>;
|
|
67
|
+
/** Which files to take from a paste or a drop. Images, video, and audio by default. */
|
|
68
|
+
accept: (file: File) => boolean;
|
|
69
|
+
/** Called when `upload` rejects. The placeholder is gone by then. */
|
|
70
|
+
onError?: (error: unknown, file: File) => void;
|
|
71
|
+
}
|
|
72
|
+
/** What a placeholder shows while its file uploads. */
|
|
73
|
+
interface PendingUpload {
|
|
74
|
+
id: number;
|
|
75
|
+
file: File;
|
|
76
|
+
/** From 0 to 1, or `null` until the first progress report. */
|
|
77
|
+
fraction: number | null;
|
|
78
|
+
/** A `blob:` URL for an image or video's preview, for this browser only. */
|
|
79
|
+
preview?: string;
|
|
80
|
+
}
|
|
81
|
+
/** The state an editor view gives the plugin: a test can pass a plain object. */
|
|
82
|
+
interface View {
|
|
83
|
+
readonly state: EditorState;
|
|
84
|
+
dispatch(tr: Transaction): void;
|
|
85
|
+
}
|
|
86
|
+
declare const uploadKey: PluginKey<DecorationSet>;
|
|
87
|
+
/** Where placeholder `id` sits now, after every edit since it was added. */
|
|
88
|
+
declare function findUpload(state: EditorState, id: number): number | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* Uploads `files` into the document at `pos`. Each shows a placeholder there until its URL comes back, then becomes an
|
|
91
|
+
* image node, which comark-media plays when its URL ends in a video or audio extension. The placeholder is a
|
|
92
|
+
* decoration, so a collaborative room never sees a file that hasn't finished.
|
|
93
|
+
*/
|
|
94
|
+
declare function startUploads(view: View, files: File[], pos: number, options: UploadOptions): Promise<string | undefined>[];
|
|
95
|
+
/** The plugin alone, for a ProseMirror editor without Tiptap. */
|
|
96
|
+
declare function uploadPlugin(options: UploadOptions): Plugin<DecorationSet>;
|
|
97
|
+
declare module "@tiptap/core" {
|
|
98
|
+
interface Commands<ReturnType> {
|
|
99
|
+
comarkUpload: {
|
|
100
|
+
/** Uploads files at the cursor, as a paste would, such as the ones a file picker returns. */
|
|
101
|
+
uploadFiles: (files: File[]) => ReturnType;
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/** Uploads pasted and dropped files, with a placeholder that shows the progress. Pass `upload` to turn it on. */
|
|
106
|
+
declare const Upload: Extension<UploadOptions, any>;
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/editor/codec.d.ts
|
|
109
|
+
/**
|
|
110
|
+
* A schema and Markdown codec that a server and its browsers share, as a collaborative room needs: the server converts
|
|
111
|
+
* the stored Markdown with it, and every editor that joins builds the same schema from `extensions()`. ViteHub
|
|
112
|
+
* Realtime's `editor` option takes it as it is.
|
|
113
|
+
*/
|
|
114
|
+
interface EditorCodec {
|
|
115
|
+
extensions(): AnyExtension[];
|
|
116
|
+
fromMarkdown(markdown: string): Promise<JSONContent>;
|
|
117
|
+
toMarkdown(doc: JSONContent): Promise<string>;
|
|
118
|
+
/** Whether the room may save this document. `canonical` is what the first save writes for it unchanged. */
|
|
119
|
+
verify(markdown: string): Promise<{
|
|
120
|
+
writable: boolean;
|
|
121
|
+
canonical?: string;
|
|
122
|
+
}>;
|
|
123
|
+
}
|
|
124
|
+
interface EditorCodecOptions {
|
|
125
|
+
kit?: ComarkKitOptions;
|
|
126
|
+
/** The parse plugins the page renders with, so a document only they read opens read-only. */
|
|
127
|
+
plugins?: readonly ComarkPlugin<any, any>[];
|
|
128
|
+
}
|
|
129
|
+
declare function createEditorCodec(options?: EditorCodecOptions): EditorCodec;
|
|
130
|
+
//#endregion
|
|
131
|
+
export { ComarkSlot as S, ComarkComment as _, Upload as a, ComarkKit as b, startUploads as c, EditorDocument as d, MarkdownCheck as f, ComarkBlock as g, toMarkdown as h, PendingUpload as i, uploadKey as l, fromMarkdown as m, EditorCodecOptions as n, UploadOptions as o, checkMarkdown as p, createEditorCodec as r, findUpload as s, EditorCodec as t, uploadPlugin as u, ComarkImage as v, ComarkKitOptions as x, ComarkInline as y };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { x as ComarkKitOptions } from "./editor-CNivEuMH.mjs";
|
|
2
|
+
import { ComarkPlugin } from "comark";
|
|
3
|
+
import { AnyExtension } from "@tiptap/core";
|
|
4
|
+
import { Editor } from "@tiptap/vue-3";
|
|
5
|
+
import { PropType, Ref } from "vue";
|
|
6
|
+
//#region src/editor-vue.d.ts
|
|
7
|
+
export interface UseComarkEditorOptions {
|
|
8
|
+
/** Added after ComarkKit, such as a placeholder. */
|
|
9
|
+
extensions?: AnyExtension[];
|
|
10
|
+
kit?: ComarkKitOptions;
|
|
11
|
+
/** The parse plugins the page renders with, so a document only they read is opened read-only. */
|
|
12
|
+
plugins?: readonly ComarkPlugin<any, any>[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A Tiptap editor bound to a Markdown string: an edit writes the Markdown back, and a change from outside reloads the
|
|
16
|
+
* editor. A document the editor can't save unchanged (see `checkMarkdown`) opens read-only, with `editable` false.
|
|
17
|
+
*/
|
|
18
|
+
export declare function useComarkEditor(markdown: Ref<string>, options?: UseComarkEditorOptions): {
|
|
19
|
+
editor: import("vue").ShallowRef<Editor | undefined, Editor | undefined>;
|
|
20
|
+
editable: Ref<boolean, boolean>;
|
|
21
|
+
};
|
|
22
|
+
/** `useComarkEditor` as a component: `<ComarkEditor v-model="markdown" />`. */
|
|
23
|
+
export declare const ComarkEditor: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
24
|
+
modelValue: {
|
|
25
|
+
type: StringConstructor;
|
|
26
|
+
required: true;
|
|
27
|
+
};
|
|
28
|
+
extensions: {
|
|
29
|
+
type: PropType<AnyExtension[]>;
|
|
30
|
+
default: undefined;
|
|
31
|
+
};
|
|
32
|
+
plugins: {
|
|
33
|
+
type: PropType<ComarkPlugin<any, any>[]>;
|
|
34
|
+
default: undefined;
|
|
35
|
+
};
|
|
36
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
37
|
+
[key: string]: any;
|
|
38
|
+
}> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
39
|
+
modelValue: {
|
|
40
|
+
type: StringConstructor;
|
|
41
|
+
required: true;
|
|
42
|
+
};
|
|
43
|
+
extensions: {
|
|
44
|
+
type: PropType<AnyExtension[]>;
|
|
45
|
+
default: undefined;
|
|
46
|
+
};
|
|
47
|
+
plugins: {
|
|
48
|
+
type: PropType<ComarkPlugin<any, any>[]>;
|
|
49
|
+
default: undefined;
|
|
50
|
+
};
|
|
51
|
+
}>> & Readonly<{
|
|
52
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
53
|
+
}>, {
|
|
54
|
+
extensions: AnyExtension[];
|
|
55
|
+
plugins: ComarkPlugin<any, any>[];
|
|
56
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
57
|
+
//#endregion
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { c as fromMarkdown, l as toMarkdown, m as ComarkKit, s as checkMarkdown } from "./editor-BAdok66p.mjs";
|
|
2
|
+
import { Editor, EditorContent } from "@tiptap/vue-3";
|
|
3
|
+
import { defineComponent, h, onScopeDispose, ref, shallowRef, watch } from "vue";
|
|
4
|
+
//#region src/editor-vue.ts
|
|
5
|
+
/**
|
|
6
|
+
* A Tiptap editor bound to a Markdown string: an edit writes the Markdown back, and a change from outside reloads the
|
|
7
|
+
* editor. A document the editor can't save unchanged (see `checkMarkdown`) opens read-only, with `editable` false.
|
|
8
|
+
*/
|
|
9
|
+
function useComarkEditor(markdown, options = {}) {
|
|
10
|
+
const editor = shallowRef();
|
|
11
|
+
const editable = ref(false);
|
|
12
|
+
let frontmatter = {};
|
|
13
|
+
let written;
|
|
14
|
+
let loads = 0;
|
|
15
|
+
let saves = 0;
|
|
16
|
+
async function save() {
|
|
17
|
+
const current = editor.value;
|
|
18
|
+
if (!current) return;
|
|
19
|
+
const run = ++saves;
|
|
20
|
+
const next = await toMarkdown(current.getJSON(), { frontmatter });
|
|
21
|
+
if (run !== saves) return;
|
|
22
|
+
written = next;
|
|
23
|
+
markdown.value = next;
|
|
24
|
+
}
|
|
25
|
+
async function load(source) {
|
|
26
|
+
const run = ++loads;
|
|
27
|
+
++saves;
|
|
28
|
+
const [check, read] = await Promise.all([checkMarkdown(source, { plugins: options.plugins }), fromMarkdown(source)]);
|
|
29
|
+
if (run !== loads) return;
|
|
30
|
+
frontmatter = read.frontmatter;
|
|
31
|
+
editable.value = check.editable;
|
|
32
|
+
if (editor.value) {
|
|
33
|
+
editor.value.commands.setContent(read.doc, { emitUpdate: false });
|
|
34
|
+
editor.value.setEditable(check.editable, false);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
editor.value = new Editor({
|
|
38
|
+
extensions: [ComarkKit.configure(options.kit), ...options.extensions ?? []],
|
|
39
|
+
content: read.doc,
|
|
40
|
+
editable: check.editable,
|
|
41
|
+
onUpdate: () => void save()
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
watch(markdown, (value) => {
|
|
45
|
+
if (value !== written) load(value);
|
|
46
|
+
}, { immediate: true });
|
|
47
|
+
onScopeDispose(() => editor.value?.destroy());
|
|
48
|
+
return {
|
|
49
|
+
editor,
|
|
50
|
+
editable
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/** `useComarkEditor` as a component: `<ComarkEditor v-model="markdown" />`. */
|
|
54
|
+
const ComarkEditor = defineComponent({
|
|
55
|
+
name: "ComarkEditor",
|
|
56
|
+
props: {
|
|
57
|
+
modelValue: {
|
|
58
|
+
type: String,
|
|
59
|
+
required: true
|
|
60
|
+
},
|
|
61
|
+
extensions: {
|
|
62
|
+
type: Array,
|
|
63
|
+
default: void 0
|
|
64
|
+
},
|
|
65
|
+
plugins: {
|
|
66
|
+
type: Array,
|
|
67
|
+
default: void 0
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
emits: ["update:modelValue"],
|
|
71
|
+
setup(props, { emit }) {
|
|
72
|
+
const markdown = ref(props.modelValue);
|
|
73
|
+
watch(() => props.modelValue, (value) => markdown.value = value);
|
|
74
|
+
watch(markdown, (value) => {
|
|
75
|
+
if (value !== props.modelValue) emit("update:modelValue", value);
|
|
76
|
+
});
|
|
77
|
+
const { editor } = useComarkEditor(markdown, {
|
|
78
|
+
extensions: props.extensions,
|
|
79
|
+
plugins: props.plugins
|
|
80
|
+
});
|
|
81
|
+
return () => editor.value ? h(EditorContent, { editor: editor.value }) : null;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
//#endregion
|
|
85
|
+
export { ComarkEditor, useComarkEditor };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { S as ComarkSlot, _ as ComarkComment, a as Upload, b as ComarkKit, c as startUploads, d as EditorDocument, f as MarkdownCheck, g as ComarkBlock, h as toMarkdown, i as PendingUpload, l as uploadKey, m as fromMarkdown, n as EditorCodecOptions, o as UploadOptions, p as checkMarkdown, r as createEditorCodec, s as findUpload, t as EditorCodec, u as uploadPlugin, v as ComarkImage, x as ComarkKitOptions, y as ComarkInline } from "./editor-CNivEuMH.mjs";
|
|
2
|
+
export { ComarkBlock, ComarkComment, ComarkImage, ComarkInline, ComarkKit, type ComarkKitOptions, ComarkSlot, type EditorCodec, type EditorCodecOptions, type EditorDocument, type MarkdownCheck, type PendingUpload, Upload, type UploadOptions, checkMarkdown, createEditorCodec, findUpload, fromMarkdown, startUploads, toMarkdown, uploadKey, uploadPlugin };
|
package/dist/editor.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { u as ComarkBlock, d as ComarkComment, f as ComarkImage, p as ComarkInline, m as ComarkKit, h as ComarkSlot, n as Upload, s as checkMarkdown, t as createEditorCodec, r as findUpload, c as fromMarkdown, i as startUploads, l as toMarkdown, a as uploadKey, o as uploadPlugin } from "./editor-BAdok66p.mjs";
|
package/dist/html.d.mts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { a as criticCss, n as Preset, r as PresetOptions } from "./index-B0YvApci.mjs";
|
|
2
|
+
import { NodeHandler } from "comark";
|
|
3
|
+
//#region src/html.d.ts
|
|
4
|
+
/** Every plugin for `@comark/html`, with the `components` to render them. */
|
|
5
|
+
declare const _default: (options?: PresetOptions) => Preset<NodeHandler>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { type PresetOptions, criticCss, _default as default };
|
package/dist/html.mjs
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { t as typesetCss } from "./typeset-css-DPB0S1bV.mjs";
|
|
2
|
+
import { n as preset, t as criticCss } from "./src-DROB05U6.mjs";
|
|
3
|
+
import { mermaidCss } from "./client.mjs";
|
|
4
|
+
import * as annotate from "comark-annotate/html";
|
|
5
|
+
import * as badge from "comark-badge/html";
|
|
6
|
+
import * as cards from "comark-cards/html";
|
|
7
|
+
import * as carousel from "comark-carousel/html";
|
|
8
|
+
import * as cast from "comark-cast/html";
|
|
9
|
+
import * as charts from "comark-charts/html";
|
|
10
|
+
import * as chips from "comark-chips/html";
|
|
11
|
+
import * as code from "comark-code/html";
|
|
12
|
+
import * as codeNotes from "comark-code-notes/html";
|
|
13
|
+
import * as colors from "comark-colors/html";
|
|
14
|
+
import * as details from "comark-details/html";
|
|
15
|
+
import * as diagrams from "comark-diagrams/html";
|
|
16
|
+
import * as diff from "comark-diff/html";
|
|
17
|
+
import * as embed from "comark-embed/html";
|
|
18
|
+
import * as fields from "comark-fields/html";
|
|
19
|
+
import * as fileTree from "comark-file-tree/html";
|
|
20
|
+
import * as github from "comark-github/html";
|
|
21
|
+
import * as icon from "comark-icon/html";
|
|
22
|
+
import * as links from "comark-links/html";
|
|
23
|
+
import * as magicMove from "comark-magic-move/html";
|
|
24
|
+
import * as mark from "comark-mark/html";
|
|
25
|
+
import * as math from "comark-mathml/html";
|
|
26
|
+
import * as media from "comark-media/html";
|
|
27
|
+
import pele, { Pele } from "comark-pele/html";
|
|
28
|
+
import * as metrics from "comark-metrics/html";
|
|
29
|
+
import * as outline from "comark-outline/html";
|
|
30
|
+
import * as properties from "comark-properties/html";
|
|
31
|
+
import * as qr from "comark-qr/html";
|
|
32
|
+
import * as quiz from "comark-quiz/html";
|
|
33
|
+
import * as sources from "comark-sources/html";
|
|
34
|
+
import * as steps from "comark-steps/html";
|
|
35
|
+
import * as table from "comark-table/html";
|
|
36
|
+
import * as tabs from "comark-tabs/html";
|
|
37
|
+
import * as tests from "comark-tests/html";
|
|
38
|
+
import * as zoom from "comark-zoom/html";
|
|
39
|
+
//#region src/html.ts
|
|
40
|
+
const styled = /* @__PURE__ */ new WeakSet();
|
|
41
|
+
const mermaid = {
|
|
42
|
+
default: pele,
|
|
43
|
+
components: { pele: ((node, state) => {
|
|
44
|
+
const styles = styled.has(state.context) ? "" : `<style data-comark-mermaid>${mermaidCss}</style>`;
|
|
45
|
+
styled.add(state.context);
|
|
46
|
+
return styles + Pele(node);
|
|
47
|
+
}) }
|
|
48
|
+
};
|
|
49
|
+
const typeset = () => `<style data-comark-typeset>${typesetCss}</style>`;
|
|
50
|
+
/** Every plugin for `@comark/html`, with the `components` to render them. */
|
|
51
|
+
var html_default = (options) => preset({
|
|
52
|
+
annotate,
|
|
53
|
+
badge,
|
|
54
|
+
cards,
|
|
55
|
+
carousel,
|
|
56
|
+
cast,
|
|
57
|
+
charts,
|
|
58
|
+
chips,
|
|
59
|
+
code,
|
|
60
|
+
codeNotes,
|
|
61
|
+
colors,
|
|
62
|
+
details,
|
|
63
|
+
diagrams,
|
|
64
|
+
diff,
|
|
65
|
+
embed,
|
|
66
|
+
fields,
|
|
67
|
+
fileTree,
|
|
68
|
+
github,
|
|
69
|
+
icon,
|
|
70
|
+
links,
|
|
71
|
+
magicMove,
|
|
72
|
+
mark,
|
|
73
|
+
math,
|
|
74
|
+
media,
|
|
75
|
+
mermaid,
|
|
76
|
+
metrics,
|
|
77
|
+
outline,
|
|
78
|
+
properties,
|
|
79
|
+
qr,
|
|
80
|
+
quiz,
|
|
81
|
+
sources,
|
|
82
|
+
steps,
|
|
83
|
+
table,
|
|
84
|
+
tabs,
|
|
85
|
+
tests,
|
|
86
|
+
typeset,
|
|
87
|
+
zoom
|
|
88
|
+
}, options);
|
|
89
|
+
//#endregion
|
|
90
|
+
export { criticCss, html_default as default };
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { CriticOptions, css as criticCss } from "comark-critic";
|
|
2
|
+
import { FigureOptions } from "comark-figure";
|
|
3
|
+
import { FootnotesOptions } from "comark-footnotes";
|
|
4
|
+
import { IconOptions, Icons } from "comark-icon";
|
|
5
|
+
import { IncludeOptions } from "comark-include";
|
|
6
|
+
import { KeysOptions } from "comark-keys";
|
|
7
|
+
import { ReadingTimeOptions } from "comark-reading-time";
|
|
8
|
+
import { XrefOptions } from "comark-xref";
|
|
9
|
+
import { ComarkPlugin } from "comark";
|
|
10
|
+
import { BadgeOptions } from "comark-badge";
|
|
11
|
+
import { CastOptions } from "comark-cast";
|
|
12
|
+
import { ChartsOptions } from "comark-charts";
|
|
13
|
+
import { ChipsOptions } from "comark-chips";
|
|
14
|
+
import { CodeOptions } from "comark-code";
|
|
15
|
+
import { DetailsOptions } from "comark-details";
|
|
16
|
+
import { DiagramsOptions } from "comark-diagrams";
|
|
17
|
+
import { FileTreeOptions } from "comark-file-tree";
|
|
18
|
+
import { CalloutsOptions, ReferencesOptions } from "comark-github";
|
|
19
|
+
import { AnchorsOptions, ExternalOptions } from "comark-links";
|
|
20
|
+
import { MathOptions } from "comark-mathml";
|
|
21
|
+
import { MediaOptions } from "comark-media";
|
|
22
|
+
import { PeleConfig } from "comark-pele";
|
|
23
|
+
import { PropertiesOptions } from "comark-properties";
|
|
24
|
+
import { QuizOptions } from "comark-quiz";
|
|
25
|
+
import { TableOptions } from "comark-table";
|
|
26
|
+
import { TabsOptions } from "comark-tabs";
|
|
27
|
+
import { TestsOptions } from "comark-tests";
|
|
28
|
+
import { ZoomOptions } from "comark-zoom";
|
|
29
|
+
//#region src/typeset.d.ts
|
|
30
|
+
/** The node that adds the styles. The plugin adds one at the end of every document. */
|
|
31
|
+
declare const TYPESET_TAG = "typeset-styles";
|
|
32
|
+
/** Adds the node that writes the typeset styles at the end of the document. The preset turns it on by default. */
|
|
33
|
+
declare const typeset: import("comark").ComarkPluginFactory<unknown, {}, {}>;
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/index.d.ts
|
|
36
|
+
/**
|
|
37
|
+
* `false` turns a plugin off, and an object turns it on with those options. Everything but `include` is on, and cast,
|
|
38
|
+
* table, and tests read no files until they get options.
|
|
39
|
+
*/
|
|
40
|
+
type PresetOptions = {
|
|
41
|
+
/** Pastes files into the Markdown before the other plugins read it. Off, since it reads from disk by default. */
|
|
42
|
+
include?: IncludeOptions | boolean;
|
|
43
|
+
/** HTML only: Vue, React, and Svelte have no annotate components. */
|
|
44
|
+
annotate?: boolean;
|
|
45
|
+
carousel?: boolean;
|
|
46
|
+
/** Reads no cast files unless you pass `{ root }` or `{ read }`; inline casts render either way. */
|
|
47
|
+
cast?: CastOptions | boolean;
|
|
48
|
+
cjk?: boolean;
|
|
49
|
+
deflist?: boolean;
|
|
50
|
+
figure?: FigureOptions | boolean;
|
|
51
|
+
critic?: CriticOptions | boolean;
|
|
52
|
+
charts?: ChartsOptions | boolean;
|
|
53
|
+
/** Pass `{ download: false }` when parsing in a browser, which may not download another site's images. */
|
|
54
|
+
chips?: ChipsOptions | boolean;
|
|
55
|
+
colors?: boolean;
|
|
56
|
+
/** Sends each diagram's source to `https://kroki.io` unless you pass your own `server`, or `{ draw: false }`. */
|
|
57
|
+
diagrams?: DiagramsOptions | boolean;
|
|
58
|
+
/** Draws `mermaid` fences with comark-pele, on the server and offline. */
|
|
59
|
+
mermaid?: PeleConfig | boolean;
|
|
60
|
+
/** HTML only: Vue, React, and Svelte have no diff components. */
|
|
61
|
+
diff?: boolean;
|
|
62
|
+
embed?: boolean;
|
|
63
|
+
footnotes?: FootnotesOptions | boolean;
|
|
64
|
+
github?: {
|
|
65
|
+
callouts?: CalloutsOptions | boolean;
|
|
66
|
+
references?: ReferencesOptions | boolean;
|
|
67
|
+
html?: boolean;
|
|
68
|
+
} | boolean;
|
|
69
|
+
/** Also resolves the icons of cards, details, file trees, tabs, and code actions, so they share its options. */
|
|
70
|
+
icon?: IconOptions | boolean;
|
|
71
|
+
magicMove?: boolean;
|
|
72
|
+
mark?: boolean;
|
|
73
|
+
/** Typesets `$…$`, `$$…$$`, and `math` fences as MathML while parsing, in place of Comark's math plugin. */
|
|
74
|
+
math?: MathOptions | boolean;
|
|
75
|
+
details?: DetailsOptions | boolean;
|
|
76
|
+
links?: {
|
|
77
|
+
external?: ExternalOptions | boolean;
|
|
78
|
+
anchors?: AnchorsOptions | boolean;
|
|
79
|
+
} | boolean;
|
|
80
|
+
fileTree?: FileTreeOptions | boolean;
|
|
81
|
+
fields?: boolean;
|
|
82
|
+
properties?: PropertiesOptions | boolean;
|
|
83
|
+
/** HTML only: Vue, React, and Svelte have no quiz components. */
|
|
84
|
+
quiz?: QuizOptions | boolean;
|
|
85
|
+
keys?: KeysOptions | boolean;
|
|
86
|
+
badge?: BadgeOptions | boolean;
|
|
87
|
+
media?: MediaOptions | boolean;
|
|
88
|
+
metrics?: boolean;
|
|
89
|
+
/** Reads no data files unless you pass `{ root }` or `{ read }`; CSV fences render either way. */
|
|
90
|
+
table?: TableOptions | boolean;
|
|
91
|
+
cards?: boolean;
|
|
92
|
+
qr?: boolean;
|
|
93
|
+
sources?: boolean;
|
|
94
|
+
steps?: boolean;
|
|
95
|
+
readingTime?: ReadingTimeOptions | boolean;
|
|
96
|
+
tabs?: TabsOptions | boolean;
|
|
97
|
+
outline?: boolean;
|
|
98
|
+
xref?: XrefOptions | boolean;
|
|
99
|
+
/** Reads no JUnit reports unless you pass `{ root }` or `{ read }`; inline reports render either way. */
|
|
100
|
+
tests?: TestsOptions | boolean;
|
|
101
|
+
zoom?: ZoomOptions | boolean;
|
|
102
|
+
code?: CodeOptions | boolean;
|
|
103
|
+
codeNotes?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* The text around the blocks, from shadcn/typeset on the same tokens: headings, paragraphs, lists, tables, code, and
|
|
106
|
+
* quotes. `false` leaves the text to your own styles.
|
|
107
|
+
*/
|
|
108
|
+
typeset?: boolean;
|
|
109
|
+
};
|
|
110
|
+
type AnyPlugin = ComarkPlugin<any, any>;
|
|
111
|
+
type Part<C, O = void> = {
|
|
112
|
+
default: (options?: O) => AnyPlugin;
|
|
113
|
+
components: Record<string, C>;
|
|
114
|
+
};
|
|
115
|
+
/** One renderer's entry of each package with components, by the option that turns it on. */
|
|
116
|
+
type Renderer<C> = {
|
|
117
|
+
annotate?: Part<C>;
|
|
118
|
+
carousel: Part<C>;
|
|
119
|
+
cast: Part<C, CastOptions>;
|
|
120
|
+
charts: Part<C, ChartsOptions>;
|
|
121
|
+
chips: Part<C, ChipsOptions>;
|
|
122
|
+
colors: Part<C>;
|
|
123
|
+
diagrams: Part<C, DiagramsOptions>;
|
|
124
|
+
mermaid: Part<C, PeleConfig>;
|
|
125
|
+
diff?: Part<C>;
|
|
126
|
+
embed: Part<C>;
|
|
127
|
+
github: {
|
|
128
|
+
callouts: (options?: CalloutsOptions) => AnyPlugin;
|
|
129
|
+
references: (options?: ReferencesOptions) => AnyPlugin;
|
|
130
|
+
html: () => AnyPlugin;
|
|
131
|
+
components: Record<string, C>;
|
|
132
|
+
};
|
|
133
|
+
icon: Part<C, IconOptions | Icons>;
|
|
134
|
+
details: Part<C, DetailsOptions>;
|
|
135
|
+
links: {
|
|
136
|
+
external: (options?: ExternalOptions) => AnyPlugin;
|
|
137
|
+
anchors: (options?: AnchorsOptions) => AnyPlugin;
|
|
138
|
+
components: Record<string, C>;
|
|
139
|
+
};
|
|
140
|
+
fileTree: Part<C, FileTreeOptions>;
|
|
141
|
+
fields: Part<C>;
|
|
142
|
+
properties: Part<C, PropertiesOptions>;
|
|
143
|
+
quiz?: Part<C, QuizOptions>;
|
|
144
|
+
badge: Part<C, BadgeOptions>;
|
|
145
|
+
magicMove: Part<C>;
|
|
146
|
+
mark: Part<C>;
|
|
147
|
+
math: Part<C, MathOptions>;
|
|
148
|
+
media: Part<C, MediaOptions>;
|
|
149
|
+
metrics: Part<C>;
|
|
150
|
+
table: Part<C, TableOptions>;
|
|
151
|
+
cards: Part<C, {
|
|
152
|
+
iconResolver?: Icons;
|
|
153
|
+
}>;
|
|
154
|
+
qr: Part<C>;
|
|
155
|
+
sources: Part<C>;
|
|
156
|
+
steps: Part<C>;
|
|
157
|
+
tabs: Part<C, TabsOptions>;
|
|
158
|
+
outline: Part<C>;
|
|
159
|
+
tests: Part<C, TestsOptions>;
|
|
160
|
+
zoom: Part<C, ZoomOptions>;
|
|
161
|
+
code: Part<C, CodeOptions>;
|
|
162
|
+
codeNotes: Part<C>;
|
|
163
|
+
/** The component that writes the typeset styles into the document, as `typeset-styles`. */
|
|
164
|
+
typeset: C;
|
|
165
|
+
};
|
|
166
|
+
type Preset<C> = {
|
|
167
|
+
plugins: AnyPlugin[];
|
|
168
|
+
components: Record<string, C>;
|
|
169
|
+
};
|
|
170
|
+
/** Builds a renderer's preset. Use the one from `comark-ui/html`, `/vue`, `/react`, or `/svelte`. */
|
|
171
|
+
declare function preset<C>(renderer: Renderer<C>, options?: PresetOptions): Preset<C>;
|
|
172
|
+
//#endregion
|
|
173
|
+
export { criticCss as a, typeset as c, Renderer as i, Preset as n, preset as o, PresetOptions as r, TYPESET_TAG as s, AnyPlugin as t };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { t as typesetCss } from "./typeset-css-DdOGL7WF.mjs";
|
|
2
|
+
import { a as criticCss, c as typeset, i as Renderer, n as Preset, o as preset, r as PresetOptions, s as TYPESET_TAG, t as AnyPlugin } from "./index-B0YvApci.mjs";
|
|
3
|
+
export { AnyPlugin, Preset, PresetOptions, Renderer, TYPESET_TAG, criticCss, preset, typeset, typesetCss };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/nuxt-ui.d.ts
|
|
2
|
+
export type NuxtUiTheme = {
|
|
3
|
+
/** `ui.colors` from the app's `app.config.ts`, such as `{ primary: "indigo", neutral: "zinc" }`. */
|
|
4
|
+
colors?: Record<string, string | undefined>;
|
|
5
|
+
/** The app's main CSS file: its `@theme` colors and fonts, and the `--ui-*` variables its `:root` and `.dark` set. */
|
|
6
|
+
css?: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Rebuilds a Nuxt UI app's `--ui-*` variables from its `app.config` colors and main CSS, for a page that renders
|
|
10
|
+
* Comark outside the app, such as a review document. The plugins read those variables, so the page matches the app.
|
|
11
|
+
* Light mode sits on `:root` and `.light`, dark on `.dark` and on a system in dark mode, all in the `theme` layer.
|
|
12
|
+
*/
|
|
13
|
+
export declare function nuxtUiTheme(theme?: NuxtUiTheme): {
|
|
14
|
+
css: string;
|
|
15
|
+
issues: string[];
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|