@comark/vue 0.1.1 → 0.2.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.
@@ -1,5 +1,5 @@
1
1
  import { computed, defineComponent, h, shallowRef, watch } from 'vue';
2
- import { createParse } from 'comark';
2
+ import { createSerializedParse } from 'comark';
3
3
  import { ComarkRenderer } from "./ComarkRenderer.js";
4
4
  /**
5
5
  * Comark component
@@ -110,12 +110,10 @@ export const Comark = defineComponent({
110
110
  return (result || '').trim();
111
111
  });
112
112
  const parsed = shallowRef(null);
113
- const parse = createParse({ ...props.options, plugins: props.plugins });
114
- async function parseMarkdown() {
115
- parsed.value = await parse(markdown.value, { streaming: props.streaming });
116
- }
117
- watch(markdown, parseMarkdown);
118
- await parseMarkdown();
113
+ const parse = createSerializedParse({ ...props.options, plugins: props.plugins });
114
+ watch(() => [markdown.value, props.streaming], () => parse(markdown.value, { streaming: props.streaming }).then(result => parsed.value = result));
115
+ await parse(markdown.value, { streaming: props.streaming })
116
+ .then(result => parsed.value = result);
119
117
  return () => {
120
118
  // Render using ComarkRenderer
121
119
  return h(ComarkRenderer, {
@@ -123,7 +121,7 @@ export const Comark = defineComponent({
123
121
  components: props.components,
124
122
  streaming: props.streaming,
125
123
  componentsManifest: props.componentsManifest,
126
- class: `comark-content ${props.streaming ? 'comark-stream' : ''}`,
124
+ class: props.streaming ? 'comark-stream' : '',
127
125
  caret: props.caret,
128
126
  });
129
127
  };
@@ -55,8 +55,8 @@ export declare const Mermaid: import("vue").DefineComponent<import("vue").Extrac
55
55
  };
56
56
  }>> & Readonly<{}>, {
57
57
  class: string;
58
- height: string;
59
- width: string;
60
58
  theme: ThemeNames | DiagramColors;
61
59
  themeDark: ThemeNames | DiagramColors;
60
+ height: string;
61
+ width: string;
62
62
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
package/dist/index.d.ts CHANGED
@@ -8,11 +8,19 @@ interface DefineComarkComponentOptions extends ParseOptions {
8
8
  extends?: typeof Comark;
9
9
  name?: string;
10
10
  components?: Record<string, any>;
11
+ /**
12
+ * Additional classes for the wrapper div
13
+ */
14
+ class?: string;
11
15
  }
12
16
  interface DefineComarkRendererOptions {
13
17
  extends?: typeof ComarkRenderer;
14
18
  name?: string;
15
19
  components?: Record<string, any>;
20
+ /**
21
+ * Additional classes for the wrapper div
22
+ */
23
+ class?: string;
16
24
  }
17
25
  export declare function defineComarkComponent(config?: DefineComarkComponentOptions): typeof Comark;
18
26
  export declare function defineComarkRendererComponent(config?: DefineComarkRendererOptions): typeof ComarkRenderer;
package/dist/index.js CHANGED
@@ -92,6 +92,7 @@ export function defineComarkComponent(config = {}) {
92
92
  streaming: props.streaming,
93
93
  summary: props.summary,
94
94
  caret: props.caret,
95
+ class: config.class,
95
96
  }, {
96
97
  default: slots.default,
97
98
  });
@@ -155,6 +156,7 @@ export function defineComarkRendererComponent(config = {}) {
155
156
  componentsManifest: props.componentsManifest,
156
157
  streaming: props.streaming,
157
158
  caret: props.caret,
159
+ class: config.class,
158
160
  }, {
159
161
  default: slots.default,
160
162
  });
@@ -0,0 +1,2 @@
1
+ export * from 'comark/plugins/json-render';
2
+ export { default } from 'comark/plugins/json-render';
@@ -0,0 +1,2 @@
1
+ export * from 'comark/plugins/json-render';
2
+ export { default } from 'comark/plugins/json-render';
@@ -1,4 +1,4 @@
1
- const CARET_TEXT = ' '; // thin space is used to avoid wide spaces between text and caret
1
+ const CARET_TEXT = ''; // thin space is used to avoid wide spaces between text and caret
2
2
  const CARET_STYLE = 'background-color: currentColor; display: inline-block; margin-left: 0.25rem; margin-right: 0.25rem; animation: pulse 0.75s cubic-bezier(0.4,0,0.6,1) infinite;';
3
3
  export function getCaret(options) {
4
4
  if (options === true) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@comark/vue",
3
3
  "type": "module",
4
- "version": "0.1.1",
4
+ "version": "0.2.1",
5
5
  "description": "Vue components for Comark",
6
6
  "exports": {
7
7
  ".": "./dist/index.js",
@@ -30,10 +30,10 @@
30
30
  "release": "release-it"
31
31
  },
32
32
  "peerDependencies": {
33
- "vue": "^3.5.0",
34
33
  "beautiful-mermaid": "^1.1.3",
35
34
  "katex": "^0.16.33",
36
- "shiki": "^3.22.0"
35
+ "shiki": "^4.0.0",
36
+ "vue": "^3.5.0"
37
37
  },
38
38
  "peerDependenciesMeta": {
39
39
  "shiki": {
@@ -47,11 +47,13 @@
47
47
  }
48
48
  },
49
49
  "dependencies": {
50
- "comark": "^0.1.1"
50
+ "comark": "^0.2.1"
51
51
  },
52
52
  "devDependencies": {
53
- "@vue/server-renderer": "^3.5.30",
54
- "vitest": "^4.1.1",
55
- "vue": "^3.5.30"
53
+ "@vue/compiler-core": "^3.5.32",
54
+ "@vue/server-renderer": "^3.5.32",
55
+ "vite": "^8.0.8",
56
+ "vitest": "^4.1.4",
57
+ "vue": "^3.5.32"
56
58
  }
57
59
  }