bridgerte 0.9.3 → 0.9.5

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 +892 -861
  2. package/dist/bridge.cjs.map +1 -1
  3. package/dist/bridge.d.ts +1 -3
  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 +9 -3
  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 +9 -3
  12. package/dist/dom.js +6 -5
  13. package/dist/index-BWi3d-Zp.js +314 -0
  14. package/dist/index-BWi3d-Zp.js.map +1 -0
  15. package/dist/index-B_g23O7q.cjs +4 -0
  16. package/dist/index-B_g23O7q.cjs.map +1 -0
  17. package/dist/index-CuNKUHed.js.map +1 -1
  18. package/dist/index-DF8OhKI4.cjs +2 -0
  19. package/dist/index-DF8OhKI4.cjs.map +1 -0
  20. package/dist/{index-BwZ0II4h.js → index-DyCMSFrm.js} +1135 -1141
  21. package/dist/index-DyCMSFrm.js.map +1 -0
  22. package/dist/index-GaS65GL0.cjs.map +1 -1
  23. package/dist/index-H5V0EMkq.cjs +36 -0
  24. package/dist/index-H5V0EMkq.cjs.map +1 -0
  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 +17 -3
  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 +1 -3
  34. package/dist/native-spec.js +73 -119
  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 +1 -3
  39. package/dist/webview.js +1 -1
  40. package/package.json +1 -1
  41. package/dist/index-BaOlPu8L.cjs +0 -4
  42. package/dist/index-BaOlPu8L.cjs.map +0 -1
  43. package/dist/index-BwZ0II4h.js.map +0 -1
  44. package/dist/index-bN5Hs6-3.js +0 -299
  45. package/dist/index-bN5Hs6-3.js.map +0 -1
  46. package/dist/index-hd9Zi2DV.cjs +0 -36
  47. package/dist/index-hd9Zi2DV.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index-CuNKUHed.js","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","BRIDGERTE_TABLE_INSERT_MAX_ROWS","BRIDGERTE_TABLE_INSERT_MAX_COLS"],"mappings":"AAMO,MAAMA,IAA4B,SAQ5BC,IAAkC,IAClCC,IAAkC;"}
1
+ {"version":3,"file":"index-CuNKUHed.js","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","BRIDGERTE_TABLE_INSERT_MAX_ROWS","BRIDGERTE_TABLE_INSERT_MAX_COLS"],"mappings":"AAOO,MAAMA,IAA4B,SAQ5BC,IAAkC,IAClCC,IAAkC;"}
@@ -0,0 +1,2 @@
1
+ "use strict";const b=e=>e!==void 0&&Object.keys(e).length>0,h=(e,t)=>{var p,m;const a=(p=t.options)!=null&&p.length?t.options:e,r=new Map(a.map(s=>[s.value,s])),u=(m=t.includeValues)!=null&&m.length?t.includeValues.flatMap(s=>{const l=r.get(s);return l?[l]:[]}):a,d=new Set(t.excludeValues??[]),o=u.filter(s=>!d.has(s.value)).map(s=>{var l,v;return{...s,label:((l=t.optionLabels)==null?void 0:l[s.value])??s.label,value:((v=t.optionValues)==null?void 0:v[s.value])??s.value}});return o.length>0?o:a},n=(e,t)=>({label:t.label??e.label,defaultValue:t.defaultValue??e.defaultValue,placeholder:t.placeholder??e.placeholder}),y=(e,t)=>!t||!b(t)?e:e.type==="select"?{...e,...n(e,t),options:h(e.options,t)}:e.type==="color"?{...e,...n(e,t),options:h(e.options??[],t)}:e.type==="number"?{...e,...n(e,t),min:t.min??e.min,max:t.max??e.max,step:t.step??e.step}:{...e,...n(e,t)},O=(e,t)=>{const a=t==null?void 0:t[e.id];return!a||!b(a)?e:{...e,title:a.title??e.title,description:a.description??e.description,fields:e.fields.map(r=>{var u;return y(r,(u=a.fields)==null?void 0:u[r.name])})}};exports.resolvePayloadPanelSchema=O;
2
+ //# sourceMappingURL=index-DF8OhKI4.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-DF8OhKI4.cjs","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","baseOptions","_a","optionByValue","option","includedOptions","_b","value","excludeValues","nextOptions","resolveFieldBaseOverride","field","resolvePayloadPanelField","resolvePayloadPanelSchema","panel","panelConfig"],"mappings":"aAUA,MAAMA,EAAoBC,GACxBA,IAAW,QAAa,OAAO,KAAKA,CAAM,EAAE,OAAS,EAGjDC,EAAoB,CACxBC,EACAF,IACG,SACH,MAAMG,GAAcC,EAAAJ,EAAO,UAAP,MAAAI,EAAgB,OAASJ,EAAO,QAAUE,EACxDG,EAAgB,IAAI,IAAIF,EAAY,IAAKG,GAAW,CAACA,EAAO,MAAOA,CAAM,CAAC,CAAC,EAC3EC,GAAkBC,EAAAR,EAAO,gBAAP,MAAAQ,EAAsB,OAC1CR,EAAO,cAAc,QAASS,GAAU,CACxC,MAAMH,EAASD,EAAc,IAAII,CAAK,EAEtC,OAAOH,EAAS,CAACA,CAAM,EAAI,CAAA,CAC7B,CAAC,EACCH,EACEO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