bridgerte 0.9.2 → 0.9.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 (47) hide show
  1. package/README.md +936 -855
  2. package/dist/bridge.cjs.map +1 -1
  3. package/dist/bridge.d.ts +8 -1
  4. package/dist/bridge.js.map +1 -1
  5. package/dist/core.cjs +1 -1
  6. package/dist/core.cjs.map +1 -1
  7. package/dist/core.d.ts +8 -1
  8. package/dist/core.js +44 -54
  9. package/dist/core.js.map +1 -1
  10. package/dist/dom.cjs +1 -1
  11. package/dist/dom.d.ts +8 -1
  12. package/dist/dom.js +6 -5
  13. package/dist/index-5d8qaSP5.cjs +36 -0
  14. package/dist/index-5d8qaSP5.cjs.map +1 -0
  15. package/dist/{index-KRuLtGv9.js → index-BzpD9bI2.js} +1800 -1661
  16. package/dist/index-BzpD9bI2.js.map +1 -0
  17. package/dist/index-C26bdJ7I.js +319 -0
  18. package/dist/index-C26bdJ7I.js.map +1 -0
  19. package/dist/index-CuNKUHed.js.map +1 -1
  20. package/dist/index-DF8OhKI4.cjs +2 -0
  21. package/dist/index-DF8OhKI4.cjs.map +1 -0
  22. package/dist/index-DKalD8mx.cjs +4 -0
  23. package/dist/index-DKalD8mx.cjs.map +1 -0
  24. package/dist/index-GaS65GL0.cjs.map +1 -1
  25. package/dist/index-sbZNOcCB.js +54 -0
  26. package/dist/index-sbZNOcCB.js.map +1 -0
  27. package/dist/index.cjs +1 -1
  28. package/dist/index.d.ts +8 -1
  29. package/dist/index.js +24 -21
  30. package/dist/index.js.map +1 -1
  31. package/dist/native-spec.cjs +1 -1
  32. package/dist/native-spec.cjs.map +1 -1
  33. package/dist/native-spec.d.ts +8 -1
  34. package/dist/native-spec.js +50 -42
  35. package/dist/native-spec.js.map +1 -1
  36. package/dist/style.css +1 -1
  37. package/dist/webview.cjs +1 -1
  38. package/dist/webview.d.ts +8 -1
  39. package/dist/webview.js +1 -1
  40. package/package.json +2 -1
  41. package/dist/index-CkgUKPh3.cjs +0 -3
  42. package/dist/index-CkgUKPh3.cjs.map +0 -1
  43. package/dist/index-CqOH1_5N.cjs +0 -2
  44. package/dist/index-CqOH1_5N.cjs.map +0 -1
  45. package/dist/index-DRWIM218.js +0 -262
  46. package/dist/index-DRWIM218.js.map +0 -1
  47. package/dist/index-KRuLtGv9.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index-GaS65GL0.cjs","sources":["../../core/src/index.ts"],"sourcesContent":["export type * from './type';\nexport { resolvePayloadPanelSchema } from './payloadPanel';\n\n/**\n * 内容结构版本号,用于后续内容协议升级时做兼容判断。\n */\nexport const BRIDGERTE_CONTENT_VERSION = '0.1.0';\n\n/**\n * 默认表格插入能力上限。\n *\n * schema、自绘和 DOM 命令执行共用这组边界;DOM 默认面板可以用更小的首屏网格展示,\n * 但最终提交和 API 执行都不应超过这里声明的库内置上限。\n */\nexport const BRIDGERTE_TABLE_INSERT_MAX_ROWS = 20;\nexport const BRIDGERTE_TABLE_INSERT_MAX_COLS = 20;\n"],"names":["BRIDGERTE_CONTENT_VERSION"],"mappings":"aAMO,MAAMA,EAA4B"}
1
+ {"version":3,"file":"index-GaS65GL0.cjs","sources":["../../core/src/index.ts"],"sourcesContent":["export type * from './type';\nexport { isEditorContentEmpty } from './content';\nexport { resolvePayloadPanelSchema } from './payloadPanel';\n\r\n/**\r\n * 内容结构版本号,用于后续内容协议升级时做兼容判断。\r\n */\r\nexport const BRIDGERTE_CONTENT_VERSION = '0.1.0';\r\n\r\n/**\r\n * 默认表格插入能力上限。\r\n *\r\n * schema、自绘和 DOM 命令执行共用这组边界;DOM 默认面板可以用更小的首屏网格展示,\r\n * 但最终提交和 API 执行都不应超过这里声明的库内置上限。\r\n */\r\nexport const BRIDGERTE_TABLE_INSERT_MAX_ROWS = 20;\r\nexport const BRIDGERTE_TABLE_INSERT_MAX_COLS = 20;\r\n"],"names":["BRIDGERTE_CONTENT_VERSION"],"mappings":"aAOO,MAAMA,EAA4B"}
@@ -0,0 +1,54 @@
1
+ const b = (e) => e !== void 0 && Object.keys(e).length > 0, h = (e, t) => {
2
+ var o, m;
3
+ const a = (o = t.options) != null && o.length ? t.options : e, r = new Map(a.map((s) => [s.value, s])), u = (m = t.includeValues) != null && m.length ? t.includeValues.flatMap((s) => {
4
+ const l = r.get(s);
5
+ return l ? [l] : [];
6
+ }) : a, O = new Set(t.excludeValues ?? []), p = u.filter((s) => !O.has(s.value)).map((s) => {
7
+ var l, v;
8
+ return {
9
+ ...s,
10
+ label: ((l = t.optionLabels) == null ? void 0 : l[s.value]) ?? s.label,
11
+ value: ((v = t.optionValues) == null ? void 0 : v[s.value]) ?? s.value
12
+ };
13
+ });
14
+ return p.length > 0 ? p : a;
15
+ }, n = (e, t) => ({
16
+ label: t.label ?? e.label,
17
+ defaultValue: t.defaultValue ?? e.defaultValue,
18
+ placeholder: t.placeholder ?? e.placeholder
19
+ }), V = (e, t) => !t || !b(t) ? e : e.type === "select" ? {
20
+ ...e,
21
+ ...n(e, t),
22
+ options: h(e.options, t)
23
+ } : e.type === "color" ? {
24
+ ...e,
25
+ ...n(e, t),
26
+ options: h(e.options ?? [], t)
27
+ } : e.type === "number" ? {
28
+ ...e,
29
+ ...n(e, t),
30
+ min: t.min ?? e.min,
31
+ max: t.max ?? e.max,
32
+ step: t.step ?? e.step
33
+ } : {
34
+ ...e,
35
+ ...n(e, t)
36
+ }, y = (e, t) => {
37
+ const a = t == null ? void 0 : t[e.id];
38
+ return !a || !b(a) ? e : {
39
+ ...e,
40
+ title: a.title ?? e.title,
41
+ description: a.description ?? e.description,
42
+ fields: e.fields.map((r) => {
43
+ var u;
44
+ return V(
45
+ r,
46
+ (u = a.fields) == null ? void 0 : u[r.name]
47
+ );
48
+ })
49
+ };
50
+ };
51
+ export {
52
+ y as r
53
+ };
54
+ //# sourceMappingURL=index-sbZNOcCB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-sbZNOcCB.js","sources":["../../core/src/payloadPanel/index.ts"],"sourcesContent":["import type {\r\n PayloadPanelConfig,\r\n PayloadPanelField,\r\n PayloadPanelFieldConfig,\r\n PayloadPanelOption,\r\n PayloadPanelSchema\r\n} from './type';\r\n\r\nexport type * from './type';\r\n\r\nconst hasOwnConfigKeys = (config: object | undefined) => (\r\n config !== undefined && Object.keys(config).length > 0\r\n);\r\n\r\nconst resolveOptionList = (\r\n options: PayloadPanelOption[],\r\n config: PayloadPanelFieldConfig\r\n) => {\r\n const baseOptions = config.options?.length ? config.options : options;\r\n const optionByValue = new Map(baseOptions.map((option) => [option.value, option]));\r\n const includedOptions = config.includeValues?.length\r\n ? config.includeValues.flatMap((value) => {\r\n const option = optionByValue.get(value);\r\n\r\n return option ? [option] : [];\r\n })\r\n : baseOptions;\r\n const excludeValues = new Set(config.excludeValues ?? []);\r\n const filteredOptions = includedOptions.filter((option) => !excludeValues.has(option.value));\r\n const nextOptions = filteredOptions.map((option) => ({\r\n ...option,\r\n label: config.optionLabels?.[option.value] ?? option.label,\r\n value: config.optionValues?.[option.value] ?? option.value\r\n }));\r\n\r\n /*\r\n * 配置写错时不返回空候选,避免默认 DOM 面板、自绘 request 和原生菜单拿到\r\n * 无法操作的空列表;业务真要完全隐藏菜单应通过菜单 config 排除入口。\r\n */\r\n return nextOptions.length > 0 ? nextOptions : baseOptions;\r\n};\r\n\r\nconst resolveFieldBaseOverride = (\r\n field: PayloadPanelField,\r\n config: PayloadPanelFieldConfig\r\n) => ({\r\n label: config.label ?? field.label,\r\n defaultValue: config.defaultValue ?? field.defaultValue,\r\n placeholder: config.placeholder ?? field.placeholder\r\n});\r\n\r\nconst resolvePayloadPanelField = (\r\n field: PayloadPanelField,\r\n config: PayloadPanelFieldConfig | undefined\r\n): PayloadPanelField => {\r\n if (!config || !hasOwnConfigKeys(config)) return field;\r\n\r\n if (field.type === 'select') {\r\n return {\r\n ...field,\r\n ...resolveFieldBaseOverride(field, config),\r\n options: resolveOptionList(field.options, config)\r\n };\r\n }\r\n\r\n if (field.type === 'color') {\r\n return {\r\n ...field,\r\n ...resolveFieldBaseOverride(field, config),\r\n options: resolveOptionList(field.options ?? [], config)\r\n };\r\n }\r\n\r\n if (field.type === 'number') {\r\n return {\r\n ...field,\r\n ...resolveFieldBaseOverride(field, config),\r\n min: config.min ?? field.min,\r\n max: config.max ?? field.max,\r\n step: config.step ?? field.step\r\n };\r\n }\r\n\r\n return {\r\n ...field,\r\n ...resolveFieldBaseOverride(field, config)\r\n };\r\n};\r\n\r\n/**\r\n * 解析参数面板 schema。\r\n *\r\n * 这个纯函数只处理 schema 数据,不理解 DOM、Lexical 或具体命令;toolbar、hoverbar、\r\n * code block header 和 WebView host request 都应先走这里,保证默认 UI 和业务自绘同源。\r\n */\r\nexport const resolvePayloadPanelSchema = (\r\n panel: PayloadPanelSchema,\r\n config?: PayloadPanelConfig\r\n): PayloadPanelSchema => {\r\n const panelConfig = config?.[panel.id];\r\n\r\n if (!panelConfig || !hasOwnConfigKeys(panelConfig)) return panel;\r\n\r\n return {\r\n ...panel,\r\n title: panelConfig.title ?? panel.title,\r\n description: panelConfig.description ?? panel.description,\r\n fields: panel.fields.map((field) => resolvePayloadPanelField(\r\n field,\r\n panelConfig.fields?.[field.name]\r\n ))\r\n };\r\n};\r\n"],"names":["hasOwnConfigKeys","config","resolveOptionList","options","_a","_b","baseOptions","optionByValue","option","includedOptions","value","excludeValues","nextOptions","resolveFieldBaseOverride","field","resolvePayloadPanelField","resolvePayloadPanelSchema","panel","panelConfig"],"mappings":"AAUA,MAAMA,IAAmB,CAACC,MACxBA,MAAW,UAAa,OAAO,KAAKA,CAAM,EAAE,SAAS,GAGjDC,IAAoB,CACxBC,GACAF,MACG;AAPL,MAAAG,GAAAC;AAQE,QAAMC,KAAcF,IAAAH,EAAO,YAAP,QAAAG,EAAgB,SAASH,EAAO,UAAUE,GACxDI,IAAgB,IAAI,IAAID,EAAY,IAAI,CAACE,MAAW,CAACA,EAAO,OAAOA,CAAM,CAAC,CAAC,GAC3EC,KAAkB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AAO,OAAOa,EAAM;AAAA,EACzB,KAAKb,EAAO,OAAOa,EAAM;AAAA,EACzB,MAAMb,EAAO,QAAQa,EAAM;AAAA,IAIxB;AAAA,EACL,GAAGA;AAAA,EACH,GAAGD,EAAyBC,GAAOb,CAAM;AAAA,GAUhCe,IAA4B,CACvCC,GACAhB,MACuB;AACvB,QAAMiB,IAAcjB,KAAA,gBAAAA,EAASgB,EAAM;AAEnC,SAAI,CAACC,KAAe,CAAClB,EAAiBkB,CAAW,IAAUD,IAEpD;AAAA,IACL,GAAGA;AAAA,IACH,OAAOC,EAAY,SAASD,EAAM;AAAA,IAClC,aAAaC,EAAY,eAAeD,EAAM;AAAA,IAC9C,QAAQA,EAAM,OAAO,IAAI,CAACH,MAAA;AAjG9B,UAAAV;AAiGwC,aAAAW;AAAA,QAClCD;AAAA,SACAV,IAAAc,EAAY,WAAZ,gBAAAd,EAAqBU,EAAM;AAAA,MAAI;AAAA,KAChC;AAAA,EAAA;AAEL;"}
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-GaS65GL0.cjs"),a=require("./bridge.cjs"),e=require("./native-spec.cjs"),o=require("./index-CkgUKPh3.cjs"),r=require("./index-CqOH1_5N.cjs"),n=require("./core.cjs");exports.BRIDGERTE_CONTENT_VERSION=t.BRIDGERTE_CONTENT_VERSION;exports.BRIDGERTE_TABLE_INSERT_MAX_COLS=t.BRIDGERTE_TABLE_INSERT_MAX_COLS;exports.BRIDGERTE_TABLE_INSERT_MAX_ROWS=t.BRIDGERTE_TABLE_INSERT_MAX_ROWS;exports.BRIDGE_CONTENT_CHANGE_DEBOUNCE_MS=a.BRIDGE_CONTENT_CHANGE_DEBOUNCE_MS;exports.BRIDGE_HEIGHT_CHANGE_THROTTLE_MS=a.BRIDGE_HEIGHT_CHANGE_THROTTLE_MS;exports.defaultBridgeEventTiming=a.defaultBridgeEventTiming;exports.isBridgeMessage=a.isBridgeMessage;exports.codeBlockLanguagePanel=e.codeBlockLanguagePanel;exports.codeBlockLanguagePayloadPanel=e.codeBlockLanguagePayloadPanel;exports.createDisabledCommandStates=e.createDisabledCommandStates;exports.defaultMenuSchema=e.defaultMenuSchema;exports.defaultToolbarConfig=e.defaultToolbarConfig;exports.getCommandStateMatchValue=e.getCommandStateMatchValue;exports.isCommandStateForCommand=e.isCommandStateForCommand;exports.isMenuItemCommandState=e.isMenuItemCommandState;exports.resolveToolbarMenu=e.resolveToolbarMenu;exports.tableHeaderMenuItems=e.tableHeaderMenuItems;exports.createFloatingLayer=o.createFloatingLayer;exports.createRichTextEditor=o.createRichTextEditor;exports.createWebViewBridgeRuntime=o.createWebViewBridgeRuntime;exports.createRichTextToolbar=r.createRichTextToolbar;exports.resolvePayloadPanelSchema=n.resolvePayloadPanelSchema;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-GaS65GL0.cjs"),a=require("./bridge.cjs"),e=require("./native-spec.cjs"),n=require("./index-DKalD8mx.cjs"),o=require("./index-5d8qaSP5.cjs"),r=require("./core.cjs"),i=require("./index-DF8OhKI4.cjs");exports.BRIDGERTE_CONTENT_VERSION=t.BRIDGERTE_CONTENT_VERSION;exports.BRIDGERTE_TABLE_INSERT_MAX_COLS=t.BRIDGERTE_TABLE_INSERT_MAX_COLS;exports.BRIDGERTE_TABLE_INSERT_MAX_ROWS=t.BRIDGERTE_TABLE_INSERT_MAX_ROWS;exports.BRIDGE_CONTENT_CHANGE_DEBOUNCE_MS=a.BRIDGE_CONTENT_CHANGE_DEBOUNCE_MS;exports.BRIDGE_HEIGHT_CHANGE_THROTTLE_MS=a.BRIDGE_HEIGHT_CHANGE_THROTTLE_MS;exports.defaultBridgeEventTiming=a.defaultBridgeEventTiming;exports.isBridgeMessage=a.isBridgeMessage;exports.codeBlockLanguagePanel=e.codeBlockLanguagePanel;exports.codeBlockLanguagePayloadPanel=e.codeBlockLanguagePayloadPanel;exports.createDisabledCommandStates=e.createDisabledCommandStates;exports.defaultMenuSchema=e.defaultMenuSchema;exports.defaultToolbarConfig=e.defaultToolbarConfig;exports.getCommandStateMatchValue=e.getCommandStateMatchValue;exports.isCommandStateForCommand=e.isCommandStateForCommand;exports.isMenuItemCommandState=e.isMenuItemCommandState;exports.resolveToolbarMenu=e.resolveToolbarMenu;exports.tableHeaderMenuItems=e.tableHeaderMenuItems;exports.createFloatingLayer=n.createFloatingLayer;exports.createRichTextEditor=n.createRichTextEditor;exports.createWebViewBridgeRuntime=n.createWebViewBridgeRuntime;exports.createRichTextToolbar=o.createRichTextToolbar;exports.hasMeaningfulHtmlContent=o.hasMeaningfulHtmlContent;exports.isEditorContentEmpty=r.isEditorContentEmpty;exports.resolvePayloadPanelSchema=i.resolvePayloadPanelSchema;
2
2
  //# sourceMappingURL=index.cjs.map
package/dist/index.d.ts CHANGED
@@ -283,7 +283,7 @@ export type FormatClearScope = 'selection' | 'block';
283
283
  /**
284
284
  * 代码块语言标识。
285
285
  *
286
- * 保持 string 是为了兼容 highlight.js、Prism 或业务自定义语言表。
286
+ * 保持 string 是为了兼容 Shiki、highlight.js 或业务自定义语言表。
287
287
  */
288
288
  export type CodeBlockLanguage = string;
289
289
  /**
@@ -527,7 +527,14 @@ export type SlashCommandMenuAnchorRect = {
527
527
  width: number;
528
528
  height: number;
529
529
  };
530
+ /**
531
+ * slash command 菜单展示配置。
532
+ *
533
+ * `showIcon` 只决定默认候选菜单是否展示 icon;候选数据仍保留 icon key,方便 DOM、
534
+ * WebView 或业务自绘层按自己的 UI 策略渲染。
535
+ */
530
536
  export type SlashCommandMenuConfig = {
537
+ showIcon?: boolean;
531
538
  loadingText?: string;
532
539
  emptyText?: string;
533
540
  errorText?: string;
package/dist/index.js CHANGED
@@ -1,31 +1,34 @@
1
- import { B as o, a as t, b as r } from "./index-CuNKUHed.js";
2
- import { BRIDGE_CONTENT_CHANGE_DEBOUNCE_MS as m, BRIDGE_HEIGHT_CHANGE_THROTTLE_MS as T, defaultBridgeEventTiming as l, isBridgeMessage as n } from "./bridge.js";
3
- import { codeBlockLanguagePanel as _, codeBlockLanguagePayloadPanel as s, createDisabledCommandStates as c, defaultMenuSchema as i, defaultToolbarConfig as R, getCommandStateMatchValue as B, isCommandStateForCommand as S, isMenuItemCommandState as g, resolveToolbarMenu as C, tableHeaderMenuItems as u } from "./native-spec.js";
4
- import { c as f, a as M, b as N } from "./index-KRuLtGv9.js";
5
- import { c as x } from "./index-DRWIM218.js";
6
- import { resolvePayloadPanelSchema as D } from "./core.js";
1
+ import { B as t, a as o, b as r } from "./index-CuNKUHed.js";
2
+ import { BRIDGE_CONTENT_CHANGE_DEBOUNCE_MS as n, BRIDGE_HEIGHT_CHANGE_THROTTLE_MS as E, defaultBridgeEventTiming as l, isBridgeMessage as s } from "./bridge.js";
3
+ import { codeBlockLanguagePanel as d, codeBlockLanguagePayloadPanel as i, createDisabledCommandStates as _, defaultMenuSchema as c, defaultToolbarConfig as R, getCommandStateMatchValue as B, isCommandStateForCommand as C, isMenuItemCommandState as g, resolveToolbarMenu as S, tableHeaderMenuItems as f } from "./native-spec.js";
4
+ import { c as I, a as M, b as N } from "./index-BzpD9bI2.js";
5
+ import { c as b, h as p } from "./index-C26bdJ7I.js";
6
+ import { isEditorContentEmpty as h } from "./core.js";
7
+ import { r as H } from "./index-sbZNOcCB.js";
7
8
  export {
8
- o as BRIDGERTE_CONTENT_VERSION,
9
- t as BRIDGERTE_TABLE_INSERT_MAX_COLS,
9
+ t as BRIDGERTE_CONTENT_VERSION,
10
+ o as BRIDGERTE_TABLE_INSERT_MAX_COLS,
10
11
  r as BRIDGERTE_TABLE_INSERT_MAX_ROWS,
11
- m as BRIDGE_CONTENT_CHANGE_DEBOUNCE_MS,
12
- T as BRIDGE_HEIGHT_CHANGE_THROTTLE_MS,
13
- _ as codeBlockLanguagePanel,
14
- s as codeBlockLanguagePayloadPanel,
15
- c as createDisabledCommandStates,
16
- f as createFloatingLayer,
12
+ n as BRIDGE_CONTENT_CHANGE_DEBOUNCE_MS,
13
+ E as BRIDGE_HEIGHT_CHANGE_THROTTLE_MS,
14
+ d as codeBlockLanguagePanel,
15
+ i as codeBlockLanguagePayloadPanel,
16
+ _ as createDisabledCommandStates,
17
+ I as createFloatingLayer,
17
18
  M as createRichTextEditor,
18
- x as createRichTextToolbar,
19
+ b as createRichTextToolbar,
19
20
  N as createWebViewBridgeRuntime,
20
21
  l as defaultBridgeEventTiming,
21
- i as defaultMenuSchema,
22
+ c as defaultMenuSchema,
22
23
  R as defaultToolbarConfig,
23
24
  B as getCommandStateMatchValue,
24
- n as isBridgeMessage,
25
- S as isCommandStateForCommand,
25
+ p as hasMeaningfulHtmlContent,
26
+ s as isBridgeMessage,
27
+ C as isCommandStateForCommand,
28
+ h as isEditorContentEmpty,
26
29
  g as isMenuItemCommandState,
27
- D as resolvePayloadPanelSchema,
28
- C as resolveToolbarMenu,
29
- u as tableHeaderMenuItems
30
+ H as resolvePayloadPanelSchema,
31
+ S as resolveToolbarMenu,
32
+ f as tableHeaderMenuItems
30
33
  };
31
34
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./index-GaS65GL0.cjs"),g={id:"code-block-language",title:"代码语言",fields:[{type:"select",name:"language",label:"语言",defaultValue:"",options:[{label:"纯文本",value:""},{label:"C",value:"c"},{label:"C-like",value:"clike"},{label:"C++",value:"cpp"},{label:"CSS",value:"css"},{label:"HTML",value:"html"},{label:"Java",value:"java"},{label:"JavaScript",value:"javascript"},{label:"JSON",value:"json"},{label:"Markdown",value:"markdown"},{label:"Objective-C",value:"objc"},{label:"PowerShell",value:"powershell"},{label:"Python",value:"python"},{label:"Rust",value:"rust"},{label:"SQL",value:"sql"},{label:"Swift",value:"swift"},{label:"TypeScript",value:"typescript"},{label:"XML",value:"xml"}]}]},k=g,x={id:"text-color",title:"文字颜色",fields:[{type:"color",name:"value",label:"颜色"}]},P={id:"background-color",title:"背景色",fields:[{type:"color",name:"value",label:"背景"}]},S={id:"font-size",title:"字号",fields:[{type:"select",name:"value",label:"字号",defaultValue:"16px",options:[{label:"小号 14px",value:"14px"},{label:"正文 16px",value:"16px"},{label:"强调 18px",value:"18px"},{label:"标题 20px",value:"20px"},{label:"大标题 24px",value:"24px"}]}]},w={id:"font-family",title:"字体",fields:[{type:"select",name:"value",label:"字体",defaultValue:"",options:[{label:"跟随页面",value:""},{label:"无衬线",value:"sans-serif"},{label:"衬线",value:"serif"},{label:"等宽",value:"monospace"}]}]},M={id:"line-height",title:"行高",fields:[{type:"select",name:"value",label:"行高",defaultValue:"1.7",options:[{label:"紧凑 1.4",value:"1.4"},{label:"常规 1.7",value:"1.7"},{label:"舒展 2",value:"2"}]}]},T={id:"table-insert",title:"插入表格",fields:[{type:"number",name:"rows",label:"行数",defaultValue:"3",min:1,max:b.BRIDGERTE_TABLE_INSERT_MAX_ROWS,step:1},{type:"number",name:"cols",label:"列数",defaultValue:"3",min:1,max:b.BRIDGERTE_TABLE_INSERT_MAX_COLS,step:1}]},y=[{id:"table-insert-row-after",command:{type:"table.insertRow",direction:"after"},label:"插入行",icon:"rows-plus",group:"table"},{id:"table-delete-row",command:{type:"table.deleteRow"},label:"删除行",icon:"rows-minus",group:"table"},{id:"table-insert-column-after",command:{type:"table.insertColumn",direction:"after"},label:"插入列",icon:"columns-plus",group:"table"},{id:"table-delete-column",command:{type:"table.deleteColumn"},label:"删除列",icon:"columns-minus",group:"table"},{id:"table-delete",command:{type:"table.delete"},label:"删除表格",icon:"table-delete",group:"table"}],c=[{id:"bold",command:{type:"format.bold"},label:"加粗",icon:"bold",group:"text"},{id:"italic",command:{type:"format.italic"},label:"斜体",icon:"italic",group:"text"},{id:"underline",command:{type:"format.underline"},label:"下划线",icon:"underline",group:"text"},{id:"strike",command:{type:"format.strike"},label:"删除线",icon:"strikethrough",group:"text"},{id:"inline-code",command:{type:"format.inlineCode"},label:"行内代码",icon:"code",group:"text"},{id:"superscript",command:{type:"format.superscript"},label:"上标",icon:"superscript",group:"text"},{id:"subscript",command:{type:"format.subscript"},label:"下标",icon:"subscript",group:"text"},{id:"clear-style",command:{type:"format.clear"},label:"清除样式",icon:"remove-formatting",group:"text"},{id:"color",command:{type:"format.color",value:""},label:"文字颜色",icon:"palette",group:"style",requiresPayload:!0,payloadPanel:x},{id:"background-color",command:{type:"format.backgroundColor",value:""},label:"背景色",icon:"paint-bucket",group:"style",requiresPayload:!0,payloadPanel:P},{id:"font-size",command:{type:"format.fontSize",value:""},label:"字号",icon:"case-sensitive",group:"style",requiresPayload:!0,payloadPanel:S},{id:"font-family",command:{type:"format.fontFamily",value:""},label:"字体",icon:"type",group:"style",requiresPayload:!0,payloadPanel:w},{id:"line-height",command:{type:"format.lineHeight",value:""},label:"行高",icon:"wrap-text",group:"style",requiresPayload:!0,payloadPanel:M},{id:"paragraph",command:{type:"block.paragraph"},label:"正文",icon:"pilcrow",group:"block"},{id:"heading-1",command:{type:"block.heading",level:1},label:"一级标题",icon:"heading-1",group:"block"},{id:"heading-2",command:{type:"block.heading",level:2},label:"二级标题",icon:"heading-2",group:"block"},{id:"heading-3",command:{type:"block.heading",level:3},label:"三级标题",icon:"heading-3",group:"block"},{id:"heading-4",command:{type:"block.heading",level:4},label:"四级标题",icon:"heading-4",group:"block"},{id:"heading-5",command:{type:"block.heading",level:5},label:"五级标题",icon:"heading-5",group:"block"},{id:"heading-6",command:{type:"block.heading",level:6},label:"六级标题",icon:"heading-6",group:"block"},{id:"quote",command:{type:"block.quote"},label:"引用",icon:"quote",group:"block"},{id:"divider",command:{type:"block.divider"},label:"分割线",icon:"minus",group:"block"},{id:"code-block",command:{type:"block.code"},label:"代码块",icon:"square-code",group:"block"},{id:"ordered-list",command:{type:"list.ordered"},label:"有序列表",icon:"list-ordered",group:"list"},{id:"unordered-list",command:{type:"list.unordered"},label:"无序列表",icon:"list",group:"list"},{id:"todo-list",command:{type:"list.todo"},label:"待办列表",icon:"list-todo",group:"list"},{id:"align-left",command:{type:"align",value:"left"},label:"左对齐",icon:"align-left",group:"align"},{id:"align-center",command:{type:"align",value:"center"},label:"居中",icon:"align-center",group:"align"},{id:"align-right",command:{type:"align",value:"right"},label:"右对齐",icon:"align-right",group:"align"},{id:"align-justify",command:{type:"align",value:"justify"},label:"两端对齐",icon:"align-justify",group:"align"},{id:"indent-increase",command:{type:"indent.increase"},label:"增加缩进",icon:"indent-increase",group:"align"},{id:"indent-decrease",command:{type:"indent.decrease"},label:"减少缩进",icon:"indent-decrease",group:"align"},{id:"mention",command:{type:"mention.insert",item:{id:"",label:"",value:""}},label:"@ 提及",icon:"at-sign",group:"insert",requiresPayload:!0},{id:"upload-image",command:{type:"media.pickImage"},label:"上传图片",icon:"upload-image",group:"media"},{id:"upload-video",command:{type:"media.pickVideo"},label:"上传视频",icon:"upload-video",group:"media"},{id:"table",command:{type:"table.insert",rows:3,cols:3},label:"表格",icon:"table",group:"table",requiresPayload:!0,payloadPanel:T},...y,{id:"slash-command",command:{type:"slash.open"},label:"/ 命令",icon:"list-plus",group:"insert"},{id:"undo",command:{type:"history.undo"},label:"撤销",icon:"undo",group:"history"},{id:"redo",command:{type:"history.redo"},label:"重做",icon:"redo",group:"history"},{id:"clear",command:{type:"content.clear"},label:"清空",icon:"trash-2",group:"history"},{id:"fullscreen",command:{type:"fullscreen.toggle"},label:"全屏",icon:"maximize",group:"view"}],r={align:e=>e.type==="align"?e.value:void 0,"block.heading":e=>e.type==="block.heading"?e.level:void 0,"block.setCodeLanguage":e=>e.type==="block.setCodeLanguage"?e.language:void 0},u=e=>{var l;return(l=r[e.type])==null?void 0:l.call(r,e)},v=(e,l)=>{const a=u(e);return l.command===e.type&&(a===void 0||l.value===a)},q=(e,l)=>v(e.command,l);function I(e=c){return e.map(l=>({command:l.command.type,active:!1,disabled:!0,value:u(l.command)}))}const d={toolbarKeys:["undo","redo","clear","|","paragraph","heading-1","heading-2","heading-3","heading-4","heading-5","heading-6","quote","divider","code-block","|","bold","italic","underline","strike","inline-code","superscript","subscript","clear-style","color","background-color","font-size","font-family","line-height","|","ordered-list","unordered-list","todo-list","|","upload-image","upload-video","|","table","|","align-left","align-center","align-right","align-justify","indent-increase","indent-decrease","|","fullscreen"]},K=e=>typeof e=="object"&&Array.isArray(e.menuKeys),C=e=>new Map(e.map(l=>[l.id,l])),L=(e,l)=>typeof e=="string"?e!=="|"&&l.has(e):l.has(e.key)||e.menuKeys.every(a=>l.has(a)),j=(e,l)=>{const a=new Set((l==null?void 0:l.excludeKeys)??[]),n=e.filter(o=>!L(o,a));if(!(l!=null&&l.insertKeys))return n;const t=Math.max(0,Math.min(l.insertKeys.index,n.length));return[...n.slice(0,t),...l.insertKeys.keys,...n.slice(t)]},R=(e,l,a,n)=>{if(e==="|")return[{type:"separator",key:`separator-${n}`}];if(typeof e=="string"){const t=l.get(e);return!t||t.requiresPayload&&!t.payloadPanel||a.has(t.id)?[]:[{type:"button",item:t}]}if(K(e)){const t=e.menuKeys.filter(o=>!a.has(o)).map(o=>l.get(o)).filter(o=>o!==void 0&&(!o.requiresPayload||o.payloadPanel!==void 0));return t.length>0?[{type:"group",key:e.key,title:e.title,icon:e.icon,items:t}]:[]}return[]},E=(e,l)=>{if(e.type!=="separator")return!0;const a=l[l.length-1];return a!==void 0&&a.type!=="separator"},V=e=>{var l;for(;((l=e.at(-1))==null?void 0:l.type)==="separator";)e.pop();return e},_=(e=d,l=c)=>{const a=C(l),n=e.toolbarKeys??d.toolbarKeys??[],t=j(n,e),o=new Set(e.excludeKeys??[]);let s=0;const h=t.reduce((i,p)=>{const f=R(p,a,o,s);return p==="|"&&(s+=1),f.forEach(m=>{E(m,i)&&i.push(m)}),i},[]);return V(h)};exports.codeBlockLanguagePanel=g;exports.codeBlockLanguagePayloadPanel=k;exports.createDisabledCommandStates=I;exports.defaultMenuSchema=c;exports.defaultToolbarConfig=d;exports.getCommandStateMatchValue=u;exports.isCommandStateForCommand=v;exports.isMenuItemCommandState=q;exports.resolveToolbarMenu=_;exports.tableHeaderMenuItems=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./index-GaS65GL0.cjs"),g={id:"code-block-language",title:"代码语言",fields:[{type:"select",name:"language",label:"语言",defaultValue:"",options:[{label:"纯文本",value:""},{label:"Bash",value:"shellscript"},{label:"C",value:"c"},{label:"C++",value:"cpp"},{label:"C#",value:"csharp"},{label:"CSS",value:"css"},{label:"Dart",value:"dart"},{label:"Dockerfile",value:"docker"},{label:"Go",value:"go"},{label:"HTML",value:"html"},{label:"Java",value:"java"},{label:"JavaScript",value:"javascript"},{label:"JSON",value:"json"},{label:"Kotlin",value:"kotlin"},{label:"Markdown",value:"markdown"},{label:"PHP",value:"php"},{label:"Python",value:"python"},{label:"Rust",value:"rust"},{label:"SQL",value:"sql"},{label:"Swift",value:"swift"},{label:"TOML",value:"toml"},{label:"TSX",value:"tsx"},{label:"TypeScript",value:"typescript"},{label:"Vue",value:"vue"},{label:"XML",value:"xml"},{label:"YAML",value:"yaml"}]}]},k=g,x={id:"text-color",title:"文字颜色",fields:[{type:"color",name:"value",label:"颜色"}]},P={id:"background-color",title:"背景色",fields:[{type:"color",name:"value",label:"背景"}]},S={id:"font-size",title:"字号",fields:[{type:"select",name:"value",label:"字号",defaultValue:"16px",options:[{label:"小号 14px",value:"14px"},{label:"正文 16px",value:"16px"},{label:"强调 18px",value:"18px"},{label:"标题 20px",value:"20px"},{label:"大标题 24px",value:"24px"}]}]},M={id:"font-family",title:"字体",fields:[{type:"select",name:"value",label:"字体",defaultValue:"",options:[{label:"跟随页面",value:""},{label:"无衬线",value:"sans-serif"},{label:"衬线",value:"serif"},{label:"等宽",value:"monospace"}]}]},T={id:"line-height",title:"行高",fields:[{type:"select",name:"value",label:"行高",defaultValue:"1.7",options:[{label:"紧凑 1.4",value:"1.4"},{label:"常规 1.7",value:"1.7"},{label:"舒展 2",value:"2"}]}]},w={id:"table-insert",title:"插入表格",fields:[{type:"number",name:"rows",label:"行数",defaultValue:"3",min:1,max:b.BRIDGERTE_TABLE_INSERT_MAX_ROWS,step:1},{type:"number",name:"cols",label:"列数",defaultValue:"3",min:1,max:b.BRIDGERTE_TABLE_INSERT_MAX_COLS,step:1}]},y=[{id:"table-insert-row-after",command:{type:"table.insertRow",direction:"after"},label:"插入行",icon:"rows-plus",group:"table"},{id:"table-delete-row",command:{type:"table.deleteRow"},label:"删除行",icon:"rows-minus",group:"table"},{id:"table-insert-column-after",command:{type:"table.insertColumn",direction:"after"},label:"插入列",icon:"columns-plus",group:"table"},{id:"table-delete-column",command:{type:"table.deleteColumn"},label:"删除列",icon:"columns-minus",group:"table"},{id:"table-delete",command:{type:"table.delete"},label:"删除表格",icon:"table-delete",group:"table"}],c=[{id:"bold",command:{type:"format.bold"},label:"加粗",icon:"bold",group:"text"},{id:"italic",command:{type:"format.italic"},label:"斜体",icon:"italic",group:"text"},{id:"underline",command:{type:"format.underline"},label:"下划线",icon:"underline",group:"text"},{id:"strike",command:{type:"format.strike"},label:"删除线",icon:"strikethrough",group:"text"},{id:"inline-code",command:{type:"format.inlineCode"},label:"行内代码",icon:"code",group:"text"},{id:"superscript",command:{type:"format.superscript"},label:"上标",icon:"superscript",group:"text"},{id:"subscript",command:{type:"format.subscript"},label:"下标",icon:"subscript",group:"text"},{id:"clear-style",command:{type:"format.clear"},label:"清除样式",icon:"remove-formatting",group:"text"},{id:"color",command:{type:"format.color",value:""},label:"文字颜色",icon:"palette",group:"style",requiresPayload:!0,payloadPanel:x},{id:"background-color",command:{type:"format.backgroundColor",value:""},label:"背景色",icon:"paint-bucket",group:"style",requiresPayload:!0,payloadPanel:P},{id:"font-size",command:{type:"format.fontSize",value:""},label:"字号",icon:"case-sensitive",group:"style",requiresPayload:!0,payloadPanel:S},{id:"font-family",command:{type:"format.fontFamily",value:""},label:"字体",icon:"type",group:"style",requiresPayload:!0,payloadPanel:M},{id:"line-height",command:{type:"format.lineHeight",value:""},label:"行高",icon:"wrap-text",group:"style",requiresPayload:!0,payloadPanel:T},{id:"paragraph",command:{type:"block.paragraph"},label:"正文",icon:"pilcrow",group:"block"},{id:"heading-1",command:{type:"block.heading",level:1},label:"一级标题",icon:"heading-1",group:"block"},{id:"heading-2",command:{type:"block.heading",level:2},label:"二级标题",icon:"heading-2",group:"block"},{id:"heading-3",command:{type:"block.heading",level:3},label:"三级标题",icon:"heading-3",group:"block"},{id:"heading-4",command:{type:"block.heading",level:4},label:"四级标题",icon:"heading-4",group:"block"},{id:"heading-5",command:{type:"block.heading",level:5},label:"五级标题",icon:"heading-5",group:"block"},{id:"heading-6",command:{type:"block.heading",level:6},label:"六级标题",icon:"heading-6",group:"block"},{id:"quote",command:{type:"block.quote"},label:"引用",icon:"quote",group:"block"},{id:"divider",command:{type:"block.divider"},label:"分割线",icon:"minus",group:"block"},{id:"code-block",command:{type:"block.code"},label:"代码块",icon:"square-code",group:"block"},{id:"ordered-list",command:{type:"list.ordered"},label:"有序列表",icon:"list-ordered",group:"list"},{id:"unordered-list",command:{type:"list.unordered"},label:"无序列表",icon:"list",group:"list"},{id:"todo-list",command:{type:"list.todo"},label:"待办列表",icon:"list-todo",group:"list"},{id:"align-left",command:{type:"align",value:"left"},label:"左对齐",icon:"align-left",group:"align"},{id:"align-center",command:{type:"align",value:"center"},label:"居中",icon:"align-center",group:"align"},{id:"align-right",command:{type:"align",value:"right"},label:"右对齐",icon:"align-right",group:"align"},{id:"align-justify",command:{type:"align",value:"justify"},label:"两端对齐",icon:"align-justify",group:"align"},{id:"indent-increase",command:{type:"indent.increase"},label:"增加缩进",icon:"indent-increase",group:"align"},{id:"indent-decrease",command:{type:"indent.decrease"},label:"减少缩进",icon:"indent-decrease",group:"align"},{id:"mention",command:{type:"mention.insert",item:{id:"",label:"",value:""}},label:"@ 提及",icon:"at-sign",group:"insert",requiresPayload:!0},{id:"upload-image",command:{type:"media.pickImage"},label:"上传图片",icon:"upload-image",group:"media"},{id:"upload-video",command:{type:"media.pickVideo"},label:"上传视频",icon:"upload-video",group:"media"},{id:"table",command:{type:"table.insert",rows:3,cols:3},label:"表格",icon:"table",group:"table",requiresPayload:!0,payloadPanel:w},...y,{id:"slash-command",command:{type:"slash.open"},label:"/ 命令",icon:"list-plus",group:"insert"},{id:"undo",command:{type:"history.undo"},label:"撤销",icon:"undo",group:"history"},{id:"redo",command:{type:"history.redo"},label:"重做",icon:"redo",group:"history"},{id:"clear",command:{type:"content.clear"},label:"清空",icon:"trash-2",group:"history"},{id:"fullscreen",command:{type:"fullscreen.toggle"},label:"全屏",icon:"maximize",group:"view"}],r={align:e=>e.type==="align"?e.value:void 0,"block.heading":e=>e.type==="block.heading"?e.level:void 0,"block.setCodeLanguage":e=>e.type==="block.setCodeLanguage"?e.language:void 0},u=e=>{var l;return(l=r[e.type])==null?void 0:l.call(r,e)},v=(e,l)=>{const a=u(e);return l.command===e.type&&(a===void 0||l.value===a)},K=(e,l)=>v(e.command,l);function q(e=c){return e.map(l=>({command:l.command.type,active:!1,disabled:!0,value:u(l.command)}))}const d={toolbarKeys:["undo","redo","clear","|","paragraph","heading-1","heading-2","heading-3","heading-4","heading-5","heading-6","quote","divider","code-block","|","bold","italic","underline","strike","inline-code","superscript","subscript","clear-style","color","background-color","font-size","font-family","line-height","|","ordered-list","unordered-list","todo-list","|","upload-image","upload-video","|","table","|","align-left","align-center","align-right","align-justify","indent-increase","indent-decrease","|","fullscreen"]},I=e=>typeof e=="object"&&Array.isArray(e.menuKeys),C=e=>new Map(e.map(l=>[l.id,l])),L=(e,l)=>typeof e=="string"?e!=="|"&&l.has(e):l.has(e.key)||e.menuKeys.every(a=>l.has(a)),R=(e,l)=>{const a=new Set((l==null?void 0:l.excludeKeys)??[]),n=e.filter(o=>!L(o,a));if(!(l!=null&&l.insertKeys))return n;const t=Math.max(0,Math.min(l.insertKeys.index,n.length));return[...n.slice(0,t),...l.insertKeys.keys,...n.slice(t)]},E=(e,l,a,n)=>{if(e==="|")return[{type:"separator",key:`separator-${n}`}];if(typeof e=="string"){const t=l.get(e);return!t||t.requiresPayload&&!t.payloadPanel||a.has(t.id)?[]:[{type:"button",item:t}]}if(I(e)){const t=e.menuKeys.filter(o=>!a.has(o)).map(o=>l.get(o)).filter(o=>o!==void 0&&(!o.requiresPayload||o.payloadPanel!==void 0));return t.length>0?[{type:"group",key:e.key,title:e.title,icon:e.icon,items:t}]:[]}return[]},V=(e,l)=>{if(e.type!=="separator")return!0;const a=l[l.length-1];return a!==void 0&&a.type!=="separator"},j=e=>{var l;for(;((l=e.at(-1))==null?void 0:l.type)==="separator";)e.pop();return e},B=(e=d,l=c)=>{const a=C(l),n=e.toolbarKeys??d.toolbarKeys??[],t=R(n,e),o=new Set(e.excludeKeys??[]);let s=0;const h=t.reduce((i,p)=>{const f=E(p,a,o,s);return p==="|"&&(s+=1),f.forEach(m=>{V(m,i)&&i.push(m)}),i},[]);return j(h)};exports.codeBlockLanguagePanel=g;exports.codeBlockLanguagePayloadPanel=k;exports.createDisabledCommandStates=q;exports.defaultMenuSchema=c;exports.defaultToolbarConfig=d;exports.getCommandStateMatchValue=u;exports.isCommandStateForCommand=v;exports.isMenuItemCommandState=K;exports.resolveToolbarMenu=B;exports.tableHeaderMenuItems=y;
2
2
  //# sourceMappingURL=native-spec.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"native-spec.cjs","sources":["../../native-spec/src/menuSchema/payloadPanels.ts","../../native-spec/src/menuSchema/tableHeaderMenuItems.ts","../../native-spec/src/menuSchema/defaultMenuSchema.ts","../../native-spec/src/commandState/index.ts","../../native-spec/src/toolbarConfig/index.ts"],"sourcesContent":["import {\n BRIDGERTE_TABLE_INSERT_MAX_COLS,\n BRIDGERTE_TABLE_INSERT_MAX_ROWS,\n type PayloadPanelSchema\n} from '@bridgerte/core';\n\n/**\n * 代码块语言列表给 DOM 代码块顶部控制栏和原生侧自绘使用。\n *\n * 空字符串表示纯文本;默认候选覆盖 Lexical Prism tokenizer 当前内置语言,并保留\n * JSON 这个高频实用项。业务如需裁剪语言、调整顺序或接入更多 Prism 语言,传入\n * 自己的 `codeBlockLanguagePanel` 即可,不需要改 DOM 内置语言菜单。\n */\nexport const codeBlockLanguagePanel: PayloadPanelSchema = {\n id: 'code-block-language',\n title: '代码语言',\n fields: [\n {\n type: 'select',\n name: 'language',\n label: '语言',\n defaultValue: '',\n options: [\n { label: '纯文本', value: '' },\n { label: 'C', value: 'c' },\n { label: 'C-like', value: 'clike' },\n { label: 'C++', value: 'cpp' },\n { label: 'CSS', value: 'css' },\n { label: 'HTML', value: 'html' },\n { label: 'Java', value: 'java' },\n { label: 'JavaScript', value: 'javascript' },\n { label: 'JSON', value: 'json' },\n { label: 'Markdown', value: 'markdown' },\n { label: 'Objective-C', value: 'objc' },\n { label: 'PowerShell', value: 'powershell' },\n { label: 'Python', value: 'python' },\n { label: 'Rust', value: 'rust' },\n { label: 'SQL', value: 'sql' },\n { label: 'Swift', value: 'swift' },\n { label: 'TypeScript', value: 'typescript' },\n { label: 'XML', value: 'xml' }\n ]\n }\n ]\n};\n\n/**\n * 兼容旧导出名。\n *\n * 代码块语言现在由代码块 header 触发,不再代表 toolbar 菜单 payload。\n */\nexport const codeBlockLanguagePayloadPanel = codeBlockLanguagePanel;\n\n/**\n * 颜色菜单使用 color 字段而不是预设色列表。\n *\n * DOM 默认面板可以渲染内置颜色控件,RN/Flutter/WebView 或业务自绘层仍读取同一份 schema。\n */\nexport const textColorPanel: PayloadPanelSchema = {\n id: 'text-color',\n title: '文字颜色',\n fields: [\n {\n type: 'color',\n name: 'value',\n label: '颜色'\n }\n ]\n};\n\nexport const backgroundColorPanel: PayloadPanelSchema = {\n id: 'background-color',\n title: '背景色',\n fields: [\n {\n type: 'color',\n name: 'value',\n label: '背景'\n }\n ]\n};\n\nexport const fontSizePanel: PayloadPanelSchema = {\n id: 'font-size',\n title: '字号',\n fields: [\n {\n type: 'select',\n name: 'value',\n label: '字号',\n defaultValue: '16px',\n options: [\n { label: '小号 14px', value: '14px' },\n { label: '正文 16px', value: '16px' },\n { label: '强调 18px', value: '18px' },\n { label: '标题 20px', value: '20px' },\n { label: '大标题 24px', value: '24px' }\n ]\n }\n ]\n};\n\nexport const fontFamilyPanel: PayloadPanelSchema = {\n id: 'font-family',\n title: '字体',\n fields: [\n {\n type: 'select',\n name: 'value',\n label: '字体',\n defaultValue: '',\n options: [\n { label: '跟随页面', value: '' },\n { label: '无衬线', value: 'sans-serif' },\n { label: '衬线', value: 'serif' },\n { label: '等宽', value: 'monospace' }\n ]\n }\n ]\n};\n\nexport const lineHeightPanel: PayloadPanelSchema = {\n id: 'line-height',\n title: '行高',\n fields: [\n {\n type: 'select',\n name: 'value',\n label: '行高',\n defaultValue: '1.7',\n options: [\n { label: '紧凑 1.4', value: '1.4' },\n { label: '常规 1.7', value: '1.7' },\n { label: '舒展 2', value: '2' }\n ]\n }\n ]\n};\n\n/**\n * 表格插入使用 number 字段收集行列。\n *\n * DOM 默认面板、H5 自绘和 RN/Flutter 原生表单都读取同一份 schema;真正的表格进阶操作\n * 仍放后续表格菜单阶段继续扩展。\n */\nexport const tableInsertPanel: PayloadPanelSchema = {\n id: 'table-insert',\n title: '插入表格',\n fields: [\n {\n type: 'number',\n name: 'rows',\n label: '行数',\n defaultValue: '3',\n min: 1,\n max: BRIDGERTE_TABLE_INSERT_MAX_ROWS,\n step: 1\n },\n {\n type: 'number',\n name: 'cols',\n label: '列数',\n defaultValue: '3',\n min: 1,\n max: BRIDGERTE_TABLE_INSERT_MAX_COLS,\n step: 1\n }\n ]\n};\n","import type { MenuItem } from './type';\n\n/*\n * 表格 header 和后续表格浮动菜单共用这组操作入口。\n * 这些菜单默认不进入 toolbar 排列,但仍放在 native-spec,保证 DOM/RN/Flutter 自绘读取同一份\n * command/label/icon 协议。\n */\nexport const tableHeaderMenuItems: MenuItem[] = [\n {\n id: 'table-insert-row-after',\n command: { type: 'table.insertRow', direction: 'after' },\n label: '插入行',\n icon: 'rows-plus',\n group: 'table'\n },\n {\n id: 'table-delete-row',\n command: { type: 'table.deleteRow' },\n label: '删除行',\n icon: 'rows-minus',\n group: 'table'\n },\n {\n id: 'table-insert-column-after',\n command: { type: 'table.insertColumn', direction: 'after' },\n label: '插入列',\n icon: 'columns-plus',\n group: 'table'\n },\n {\n id: 'table-delete-column',\n command: { type: 'table.deleteColumn' },\n label: '删除列',\n icon: 'columns-minus',\n group: 'table'\n },\n {\n id: 'table-delete',\n command: { type: 'table.delete' },\n label: '删除表格',\n icon: 'table-delete',\n group: 'table'\n }\n];\n","import type { MenuItem } from './type';\nimport {\n backgroundColorPanel,\n fontFamilyPanel,\n fontSizePanel,\n lineHeightPanel,\n tableInsertPanel,\n textColorPanel\n} from './payloadPanels';\nimport { tableHeaderMenuItems } from './tableHeaderMenuItems';\n\n/**\n * 默认菜单 schema 覆盖 wangEditor 常用入口。\n *\n * RN/Flutter 可以按 group 渲染分组,也可以基于 id 做业务侧排序或裁剪。\n */\nexport const defaultMenuSchema: MenuItem[] = [\n {\n id: 'bold',\n command: { type: 'format.bold' },\n label: '加粗',\n icon: 'bold',\n group: 'text'\n },\n {\n id: 'italic',\n command: { type: 'format.italic' },\n label: '斜体',\n icon: 'italic',\n group: 'text'\n },\n {\n id: 'underline',\n command: { type: 'format.underline' },\n label: '下划线',\n icon: 'underline',\n group: 'text'\n },\n {\n id: 'strike',\n command: { type: 'format.strike' },\n label: '删除线',\n icon: 'strikethrough',\n group: 'text'\n },\n {\n id: 'inline-code',\n command: { type: 'format.inlineCode' },\n label: '行内代码',\n icon: 'code',\n group: 'text'\n },\n {\n id: 'superscript',\n command: { type: 'format.superscript' },\n label: '上标',\n icon: 'superscript',\n group: 'text'\n },\n {\n id: 'subscript',\n command: { type: 'format.subscript' },\n label: '下标',\n icon: 'subscript',\n group: 'text'\n },\n {\n id: 'clear-style',\n command: { type: 'format.clear' },\n label: '清除样式',\n icon: 'remove-formatting',\n group: 'text'\n },\n {\n id: 'color',\n command: { type: 'format.color', value: '' },\n label: '文字颜色',\n icon: 'palette',\n group: 'style',\n requiresPayload: true,\n payloadPanel: textColorPanel\n },\n {\n id: 'background-color',\n command: { type: 'format.backgroundColor', value: '' },\n label: '背景色',\n icon: 'paint-bucket',\n group: 'style',\n requiresPayload: true,\n payloadPanel: backgroundColorPanel\n },\n {\n id: 'font-size',\n command: { type: 'format.fontSize', value: '' },\n label: '字号',\n icon: 'case-sensitive',\n group: 'style',\n requiresPayload: true,\n payloadPanel: fontSizePanel\n },\n {\n id: 'font-family',\n command: { type: 'format.fontFamily', value: '' },\n label: '字体',\n icon: 'type',\n group: 'style',\n requiresPayload: true,\n payloadPanel: fontFamilyPanel\n },\n {\n id: 'line-height',\n command: { type: 'format.lineHeight', value: '' },\n label: '行高',\n icon: 'wrap-text',\n group: 'style',\n requiresPayload: true,\n payloadPanel: lineHeightPanel\n },\n {\n id: 'paragraph',\n command: { type: 'block.paragraph' },\n label: '正文',\n icon: 'pilcrow',\n group: 'block'\n },\n {\n id: 'heading-1',\n command: { type: 'block.heading', level: 1 },\n label: '一级标题',\n icon: 'heading-1',\n group: 'block'\n },\n {\n id: 'heading-2',\n command: { type: 'block.heading', level: 2 },\n label: '二级标题',\n icon: 'heading-2',\n group: 'block'\n },\n {\n id: 'heading-3',\n command: { type: 'block.heading', level: 3 },\n label: '三级标题',\n icon: 'heading-3',\n group: 'block'\n },\n {\n id: 'heading-4',\n command: { type: 'block.heading', level: 4 },\n label: '四级标题',\n icon: 'heading-4',\n group: 'block'\n },\n {\n id: 'heading-5',\n command: { type: 'block.heading', level: 5 },\n label: '五级标题',\n icon: 'heading-5',\n group: 'block'\n },\n {\n id: 'heading-6',\n command: { type: 'block.heading', level: 6 },\n label: '六级标题',\n icon: 'heading-6',\n group: 'block'\n },\n {\n id: 'quote',\n command: { type: 'block.quote' },\n label: '引用',\n icon: 'quote',\n group: 'block'\n },\n {\n id: 'divider',\n command: { type: 'block.divider' },\n label: '分割线',\n icon: 'minus',\n group: 'block'\n },\n {\n id: 'code-block',\n command: { type: 'block.code' },\n label: '代码块',\n icon: 'square-code',\n group: 'block'\n },\n {\n id: 'ordered-list',\n command: { type: 'list.ordered' },\n label: '有序列表',\n icon: 'list-ordered',\n group: 'list'\n },\n {\n id: 'unordered-list',\n command: { type: 'list.unordered' },\n label: '无序列表',\n icon: 'list',\n group: 'list'\n },\n {\n id: 'todo-list',\n command: { type: 'list.todo' },\n label: '待办列表',\n icon: 'list-todo',\n group: 'list'\n },\n {\n id: 'align-left',\n command: { type: 'align', value: 'left' },\n label: '左对齐',\n icon: 'align-left',\n group: 'align'\n },\n {\n id: 'align-center',\n command: { type: 'align', value: 'center' },\n label: '居中',\n icon: 'align-center',\n group: 'align'\n },\n {\n id: 'align-right',\n command: { type: 'align', value: 'right' },\n label: '右对齐',\n icon: 'align-right',\n group: 'align'\n },\n {\n id: 'align-justify',\n command: { type: 'align', value: 'justify' },\n label: '两端对齐',\n icon: 'align-justify',\n group: 'align'\n },\n {\n id: 'indent-increase',\n command: { type: 'indent.increase' },\n label: '增加缩进',\n icon: 'indent-increase',\n group: 'align'\n },\n {\n id: 'indent-decrease',\n command: { type: 'indent.decrease' },\n label: '减少缩进',\n icon: 'indent-decrease',\n group: 'align'\n },\n {\n id: 'mention',\n command: { type: 'mention.insert', item: { id: '', label: '', value: '' } },\n label: '@ 提及',\n icon: 'at-sign',\n group: 'insert',\n requiresPayload: true\n },\n {\n id: 'upload-image',\n command: { type: 'media.pickImage' },\n label: '上传图片',\n icon: 'upload-image',\n group: 'media'\n },\n {\n id: 'upload-video',\n command: { type: 'media.pickVideo' },\n label: '上传视频',\n icon: 'upload-video',\n group: 'media'\n },\n {\n id: 'table',\n command: { type: 'table.insert', rows: 3, cols: 3 },\n label: '表格',\n icon: 'table',\n group: 'table',\n requiresPayload: true,\n payloadPanel: tableInsertPanel\n },\n ...tableHeaderMenuItems,\n {\n id: 'slash-command',\n command: { type: 'slash.open' },\n label: '/ 命令',\n icon: 'list-plus',\n group: 'insert'\n },\n {\n id: 'undo',\n command: { type: 'history.undo' },\n label: '撤销',\n icon: 'undo',\n group: 'history'\n },\n {\n id: 'redo',\n command: { type: 'history.redo' },\n label: '重做',\n icon: 'redo',\n group: 'history'\n },\n {\n id: 'clear',\n command: { type: 'content.clear' },\n label: '清空',\n icon: 'trash-2',\n group: 'history'\n },\n {\n id: 'fullscreen',\n command: { type: 'fullscreen.toggle' },\n label: '全屏',\n icon: 'maximize',\n group: 'view'\n }\n];\n","import type { CommandState, EditorCommand } from '@bridgerte/core';\nimport type { MenuItem } from '../menuSchema';\nimport { defaultMenuSchema } from '../menuSchema';\n\nconst commandStateValueByType: Partial<Record<EditorCommand['type'], (command: EditorCommand) => (\n CommandState['value'] | undefined\n)>> = {\n align: (command) => command.type === 'align' ? command.value : undefined,\n 'block.heading': (command) => command.type === 'block.heading' ? command.level : undefined,\n 'block.setCodeLanguage': (command) => (\n command.type === 'block.setCodeLanguage' ? command.language : undefined\n )\n};\n\n/**\n * 取出菜单命令用于匹配 `CommandState.value` 的稳定值。\n *\n * 同类命令存在多个菜单项时使用这个值区分,比如对齐方式和标题级别。\n */\nexport const getCommandStateMatchValue = (\n command: EditorCommand\n): CommandState['value'] | undefined => commandStateValueByType[command.type]?.(command);\n\n/**\n * 判断某条命令状态是否对应一个完整命令 payload。\n */\nexport const isCommandStateForCommand = (\n command: EditorCommand,\n state: CommandState\n): boolean => {\n const matchValue = getCommandStateMatchValue(command);\n\n return state.command === command.type\n && (matchValue === undefined || state.value === matchValue);\n};\n\n/**\n * 判断某条命令状态是否对应一个菜单项。\n *\n * 原生 toolbar 可以用它把 `CommandState[]` 映射回具体按钮 active/disabled 状态。\n */\nexport const isMenuItemCommandState = (item: MenuItem, state: CommandState): boolean => (\n isCommandStateForCommand(item.command, state)\n);\n\n/**\n * 为给定菜单生成默认禁用状态。\n *\n * 编辑器未 ready 或无选区时,原生 toolbar 可以先使用这组状态兜底。\n */\nexport function createDisabledCommandStates(menuSchema = defaultMenuSchema): CommandState[] {\n return menuSchema.map((item) => ({\n command: item.command.type,\n active: false,\n disabled: true,\n value: getCommandStateMatchValue(item.command)\n }));\n}\n","import type { ToolbarConfig, ToolbarGroupConfig, ToolbarKey } from '@bridgerte/core';\nimport type { MenuItem } from '../menuSchema';\nimport { defaultMenuSchema } from '../menuSchema';\nimport type { ResolvedToolbarItem } from './type';\n\nexport type * from './type';\n\n/**\n * 默认 DOM toolbar 配置。\n *\n * 这里只选择已实现或带参数面板的基础按钮;完整菜单全集仍由 `defaultMenuSchema` 维护。\n */\nexport const defaultToolbarConfig: ToolbarConfig = {\n toolbarKeys: [\n 'undo',\n 'redo',\n 'clear',\n '|',\n 'paragraph',\n 'heading-1',\n 'heading-2',\n 'heading-3',\n 'heading-4',\n 'heading-5',\n 'heading-6',\n 'quote',\n 'divider',\n 'code-block',\n '|',\n 'bold',\n 'italic',\n 'underline',\n 'strike',\n 'inline-code',\n 'superscript',\n 'subscript',\n 'clear-style',\n 'color',\n 'background-color',\n 'font-size',\n 'font-family',\n 'line-height',\n '|',\n 'ordered-list',\n 'unordered-list',\n 'todo-list',\n '|',\n 'upload-image',\n 'upload-video',\n '|',\n 'table',\n '|',\n 'align-left',\n 'align-center',\n 'align-right',\n 'align-justify',\n 'indent-increase',\n 'indent-decrease',\n '|',\n 'fullscreen'\n ]\n};\n\nconst isToolbarGroupConfig = (key: ToolbarKey): key is ToolbarGroupConfig => (\n typeof key === 'object' && Array.isArray(key.menuKeys)\n);\n\nconst createMenuMap = (menuSchema: MenuItem[]) => new Map(\n menuSchema.map((item) => [item.id, item])\n);\n\nconst shouldExcludeToolbarKey = (\n key: ToolbarKey,\n excludeKeys: Set<string>\n) => {\n if (typeof key === 'string') return key !== '|' && excludeKeys.has(key);\n\n return excludeKeys.has(key.key) || key.menuKeys.every((menuKey) => excludeKeys.has(menuKey));\n};\n\nconst applyToolbarConfigOverrides = (\n baseKeys: ToolbarKey[],\n toolbarConfig?: ToolbarConfig\n): ToolbarKey[] => {\n const excludeKeys = new Set(toolbarConfig?.excludeKeys ?? []);\n /*\n * 先排除再插入,等价于“在用户最终想保留的默认菜单里加东西”。\n * insert index 做夹取,避免业务传入负数或超长下标时破坏默认 toolbar。\n */\n const filteredKeys = baseKeys.filter((key) => !shouldExcludeToolbarKey(key, excludeKeys));\n\n if (!toolbarConfig?.insertKeys) return filteredKeys;\n\n const insertIndex = Math.max(0, Math.min(toolbarConfig.insertKeys.index, filteredKeys.length));\n\n return [\n ...filteredKeys.slice(0, insertIndex),\n ...toolbarConfig.insertKeys.keys,\n ...filteredKeys.slice(insertIndex)\n ];\n};\n\nconst resolveToolbarKey = (\n key: ToolbarKey,\n menuMap: Map<string, MenuItem>,\n excludeKeys: Set<string>,\n separatorIndex: number\n): ResolvedToolbarItem[] => {\n if (key === '|') {\n return [{ type: 'separator', key: `separator-${separatorIndex}` }];\n }\n\n if (typeof key === 'string') {\n const item = menuMap.get(key);\n\n // 未知 key 直接忽略;需要 payload 但没有 panel 的菜单暂不渲染,避免按钮点击后无法生成合法命令。\n if (!item || (item.requiresPayload && !item.payloadPanel) || excludeKeys.has(item.id)) {\n return [];\n }\n\n return [{ type: 'button', item }];\n }\n\n if (isToolbarGroupConfig(key)) {\n const items = key.menuKeys\n .filter((menuKey) => !excludeKeys.has(menuKey))\n .map((menuKey) => menuMap.get(menuKey))\n .filter((item): item is MenuItem => (\n item !== undefined && (!item.requiresPayload || item.payloadPanel !== undefined)\n ));\n\n return items.length > 0 ? [{\n type: 'group',\n key: key.key,\n title: key.title,\n icon: key.icon,\n items\n }] : [];\n }\n\n return [];\n};\n\nconst shouldKeepResolvedToolbarItem = (\n item: ResolvedToolbarItem,\n items: ResolvedToolbarItem[]\n) => {\n if (item.type !== 'separator') return true;\n\n const previousItem = items[items.length - 1];\n\n return previousItem !== undefined && previousItem.type !== 'separator';\n};\n\nconst trimTrailingToolbarSeparators = (items: ResolvedToolbarItem[]) => {\n while (items.at(-1)?.type === 'separator') {\n items.pop();\n }\n\n return items;\n};\n\n/**\n * 把 wangEditor 风格的 JSON 配置解析成 DOM/RN/Flutter 都能消费的菜单结构。\n *\n * 未知 key 和缺少 payloadPanel 的 requiresPayload 菜单会被忽略,避免默认 toolbar 渲染无法处理的按钮。\n * 分割线会自动去掉开头、结尾和连续项,避免被跳过的菜单留下空分隔。\n */\nexport const resolveToolbarMenu = (\n toolbarConfig: ToolbarConfig = defaultToolbarConfig,\n menuSchema: MenuItem[] = defaultMenuSchema\n): ResolvedToolbarItem[] => {\n const menuMap = createMenuMap(menuSchema);\n const baseKeys = toolbarConfig.toolbarKeys ?? defaultToolbarConfig.toolbarKeys ?? [];\n const toolbarKeys = applyToolbarConfigOverrides(baseKeys, toolbarConfig);\n const excludeKeys = new Set(toolbarConfig.excludeKeys ?? []);\n let separatorIndex = 0;\n\n const resolvedItems = toolbarKeys.reduce<ResolvedToolbarItem[]>((items, key) => {\n const nextItems = resolveToolbarKey(key, menuMap, excludeKeys, separatorIndex);\n\n if (key === '|') separatorIndex += 1;\n\n nextItems.forEach((item) => {\n if (shouldKeepResolvedToolbarItem(item, items)) {\n items.push(item);\n }\n });\n\n return items;\n }, []);\n\n return trimTrailingToolbarSeparators(resolvedItems);\n};\n"],"names":["codeBlockLanguagePanel","codeBlockLanguagePayloadPanel","textColorPanel","backgroundColorPanel","fontSizePanel","fontFamilyPanel","lineHeightPanel","tableInsertPanel","BRIDGERTE_TABLE_INSERT_MAX_ROWS","BRIDGERTE_TABLE_INSERT_MAX_COLS","tableHeaderMenuItems","defaultMenuSchema","commandStateValueByType","command","getCommandStateMatchValue","_a","isCommandStateForCommand","state","matchValue","isMenuItemCommandState","item","createDisabledCommandStates","menuSchema","defaultToolbarConfig","isToolbarGroupConfig","key","createMenuMap","shouldExcludeToolbarKey","excludeKeys","menuKey","applyToolbarConfigOverrides","baseKeys","toolbarConfig","filteredKeys","insertIndex","resolveToolbarKey","menuMap","separatorIndex","items","shouldKeepResolvedToolbarItem","previousItem","trimTrailingToolbarSeparators","resolveToolbarMenu","toolbarKeys","resolvedItems","nextItems"],"mappings":"wHAaaA,EAA6C,CACxD,GAAI,sBACJ,MAAO,OACP,OAAQ,CACN,CACE,KAAM,SACN,KAAM,WACN,MAAO,KACP,aAAc,GACd,QAAS,CACP,CAAE,MAAO,MAAO,MAAO,EAAA,EACvB,CAAE,MAAO,IAAK,MAAO,GAAA,EACrB,CAAE,MAAO,SAAU,MAAO,OAAA,EAC1B,CAAE,MAAO,MAAO,MAAO,KAAA,EACvB,CAAE,MAAO,MAAO,MAAO,KAAA,EACvB,CAAE,MAAO,OAAQ,MAAO,MAAA,EACxB,CAAE,MAAO,OAAQ,MAAO,MAAA,EACxB,CAAE,MAAO,aAAc,MAAO,YAAA,EAC9B,CAAE,MAAO,OAAQ,MAAO,MAAA,EACxB,CAAE,MAAO,WAAY,MAAO,UAAA,EAC5B,CAAE,MAAO,cAAe,MAAO,MAAA,EAC/B,CAAE,MAAO,aAAc,MAAO,YAAA,EAC9B,CAAE,MAAO,SAAU,MAAO,QAAA,EAC1B,CAAE,MAAO,OAAQ,MAAO,MAAA,EACxB,CAAE,MAAO,MAAO,MAAO,KAAA,EACvB,CAAE,MAAO,QAAS,MAAO,OAAA,EACzB,CAAE,MAAO,aAAc,MAAO,YAAA,EAC9B,CAAE,MAAO,MAAO,MAAO,KAAA,CAAM,CAC/B,CACF,CAEJ,EAOaC,EAAgCD,EAOhCE,EAAqC,CAChD,GAAI,aACJ,MAAO,OACP,OAAQ,CACN,CACE,KAAM,QACN,KAAM,QACN,MAAO,IAAA,CACT,CAEJ,EAEaC,EAA2C,CACtD,GAAI,mBACJ,MAAO,MACP,OAAQ,CACN,CACE,KAAM,QACN,KAAM,QACN,MAAO,IAAA,CACT,CAEJ,EAEaC,EAAoC,CAC/C,GAAI,YACJ,MAAO,KACP,OAAQ,CACN,CACE,KAAM,SACN,KAAM,QACN,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AAQ,CAC9E,MAAMoB,EAAYV,EAAkBV,EAAKW,EAASR,EAAaS,CAAc,EAE7E,OAAIZ,IAAQ,MAAKY,GAAkB,GAEnCQ,EAAU,QAASzB,GAAS,CACtBmB,EAA8BnB,EAAMkB,CAAK,GAC3CA,EAAM,KAAKlB,CAAI,CAEnB,CAAC,EAEMkB,CACT,EAAG,CAAA,CAAE,EAEL,OAAOG,EAA8BG,CAAa,CACpD"}
1
+ {"version":3,"file":"native-spec.cjs","sources":["../../native-spec/src/menuSchema/payloadPanels.ts","../../native-spec/src/menuSchema/tableHeaderMenuItems.ts","../../native-spec/src/menuSchema/defaultMenuSchema.ts","../../native-spec/src/commandState/index.ts","../../native-spec/src/toolbarConfig/index.ts"],"sourcesContent":["import {\n BRIDGERTE_TABLE_INSERT_MAX_COLS,\n BRIDGERTE_TABLE_INSERT_MAX_ROWS,\n type PayloadPanelSchema\n} from '@bridgerte/core';\n\n/**\n * 代码块语言列表给 DOM 代码块顶部控制栏和原生侧自绘使用。\n *\n * 空字符串表示纯文本;默认候选按 Shiki 高频技术文档语言维护。业务如需裁剪语言、\n * 调整顺序或接入更多 Shiki 语言,传入自己的 `codeBlockLanguagePanel` 即可。\n */\nexport const codeBlockLanguagePanel: PayloadPanelSchema = {\n id: 'code-block-language',\n title: '代码语言',\n fields: [\n {\n type: 'select',\n name: 'language',\n label: '语言',\n defaultValue: '',\n options: [\n { label: '纯文本', value: '' },\n { label: 'Bash', value: 'shellscript' },\n { label: 'C', value: 'c' },\n { label: 'C++', value: 'cpp' },\n { label: 'C#', value: 'csharp' },\n { label: 'CSS', value: 'css' },\n { label: 'Dart', value: 'dart' },\n { label: 'Dockerfile', value: 'docker' },\n { label: 'Go', value: 'go' },\n { label: 'HTML', value: 'html' },\n { label: 'Java', value: 'java' },\n { label: 'JavaScript', value: 'javascript' },\n { label: 'JSON', value: 'json' },\n { label: 'Kotlin', value: 'kotlin' },\n { label: 'Markdown', value: 'markdown' },\n { label: 'PHP', value: 'php' },\n { label: 'Python', value: 'python' },\n { label: 'Rust', value: 'rust' },\n { label: 'SQL', value: 'sql' },\n { label: 'Swift', value: 'swift' },\n { label: 'TOML', value: 'toml' },\n { label: 'TSX', value: 'tsx' },\n { label: 'TypeScript', value: 'typescript' },\n { label: 'Vue', value: 'vue' },\n { label: 'XML', value: 'xml' },\n { label: 'YAML', value: 'yaml' }\n ]\n }\n ]\n};\n\n/**\n * 兼容旧导出名。\n *\n * 代码块语言现在由代码块 header 触发,不再代表 toolbar 菜单 payload。\n */\nexport const codeBlockLanguagePayloadPanel = codeBlockLanguagePanel;\n\n/**\n * 颜色菜单使用 color 字段而不是预设色列表。\n *\n * DOM 默认面板可以渲染内置颜色控件,RN/Flutter/WebView 或业务自绘层仍读取同一份 schema。\n */\nexport const textColorPanel: PayloadPanelSchema = {\n id: 'text-color',\n title: '文字颜色',\n fields: [\n {\n type: 'color',\n name: 'value',\n label: '颜色'\n }\n ]\n};\n\nexport const backgroundColorPanel: PayloadPanelSchema = {\n id: 'background-color',\n title: '背景色',\n fields: [\n {\n type: 'color',\n name: 'value',\n label: '背景'\n }\n ]\n};\n\nexport const fontSizePanel: PayloadPanelSchema = {\n id: 'font-size',\n title: '字号',\n fields: [\n {\n type: 'select',\n name: 'value',\n label: '字号',\n defaultValue: '16px',\n options: [\n { label: '小号 14px', value: '14px' },\n { label: '正文 16px', value: '16px' },\n { label: '强调 18px', value: '18px' },\n { label: '标题 20px', value: '20px' },\n { label: '大标题 24px', value: '24px' }\n ]\n }\n ]\n};\n\nexport const fontFamilyPanel: PayloadPanelSchema = {\n id: 'font-family',\n title: '字体',\n fields: [\n {\n type: 'select',\n name: 'value',\n label: '字体',\n defaultValue: '',\n options: [\n { label: '跟随页面', value: '' },\n { label: '无衬线', value: 'sans-serif' },\n { label: '衬线', value: 'serif' },\n { label: '等宽', value: 'monospace' }\n ]\n }\n ]\n};\n\nexport const lineHeightPanel: PayloadPanelSchema = {\n id: 'line-height',\n title: '行高',\n fields: [\n {\n type: 'select',\n name: 'value',\n label: '行高',\n defaultValue: '1.7',\n options: [\n { label: '紧凑 1.4', value: '1.4' },\n { label: '常规 1.7', value: '1.7' },\n { label: '舒展 2', value: '2' }\n ]\n }\n ]\n};\n\n/**\n * 表格插入使用 number 字段收集行列。\n *\n * DOM 默认面板、H5 自绘和 RN/Flutter 原生表单都读取同一份 schema;真正的表格进阶操作\n * 仍放后续表格菜单阶段继续扩展。\n */\nexport const tableInsertPanel: PayloadPanelSchema = {\n id: 'table-insert',\n title: '插入表格',\n fields: [\n {\n type: 'number',\n name: 'rows',\n label: '行数',\n defaultValue: '3',\n min: 1,\n max: BRIDGERTE_TABLE_INSERT_MAX_ROWS,\n step: 1\n },\n {\n type: 'number',\n name: 'cols',\n label: '列数',\n defaultValue: '3',\n min: 1,\n max: BRIDGERTE_TABLE_INSERT_MAX_COLS,\n step: 1\n }\n ]\n};\n","import type { MenuItem } from './type';\n\n/*\n * 表格 header 和后续表格浮动菜单共用这组操作入口。\n * 这些菜单默认不进入 toolbar 排列,但仍放在 native-spec,保证 DOM/RN/Flutter 自绘读取同一份\n * command/label/icon 协议。\n */\nexport const tableHeaderMenuItems: MenuItem[] = [\n {\n id: 'table-insert-row-after',\n command: { type: 'table.insertRow', direction: 'after' },\n label: '插入行',\n icon: 'rows-plus',\n group: 'table'\n },\n {\n id: 'table-delete-row',\n command: { type: 'table.deleteRow' },\n label: '删除行',\n icon: 'rows-minus',\n group: 'table'\n },\n {\n id: 'table-insert-column-after',\n command: { type: 'table.insertColumn', direction: 'after' },\n label: '插入列',\n icon: 'columns-plus',\n group: 'table'\n },\n {\n id: 'table-delete-column',\n command: { type: 'table.deleteColumn' },\n label: '删除列',\n icon: 'columns-minus',\n group: 'table'\n },\n {\n id: 'table-delete',\n command: { type: 'table.delete' },\n label: '删除表格',\n icon: 'table-delete',\n group: 'table'\n }\n];\n","import type { MenuItem } from './type';\r\nimport {\r\n backgroundColorPanel,\r\n fontFamilyPanel,\r\n fontSizePanel,\r\n lineHeightPanel,\r\n tableInsertPanel,\r\n textColorPanel\r\n} from './payloadPanels';\r\nimport { tableHeaderMenuItems } from './tableHeaderMenuItems';\r\n\r\n/**\r\n * 默认菜单 schema 覆盖 wangEditor 常用入口。\r\n *\r\n * RN/Flutter 可以按 group 渲染分组,也可以基于 id 做业务侧排序或裁剪。\r\n */\r\nexport const defaultMenuSchema: MenuItem[] = [\r\n {\r\n id: 'bold',\r\n command: { type: 'format.bold' },\r\n label: '加粗',\r\n icon: 'bold',\r\n group: 'text'\r\n },\r\n {\r\n id: 'italic',\r\n command: { type: 'format.italic' },\r\n label: '斜体',\r\n icon: 'italic',\r\n group: 'text'\r\n },\r\n {\r\n id: 'underline',\r\n command: { type: 'format.underline' },\r\n label: '下划线',\r\n icon: 'underline',\r\n group: 'text'\r\n },\r\n {\r\n id: 'strike',\r\n command: { type: 'format.strike' },\r\n label: '删除线',\r\n icon: 'strikethrough',\r\n group: 'text'\r\n },\r\n {\r\n id: 'inline-code',\r\n command: { type: 'format.inlineCode' },\r\n label: '行内代码',\r\n icon: 'code',\r\n group: 'text'\r\n },\r\n {\r\n id: 'superscript',\r\n command: { type: 'format.superscript' },\r\n label: '上标',\r\n icon: 'superscript',\r\n group: 'text'\r\n },\r\n {\r\n id: 'subscript',\r\n command: { type: 'format.subscript' },\r\n label: '下标',\r\n icon: 'subscript',\r\n group: 'text'\r\n },\r\n {\r\n id: 'clear-style',\r\n command: { type: 'format.clear' },\r\n label: '清除样式',\r\n icon: 'remove-formatting',\r\n group: 'text'\r\n },\r\n {\r\n id: 'color',\r\n command: { type: 'format.color', value: '' },\r\n label: '文字颜色',\r\n icon: 'palette',\r\n group: 'style',\r\n requiresPayload: true,\r\n payloadPanel: textColorPanel\r\n },\r\n {\r\n id: 'background-color',\r\n command: { type: 'format.backgroundColor', value: '' },\r\n label: '背景色',\r\n icon: 'paint-bucket',\r\n group: 'style',\r\n requiresPayload: true,\r\n payloadPanel: backgroundColorPanel\r\n },\r\n {\r\n id: 'font-size',\r\n command: { type: 'format.fontSize', value: '' },\r\n label: '字号',\r\n icon: 'case-sensitive',\r\n group: 'style',\r\n requiresPayload: true,\r\n payloadPanel: fontSizePanel\r\n },\r\n {\r\n id: 'font-family',\r\n command: { type: 'format.fontFamily', value: '' },\r\n label: '字体',\r\n icon: 'type',\r\n group: 'style',\r\n requiresPayload: true,\r\n payloadPanel: fontFamilyPanel\r\n },\r\n {\r\n id: 'line-height',\r\n command: { type: 'format.lineHeight', value: '' },\r\n label: '行高',\r\n icon: 'wrap-text',\r\n group: 'style',\r\n requiresPayload: true,\r\n payloadPanel: lineHeightPanel\r\n },\r\n {\r\n id: 'paragraph',\r\n command: { type: 'block.paragraph' },\r\n label: '正文',\r\n icon: 'pilcrow',\r\n group: 'block'\r\n },\r\n {\r\n id: 'heading-1',\r\n command: { type: 'block.heading', level: 1 },\r\n label: '一级标题',\r\n icon: 'heading-1',\r\n group: 'block'\r\n },\r\n {\r\n id: 'heading-2',\r\n command: { type: 'block.heading', level: 2 },\r\n label: '二级标题',\r\n icon: 'heading-2',\r\n group: 'block'\r\n },\r\n {\r\n id: 'heading-3',\r\n command: { type: 'block.heading', level: 3 },\r\n label: '三级标题',\r\n icon: 'heading-3',\r\n group: 'block'\r\n },\r\n {\r\n id: 'heading-4',\r\n command: { type: 'block.heading', level: 4 },\r\n label: '四级标题',\r\n icon: 'heading-4',\r\n group: 'block'\r\n },\r\n {\r\n id: 'heading-5',\r\n command: { type: 'block.heading', level: 5 },\r\n label: '五级标题',\r\n icon: 'heading-5',\r\n group: 'block'\r\n },\r\n {\r\n id: 'heading-6',\r\n command: { type: 'block.heading', level: 6 },\r\n label: '六级标题',\r\n icon: 'heading-6',\r\n group: 'block'\r\n },\r\n {\r\n id: 'quote',\r\n command: { type: 'block.quote' },\r\n label: '引用',\r\n icon: 'quote',\r\n group: 'block'\r\n },\r\n {\r\n id: 'divider',\r\n command: { type: 'block.divider' },\r\n label: '分割线',\r\n icon: 'minus',\r\n group: 'block'\r\n },\r\n {\r\n id: 'code-block',\r\n command: { type: 'block.code' },\r\n label: '代码块',\r\n icon: 'square-code',\r\n group: 'block'\r\n },\r\n {\r\n id: 'ordered-list',\r\n command: { type: 'list.ordered' },\r\n label: '有序列表',\r\n icon: 'list-ordered',\r\n group: 'list'\r\n },\r\n {\r\n id: 'unordered-list',\r\n command: { type: 'list.unordered' },\r\n label: '无序列表',\r\n icon: 'list',\r\n group: 'list'\r\n },\r\n {\r\n id: 'todo-list',\r\n command: { type: 'list.todo' },\r\n label: '待办列表',\r\n icon: 'list-todo',\r\n group: 'list'\r\n },\r\n {\r\n id: 'align-left',\r\n command: { type: 'align', value: 'left' },\r\n label: '左对齐',\r\n icon: 'align-left',\r\n group: 'align'\r\n },\r\n {\r\n id: 'align-center',\r\n command: { type: 'align', value: 'center' },\r\n label: '居中',\r\n icon: 'align-center',\r\n group: 'align'\r\n },\r\n {\r\n id: 'align-right',\r\n command: { type: 'align', value: 'right' },\r\n label: '右对齐',\r\n icon: 'align-right',\r\n group: 'align'\r\n },\r\n {\r\n id: 'align-justify',\r\n command: { type: 'align', value: 'justify' },\r\n label: '两端对齐',\r\n icon: 'align-justify',\r\n group: 'align'\r\n },\r\n {\r\n id: 'indent-increase',\r\n command: { type: 'indent.increase' },\r\n label: '增加缩进',\r\n icon: 'indent-increase',\r\n group: 'align'\r\n },\r\n {\r\n id: 'indent-decrease',\r\n command: { type: 'indent.decrease' },\r\n label: '减少缩进',\r\n icon: 'indent-decrease',\r\n group: 'align'\r\n },\r\n {\r\n id: 'mention',\r\n command: { type: 'mention.insert', item: { id: '', label: '', value: '' } },\r\n label: '@ 提及',\r\n icon: 'at-sign',\r\n group: 'insert',\r\n requiresPayload: true\r\n },\r\n {\r\n id: 'upload-image',\r\n command: { type: 'media.pickImage' },\r\n label: '上传图片',\r\n icon: 'upload-image',\r\n group: 'media'\r\n },\r\n {\r\n id: 'upload-video',\r\n command: { type: 'media.pickVideo' },\r\n label: '上传视频',\r\n icon: 'upload-video',\r\n group: 'media'\r\n },\r\n {\r\n id: 'table',\r\n command: { type: 'table.insert', rows: 3, cols: 3 },\r\n label: '表格',\r\n icon: 'table',\r\n group: 'table',\r\n requiresPayload: true,\r\n payloadPanel: tableInsertPanel\r\n },\r\n ...tableHeaderMenuItems,\r\n {\r\n id: 'slash-command',\r\n command: { type: 'slash.open' },\r\n label: '/ 命令',\r\n icon: 'list-plus',\r\n group: 'insert'\r\n },\r\n {\r\n id: 'undo',\r\n command: { type: 'history.undo' },\r\n label: '撤销',\r\n icon: 'undo',\r\n group: 'history'\r\n },\r\n {\r\n id: 'redo',\r\n command: { type: 'history.redo' },\r\n label: '重做',\r\n icon: 'redo',\r\n group: 'history'\r\n },\r\n {\r\n id: 'clear',\r\n command: { type: 'content.clear' },\r\n label: '清空',\r\n icon: 'trash-2',\r\n group: 'history'\r\n },\r\n {\r\n id: 'fullscreen',\r\n command: { type: 'fullscreen.toggle' },\r\n label: '全屏',\r\n icon: 'maximize',\r\n group: 'view'\r\n }\r\n];\r\n","import type { CommandState, EditorCommand } from '@bridgerte/core';\r\nimport type { MenuItem } from '../menuSchema';\r\nimport { defaultMenuSchema } from '../menuSchema';\r\n\r\nconst commandStateValueByType: Partial<Record<EditorCommand['type'], (command: EditorCommand) => (\r\n CommandState['value'] | undefined\r\n)>> = {\r\n align: (command) => command.type === 'align' ? command.value : undefined,\r\n 'block.heading': (command) => command.type === 'block.heading' ? command.level : undefined,\r\n 'block.setCodeLanguage': (command) => (\r\n command.type === 'block.setCodeLanguage' ? command.language : undefined\r\n )\r\n};\r\n\r\n/**\r\n * 取出菜单命令用于匹配 `CommandState.value` 的稳定值。\r\n *\r\n * 同类命令存在多个菜单项时使用这个值区分,比如对齐方式和标题级别。\r\n */\r\nexport const getCommandStateMatchValue = (\r\n command: EditorCommand\r\n): CommandState['value'] | undefined => commandStateValueByType[command.type]?.(command);\r\n\r\n/**\r\n * 判断某条命令状态是否对应一个完整命令 payload。\r\n */\r\nexport const isCommandStateForCommand = (\r\n command: EditorCommand,\r\n state: CommandState\r\n): boolean => {\r\n const matchValue = getCommandStateMatchValue(command);\r\n\r\n return state.command === command.type\r\n && (matchValue === undefined || state.value === matchValue);\r\n};\r\n\r\n/**\r\n * 判断某条命令状态是否对应一个菜单项。\r\n *\r\n * 原生 toolbar 可以用它把 `CommandState[]` 映射回具体按钮 active/disabled 状态。\r\n */\r\nexport const isMenuItemCommandState = (item: MenuItem, state: CommandState): boolean => (\r\n isCommandStateForCommand(item.command, state)\r\n);\r\n\r\n/**\r\n * 为给定菜单生成默认禁用状态。\r\n *\r\n * 编辑器未 ready 或无选区时,原生 toolbar 可以先使用这组状态兜底。\r\n */\r\nexport function createDisabledCommandStates(menuSchema = defaultMenuSchema): CommandState[] {\r\n return menuSchema.map((item) => ({\r\n command: item.command.type,\r\n active: false,\r\n disabled: true,\r\n value: getCommandStateMatchValue(item.command)\r\n }));\r\n}\r\n","import type { ToolbarConfig, ToolbarGroupConfig, ToolbarKey } from '@bridgerte/core';\r\nimport type { MenuItem } from '../menuSchema';\r\nimport { defaultMenuSchema } from '../menuSchema';\r\nimport type { ResolvedToolbarItem } from './type';\r\n\r\nexport type * from './type';\r\n\r\n/**\r\n * 默认 DOM toolbar 配置。\r\n *\r\n * 这里只选择已实现或带参数面板的基础按钮;完整菜单全集仍由 `defaultMenuSchema` 维护。\r\n */\r\nexport const defaultToolbarConfig: ToolbarConfig = {\r\n toolbarKeys: [\r\n 'undo',\r\n 'redo',\r\n 'clear',\r\n '|',\r\n 'paragraph',\r\n 'heading-1',\r\n 'heading-2',\r\n 'heading-3',\r\n 'heading-4',\r\n 'heading-5',\r\n 'heading-6',\r\n 'quote',\r\n 'divider',\r\n 'code-block',\r\n '|',\r\n 'bold',\r\n 'italic',\r\n 'underline',\r\n 'strike',\r\n 'inline-code',\r\n 'superscript',\r\n 'subscript',\r\n 'clear-style',\r\n 'color',\r\n 'background-color',\r\n 'font-size',\r\n 'font-family',\r\n 'line-height',\r\n '|',\r\n 'ordered-list',\n 'unordered-list',\n 'todo-list',\n '|',\n 'upload-image',\n 'upload-video',\n '|',\n 'table',\n '|',\n 'align-left',\r\n 'align-center',\r\n 'align-right',\r\n 'align-justify',\r\n 'indent-increase',\r\n 'indent-decrease',\r\n '|',\r\n 'fullscreen'\r\n ]\r\n};\r\n\r\nconst isToolbarGroupConfig = (key: ToolbarKey): key is ToolbarGroupConfig => (\r\n typeof key === 'object' && Array.isArray(key.menuKeys)\r\n);\r\n\r\nconst createMenuMap = (menuSchema: MenuItem[]) => new Map(\r\n menuSchema.map((item) => [item.id, item])\r\n);\r\n\r\nconst shouldExcludeToolbarKey = (\r\n key: ToolbarKey,\r\n excludeKeys: Set<string>\r\n) => {\r\n if (typeof key === 'string') return key !== '|' && excludeKeys.has(key);\r\n\r\n return excludeKeys.has(key.key) || key.menuKeys.every((menuKey) => excludeKeys.has(menuKey));\r\n};\r\n\r\nconst applyToolbarConfigOverrides = (\r\n baseKeys: ToolbarKey[],\r\n toolbarConfig?: ToolbarConfig\r\n): ToolbarKey[] => {\r\n const excludeKeys = new Set(toolbarConfig?.excludeKeys ?? []);\r\n /*\r\n * 先排除再插入,等价于“在用户最终想保留的默认菜单里加东西”。\r\n * insert index 做夹取,避免业务传入负数或超长下标时破坏默认 toolbar。\r\n */\r\n const filteredKeys = baseKeys.filter((key) => !shouldExcludeToolbarKey(key, excludeKeys));\r\n\r\n if (!toolbarConfig?.insertKeys) return filteredKeys;\r\n\r\n const insertIndex = Math.max(0, Math.min(toolbarConfig.insertKeys.index, filteredKeys.length));\r\n\r\n return [\r\n ...filteredKeys.slice(0, insertIndex),\r\n ...toolbarConfig.insertKeys.keys,\r\n ...filteredKeys.slice(insertIndex)\r\n ];\r\n};\r\n\r\nconst resolveToolbarKey = (\r\n key: ToolbarKey,\r\n menuMap: Map<string, MenuItem>,\r\n excludeKeys: Set<string>,\r\n separatorIndex: number\r\n): ResolvedToolbarItem[] => {\r\n if (key === '|') {\r\n return [{ type: 'separator', key: `separator-${separatorIndex}` }];\r\n }\r\n\r\n if (typeof key === 'string') {\r\n const item = menuMap.get(key);\r\n\r\n // 未知 key 直接忽略;需要 payload 但没有 panel 的菜单暂不渲染,避免按钮点击后无法生成合法命令。\r\n if (!item || (item.requiresPayload && !item.payloadPanel) || excludeKeys.has(item.id)) {\r\n return [];\r\n }\r\n\r\n return [{ type: 'button', item }];\r\n }\r\n\r\n if (isToolbarGroupConfig(key)) {\r\n const items = key.menuKeys\r\n .filter((menuKey) => !excludeKeys.has(menuKey))\r\n .map((menuKey) => menuMap.get(menuKey))\r\n .filter((item): item is MenuItem => (\r\n item !== undefined && (!item.requiresPayload || item.payloadPanel !== undefined)\r\n ));\r\n\r\n return items.length > 0 ? [{\r\n type: 'group',\r\n key: key.key,\r\n title: key.title,\r\n icon: key.icon,\r\n items\r\n }] : [];\r\n }\r\n\r\n return [];\r\n};\r\n\r\nconst shouldKeepResolvedToolbarItem = (\r\n item: ResolvedToolbarItem,\r\n items: ResolvedToolbarItem[]\r\n) => {\r\n if (item.type !== 'separator') return true;\r\n\r\n const previousItem = items[items.length - 1];\r\n\r\n return previousItem !== undefined && previousItem.type !== 'separator';\r\n};\r\n\r\nconst trimTrailingToolbarSeparators = (items: ResolvedToolbarItem[]) => {\r\n while (items.at(-1)?.type === 'separator') {\r\n items.pop();\r\n }\r\n\r\n return items;\r\n};\r\n\r\n/**\r\n * 把 wangEditor 风格的 JSON 配置解析成 DOM/RN/Flutter 都能消费的菜单结构。\r\n *\r\n * 未知 key 和缺少 payloadPanel 的 requiresPayload 菜单会被忽略,避免默认 toolbar 渲染无法处理的按钮。\r\n * 分割线会自动去掉开头、结尾和连续项,避免被跳过的菜单留下空分隔。\r\n */\r\nexport const resolveToolbarMenu = (\r\n toolbarConfig: ToolbarConfig = defaultToolbarConfig,\r\n menuSchema: MenuItem[] = defaultMenuSchema\r\n): ResolvedToolbarItem[] => {\r\n const menuMap = createMenuMap(menuSchema);\r\n const baseKeys = toolbarConfig.toolbarKeys ?? defaultToolbarConfig.toolbarKeys ?? [];\r\n const toolbarKeys = applyToolbarConfigOverrides(baseKeys, toolbarConfig);\r\n const excludeKeys = new Set(toolbarConfig.excludeKeys ?? []);\r\n let separatorIndex = 0;\r\n\r\n const resolvedItems = toolbarKeys.reduce<ResolvedToolbarItem[]>((items, key) => {\r\n const nextItems = resolveToolbarKey(key, menuMap, excludeKeys, separatorIndex);\r\n\r\n if (key === '|') separatorIndex += 1;\r\n\r\n nextItems.forEach((item) => {\r\n if (shouldKeepResolvedToolbarItem(item, items)) {\r\n items.push(item);\r\n }\r\n });\r\n\r\n return items;\r\n }, []);\r\n\r\n return trimTrailingToolbarSeparators(resolvedItems);\r\n};\r\n"],"names":["codeBlockLanguagePanel","codeBlockLanguagePayloadPanel","textColorPanel","backgroundColorPanel","fontSizePanel","fontFamilyPanel","lineHeightPanel","tableInsertPanel","BRIDGERTE_TABLE_INSERT_MAX_ROWS","BRIDGERTE_TABLE_INSERT_MAX_COLS","tableHeaderMenuItems","defaultMenuSchema","commandStateValueByType","command","getCommandStateMatchValue","_a","isCommandStateForCommand","state","matchValue","isMenuItemCommandState","item","createDisabledCommandStates","menuSchema","defaultToolbarConfig","isToolbarGroupConfig","key","createMenuMap","shouldExcludeToolbarKey","excludeKeys","menuKey","applyToolbarConfigOverrides","baseKeys","toolbarConfig","filteredKeys","insertIndex","resolveToolbarKey","menuMap","separatorIndex","items","shouldKeepResolvedToolbarItem","previousItem","trimTrailingToolbarSeparators","resolveToolbarMenu","toolbarKeys","resolvedItems","nextItems"],"mappings":"wHAYaA,EAA6C,CACxD,GAAI,sBACJ,MAAO,OACP,OAAQ,CACN,CACE,KAAM,SACN,KAAM,WACN,MAAO,KACP,aAAc,GACd,QAAS,CACP,CAAE,MAAO,MAAO,MAAO,EAAA,EACvB,CAAE,MAAO,OAAQ,MAAO,aAAA,EACxB,CAAE,MAAO,IAAK,MAAO,GAAA,EACrB,CAAE,MAAO,MAAO,MAAO,KAAA,EACvB,CAAE,MAAO,KAAM,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,EAAU,QAASzB,GAAS,CACtBmB,EAA8BnB,EAAMkB,CAAK,GAC3CA,EAAM,KAAKlB,CAAI,CAEnB,CAAC,EAEMkB,CACT,EAAG,CAAA,CAAE,EAEL,OAAOG,EAA8BG,CAAa,CACpD"}
@@ -283,7 +283,7 @@ export type FormatClearScope = 'selection' | 'block';
283
283
  /**
284
284
  * 代码块语言标识。
285
285
  *
286
- * 保持 string 是为了兼容 highlight.js、Prism 或业务自定义语言表。
286
+ * 保持 string 是为了兼容 Shiki、highlight.js 或业务自定义语言表。
287
287
  */
288
288
  export type CodeBlockLanguage = string;
289
289
  /**
@@ -527,7 +527,14 @@ export type SlashCommandMenuAnchorRect = {
527
527
  width: number;
528
528
  height: number;
529
529
  };
530
+ /**
531
+ * slash command 菜单展示配置。
532
+ *
533
+ * `showIcon` 只决定默认候选菜单是否展示 icon;候选数据仍保留 icon key,方便 DOM、
534
+ * WebView 或业务自绘层按自己的 UI 策略渲染。
535
+ */
530
536
  export type SlashCommandMenuConfig = {
537
+ showIcon?: boolean;
531
538
  loadingText?: string;
532
539
  emptyText?: string;
533
540
  errorText?: string;