@vvfx/artis 0.0.1-alpha.3 → 0.0.1-alpha.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.
- package/dist/helper/html-overlay/html-card-service.d.ts +1 -2
- package/dist/index.cjs +5 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +5 -26
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -2,7 +2,6 @@ import { CardHTML, CardTypeConfig, type CardItem } from '../../core';
|
|
|
2
2
|
/** 管理 HTML 卡片内容、覆盖层交互与栅格化。 */
|
|
3
3
|
export declare class HTMLCardService {
|
|
4
4
|
private options;
|
|
5
|
-
private isAutoHeightMessage;
|
|
6
5
|
private eventCleanups;
|
|
7
6
|
private htmlRootConfigCleanups;
|
|
8
7
|
private pendingContentInteractionEvent?;
|
|
@@ -385,7 +384,7 @@ export declare class HTMLCardService {
|
|
|
385
384
|
*/
|
|
386
385
|
private ensureAutoHeightMode;
|
|
387
386
|
/**
|
|
388
|
-
* 为卡片挂载 Resize/Mutation
|
|
387
|
+
* 为卡片挂载 Resize/Mutation 观察,返回清理函数
|
|
389
388
|
* @param id 卡片 ID
|
|
390
389
|
* @returns 注销观察与监听的清理函数
|
|
391
390
|
*/
|
package/dist/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: 智能画布
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 赤芍,何即,不择,意绮
|
|
6
|
-
* Version: v0.0.1-alpha.
|
|
6
|
+
* Version: v0.0.1-alpha.4
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -134827,7 +134827,7 @@ const CARD_HTML_EVENT_MESSAGE_SOURCE = 'vvfx-card-html-event';
|
|
|
134827
134827
|
this.state.autoHeightModes.set(id, content.kind === 'inline' || content.kind === 'document' ? 'message' : 'measure');
|
|
134828
134828
|
}
|
|
134829
134829
|
/**
|
|
134830
|
-
* 为卡片挂载 Resize/Mutation
|
|
134830
|
+
* 为卡片挂载 Resize/Mutation 观察,返回清理函数
|
|
134831
134831
|
* @param id 卡片 ID
|
|
134832
134832
|
* @returns 注销观察与监听的清理函数
|
|
134833
134833
|
*/ createAutoHeightObserver(id) {
|
|
@@ -134860,25 +134860,12 @@ const CARD_HTML_EVENT_MESSAGE_SOURCE = 'vvfx-card-html-event';
|
|
|
134860
134860
|
mutationObserver.disconnect();
|
|
134861
134861
|
});
|
|
134862
134862
|
};
|
|
134863
|
-
// 2. 观察宿主挂载点,并为每个 iframe
|
|
134863
|
+
// 2. 观察宿主挂载点,并为每个 iframe 建立加载同步与同源文档观察。
|
|
134864
134864
|
const mount = this.state.contentMountElements.get(id);
|
|
134865
134865
|
observeElement(mount);
|
|
134866
134866
|
mount?.querySelectorAll('iframe').forEach((iframe)=>{
|
|
134867
134867
|
/**
|
|
134868
|
-
*
|
|
134869
|
-
* @param event 跨文档高度消息
|
|
134870
|
-
*/ const handleAutoHeightMessage = (event)=>{
|
|
134871
|
-
if (event.source !== iframe.contentWindow || !this.isAutoHeightMessage(event.data, id)) {
|
|
134872
|
-
return;
|
|
134873
|
-
}
|
|
134874
|
-
this.applyAutoHeight(id, event.data.height);
|
|
134875
|
-
};
|
|
134876
|
-
window.addEventListener('message', handleAutoHeightMessage);
|
|
134877
|
-
cleanupFns.push(()=>{
|
|
134878
|
-
window.removeEventListener('message', handleAutoHeightMessage);
|
|
134879
|
-
});
|
|
134880
|
-
/**
|
|
134881
|
-
* 在同源 iframe 就绪后解除文档高度约束,并接入自然高度观察。
|
|
134868
|
+
* 在同源 iframe 就绪后接入自然高度观察。
|
|
134882
134869
|
*/ const syncIframeDocument = ()=>{
|
|
134883
134870
|
let doc = null;
|
|
134884
134871
|
try {
|
|
@@ -134889,12 +134876,6 @@ const CARD_HTML_EVENT_MESSAGE_SOURCE = 'vvfx-card-html-event';
|
|
|
134889
134876
|
if (!doc) {
|
|
134890
134877
|
return;
|
|
134891
134878
|
}
|
|
134892
|
-
doc.documentElement.style.height = 'auto';
|
|
134893
|
-
doc.documentElement.style.minHeight = '0';
|
|
134894
|
-
if (doc.body) {
|
|
134895
|
-
doc.body.style.height = 'auto';
|
|
134896
|
-
doc.body.style.minHeight = '0';
|
|
134897
|
-
}
|
|
134898
134879
|
observeElement(doc.documentElement);
|
|
134899
134880
|
observeElement(doc.body);
|
|
134900
134881
|
this.scheduleAutoHeightMeasure(id);
|
|
@@ -134905,7 +134886,7 @@ const CARD_HTML_EVENT_MESSAGE_SOURCE = 'vvfx-card-html-event';
|
|
|
134905
134886
|
});
|
|
134906
134887
|
syncIframeDocument();
|
|
134907
134888
|
});
|
|
134908
|
-
// 3.
|
|
134889
|
+
// 3. 向调用方返回统一释放入口,确保观察器随内容卸载。
|
|
134909
134890
|
return ()=>{
|
|
134910
134891
|
cleanupFns.forEach((cleanup)=>{
|
|
134911
134892
|
cleanup();
|
|
@@ -135104,7 +135085,6 @@ const CARD_HTML_EVENT_MESSAGE_SOURCE = 'vvfx-card-html-event';
|
|
|
135104
135085
|
* @internal 由 BaseArtis 装配。
|
|
135105
135086
|
*/ constructor(options){
|
|
135106
135087
|
_define_property$1(this, "options", void 0);
|
|
135107
|
-
_define_property$1(this, "isAutoHeightMessage", void 0);
|
|
135108
135088
|
_define_property$1(this, "eventCleanups", void 0);
|
|
135109
135089
|
_define_property$1(this, "htmlRootConfigCleanups", void 0);
|
|
135110
135090
|
_define_property$1(this, "pendingContentInteractionEvent", void 0);
|
|
@@ -135131,7 +135111,6 @@ const CARD_HTML_EVENT_MESSAGE_SOURCE = 'vvfx-card-html-event';
|
|
|
135131
135111
|
* @param event 容器捕获到的上下文菜单事件
|
|
135132
135112
|
*/ _define_property$1(this, "handleContainerContextMenu", void 0);
|
|
135133
135113
|
this.options = options;
|
|
135134
|
-
this.isAutoHeightMessage = isCardHTMLAutoHeightMessage;
|
|
135135
135114
|
this.eventCleanups = [];
|
|
135136
135115
|
this.htmlRootConfigCleanups = new WeakMap();
|
|
135137
135116
|
this.state = {
|