@antdv-next/x 1.1.3-beta.3 → 1.1.3-beta.4

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 (112) hide show
  1. package/dist/code-highlighter/index.d.ts +1 -0
  2. package/dist/code-highlighter/shiki-runtime.d.ts +3 -0
  3. package/dist/code-highlighter/shiki-runtime.js +14 -0
  4. package/dist/code-highlighter/shiki.d.ts +9 -7
  5. package/dist/code-highlighter/shiki.js +9 -15
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.umd.js +31 -12
  8. package/dist/package.js +1 -1
  9. package/dist/x-provider/hooks/use-x-provider-context.d.ts +2 -2
  10. package/es/{Serializer-D1JYN1kI.js → Serializer-y_SfSPKv.js} +4 -4
  11. package/es/{_basePickBy-DFHEGO2M.js → _basePickBy-Cy7KVmkk.js} +23 -23
  12. package/es/{_baseUniq-BlS7rXTs.js → _baseUniq-Ch3HuHeT.js} +83 -83
  13. package/es/antdv-next-x.esm.js +7904 -14883
  14. package/es/{arc-BuXEd18J.js → arc-caEkbRYF.js} +3 -3
  15. package/es/architecture-PBZL5I3N-DHfBr78A.js +3 -0
  16. package/es/{architectureDiagram-2XIMDMQ5-CmfsCwJk.js → architectureDiagram-2XIMDMQ5-B4BHdsAL.js} +9 -9
  17. package/es/{blockDiagram-WCTKOSBZ-lJAan65A.js → blockDiagram-WCTKOSBZ-nXanZ0sc.js} +12 -12
  18. package/es/{c4Diagram-IC4MRINW-B1c2x_1Q.js → c4Diagram-IC4MRINW-C-gVp6th.js} +6 -6
  19. package/es/channel-DoEe9DF9.js +5 -0
  20. package/es/{chunk-4BX2VUAB-J2N81Fpp.js → chunk-4BX2VUAB-fLFD6XW0.js} +2 -2
  21. package/es/{chunk-55IACEB6-DGtfGRgi.js → chunk-55IACEB6-OtyKJzCH.js} +2 -2
  22. package/es/{chunk-7E7YKBS2-CL2d4WAf.js → chunk-7E7YKBS2-C1dd36rm.js} +2 -2
  23. package/es/{chunk-7R4GIKGN-QT6IorJ_.js → chunk-7R4GIKGN-DuTRhdsf.js} +3 -3
  24. package/es/{chunk-C72U2L5F-OHTVpS-m.js → chunk-C72U2L5F-ClmZGhFC.js} +2 -2
  25. package/es/{chunk-EGIJ26TM-DyMPGYrB.js → chunk-EGIJ26TM-Bar_u1MN.js} +2 -2
  26. package/es/{chunk-FMBD7UC4-DCcRjunY.js → chunk-FMBD7UC4-C_uJ_JJA.js} +2 -2
  27. package/es/{chunk-GEFDOKGD-BWpC-zoH.js → chunk-GEFDOKGD-P7WhyrTU.js} +30 -30
  28. package/es/{chunk-GLR3WWYH-DiXcKb5Y.js → chunk-GLR3WWYH-BvazRgdo.js} +8 -8
  29. package/es/{chunk-HHEYEP7N-Cxc7E4dX.js → chunk-HHEYEP7N-rv5s5WD4.js} +3 -3
  30. package/es/{chunk-JSJVCQXG-D8_heHOp.js → chunk-JSJVCQXG-89HUGe9V.js} +4 -4
  31. package/es/{chunk-KX2RTZJC-D5cc4rj6.js → chunk-KX2RTZJC-pMHnNRQg.js} +3 -3
  32. package/es/{chunk-KYZI473N-BHJ3T5Zv.js → chunk-KYZI473N-DJmSs1gK.js} +8 -8
  33. package/es/{chunk-L3YUKLVL-7oGaUOdc.js → chunk-L3YUKLVL-Ck54qytQ.js} +2 -2
  34. package/es/{chunk-MX3YWQON-BxE-Aq9c.js → chunk-MX3YWQON-MkpK3uBD.js} +2 -2
  35. package/es/{chunk-NQ4KR5QH-EYQBXkqP.js → chunk-NQ4KR5QH-DGshodQv.js} +7 -7
  36. package/es/{chunk-O4XLMI2P-qjOoGpnx.js → chunk-O4XLMI2P-e-ZzDQwg.js} +11 -11
  37. package/es/{chunk-OZEHJAEY-D82nx27s.js → chunk-OZEHJAEY-DULNd43V.js} +2 -2
  38. package/es/{chunk-PQ6SQG4A-D3jtNCWN.js → chunk-PQ6SQG4A-CQ9Csv7s.js} +3 -3
  39. package/es/{chunk-PU5JKC2W-DdP8BS-S.js → chunk-PU5JKC2W-DkEFvrjH.js} +16 -16
  40. package/es/{chunk-QZHKN3VN-CW3cFN-h.js → chunk-QZHKN3VN-qww1plfw.js} +2 -2
  41. package/es/{chunk-R5LLSJPH-CreI2kO9.js → chunk-R5LLSJPH-BERXSDGJ.js} +2 -2
  42. package/es/{chunk-WL4C6EOR-BDbxJyGk.js → chunk-WL4C6EOR-C-d8WPS7.js} +9 -9
  43. package/es/{chunk-XIRO2GV7-S5KkbVnN.js → chunk-XIRO2GV7-CFHofxVB.js} +2 -2
  44. package/es/{chunk-XPW4576I-B0KVSHwE.js → chunk-XPW4576I-DgvoNZkW.js} +2 -2
  45. package/es/{chunk-XZSTWKYB-CucN1XvM.js → chunk-XZSTWKYB-k8_EXrSa.js} +93 -93
  46. package/es/{chunk-YBOYWFTD-CvaddD9G.js → chunk-YBOYWFTD-BUW4AzEX.js} +4 -4
  47. package/es/classDiagram-VBA2DB6C-DWTAs0Zm.js +29 -0
  48. package/es/classDiagram-v2-RAHNMMFH-CoxCdmrt.js +29 -0
  49. package/es/clone-BXDbKCDu.js +8 -0
  50. package/es/{cose-bilkent-S5V4N54A-B5OQuIhl.js → cose-bilkent-S5V4N54A-CnrS2OC1.js} +3 -3
  51. package/es/{cytoscape.esm-i2CZcWd-.js → cytoscape.esm-BY3wHcbp.js} +1 -1
  52. package/es/{dagre-5aGJFKmT.js → dagre-BJOzGlhW.js} +57 -57
  53. package/es/{dagre-KLK3FWXG-BI5QQMXo.js → dagre-KLK3FWXG-CFC0naVr.js} +16 -16
  54. package/es/{defaultLocale-bckJcYh1.js → defaultLocale-BaPFSbai.js} +12 -12
  55. package/es/{diagram-E7M64L7V-Dz62Vz_a.js → diagram-E7M64L7V-DxuJj8ZG.js} +32 -32
  56. package/es/{diagram-IFDJBPK2-9fjvFkSc.js → diagram-IFDJBPK2-BOpPZ6pu.js} +7 -7
  57. package/es/{diagram-P4PSJMXO-BlX6jFjZ.js → diagram-P4PSJMXO--ChDmcya.js} +7 -7
  58. package/es/{dist-BX_roQzC.js → dist-DltyvPj3.js} +1 -1
  59. package/es/{erDiagram-INFDFZHY-BcRXu8Cp.js → erDiagram-INFDFZHY-BA3m-v87.js} +14 -14
  60. package/es/{flowDiagram-PKNHOUZH-UeyfgU8z.js → flowDiagram-PKNHOUZH-BCq6k3kr.js} +17 -17
  61. package/es/{ganttDiagram-A5KZAMGK-txCzqgQ5.js → ganttDiagram-A5KZAMGK-DdMePS21.js} +28 -28
  62. package/es/gitGraph-HDMCJU4V-DbzpICZW.js +3 -0
  63. package/es/{gitGraphDiagram-K3NZZRJ6-DghWYaFU.js → gitGraphDiagram-K3NZZRJ6-CLbRwChG.js} +7 -7
  64. package/es/{graphlib-dRkI1OCL.js → graphlib-C7ysKz4u.js} +4 -4
  65. package/es/{html-CWvNBSxv.js → html-BNNJXCkq.js} +1 -1
  66. package/es/info-3K5VOQVL-CpUiQuel.js +3 -0
  67. package/es/{infoDiagram-LFFYTUFH-CA-vlAvP.js → infoDiagram-LFFYTUFH-DQAZ-vFk.js} +5 -5
  68. package/es/{init-B75p2clj.js → init-PAs0hR-b.js} +1 -1
  69. package/es/{isArrayLikeObject-jl2bjkAJ.js → isArrayLikeObject-y3HlYDaX.js} +80 -80
  70. package/es/{isEmpty-CmA-HYrg.js → isEmpty-2JxdWtc-.js} +3 -3
  71. package/es/{ishikawaDiagram-PHBUUO56-DjdpS9Lb.js → ishikawaDiagram-PHBUUO56-B0r2IgGz.js} +6 -6
  72. package/es/{journeyDiagram-4ABVD52K-CIJfC1fp.js → journeyDiagram-4ABVD52K-DnMUhOvg.js} +6 -6
  73. package/es/{kanban-definition-K7BYSVSG-CC2vwGck.js → kanban-definition-K7BYSVSG-Da5Y-nJy.js} +11 -11
  74. package/es/{katex-DCMiIo1z.js → katex-b-xdokOf.js} +1 -1
  75. package/es/{line-Cu9NTacD.js → line-h2iCTGsE.js} +4 -4
  76. package/es/{linear-C0rAYYmp.js → linear-Bv7XrZCH.js} +23 -23
  77. package/es/{math-CoDOuve-.js → math-DPzKeDKn.js} +1 -1
  78. package/es/{mermaid-parser.core-7Wn2L29P.js → mermaid-parser.core-kTgpNO7M.js} +16 -16
  79. package/es/{mermaid.core-Bvy_Q6Hu.js → mermaid.core-Db1VE3-f.js} +44 -44
  80. package/es/{mindmap-definition-YRQLILUH-BzTYDYmK.js → mindmap-definition-YRQLILUH-CYeqnCde.js} +16 -16
  81. package/es/{ordinal-F3U6aXtP.js → ordinal-D8PKtxfM.js} +3 -3
  82. package/es/packet-RMMSAZCW-UTFQ0FQx.js +3 -0
  83. package/es/{path-Dm3C8WEs.js → path-DZ-6AyWK.js} +3 -3
  84. package/es/pie-UPGHQEXC-CarAcBSi.js +3 -0
  85. package/es/{pieDiagram-SKSYHLDU-COvqE_C6.js → pieDiagram-SKSYHLDU-DAsfTGvY.js} +14 -14
  86. package/es/{quadrantDiagram-337W2JSQ-Dgv8ccjt.js → quadrantDiagram-337W2JSQ-CZLbmQS4.js} +4 -4
  87. package/es/radar-KQ55EAFF-NXK5PC9R.js +3 -0
  88. package/es/{requirementDiagram-Z7DCOOCP-B2NyhxO-.js → requirementDiagram-Z7DCOOCP-Cb_Ygnfe.js} +13 -13
  89. package/es/{rough.esm-BhGP2Udb.js → rough.esm-C_hJ3ICT.js} +1 -1
  90. package/es/{sankeyDiagram-WA2Y5GQK-BfnH_gpl.js → sankeyDiagram-WA2Y5GQK-DBe5YfW4.js} +18 -18
  91. package/es/{sequenceDiagram-2WXFIKYE-DXssVQOF.js → sequenceDiagram-2WXFIKYE-C_KUoojT.js} +8 -8
  92. package/es/shiki-runtime-B7sqK6Yk.js +6985 -0
  93. package/es/{src-CUQ6oOYk.js → src-BukXhifV.js} +86 -86
  94. package/es/{stateDiagram-RAJIS63D-DvDLfupV.js → stateDiagram-RAJIS63D-boG6DyfW.js} +17 -17
  95. package/es/stateDiagram-v2-FVOUBMTO-DHCajhrN.js +27 -0
  96. package/es/{timeline-definition-YZTLITO2-ErcRjbZf.js → timeline-definition-YZTLITO2-pFt6rZ6S.js} +4 -4
  97. package/es/treemap-KZPCXAKY-Cj9QakFB.js +3 -0
  98. package/es/{vennDiagram-LZ73GAT5-CDTZUtc8.js → vennDiagram-LZ73GAT5-VaCO6k4H.js} +7 -7
  99. package/es/{xychartDiagram-JWTSCODW-Y21jBOTg.js → xychartDiagram-JWTSCODW-xS5ybemA.js} +12 -12
  100. package/package.json +1 -1
  101. package/es/architecture-PBZL5I3N-D7tS55xM.js +0 -3
  102. package/es/channel-DFgF_2F7.js +0 -5
  103. package/es/classDiagram-VBA2DB6C-Co3LMmg8.js +0 -29
  104. package/es/classDiagram-v2-RAHNMMFH-BZscgdF2.js +0 -29
  105. package/es/clone-r3YukIBB.js +0 -8
  106. package/es/gitGraph-HDMCJU4V-CxsS0Qr1.js +0 -3
  107. package/es/info-3K5VOQVL-COqdvM99.js +0 -3
  108. package/es/packet-RMMSAZCW-2PTjWKLd.js +0 -3
  109. package/es/pie-UPGHQEXC-Du8-k-EA.js +0 -3
  110. package/es/radar-KQ55EAFF-jJOhyjxC.js +0 -3
  111. package/es/stateDiagram-v2-FVOUBMTO-DIXyaX9W.js +0 -27
  112. package/es/treemap-KZPCXAKY-CvZAIYVa.js +0 -3
@@ -1,4 +1,5 @@
1
1
  import { default as CodeHighlighter } from './CodeHighlighter';
2
2
  export { setupCodeHighlighter } from './shiki';
3
+ export type { CodeHighlighterLanguageLoader, SetupCodeHighlighterOptions, } from './shiki';
3
4
  export type { CodeHighlighterHeaderSlotScope, CodeHighlighterProps, CodeHighlighterRef, CodeHighlighterSemanticType, CodeHighlighterSlots, } from './interface';
4
5
  export default CodeHighlighter;
@@ -0,0 +1,3 @@
1
+ import { createHighlighterCore } from 'shiki/core';
2
+ export type CodeHighlighterInstance = Awaited<ReturnType<typeof createHighlighterCore>>;
3
+ export declare function createHighlighter(): Promise<import('shiki').HighlighterCore>;
@@ -0,0 +1,14 @@
1
+ import { createHighlighterCore } from "shiki/core";
2
+ import darkTheme from "shiki/dist/themes/vitesse-dark.mjs";
3
+ import lightTheme from "shiki/dist/themes/vitesse-light.mjs";
4
+ import { createJavaScriptRegexEngine } from "shiki/engine/javascript";
5
+ //#region components/code-highlighter/shiki-runtime.ts
6
+ function createHighlighter() {
7
+ return createHighlighterCore({
8
+ themes: [lightTheme, darkTheme],
9
+ langs: [],
10
+ engine: createJavaScriptRegexEngine()
11
+ });
12
+ }
13
+ //#endregion
14
+ export { createHighlighter };
@@ -1,15 +1,20 @@
1
- type LanguageLoader = (lang: string) => Promise<any>;
1
+ import { LanguageInput } from 'shiki';
2
+ export type CodeHighlighterLanguageLoader = (lang: string) => Promise<LanguageInput | null>;
3
+ export interface SetupCodeHighlighterOptions {
4
+ loadLanguage?: CodeHighlighterLanguageLoader;
5
+ }
2
6
  /**
3
- * 注入自定义语言加载器,覆盖默认内置白名单。
7
+ * 注入自定义语言加载器。返回 `null` 时回退到默认内置白名单。
4
8
  * 建议按需 `import` 语言模块,避免引入全量语言包。
5
9
  *
6
10
  * @example 按需加载额外语言
7
11
  * ```ts
8
12
  * import { setupCodeHighlighter } from "@antdv-next/x";
13
+ * import type { LanguageInput } from "shiki";
9
14
  *
10
15
  * setupCodeHighlighter({
11
16
  * loadLanguage: async (lang) => {
12
- * const loaders: Record<string, () => Promise<{ default: any }>> = {
17
+ * const loaders: Record<string, () => Promise<{ default: LanguageInput }>> = {
13
18
  * go: () => import("shiki/dist/langs/go.mjs"),
14
19
  * rust: () => import("shiki/dist/langs/rust.mjs"),
15
20
  * };
@@ -19,11 +24,8 @@ type LanguageLoader = (lang: string) => Promise<any>;
19
24
  * });
20
25
  * ```
21
26
  */
22
- export declare function setupCodeHighlighter(options: {
23
- loadLanguage?: LanguageLoader;
24
- }): void;
27
+ export declare function setupCodeHighlighter(options?: SetupCodeHighlighterOptions): void;
25
28
  export declare function codeToHtml(code: string, options?: {
26
29
  lang?: string;
27
30
  theme?: string;
28
31
  }): Promise<string>;
29
- export {};
@@ -1,7 +1,3 @@
1
- import { createHighlighterCore } from "shiki/core";
2
- import darkTheme from "shiki/dist/themes/vitesse-dark.mjs";
3
- import lightTheme from "shiki/dist/themes/vitesse-light.mjs";
4
- import { createJavaScriptRegexEngine } from "shiki/engine/javascript";
5
1
  //#region components/code-highlighter/shiki.ts
6
2
  var PLAIN_TEXT_LANGUAGES = new Set([
7
3
  "text",
@@ -31,18 +27,19 @@ var defaultLoader = async (lang) => {
31
27
  const loader = BUILTIN_LANGUAGES[BUILTIN_ALIASES[lang] ?? lang];
32
28
  return loader ? (await loader()).default : null;
33
29
  };
34
- var activeLoader = defaultLoader;
30
+ var customLoader = null;
35
31
  /**
36
- * 注入自定义语言加载器,覆盖默认内置白名单。
32
+ * 注入自定义语言加载器。返回 `null` 时回退到默认内置白名单。
37
33
  * 建议按需 `import` 语言模块,避免引入全量语言包。
38
34
  *
39
35
  * @example 按需加载额外语言
40
36
  * ```ts
41
37
  * import { setupCodeHighlighter } from "@antdv-next/x";
38
+ * import type { LanguageInput } from "shiki";
42
39
  *
43
40
  * setupCodeHighlighter({
44
41
  * loadLanguage: async (lang) => {
45
- * const loaders: Record<string, () => Promise<{ default: any }>> = {
42
+ * const loaders: Record<string, () => Promise<{ default: LanguageInput }>> = {
46
43
  * go: () => import("shiki/dist/langs/go.mjs"),
47
44
  * rust: () => import("shiki/dist/langs/rust.mjs"),
48
45
  * };
@@ -52,8 +49,9 @@ var activeLoader = defaultLoader;
52
49
  * });
53
50
  * ```
54
51
  */
55
- function setupCodeHighlighter(options) {
56
- if (options?.loadLanguage) activeLoader = options.loadLanguage;
52
+ function setupCodeHighlighter(options = {}) {
53
+ customLoader = options.loadLanguage ?? null;
54
+ failedLangs.clear();
57
55
  }
58
56
  var highlighter = null;
59
57
  var highlighterPromise = null;
@@ -68,11 +66,7 @@ function escapeHtml(str) {
68
66
  }
69
67
  async function getHighlighter() {
70
68
  if (highlighter) return highlighter;
71
- if (!highlighterPromise) highlighterPromise = createHighlighterCore({
72
- themes: [lightTheme, darkTheme],
73
- langs: [],
74
- engine: createJavaScriptRegexEngine()
75
- });
69
+ if (!highlighterPromise) highlighterPromise = import("./shiki-runtime.js").then(({ createHighlighter }) => createHighlighter());
76
70
  highlighter = await highlighterPromise;
77
71
  return highlighter;
78
72
  }
@@ -83,7 +77,7 @@ async function loadLang(lang) {
83
77
  if (pendingLoad) return pendingLoad;
84
78
  const loadPromise = (async () => {
85
79
  try {
86
- const registration = await activeLoader(lang);
80
+ const registration = await customLoader?.(lang) ?? await defaultLoader(lang);
87
81
  if (!registration) {
88
82
  failedLangs.add(lang);
89
83
  return false;
package/dist/index.d.ts CHANGED
@@ -34,7 +34,7 @@ export type { ThoughtChainItemProps, ThoughtChainItemStatus, ThoughtChainItemTyp
34
34
  export type { ConversationItemType, ConversationsProps, ConversationsRef, CreationProps, DividerItemType, GroupableProps, } from './conversations';
35
35
  export type { SourcesProps } from './sources';
36
36
  export type { WelcomeProps, WelcomeRef } from './welcome';
37
- export type { CodeHighlighterProps, CodeHighlighterRef, CodeHighlighterSemanticType, } from './code-highlighter';
37
+ export type { CodeHighlighterLanguageLoader, CodeHighlighterProps, CodeHighlighterRef, CodeHighlighterSemanticType, SetupCodeHighlighterOptions, } from './code-highlighter';
38
38
  export { setupCodeHighlighter } from './code-highlighter';
39
39
  export type { SenderProps, SenderRef } from './sender';
40
40
  export type { RenderChildrenProps, SuggestionItem, SuggestionProps, } from './suggestion';
package/dist/index.umd.js CHANGED
@@ -29,6 +29,16 @@
29
29
  var __getOwnPropNames = Object.getOwnPropertyNames;
30
30
  var __getProtoOf = Object.getPrototypeOf;
31
31
  var __hasOwnProp = Object.prototype.hasOwnProperty;
32
+ var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
33
+ var __exportAll = (all, no_symbols) => {
34
+ let target = {};
35
+ for (var name in all) __defProp(target, name, {
36
+ get: all[name],
37
+ enumerable: true
38
+ });
39
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
40
+ return target;
41
+ };
32
42
  var __copyProps = (to, from, except, desc) => {
33
43
  if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
34
44
  key = keys[i];
@@ -49,7 +59,7 @@
49
59
  shiki_dist_themes_vitesse_dark_mjs = __toESM(shiki_dist_themes_vitesse_dark_mjs);
50
60
  shiki_dist_themes_vitesse_light_mjs = __toESM(shiki_dist_themes_vitesse_light_mjs);
51
61
  //#region package.json
52
- var version = "1.1.3-beta.3";
62
+ var version = "1.1.3-beta.4";
53
63
  //#endregion
54
64
  //#region components/x-provider/context.ts
55
65
  var XProviderContextKey = Symbol("antdv-next-x-provider-context");
@@ -4754,6 +4764,17 @@
4754
4764
  BubbleWithSub.System = XBubbleSystem;
4755
4765
  BubbleWithSub.Divider = XBubbleDivider;
4756
4766
  //#endregion
4767
+ //#region components/code-highlighter/shiki-runtime.ts
4768
+ var shiki_runtime_exports = /* @__PURE__ */ __exportAll({ createHighlighter: () => createHighlighter });
4769
+ function createHighlighter() {
4770
+ return (0, shiki_core.createHighlighterCore)({
4771
+ themes: [shiki_dist_themes_vitesse_light_mjs.default, shiki_dist_themes_vitesse_dark_mjs.default],
4772
+ langs: [],
4773
+ engine: (0, shiki_engine_javascript.createJavaScriptRegexEngine)()
4774
+ });
4775
+ }
4776
+ var init_shiki_runtime = __esmMin((() => {}));
4777
+ //#endregion
4757
4778
  //#region components/code-highlighter/shiki.ts
4758
4779
  var PLAIN_TEXT_LANGUAGES = new Set([
4759
4780
  "text",
@@ -4783,18 +4804,19 @@
4783
4804
  const loader = BUILTIN_LANGUAGES[BUILTIN_ALIASES[lang] ?? lang];
4784
4805
  return loader ? (await loader()).default : null;
4785
4806
  };
4786
- var activeLoader = defaultLoader;
4807
+ var customLoader = null;
4787
4808
  /**
4788
- * 注入自定义语言加载器,覆盖默认内置白名单。
4809
+ * 注入自定义语言加载器。返回 `null` 时回退到默认内置白名单。
4789
4810
  * 建议按需 `import` 语言模块,避免引入全量语言包。
4790
4811
  *
4791
4812
  * @example 按需加载额外语言
4792
4813
  * ```ts
4793
4814
  * import { setupCodeHighlighter } from "@antdv-next/x";
4815
+ * import type { LanguageInput } from "shiki";
4794
4816
  *
4795
4817
  * setupCodeHighlighter({
4796
4818
  * loadLanguage: async (lang) => {
4797
- * const loaders: Record<string, () => Promise<{ default: any }>> = {
4819
+ * const loaders: Record<string, () => Promise<{ default: LanguageInput }>> = {
4798
4820
  * go: () => import("shiki/dist/langs/go.mjs"),
4799
4821
  * rust: () => import("shiki/dist/langs/rust.mjs"),
4800
4822
  * };
@@ -4804,8 +4826,9 @@
4804
4826
  * });
4805
4827
  * ```
4806
4828
  */
4807
- function setupCodeHighlighter(options) {
4808
- if (options?.loadLanguage) activeLoader = options.loadLanguage;
4829
+ function setupCodeHighlighter(options = {}) {
4830
+ customLoader = options.loadLanguage ?? null;
4831
+ failedLangs.clear();
4809
4832
  }
4810
4833
  var highlighter = null;
4811
4834
  var highlighterPromise = null;
@@ -4820,11 +4843,7 @@
4820
4843
  }
4821
4844
  async function getHighlighter() {
4822
4845
  if (highlighter) return highlighter;
4823
- if (!highlighterPromise) highlighterPromise = (0, shiki_core.createHighlighterCore)({
4824
- themes: [shiki_dist_themes_vitesse_light_mjs.default, shiki_dist_themes_vitesse_dark_mjs.default],
4825
- langs: [],
4826
- engine: (0, shiki_engine_javascript.createJavaScriptRegexEngine)()
4827
- });
4846
+ if (!highlighterPromise) highlighterPromise = Promise.resolve().then(() => (init_shiki_runtime(), shiki_runtime_exports)).then(({ createHighlighter }) => createHighlighter());
4828
4847
  highlighter = await highlighterPromise;
4829
4848
  return highlighter;
4830
4849
  }
@@ -4835,7 +4854,7 @@
4835
4854
  if (pendingLoad) return pendingLoad;
4836
4855
  const loadPromise = (async () => {
4837
4856
  try {
4838
- const registration = await activeLoader(lang);
4857
+ const registration = await customLoader?.(lang) ?? await defaultLoader(lang);
4839
4858
  if (!registration) {
4840
4859
  failedLangs.add(lang);
4841
4860
  return false;
package/dist/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "1.1.3-beta.3";
2
+ var version = "1.1.3-beta.4";
3
3
  //#endregion
4
4
  export { version };
@@ -2,7 +2,7 @@ export declare const defaultPrefixCls = "ant";
2
2
  export default function useXProviderContext(): {
3
3
  theme: import('antdv-next').ThemeConfig | undefined;
4
4
  getPrefixCls: (suffixCls?: string, customizePrefixCls?: string) => string;
5
- direction: import('antdv-next/dist/config-provider/context').DirectionType;
6
- csp: import('antdv-next/dist/config-provider/context').CSPConfig | undefined;
5
+ direction: import('antdv-next/config-provider/context').DirectionType;
6
+ csp: import('antdv-next/config-provider/context').CSPConfig | undefined;
7
7
  iconPrefixCls: string;
8
8
  };
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Enum.js
1
+ //#region ../../node_modules/stylis/src/Enum.js
2
2
  var e = "-ms-", t = "-moz-", n = "-webkit-", r = "comm", i = "rule", a = "decl", o = "@import", s = "@namespace", c = "@keyframes", l = "@layer", u = Math.abs, d = String.fromCharCode, f = Object.assign;
3
3
  function p(e, t) {
4
4
  return v(e, 0) ^ 45 ? (((t << 2 ^ v(e, 0)) << 2 ^ v(e, 1)) << 2 ^ v(e, 2)) << 2 ^ v(e, 3) : 0;
@@ -39,7 +39,7 @@ function w(e, t) {
39
39
  });
40
40
  }
41
41
  //#endregion
42
- //#region ../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Tokenizer.js
42
+ //#region ../../node_modules/stylis/src/Tokenizer.js
43
43
  var T = 1, E = 1, D = 0, O = 0, k = 0, A = "";
44
44
  function j(e, t, n, r, i, a, o, s) {
45
45
  return {
@@ -150,7 +150,7 @@ function J(e) {
150
150
  return z(e, O);
151
151
  }
152
152
  //#endregion
153
- //#region ../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Parser.js
153
+ //#region ../../node_modules/stylis/src/Parser.js
154
154
  function Y(e) {
155
155
  return H(X("", null, null, null, [""], e = V(e), 0, [0], e));
156
156
  }
@@ -241,7 +241,7 @@ function Q(e, t, n, r, i) {
241
241
  return j(e, t, n, a, y(e, 0, r), y(e, r + 1, -1), r, i);
242
242
  }
243
243
  //#endregion
244
- //#region ../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Serializer.js
244
+ //#region ../../node_modules/stylis/src/Serializer.js
245
245
  function $(e, t) {
246
246
  for (var n = "", r = 0; r < e.length; r++) n += t(e[r], r, e, t) || "";
247
247
  return n;
@@ -1,19 +1,19 @@
1
- import { A as e, B as t, C as n, E as r, H as i, M as a, U as o, V as s, k as c, p as l, w as u, z as d } from "./isArrayLikeObject-jl2bjkAJ.js";
2
- import { A as f, C as p, D as m, M as h, N as g, S as _, T as v, f as y, h as b, u as x, w as S } from "./_baseUniq-BlS7rXTs.js";
3
- //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_trimmedEndIndex.js
1
+ import { A as e, B as t, C as n, E as r, H as i, M as a, U as o, V as s, k as c, p as l, w as u, z as d } from "./isArrayLikeObject-y3HlYDaX.js";
2
+ import { A as f, C as p, D as m, M as h, N as g, S as _, T as v, f as y, h as b, u as x, w as S } from "./_baseUniq-Ch3HuHeT.js";
3
+ //#region ../../node_modules/lodash-es/_trimmedEndIndex.js
4
4
  var C = /\s/;
5
5
  function w(e) {
6
6
  for (var t = e.length; t-- && C.test(e.charAt(t)););
7
7
  return t;
8
8
  }
9
9
  //#endregion
10
- //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseTrim.js
10
+ //#region ../../node_modules/lodash-es/_baseTrim.js
11
11
  var ee = /^\s+/;
12
12
  function T(e) {
13
13
  return e && e.slice(0, w(e) + 1).replace(ee, "");
14
14
  }
15
15
  //#endregion
16
- //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/toNumber.js
16
+ //#region ../../node_modules/lodash-es/toNumber.js
17
17
  var E = NaN, D = /^[-+]0x[0-9a-f]+$/i, O = /^0b[01]+$/i, k = /^0o[0-7]+$/i, A = parseInt;
18
18
  function j(e) {
19
19
  if (typeof e == "number") return e;
@@ -28,24 +28,24 @@ function j(e) {
28
28
  return r || k.test(e) ? A(e.slice(2), r ? 2 : 8) : D.test(e) ? E : +e;
29
29
  }
30
30
  //#endregion
31
- //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/toFinite.js
31
+ //#region ../../node_modules/lodash-es/toFinite.js
32
32
  var M = Infinity, N = 17976931348623157e292;
33
33
  function P(e) {
34
34
  return e ? (e = j(e), e === M || e === -M ? (e < 0 ? -1 : 1) * N : e === e ? e : 0) : e === 0 ? e : 0;
35
35
  }
36
36
  //#endregion
37
- //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/toInteger.js
37
+ //#region ../../node_modules/lodash-es/toInteger.js
38
38
  function F(e) {
39
39
  var t = P(e), n = t % 1;
40
40
  return t === t ? n ? t - n : t : 0;
41
41
  }
42
42
  //#endregion
43
- //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/flatten.js
43
+ //#region ../../node_modules/lodash-es/flatten.js
44
44
  function I(e) {
45
45
  return e != null && e.length ? _(e, 1) : [];
46
46
  }
47
47
  //#endregion
48
- //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/defaults.js
48
+ //#region ../../node_modules/lodash-es/defaults.js
49
49
  var L = Object.prototype, R = L.hasOwnProperty, z = r(function(t, r) {
50
50
  t = Object(t);
51
51
  var i = -1, a = r.length, o = a > 2 ? r[2] : void 0;
@@ -56,13 +56,13 @@ var L = Object.prototype, R = L.hasOwnProperty, z = r(function(t, r) {
56
56
  return t;
57
57
  });
58
58
  //#endregion
59
- //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/last.js
59
+ //#region ../../node_modules/lodash-es/last.js
60
60
  function B(e) {
61
61
  var t = e == null ? 0 : e.length;
62
62
  return t ? e[t - 1] : void 0;
63
63
  }
64
64
  //#endregion
65
- //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_createFind.js
65
+ //#region ../../node_modules/lodash-es/_createFind.js
66
66
  function V(e) {
67
67
  return function(t, n, r) {
68
68
  var i = Object(t);
@@ -77,7 +77,7 @@ function V(e) {
77
77
  };
78
78
  }
79
79
  //#endregion
80
- //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/findIndex.js
80
+ //#region ../../node_modules/lodash-es/findIndex.js
81
81
  var H = Math.max;
82
82
  function U(e, t, n) {
83
83
  var r = e == null ? 0 : e.length;
@@ -86,10 +86,10 @@ function U(e, t, n) {
86
86
  return i < 0 && (i = H(r + i, 0)), f(e, y(t, 3), i);
87
87
  }
88
88
  //#endregion
89
- //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/find.js
89
+ //#region ../../node_modules/lodash-es/find.js
90
90
  var W = V(U);
91
91
  //#endregion
92
- //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseMap.js
92
+ //#region ../../node_modules/lodash-es/_baseMap.js
93
93
  function G(e, t) {
94
94
  var n = -1, r = u(e) ? Array(e.length) : [];
95
95
  return x(e, function(e, i, a) {
@@ -97,34 +97,34 @@ function G(e, t) {
97
97
  }), r;
98
98
  }
99
99
  //#endregion
100
- //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/map.js
100
+ //#region ../../node_modules/lodash-es/map.js
101
101
  function K(e, t) {
102
102
  return (s(e) ? h : G)(e, y(t, 3));
103
103
  }
104
104
  //#endregion
105
- //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseHas.js
105
+ //#region ../../node_modules/lodash-es/_baseHas.js
106
106
  var q = Object.prototype.hasOwnProperty;
107
107
  function J(e, t) {
108
108
  return e != null && q.call(e, t);
109
109
  }
110
110
  //#endregion
111
- //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/has.js
111
+ //#region ../../node_modules/lodash-es/has.js
112
112
  function Y(e, t) {
113
113
  return e != null && b(e, t, J);
114
114
  }
115
115
  //#endregion
116
- //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isString.js
116
+ //#region ../../node_modules/lodash-es/isString.js
117
117
  var X = "[object String]";
118
118
  function Z(e) {
119
119
  return typeof e == "string" || !s(e) && i(e) && o(e) == X;
120
120
  }
121
121
  //#endregion
122
- //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseLt.js
122
+ //#region ../../node_modules/lodash-es/_baseLt.js
123
123
  function Q(e, t) {
124
124
  return e < t;
125
125
  }
126
126
  //#endregion
127
- //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseExtremum.js
127
+ //#region ../../node_modules/lodash-es/_baseExtremum.js
128
128
  function $(e, t, n) {
129
129
  for (var r = -1, i = e.length; ++r < i;) {
130
130
  var a = e[r], o = t(a);
@@ -133,12 +133,12 @@ function $(e, t, n) {
133
133
  return c;
134
134
  }
135
135
  //#endregion
136
- //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/min.js
136
+ //#region ../../node_modules/lodash-es/min.js
137
137
  function te(e) {
138
138
  return e && e.length ? $(e, d, Q) : void 0;
139
139
  }
140
140
  //#endregion
141
- //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseSet.js
141
+ //#region ../../node_modules/lodash-es/_baseSet.js
142
142
  function ne(e, n, r, i) {
143
143
  if (!t(e)) return e;
144
144
  n = v(n, e);
@@ -154,7 +154,7 @@ function ne(e, n, r, i) {
154
154
  return e;
155
155
  }
156
156
  //#endregion
157
- //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_basePickBy.js
157
+ //#region ../../node_modules/lodash-es/_basePickBy.js
158
158
  function re(e, t, n) {
159
159
  for (var r = -1, i = t.length, a = {}; ++r < i;) {
160
160
  var o = t[r], s = p(e, o);