@lynx-js/web-core 0.19.6 → 0.19.8
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/CHANGELOG.md +32 -0
- package/dist/apis/LynxView.d.ts +9 -0
- package/dist/apis/LynxView.js +10 -3
- package/dist/apis/createLynxView.d.ts +5 -0
- package/dist/apis/createLynxView.js +4 -4
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# @lynx-js/web-core
|
|
2
2
|
|
|
3
|
+
## 0.19.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix: avoid error when LynxView is removed immediately after connected ([#2182](https://github.com/lynx-family/lynx-stack/pull/2182))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies []:
|
|
10
|
+
- @lynx-js/web-constants@0.19.8
|
|
11
|
+
- @lynx-js/web-mainthread-apis@0.19.8
|
|
12
|
+
- @lynx-js/web-worker-rpc@0.19.8
|
|
13
|
+
- @lynx-js/web-worker-runtime@0.19.8
|
|
14
|
+
|
|
15
|
+
## 0.19.7
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- feat: add browser config of lynx-view, now you can customize the browser config of lynx-view: ([#2140](https://github.com/lynx-family/lynx-stack/pull/2140))
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
lynxView.browserConfig = {
|
|
23
|
+
pixelRatio: 1,
|
|
24
|
+
pixelWidth: 1234,
|
|
25
|
+
pixelHeight: 5678,
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
- Updated dependencies []:
|
|
30
|
+
- @lynx-js/web-constants@0.19.7
|
|
31
|
+
- @lynx-js/web-mainthread-apis@0.19.7
|
|
32
|
+
- @lynx-js/web-worker-rpc@0.19.7
|
|
33
|
+
- @lynx-js/web-worker-runtime@0.19.7
|
|
34
|
+
|
|
3
35
|
## 0.19.6
|
|
4
36
|
|
|
5
37
|
### Patch Changes
|
package/dist/apis/LynxView.d.ts
CHANGED
|
@@ -181,6 +181,15 @@ export declare class LynxView extends HTMLElement {
|
|
|
181
181
|
* @param url the url of the template
|
|
182
182
|
*/
|
|
183
183
|
customTemplateLoader?: (url: string) => Promise<LynxTemplate>;
|
|
184
|
+
/**
|
|
185
|
+
* @public
|
|
186
|
+
* allow user to customize the browser config
|
|
187
|
+
*/
|
|
188
|
+
browserConfig?: {
|
|
189
|
+
pixelRatio?: number;
|
|
190
|
+
pixelWidth?: number;
|
|
191
|
+
pixelHeight?: number;
|
|
192
|
+
};
|
|
184
193
|
/**
|
|
185
194
|
* @private
|
|
186
195
|
*/
|
package/dist/apis/LynxView.js
CHANGED
|
@@ -55,7 +55,6 @@ export class LynxView extends HTMLElement {
|
|
|
55
55
|
*/
|
|
56
56
|
static observedAttributes = LynxView.observedAttributeAsProperties.map(nm => nm.toLowerCase());
|
|
57
57
|
#instance;
|
|
58
|
-
#connected = false;
|
|
59
58
|
#url;
|
|
60
59
|
/**
|
|
61
60
|
* @public
|
|
@@ -329,6 +328,11 @@ export class LynxView extends HTMLElement {
|
|
|
329
328
|
* @param url the url of the template
|
|
330
329
|
*/
|
|
331
330
|
customTemplateLoader;
|
|
331
|
+
/**
|
|
332
|
+
* @public
|
|
333
|
+
* allow user to customize the browser config
|
|
334
|
+
*/
|
|
335
|
+
browserConfig;
|
|
332
336
|
/**
|
|
333
337
|
* @private the flag to group all changes into one render operation
|
|
334
338
|
*/
|
|
@@ -337,10 +341,13 @@ export class LynxView extends HTMLElement {
|
|
|
337
341
|
* @private
|
|
338
342
|
*/
|
|
339
343
|
#render() {
|
|
340
|
-
if (!this.#rendering && this
|
|
344
|
+
if (!this.#rendering && this.isConnected) {
|
|
341
345
|
this.#rendering = true;
|
|
342
346
|
queueMicrotask(() => {
|
|
343
347
|
this.#rendering = false;
|
|
348
|
+
if (!this.isConnected) {
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
344
351
|
const ssrData = this.getAttribute('ssr');
|
|
345
352
|
if (this.#instance) {
|
|
346
353
|
this.disconnectedCallback();
|
|
@@ -376,6 +383,7 @@ export class LynxView extends HTMLElement {
|
|
|
376
383
|
napiModulesMap: this.#napiModulesMap,
|
|
377
384
|
lynxGroupId,
|
|
378
385
|
initI18nResources: this.#initI18nResources,
|
|
386
|
+
browserConfig: this.browserConfig,
|
|
379
387
|
callbacks: {
|
|
380
388
|
nativeModulesCall: (...args) => {
|
|
381
389
|
if (this.onNativeModulesCall) {
|
|
@@ -441,7 +449,6 @@ export class LynxView extends HTMLElement {
|
|
|
441
449
|
* @private
|
|
442
450
|
*/
|
|
443
451
|
connectedCallback() {
|
|
444
|
-
this.#connected = true;
|
|
445
452
|
this.#render();
|
|
446
453
|
}
|
|
447
454
|
}
|
|
@@ -14,6 +14,11 @@ export interface LynxViewConfigs {
|
|
|
14
14
|
threadStrategy: 'all-on-ui' | 'multi-thread';
|
|
15
15
|
initI18nResources: InitI18nResources;
|
|
16
16
|
ssr?: SSRDumpInfo;
|
|
17
|
+
browserConfig?: {
|
|
18
|
+
pixelRatio?: number;
|
|
19
|
+
pixelWidth?: number;
|
|
20
|
+
pixelHeight?: number;
|
|
21
|
+
};
|
|
17
22
|
}
|
|
18
23
|
export interface LynxView {
|
|
19
24
|
updateData(data: Cloneable, processorName?: string, callback?: () => void): void;
|
|
@@ -6,7 +6,7 @@ const pixelRatio = window.devicePixelRatio;
|
|
|
6
6
|
const screenWidth = document.documentElement.clientWidth * pixelRatio;
|
|
7
7
|
const screenHeight = document.documentElement.clientHeight * pixelRatio;
|
|
8
8
|
export function createLynxView(configs) {
|
|
9
|
-
const { shadowRoot, callbacks, templateUrl, globalProps, initData, nativeModulesMap, napiModulesMap, tagMap, lynxGroupId, threadStrategy = 'multi-thread', initI18nResources, ssr, } = configs;
|
|
9
|
+
const { shadowRoot, callbacks, templateUrl, globalProps, initData, nativeModulesMap, napiModulesMap, tagMap, lynxGroupId, threadStrategy = 'multi-thread', initI18nResources, ssr, browserConfig, } = configs;
|
|
10
10
|
return startUIThread(templateUrl, {
|
|
11
11
|
tagMap,
|
|
12
12
|
initData,
|
|
@@ -14,9 +14,9 @@ export function createLynxView(configs) {
|
|
|
14
14
|
nativeModulesMap,
|
|
15
15
|
napiModulesMap,
|
|
16
16
|
browserConfig: {
|
|
17
|
-
pixelRatio: window.devicePixelRatio,
|
|
18
|
-
pixelWidth: screenWidth,
|
|
19
|
-
pixelHeight: screenHeight,
|
|
17
|
+
pixelRatio: browserConfig?.pixelRatio ?? window.devicePixelRatio,
|
|
18
|
+
pixelWidth: browserConfig?.pixelWidth ?? screenWidth,
|
|
19
|
+
pixelHeight: browserConfig?.pixelHeight ?? screenHeight,
|
|
20
20
|
},
|
|
21
21
|
initI18nResources,
|
|
22
22
|
}, shadowRoot, lynxGroupId, threadStrategy, callbacks, ssr);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/web-core",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [],
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@lynx-js/offscreen-document": "0.1.4",
|
|
28
|
-
"@lynx-js/web-constants": "0.19.
|
|
29
|
-
"@lynx-js/web-mainthread-apis": "0.19.
|
|
30
|
-
"@lynx-js/web-worker-rpc": "0.19.
|
|
31
|
-
"@lynx-js/web-worker-runtime": "0.19.
|
|
28
|
+
"@lynx-js/web-constants": "0.19.8",
|
|
29
|
+
"@lynx-js/web-mainthread-apis": "0.19.8",
|
|
30
|
+
"@lynx-js/web-worker-rpc": "0.19.8",
|
|
31
|
+
"@lynx-js/web-worker-runtime": "0.19.8"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@lynx-js/lynx-core": "0.1.3",
|
|
35
|
-
"@lynx-js/web-elements": "0.11.
|
|
35
|
+
"@lynx-js/web-elements": "0.11.2"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@lynx-js/lynx-core": "0.1.3",
|