@incremark/vue 0.4.0-alpha.2 → 1.0.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.
@@ -3,7 +3,14 @@ import type { Component } from 'vue';
3
3
  import type { CodeBlockConfig } from './Incremark.vue';
4
4
  interface Props {
5
5
  node: Code;
6
- /** Shiki 主题,默认 github-dark */
6
+ /** Shiki 亮色主题,默认 github-light */
7
+ lightTheme?: string;
8
+ /** Shiki 暗色主题,默认 github-dark */
9
+ darkTheme?: string;
10
+ /**
11
+ * Shiki 主题(手动指定,优先于 lightTheme/darkTheme 的自动选择)
12
+ * @deprecated 推荐使用 lightTheme/darkTheme 配合 ThemeProvider 自动切换
13
+ */
7
14
  theme?: string;
8
15
  /** 默认回退主题(当指定主题加载失败时使用),默认 github-dark */
9
16
  fallbackTheme?: string;
@@ -21,8 +28,9 @@ interface Props {
21
28
  defaultCodeComponent?: Component;
22
29
  }
23
30
  declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
24
- theme: string;
25
31
  mermaidDelay: number;
32
+ lightTheme: string;
33
+ darkTheme: string;
26
34
  fallbackTheme: string;
27
35
  disableHighlight: boolean;
28
36
  blockStatus: "pending" | "stable" | "completed";
@@ -1,7 +1,14 @@
1
1
  import type { Code } from 'mdast';
2
2
  interface Props {
3
3
  node: Code;
4
- /** Shiki 主题,默认 github-dark */
4
+ /** Shiki 亮色主题,默认 github-light */
5
+ lightTheme?: string;
6
+ /** Shiki 暗色主题,默认 github-dark */
7
+ darkTheme?: string;
8
+ /**
9
+ * Shiki 主题(手动指定,优先于 lightTheme/darkTheme 的自动选择)
10
+ * @deprecated 推荐使用 lightTheme/darkTheme 配合 ThemeProvider 自动切换
11
+ */
5
12
  theme?: string;
6
13
  /** 默认回退主题(当指定主题加载失败时使用),默认 github-dark */
7
14
  fallbackTheme?: string;
@@ -11,7 +18,8 @@ interface Props {
11
18
  blockStatus?: 'pending' | 'stable' | 'completed';
12
19
  }
13
20
  declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
14
- theme: string;
21
+ lightTheme: string;
22
+ darkTheme: string;
15
23
  fallbackTheme: string;
16
24
  disableHighlight: boolean;
17
25
  blockStatus: "pending" | "stable" | "completed";
@@ -2,7 +2,9 @@
2
2
  * Shiki Highlighter 单例管理器
3
3
  *
4
4
  * 避免重复创建 Shiki 实例,所有组件共享同一个 highlighter
5
+ * 支持多主题:按主题名缓存 highlighter,运行时可切换
5
6
  */
7
+ import type { MaybeRefOrGetter } from 'vue';
6
8
  import type { HighlighterGeneric, BundledLanguage, BundledTheme } from 'shiki';
7
9
  interface HighlighterInfo {
8
10
  highlighter: HighlighterGeneric<BundledLanguage, BundledTheme>;
@@ -56,10 +58,10 @@ export { getShikiManager, ShikiManager };
56
58
  /**
57
59
  * 使用 Shiki Highlighter(组合式函数)
58
60
  *
59
- * @param theme 主题名称
61
+ * @param theme 主题名称,支持响应式(ref / getter / 静态值)
60
62
  * @returns Shiki 相关的响应式状态和方法
61
63
  */
62
- export declare function useShiki(theme: string): {
64
+ export declare function useShiki(theme: MaybeRefOrGetter<string>): {
63
65
  highlighterInfo: import("vue").ShallowRef<HighlighterInfo | null, HighlighterInfo | null>;
64
66
  isHighlighting: import("vue").ShallowRef<boolean, boolean>;
65
67
  isReady: import("vue").ShallowRef<boolean, boolean>;
package/dist/index.js CHANGED
@@ -523,11 +523,11 @@ function useDefinationsContext() {
523
523
 
524
524
  // sfc-script:/Users/yishuai/develop/towardsphd/tp-full/incremark/packages/vue/src/components/Incremark.vue?type=script
525
525
  import { defineComponent as _defineComponent19 } from "vue";
526
- import { computed as computed14 } from "vue";
526
+ import { computed as computed15 } from "vue";
527
527
 
528
528
  // sfc-script:/Users/yishuai/develop/towardsphd/tp-full/incremark/packages/vue/src/components/IncremarkRenderer.vue?type=script
529
529
  import { defineComponent as _defineComponent17 } from "vue";
530
- import { computed as computed12 } from "vue";
530
+ import { computed as computed13 } from "vue";
531
531
 
532
532
  // sfc-script:/Users/yishuai/develop/towardsphd/tp-full/incremark/packages/vue/src/components/IncremarkHeading.vue?type=script
533
533
  import { defineComponent as _defineComponent4 } from "vue";
@@ -1300,7 +1300,7 @@ var IncremarkParagraph_default2 = IncremarkParagraph_default;
1300
1300
 
1301
1301
  // sfc-script:/Users/yishuai/develop/towardsphd/tp-full/incremark/packages/vue/src/components/IncremarkCode.vue?type=script
1302
1302
  import { defineComponent as _defineComponent10 } from "vue";
1303
- import { computed as computed10 } from "vue";
1303
+ import { computed as computed11 } from "vue";
1304
1304
 
1305
1305
  // sfc-script:/Users/yishuai/develop/towardsphd/tp-full/incremark/packages/vue/src/components/IncremarkCodeMermaid.vue?type=script
1306
1306
  import { defineComponent as _defineComponent7 } from "vue";
@@ -1566,12 +1566,12 @@ var IncremarkCodeMermaid_default2 = IncremarkCodeMermaid_default;
1566
1566
 
1567
1567
  // sfc-script:/Users/yishuai/develop/towardsphd/tp-full/incremark/packages/vue/src/components/IncremarkCodeDefault.vue?type=script
1568
1568
  import { defineComponent as _defineComponent9 } from "vue";
1569
- import { computed as computed9, ref as ref9, watch as watch7 } from "vue";
1569
+ import { computed as computed10, ref as ref9, watch as watch8 } from "vue";
1570
1570
  import { LucideCopy as LucideCopy2, LucideCopyCheck as LucideCopyCheck2 } from "@incremark/icons";
1571
1571
  import { isClipboardAvailable as isClipboardAvailable2 } from "@incremark/shared";
1572
1572
 
1573
1573
  // src/composables/useShiki.ts
1574
- import { shallowRef as shallowRef5 } from "vue";
1574
+ import { shallowRef as shallowRef5, toValue as toValue3, watch as watch6 } from "vue";
1575
1575
  var ShikiManager = class _ShikiManager {
1576
1576
  static instance = null;
1577
1577
  /** 存储 highlighter 实例,key 为主题名称 */
@@ -1675,9 +1675,9 @@ function useShiki(theme) {
1675
1675
  const isHighlighting = shallowRef5(false);
1676
1676
  const isReady = shallowRef5(false);
1677
1677
  async function initHighlighter() {
1678
- if (isReady.value) return;
1678
+ const currentTheme = toValue3(theme);
1679
1679
  try {
1680
- const info = await getShikiManager().getHighlighter(theme);
1680
+ const info = await getShikiManager().getHighlighter(currentTheme);
1681
1681
  highlighterInfo.value = info;
1682
1682
  isReady.value = true;
1683
1683
  } catch (e) {
@@ -1685,25 +1685,37 @@ function useShiki(theme) {
1685
1685
  throw e;
1686
1686
  }
1687
1687
  }
1688
+ watch6(() => toValue3(theme), async (newTheme) => {
1689
+ if (!newTheme) return;
1690
+ try {
1691
+ const info = await getShikiManager().getHighlighter(newTheme);
1692
+ highlighterInfo.value = info;
1693
+ isReady.value = true;
1694
+ } catch (e) {
1695
+ console.warn("Failed to switch Shiki theme:", e);
1696
+ }
1697
+ });
1688
1698
  async function getHighlighter() {
1699
+ const currentTheme = toValue3(theme);
1689
1700
  if (!highlighterInfo.value) {
1690
- highlighterInfo.value = await getShikiManager().getHighlighter(theme);
1701
+ highlighterInfo.value = await getShikiManager().getHighlighter(currentTheme);
1691
1702
  isReady.value = true;
1692
1703
  }
1693
1704
  return highlighterInfo.value;
1694
1705
  }
1695
1706
  async function highlight(code, lang, fallbackTheme) {
1707
+ const currentTheme = toValue3(theme);
1696
1708
  isHighlighting.value = true;
1697
1709
  try {
1698
1710
  const info = await getHighlighter();
1699
1711
  const manager = getShikiManager();
1700
1712
  if (!info.loadedLanguages.has(lang) && lang !== "text") {
1701
- await manager.loadLanguage(theme, lang);
1713
+ await manager.loadLanguage(currentTheme, lang);
1702
1714
  }
1703
- if (!info.loadedThemes.has(theme)) {
1704
- await manager.loadTheme(theme);
1715
+ if (!info.loadedThemes.has(currentTheme)) {
1716
+ await manager.loadTheme(currentTheme);
1705
1717
  }
1706
- return await manager.codeToHtml(theme, code, lang, fallbackTheme);
1718
+ return await manager.codeToHtml(currentTheme, code, lang, fallbackTheme);
1707
1719
  } catch (e) {
1708
1720
  throw e;
1709
1721
  } finally {
@@ -1719,9 +1731,30 @@ function useShiki(theme) {
1719
1731
  };
1720
1732
  }
1721
1733
 
1734
+ // src/composables/useThemeContext.ts
1735
+ import { inject as inject3, computed as computed9, provide as provide2 } from "vue";
1736
+ var THEME_KEY = /* @__PURE__ */ Symbol("incremark-theme");
1737
+ function provideTheme(theme) {
1738
+ provide2(THEME_KEY, theme);
1739
+ }
1740
+ function useThemeContext() {
1741
+ const theme = inject3(THEME_KEY, computed9(() => "default"));
1742
+ const isDark = computed9(() => {
1743
+ const themeValue = theme.value;
1744
+ if (typeof themeValue === "string") {
1745
+ return themeValue === "dark";
1746
+ }
1747
+ return false;
1748
+ });
1749
+ return {
1750
+ theme,
1751
+ isDark
1752
+ };
1753
+ }
1754
+
1722
1755
  // sfc-script:/Users/yishuai/develop/towardsphd/tp-full/incremark/packages/vue/src/components/CachedCodeRenderer.vue?type=script
1723
1756
  import { defineComponent as _defineComponent8 } from "vue";
1724
- import { h, ref as ref8, reactive, watch as watch6, renderList, onUnmounted as onUnmounted5 } from "vue";
1757
+ import { h, ref as ref8, reactive, watch as watch7, renderList, onUnmounted as onUnmounted5 } from "vue";
1725
1758
  import { CodeToTokenTransformStream } from "shiki-stream";
1726
1759
 
1727
1760
  // ../../node_modules/.pnpm/@shikijs+vscode-textmate@10.0.2/node_modules/@shikijs/vscode-textmate/dist/index.js
@@ -2388,7 +2421,7 @@ var CachedCodeRenderer_default = /* @__PURE__ */ _defineComponent8({
2388
2421
  });
2389
2422
  }
2390
2423
  }
2391
- watch6(() => props.code, (newCode) => {
2424
+ watch7(() => props.code, (newCode) => {
2392
2425
  if (!isBrowser || !controller) return;
2393
2426
  if (newCode.length > index.value && !hasStreamError.value) {
2394
2427
  const incremental = newCode.slice(index.value);
@@ -2449,7 +2482,9 @@ var IncremarkCodeDefault_default = /* @__PURE__ */ _defineComponent9({
2449
2482
  __name: "IncremarkCodeDefault",
2450
2483
  props: {
2451
2484
  node: { type: null, required: true },
2452
- theme: { type: String, required: false, default: "github-dark" },
2485
+ lightTheme: { type: String, required: false, default: "github-light" },
2486
+ darkTheme: { type: String, required: false, default: "github-dark" },
2487
+ theme: { type: String, required: false },
2453
2488
  fallbackTheme: { type: String, required: false, default: "github-dark" },
2454
2489
  disableHighlight: { type: Boolean, required: false, default: false },
2455
2490
  blockStatus: { type: String, required: false, default: "pending" }
@@ -2458,15 +2493,20 @@ var IncremarkCodeDefault_default = /* @__PURE__ */ _defineComponent9({
2458
2493
  __expose();
2459
2494
  const props = __props;
2460
2495
  const copied = ref9(false);
2461
- const language = computed9(() => props.node.lang || "text");
2462
- const code = computed9(() => props.node.value);
2496
+ const language = computed10(() => props.node.lang || "text");
2497
+ const code = computed10(() => props.node.value);
2463
2498
  const { t } = useLocale();
2464
- const { highlighterInfo, initHighlighter } = useShiki(props.theme);
2499
+ const { isDark } = useThemeContext();
2500
+ const actualTheme = computed10(() => {
2501
+ if (props.theme) return props.theme;
2502
+ return isDark.value ? props.darkTheme : props.lightTheme;
2503
+ });
2504
+ const { highlighterInfo, initHighlighter } = useShiki(() => actualTheme.value);
2465
2505
  const isLanguageLoaded = ref9(false);
2466
- const shouldEnableHighlight = computed9(() => {
2506
+ const shouldEnableHighlight = computed10(() => {
2467
2507
  return !props.disableHighlight && code.value && code.value.length > 0;
2468
2508
  });
2469
- watch7([highlighterInfo, language, shouldEnableHighlight], async ([info, lang, shouldHighlight]) => {
2509
+ watch8([highlighterInfo, language, shouldEnableHighlight], async ([info, lang, shouldHighlight]) => {
2470
2510
  if (!shouldHighlight) {
2471
2511
  return;
2472
2512
  }
@@ -2509,7 +2549,7 @@ var IncremarkCodeDefault_default = /* @__PURE__ */ _defineComponent9({
2509
2549
  } catch {
2510
2550
  }
2511
2551
  }
2512
- const __returned__ = { props, copied, language, code, t, highlighterInfo, initHighlighter, isLanguageLoaded, shouldEnableHighlight, get copyTimeoutId() {
2552
+ const __returned__ = { props, copied, language, code, t, isDark, actualTheme, highlighterInfo, initHighlighter, isLanguageLoaded, shouldEnableHighlight, get copyTimeoutId() {
2513
2553
  return copyTimeoutId;
2514
2554
  }, set copyTimeoutId(v) {
2515
2555
  copyTimeoutId = v;
@@ -2556,12 +2596,12 @@ function render9(_ctx, _cache, $props, $setup, $data, $options) {
2556
2596
  ]),
2557
2597
  _createElementVNode5("div", _hoisted_54, [
2558
2598
  _createElementVNode5("div", _hoisted_64, [
2559
- _createCommentVNode5(" Stream \u9AD8\u4EAE\uFF08\u53EA\u6709\u5F53\u5B58\u5728\u4EE3\u7801\u5185\u5BB9\u4E14\u8BED\u8A00\u52A0\u8F7D\u5B8C\u6210\u540E\u624D\u6E32\u67D3\uFF09 "),
2599
+ _createCommentVNode5(" Stream \u9AD8\u4EAE\uFF1Akey \u7ED1\u5B9A actualTheme\uFF0C\u4E3B\u9898\u5207\u6362\u65F6\u81EA\u52A8\u91CD\u5EFA "),
2560
2600
  $setup.shouldEnableHighlight && $setup.highlighterInfo && $setup.isLanguageLoaded ? (_openBlock9(), _createBlock4($setup["CachedCodeRenderer"], {
2561
- key: 0,
2601
+ key: $setup.actualTheme,
2562
2602
  code: $setup.code,
2563
2603
  lang: $setup.language,
2564
- theme: $props.theme,
2604
+ theme: $setup.actualTheme,
2565
2605
  highlighter: $setup.highlighterInfo.highlighter
2566
2606
  }, null, 8, ["code", "lang", "theme", "highlighter"])) : (_openBlock9(), _createElementBlock7(
2567
2607
  _Fragment5,
@@ -2596,7 +2636,9 @@ var IncremarkCode_default = /* @__PURE__ */ _defineComponent10({
2596
2636
  __name: "IncremarkCode",
2597
2637
  props: {
2598
2638
  node: { type: null, required: true },
2599
- theme: { type: String, required: false, default: "github-dark" },
2639
+ lightTheme: { type: String, required: false, default: "github-light" },
2640
+ darkTheme: { type: String, required: false, default: "github-dark" },
2641
+ theme: { type: String, required: false },
2600
2642
  fallbackTheme: { type: String, required: false, default: "github-dark" },
2601
2643
  disableHighlight: { type: Boolean, required: false, default: false },
2602
2644
  mermaidDelay: { type: Number, required: false, default: 500 },
@@ -2608,8 +2650,8 @@ var IncremarkCode_default = /* @__PURE__ */ _defineComponent10({
2608
2650
  setup(__props, { expose: __expose }) {
2609
2651
  __expose();
2610
2652
  const props = __props;
2611
- const language = computed10(() => props.node.lang || "text");
2612
- const CustomCodeBlock = computed10(() => {
2653
+ const language = computed11(() => props.node.lang || "text");
2654
+ const CustomCodeBlock = computed11(() => {
2613
2655
  const component = props.customCodeBlocks?.[language.value];
2614
2656
  if (!component) return null;
2615
2657
  const config = props.codeBlockConfigs?.[language.value];
@@ -2621,7 +2663,7 @@ var IncremarkCode_default = /* @__PURE__ */ _defineComponent10({
2621
2663
  }
2622
2664
  return component;
2623
2665
  });
2624
- const isMermaid = computed10(() => language.value === "mermaid");
2666
+ const isMermaid = computed11(() => language.value === "mermaid");
2625
2667
  const __returned__ = { props, language, CustomCodeBlock, isMermaid, IncremarkCodeMermaid: IncremarkCodeMermaid_default2 };
2626
2668
  Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
2627
2669
  return __returned__;
@@ -2661,11 +2703,13 @@ function render10(_ctx, _cache, $props, $setup, $data, $options) {
2661
2703
  _createCommentVNode6(" \u9ED8\u8BA4\u4EE3\u7801\u5757\u6E32\u67D3\uFF08\u652F\u6301\u7528\u6237\u81EA\u5B9A\u4E49\uFF0C\u4F7F\u7528 stream \u9AD8\u4EAE\uFF09"),
2662
2704
  (_openBlock10(), _createBlock5(_resolveDynamicComponent4($props.defaultCodeComponent), {
2663
2705
  node: $props.node,
2706
+ "light-theme": $props.lightTheme,
2707
+ "dark-theme": $props.darkTheme,
2664
2708
  theme: $props.theme,
2665
2709
  "fallback-theme": $props.fallbackTheme,
2666
2710
  "disable-highlight": $props.disableHighlight,
2667
2711
  "block-status": $props.blockStatus
2668
- }, null, 8, ["node", "theme", "fallback-theme", "disable-highlight", "block-status"]))
2712
+ }, null, 8, ["node", "light-theme", "dark-theme", "theme", "fallback-theme", "disable-highlight", "block-status"]))
2669
2713
  ],
2670
2714
  2112
2671
2715
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
@@ -2683,7 +2727,7 @@ var IncremarkCode_default2 = IncremarkCode_default;
2683
2727
 
2684
2728
  // sfc-script:/Users/yishuai/develop/towardsphd/tp-full/incremark/packages/vue/src/components/IncremarkList.vue?type=script
2685
2729
  import { defineComponent as _defineComponent11 } from "vue";
2686
- import { computed as computed11 } from "vue";
2730
+ import { computed as computed12 } from "vue";
2687
2731
  var IncremarkList_default = /* @__PURE__ */ _defineComponent11({
2688
2732
  ...{
2689
2733
  name: "IncremarkList"
@@ -2700,7 +2744,7 @@ var IncremarkList_default = /* @__PURE__ */ _defineComponent11({
2700
2744
  setup(__props, { expose: __expose }) {
2701
2745
  __expose();
2702
2746
  const props = __props;
2703
- const tag = computed11(() => props.node.ordered ? "ol" : "ul");
2747
+ const tag = computed12(() => props.node.ordered ? "ol" : "ul");
2704
2748
  function getItemInlineContent(item) {
2705
2749
  const firstChild = item.children[0];
2706
2750
  if (firstChild?.type === "paragraph") {
@@ -3162,7 +3206,7 @@ var IncremarkRenderer_default2 = /* @__PURE__ */ _defineComponent17({
3162
3206
  leafDirective: IncremarkContainer_default2,
3163
3207
  textDirective: IncremarkContainer_default2
3164
3208
  };
3165
- const componentMap = computed12(() => ({
3209
+ const componentMap = computed13(() => ({
3166
3210
  ...defaultComponentMap,
3167
3211
  ...props.components
3168
3212
  }));
@@ -3285,19 +3329,19 @@ var IncremarkRenderer_default = IncremarkRenderer_default2;
3285
3329
 
3286
3330
  // sfc-script:/Users/yishuai/develop/towardsphd/tp-full/incremark/packages/vue/src/components/IncremarkFootnotes.vue?type=script
3287
3331
  import { defineComponent as _defineComponent18 } from "vue";
3288
- import { computed as computed13 } from "vue";
3332
+ import { computed as computed14 } from "vue";
3289
3333
  var IncremarkFootnotes_default = /* @__PURE__ */ _defineComponent18({
3290
3334
  __name: "IncremarkFootnotes",
3291
3335
  setup(__props, { expose: __expose }) {
3292
3336
  __expose();
3293
3337
  const { footnoteDefinitions, footnoteReferenceOrder } = useDefinationsContext();
3294
- const orderedFootnotes = computed13(() => {
3338
+ const orderedFootnotes = computed14(() => {
3295
3339
  return footnoteReferenceOrder.value.map((identifier) => ({
3296
3340
  identifier,
3297
3341
  definition: footnoteDefinitions.value[identifier]
3298
3342
  })).filter((item) => item.definition !== void 0);
3299
3343
  });
3300
- const hasFootnotes = computed13(() => orderedFootnotes.value.length > 0);
3344
+ const hasFootnotes = computed14(() => orderedFootnotes.value.length > 0);
3301
3345
  const __returned__ = { footnoteDefinitions, footnoteReferenceOrder, orderedFootnotes, hasFootnotes, IncremarkRenderer: IncremarkRenderer_default };
3302
3346
  Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
3303
3347
  return __returned__;
@@ -3401,8 +3445,8 @@ var Incremark_default = /* @__PURE__ */ _defineComponent19({
3401
3445
  const {
3402
3446
  footnoteReferenceOrder
3403
3447
  } = useDefinationsContext();
3404
- const actualBlocks = computed14(() => props.incremark?.blocks.value || props.blocks || []);
3405
- const actualIsDisplayComplete = computed14(() => {
3448
+ const actualBlocks = computed15(() => props.incremark?.blocks.value || props.blocks || []);
3449
+ const actualIsDisplayComplete = computed15(() => {
3406
3450
  if (props.incremark) {
3407
3451
  return props.incremark.isDisplayComplete.value;
3408
3452
  }
@@ -3472,7 +3516,7 @@ var Incremark_default2 = Incremark_default;
3472
3516
 
3473
3517
  // sfc-script:/Users/yishuai/develop/towardsphd/tp-full/incremark/packages/vue/src/components/IncremarkContent.vue?type=script
3474
3518
  import { defineComponent as _defineComponent20 } from "vue";
3475
- import { computed as computed15, watch as watch8, onMounted as onMounted4, onUnmounted as onUnmounted6 } from "vue";
3519
+ import { computed as computed16, watch as watch9, onMounted as onMounted2, onUnmounted as onUnmounted6 } from "vue";
3476
3520
  import { generateParserId } from "@incremark/shared";
3477
3521
  var IncremarkContent_default = /* @__PURE__ */ _defineComponent20({
3478
3522
  __name: "IncremarkContent",
@@ -3494,7 +3538,7 @@ var IncremarkContent_default = /* @__PURE__ */ _defineComponent20({
3494
3538
  setup(__props, { expose: __expose }) {
3495
3539
  __expose();
3496
3540
  const props = __props;
3497
- const incremarkOptions = computed15(() => ({
3541
+ const incremarkOptions = computed16(() => ({
3498
3542
  gfm: true,
3499
3543
  htmlTree: true,
3500
3544
  containers: true,
@@ -3504,7 +3548,7 @@ var IncremarkContent_default = /* @__PURE__ */ _defineComponent20({
3504
3548
  const incremark = useIncremark(incremarkOptions);
3505
3549
  const { blocks, append, finalize, render: render24, reset, isDisplayComplete, markdown } = incremark;
3506
3550
  const parserId = props.devtoolsId || generateParserId();
3507
- onMounted4(() => {
3551
+ onMounted2(() => {
3508
3552
  if (props.devtools) {
3509
3553
  props.devtools.register(incremark.parser, {
3510
3554
  id: parserId,
@@ -3517,7 +3561,7 @@ var IncremarkContent_default = /* @__PURE__ */ _defineComponent20({
3517
3561
  props.devtools.unregister(parserId);
3518
3562
  }
3519
3563
  });
3520
- const isStreamMode = computed15(() => typeof props.stream === "function");
3564
+ const isStreamMode = computed16(() => typeof props.stream === "function");
3521
3565
  async function handleStreamInput() {
3522
3566
  if (!props.stream) return;
3523
3567
  try {
@@ -3545,14 +3589,14 @@ var IncremarkContent_default = /* @__PURE__ */ _defineComponent20({
3545
3589
  render24(newContent);
3546
3590
  }
3547
3591
  }
3548
- watch8(() => props.content, async (newContent, oldContent) => {
3592
+ watch9(() => props.content, async (newContent, oldContent) => {
3549
3593
  if (isStreamMode.value) {
3550
3594
  await handleStreamInput();
3551
3595
  } else {
3552
3596
  handleContentInput(newContent, oldContent);
3553
3597
  }
3554
3598
  }, { immediate: true });
3555
- watch8(() => props.isFinished, (newIsFinished) => {
3599
+ watch9(() => props.isFinished, (newIsFinished) => {
3556
3600
  if (newIsFinished && props.content === markdown.value) {
3557
3601
  finalize();
3558
3602
  }
@@ -3585,7 +3629,7 @@ var IncremarkContent_default2 = IncremarkContent_default;
3585
3629
 
3586
3630
  // sfc-script:/Users/yishuai/develop/towardsphd/tp-full/incremark/packages/vue/src/components/AutoScrollContainer.vue?type=script
3587
3631
  import { defineComponent as _defineComponent21 } from "vue";
3588
- import { ref as ref10, onMounted as onMounted5, onUnmounted as onUnmounted7, nextTick } from "vue";
3632
+ import { ref as ref10, onMounted as onMounted3, onUnmounted as onUnmounted7, nextTick } from "vue";
3589
3633
  var AutoScrollContainer_default = /* @__PURE__ */ _defineComponent21({
3590
3634
  __name: "AutoScrollContainer",
3591
3635
  props: {
@@ -3642,7 +3686,7 @@ var AutoScrollContainer_default = /* @__PURE__ */ _defineComponent21({
3642
3686
  lastScrollHeight = scrollHeight;
3643
3687
  }
3644
3688
  let observer = null;
3645
- onMounted5(() => {
3689
+ onMounted3(() => {
3646
3690
  if (!containerRef.value) return;
3647
3691
  lastScrollTop = containerRef.value.scrollTop;
3648
3692
  lastScrollHeight = containerRef.value.scrollHeight;
@@ -3718,18 +3762,9 @@ var AutoScrollContainer_default2 = AutoScrollContainer_default;
3718
3762
 
3719
3763
  // sfc-script:/Users/yishuai/develop/towardsphd/tp-full/incremark/packages/vue/src/ThemeProvider.vue?type=script
3720
3764
  import { defineComponent as _defineComponent22 } from "vue";
3721
- import { ref as ref11, watch as watch10, computed as computed17 } from "vue";
3765
+ import { ref as ref11, watch as watch11, computed as computed17 } from "vue";
3722
3766
  import { applyTheme } from "@incremark/theme";
3723
3767
  import { isServer } from "@incremark/shared";
3724
-
3725
- // src/composables/useThemeContext.ts
3726
- import { inject as inject3, computed as computed16, provide as provide2 } from "vue";
3727
- var THEME_KEY = /* @__PURE__ */ Symbol("incremark-theme");
3728
- function provideTheme(theme) {
3729
- provide2(THEME_KEY, theme);
3730
- }
3731
-
3732
- // sfc-script:/Users/yishuai/develop/towardsphd/tp-full/incremark/packages/vue/src/ThemeProvider.vue?type=script
3733
3768
  var ThemeProvider_default = /* @__PURE__ */ _defineComponent22({
3734
3769
  __name: "ThemeProvider",
3735
3770
  props: {
@@ -3742,7 +3777,7 @@ var ThemeProvider_default = /* @__PURE__ */ _defineComponent22({
3742
3777
  const containerRef = ref11();
3743
3778
  const themeValue = computed17(() => props.theme);
3744
3779
  provideTheme(themeValue);
3745
- watch10(
3780
+ watch11(
3746
3781
  () => props.theme,
3747
3782
  (theme) => {
3748
3783
  if (isServer()) return;
@@ -3782,7 +3817,7 @@ var ThemeProvider_default2 = ThemeProvider_default;
3782
3817
 
3783
3818
  // sfc-script:/Users/yishuai/develop/towardsphd/tp-full/incremark/packages/vue/src/components/ConfigProvider.vue?type=script
3784
3819
  import { defineComponent as _defineComponent23 } from "vue";
3785
- import { provide as provide4, ref as ref12, watch as watch11 } from "vue";
3820
+ import { provide as provide4, ref as ref12, watch as watch12 } from "vue";
3786
3821
  import { zhCN as zhCN2 } from "@incremark/shared";
3787
3822
  var ConfigProvider_default = /* @__PURE__ */ _defineComponent23({
3788
3823
  __name: "ConfigProvider",
@@ -3794,7 +3829,7 @@ var ConfigProvider_default = /* @__PURE__ */ _defineComponent23({
3794
3829
  const props = __props;
3795
3830
  const localeRef = ref12(props.locale || zhCN2);
3796
3831
  provide4(LOCALE_KEY, localeRef);
3797
- watch11(
3832
+ watch12(
3798
3833
  () => props.locale,
3799
3834
  (newLocale) => {
3800
3835
  if (newLocale) {