bridgerte 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=120,n=100,d={contentChangeDebounceMs:o,heightChangeThrottleMs:n,commandStateChangeDedupe:!0},i=new Set(["editor.init","editor.executeCommand","editor.setContent","editor.setReadonly","editor.requestContent","editor.payloadPanelResolved","editor.payloadPanelCanceled","editor.uploadResolved","editor.uploadRejected","editor.ready","editor.content","editor.contentChange","editor.selectionChange","editor.commandStateChange","editor.payloadPanelRequest","editor.uploadRequest","editor.heightChange","editor.error"]);function r(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.type=="string"&&i.has(t.type)}exports.BRIDGE_CONTENT_CHANGE_DEBOUNCE_MS=o;exports.BRIDGE_HEIGHT_CHANGE_THROTTLE_MS=n;exports.defaultBridgeEventTiming=d;exports.isBridgeMessage=r;
2
+ //# sourceMappingURL=bridge.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bridge.cjs","sources":["../../bridge/src/index.ts"],"sourcesContent":["import type { BridgeEventTiming, BridgeMessage } from './type';\n\nexport type * from './type';\n\n/**\n * bridge 高频事件的默认节流策略。\n *\n * 这里先固定协议默认值,真正的 WebView runtime 会在发送消息时使用这些数值。\n */\nexport const BRIDGE_CONTENT_CHANGE_DEBOUNCE_MS = 120;\nexport const BRIDGE_HEIGHT_CHANGE_THROTTLE_MS = 100;\n\nexport const defaultBridgeEventTiming: BridgeEventTiming = {\n contentChangeDebounceMs: BRIDGE_CONTENT_CHANGE_DEBOUNCE_MS,\n heightChangeThrottleMs: BRIDGE_HEIGHT_CHANGE_THROTTLE_MS,\n commandStateChangeDedupe: true\n};\n\n/**\n * bridge 当前支持的全部外层消息类型。\n *\n * `isBridgeMessage()` 只信任这个白名单,避免把未知 `editor.*` 消息误判为合法协议。\n */\nconst bridgeMessageTypes = new Set<BridgeMessage['type']>([\n 'editor.init',\n 'editor.executeCommand',\n 'editor.setContent',\n 'editor.setReadonly',\n 'editor.requestContent',\n 'editor.payloadPanelResolved',\n 'editor.payloadPanelCanceled',\n 'editor.uploadResolved',\n 'editor.uploadRejected',\n 'editor.ready',\n 'editor.content',\n 'editor.contentChange',\n 'editor.selectionChange',\n 'editor.commandStateChange',\n 'editor.payloadPanelRequest',\n 'editor.uploadRequest',\n 'editor.heightChange',\n 'editor.error'\n]);\n\n/**\n * bridge 消息的已知类型守卫。\n *\n * 这里只校验消息外层类型,深层 payload 校验留给具体消息处理器。\n * 这样能在轻量运行时判断和完整业务校验之间保持边界清楚。\n */\nexport function isBridgeMessage(value: unknown): value is BridgeMessage {\n if (typeof value !== 'object' || value === null) {\n return false;\n }\n\n const candidate = value as { type?: unknown };\n return typeof candidate.type === 'string'\n && bridgeMessageTypes.has(candidate.type as BridgeMessage['type']);\n}\n"],"names":["BRIDGE_CONTENT_CHANGE_DEBOUNCE_MS","BRIDGE_HEIGHT_CHANGE_THROTTLE_MS","defaultBridgeEventTiming","bridgeMessageTypes","isBridgeMessage","value","candidate"],"mappings":"gFASO,MAAMA,EAAoC,IACpCC,EAAmC,IAEnCC,EAA8C,CACzD,wBAAyBF,EACzB,uBAAwBC,EACxB,yBAA0B,EAC5B,EAOME,MAAyB,IAA2B,CACxD,cACA,wBACA,oBACA,qBACA,wBACA,8BACA,8BACA,wBACA,wBACA,eACA,iBACA,uBACA,yBACA,4BACA,6BACA,uBACA,sBACA,cACF,CAAC,EAQM,SAASC,EAAgBC,EAAwC,CACtE,GAAI,OAAOA,GAAU,UAAYA,IAAU,KACzC,MAAO,GAGT,MAAMC,EAAYD,EAClB,OAAO,OAAOC,EAAU,MAAS,UAC5BH,EAAmB,IAAIG,EAAU,IAA6B,CACrE"}