@tmagic/stage 1.5.21 → 1.5.22
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/tmagic-stage.js +14 -3
- package/dist/tmagic-stage.umd.cjs +14 -3
- package/package.json +2 -2
- package/src/StageMask.ts +12 -2
- package/src/StageRender.ts +5 -2
- package/src/types.ts +1 -0
- package/types/index.d.ts +3 -1
package/dist/tmagic-stage.js
CHANGED
|
@@ -2211,6 +2211,10 @@ class StageMask extends Rule {
|
|
|
2211
2211
|
const { clientHeight, clientWidth } = entry.target;
|
|
2212
2212
|
this.wrapperHeight = clientHeight;
|
|
2213
2213
|
this.wrapperWidth = clientWidth;
|
|
2214
|
+
if (this.mode === Mode.FIXED) {
|
|
2215
|
+
this.content.style.width = `${this.wrapperWidth}px`;
|
|
2216
|
+
this.content.style.height = `${this.wrapperHeight}px`;
|
|
2217
|
+
}
|
|
2214
2218
|
this.setMaxScrollLeft();
|
|
2215
2219
|
this.setMaxScrollTop();
|
|
2216
2220
|
});
|
|
@@ -2250,7 +2254,9 @@ class StageMask extends Rule {
|
|
|
2250
2254
|
setHeight(height) {
|
|
2251
2255
|
this.height = height;
|
|
2252
2256
|
this.setMaxScrollTop();
|
|
2253
|
-
this.
|
|
2257
|
+
if (this.mode !== Mode.FIXED) {
|
|
2258
|
+
this.content.style.height = `${height}px`;
|
|
2259
|
+
}
|
|
2254
2260
|
}
|
|
2255
2261
|
/**
|
|
2256
2262
|
* 设置蒙层宽度
|
|
@@ -2259,7 +2265,9 @@ class StageMask extends Rule {
|
|
|
2259
2265
|
setWidth(width) {
|
|
2260
2266
|
this.width = width;
|
|
2261
2267
|
this.setMaxScrollLeft();
|
|
2262
|
-
this.
|
|
2268
|
+
if (this.mode !== Mode.FIXED) {
|
|
2269
|
+
this.content.style.width = `${width}px`;
|
|
2270
|
+
}
|
|
2263
2271
|
}
|
|
2264
2272
|
/**
|
|
2265
2273
|
* 计算并设置最大滚动宽度
|
|
@@ -2324,7 +2332,10 @@ class StageRender extends EventEmitter$1 {
|
|
|
2324
2332
|
}
|
|
2325
2333
|
}
|
|
2326
2334
|
getMagicApi = () => ({
|
|
2327
|
-
|
|
2335
|
+
id: guid(),
|
|
2336
|
+
onPageElUpdate: (el) => {
|
|
2337
|
+
this.emit("page-el-update", el);
|
|
2338
|
+
},
|
|
2328
2339
|
onRuntimeReady: (runtime) => {
|
|
2329
2340
|
if (this.runtime) {
|
|
2330
2341
|
return;
|
|
@@ -4684,6 +4684,10 @@
|
|
|
4684
4684
|
const { clientHeight, clientWidth } = entry.target;
|
|
4685
4685
|
this.wrapperHeight = clientHeight;
|
|
4686
4686
|
this.wrapperWidth = clientWidth;
|
|
4687
|
+
if (this.mode === Mode.FIXED) {
|
|
4688
|
+
this.content.style.width = `${this.wrapperWidth}px`;
|
|
4689
|
+
this.content.style.height = `${this.wrapperHeight}px`;
|
|
4690
|
+
}
|
|
4687
4691
|
this.setMaxScrollLeft();
|
|
4688
4692
|
this.setMaxScrollTop();
|
|
4689
4693
|
});
|
|
@@ -4723,7 +4727,9 @@
|
|
|
4723
4727
|
setHeight(height) {
|
|
4724
4728
|
this.height = height;
|
|
4725
4729
|
this.setMaxScrollTop();
|
|
4726
|
-
this.
|
|
4730
|
+
if (this.mode !== Mode.FIXED) {
|
|
4731
|
+
this.content.style.height = `${height}px`;
|
|
4732
|
+
}
|
|
4727
4733
|
}
|
|
4728
4734
|
/**
|
|
4729
4735
|
* 设置蒙层宽度
|
|
@@ -4732,7 +4738,9 @@
|
|
|
4732
4738
|
setWidth(width) {
|
|
4733
4739
|
this.width = width;
|
|
4734
4740
|
this.setMaxScrollLeft();
|
|
4735
|
-
this.
|
|
4741
|
+
if (this.mode !== Mode.FIXED) {
|
|
4742
|
+
this.content.style.width = `${width}px`;
|
|
4743
|
+
}
|
|
4736
4744
|
}
|
|
4737
4745
|
/**
|
|
4738
4746
|
* 计算并设置最大滚动宽度
|
|
@@ -4797,7 +4805,10 @@
|
|
|
4797
4805
|
}
|
|
4798
4806
|
}
|
|
4799
4807
|
getMagicApi = () => ({
|
|
4800
|
-
|
|
4808
|
+
id: core.guid(),
|
|
4809
|
+
onPageElUpdate: (el) => {
|
|
4810
|
+
this.emit("page-el-update", el);
|
|
4811
|
+
},
|
|
4801
4812
|
onRuntimeReady: (runtime) => {
|
|
4802
4813
|
if (this.runtime) {
|
|
4803
4814
|
return;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.5.
|
|
2
|
+
"version": "1.5.22",
|
|
3
3
|
"name": "@tmagic/stage",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/tmagic-stage.umd.cjs",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"typescript": "*",
|
|
45
|
-
"@tmagic/core": "1.5.
|
|
45
|
+
"@tmagic/core": "1.5.22"
|
|
46
46
|
},
|
|
47
47
|
"peerDependenciesMeta": {
|
|
48
48
|
"typescript": {
|
package/src/StageMask.ts
CHANGED
|
@@ -236,6 +236,12 @@ export default class StageMask extends Rule {
|
|
|
236
236
|
const { clientHeight, clientWidth } = entry.target;
|
|
237
237
|
this.wrapperHeight = clientHeight;
|
|
238
238
|
this.wrapperWidth = clientWidth;
|
|
239
|
+
|
|
240
|
+
if (this.mode === Mode.FIXED) {
|
|
241
|
+
this.content.style.width = `${this.wrapperWidth}px`;
|
|
242
|
+
this.content.style.height = `${this.wrapperHeight}px`;
|
|
243
|
+
}
|
|
244
|
+
|
|
239
245
|
this.setMaxScrollLeft();
|
|
240
246
|
this.setMaxScrollTop();
|
|
241
247
|
});
|
|
@@ -286,7 +292,9 @@ export default class StageMask extends Rule {
|
|
|
286
292
|
private setHeight(height: number): void {
|
|
287
293
|
this.height = height;
|
|
288
294
|
this.setMaxScrollTop();
|
|
289
|
-
this.
|
|
295
|
+
if (this.mode !== Mode.FIXED) {
|
|
296
|
+
this.content.style.height = `${height}px`;
|
|
297
|
+
}
|
|
290
298
|
}
|
|
291
299
|
|
|
292
300
|
/**
|
|
@@ -296,7 +304,9 @@ export default class StageMask extends Rule {
|
|
|
296
304
|
private setWidth(width: number): void {
|
|
297
305
|
this.width = width;
|
|
298
306
|
this.setMaxScrollLeft();
|
|
299
|
-
this.
|
|
307
|
+
if (this.mode !== Mode.FIXED) {
|
|
308
|
+
this.content.style.width = `${width}px`;
|
|
309
|
+
}
|
|
300
310
|
}
|
|
301
311
|
|
|
302
312
|
/**
|
package/src/StageRender.ts
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
import { EventEmitter } from 'events';
|
|
20
20
|
|
|
21
21
|
import type { Id } from '@tmagic/core';
|
|
22
|
-
import { getElById, getHost, injectStyle, isSameDomain } from '@tmagic/core';
|
|
22
|
+
import { getElById, getHost, guid, injectStyle, isSameDomain } from '@tmagic/core';
|
|
23
23
|
|
|
24
24
|
import { DEFAULT_ZOOM, RenderType } from './const';
|
|
25
25
|
import style from './style.css?raw';
|
|
@@ -54,7 +54,10 @@ export default class StageRender extends EventEmitter {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
public getMagicApi = () => ({
|
|
57
|
-
|
|
57
|
+
id: guid(),
|
|
58
|
+
onPageElUpdate: (el: HTMLElement) => {
|
|
59
|
+
this.emit('page-el-update', el);
|
|
60
|
+
},
|
|
58
61
|
onRuntimeReady: (runtime: Runtime) => {
|
|
59
62
|
if (this.runtime) {
|
|
60
63
|
return;
|
package/src/types.ts
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -317,6 +317,7 @@ interface Runtime {
|
|
|
317
317
|
[key: string]: any;
|
|
318
318
|
}
|
|
319
319
|
interface Magic {
|
|
320
|
+
id: string;
|
|
320
321
|
/** 当前页面的根节点变化时调用该方法,编辑器会同步该el和stage的大小,该方法由stage注入到iframe.contentWindow中 */
|
|
321
322
|
onPageElUpdate: (el: HTMLElement) => void;
|
|
322
323
|
onRuntimeReady: (runtime: Runtime) => void;
|
|
@@ -680,7 +681,8 @@ declare class StageRender extends EventEmitter$1 {
|
|
|
680
681
|
private customizedRender?;
|
|
681
682
|
constructor({ runtimeUrl, zoom, customizedRender, renderType }: StageRenderConfig);
|
|
682
683
|
getMagicApi: () => {
|
|
683
|
-
|
|
684
|
+
id: string;
|
|
685
|
+
onPageElUpdate: (el: HTMLElement) => void;
|
|
684
686
|
onRuntimeReady: (runtime: Runtime) => void;
|
|
685
687
|
};
|
|
686
688
|
add(data: UpdateData): Promise<void>;
|