@lynx-js/web-core-canary 0.19.6 → 0.19.7-canary-20260126-5e7e43c5
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 +46 -26
- package/dist/apis/LynxView.d.ts +9 -0
- package/dist/apis/LynxView.js +6 -0
- package/dist/apis/createLynxView.d.ts +5 -0
- package/dist/apis/createLynxView.js +4 -4
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @lynx-js/web-core
|
|
2
2
|
|
|
3
|
+
## 0.19.7-canary-20260126074925-5e7e43c59237f98a93aefbd6749ad39c33acdc4d
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 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))
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
lynxView.browserConfig = {
|
|
11
|
+
pixelRatio: 1,
|
|
12
|
+
pixelWidth: 1234,
|
|
13
|
+
pixelHeight: 5678,
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
- Updated dependencies []:
|
|
18
|
+
- @lynx-js/web-constants@0.19.7-canary-20260126074925-5e7e43c59237f98a93aefbd6749ad39c33acdc4d
|
|
19
|
+
- @lynx-js/web-mainthread-apis@0.19.7-canary-20260126074925-5e7e43c59237f98a93aefbd6749ad39c33acdc4d
|
|
20
|
+
- @lynx-js/web-worker-rpc@0.19.7-canary-20260126074925-5e7e43c59237f98a93aefbd6749ad39c33acdc4d
|
|
21
|
+
- @lynx-js/web-worker-runtime@0.19.7-canary-20260126074925-5e7e43c59237f98a93aefbd6749ad39c33acdc4d
|
|
22
|
+
|
|
3
23
|
## 0.19.6
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -496,25 +516,25 @@
|
|
|
496
516
|
lynxView.initI18nResources = [
|
|
497
517
|
{
|
|
498
518
|
options: {
|
|
499
|
-
locale:
|
|
500
|
-
channel:
|
|
501
|
-
fallback_url:
|
|
519
|
+
locale: "en",
|
|
520
|
+
channel: "1",
|
|
521
|
+
fallback_url: "",
|
|
502
522
|
},
|
|
503
523
|
resource: {
|
|
504
|
-
hello:
|
|
505
|
-
lynx:
|
|
524
|
+
hello: "hello",
|
|
525
|
+
lynx: "lynx web platform1",
|
|
506
526
|
},
|
|
507
527
|
},
|
|
508
528
|
];
|
|
509
|
-
lynxView.addEventListener(
|
|
529
|
+
lynxView.addEventListener("i18nResourceMissed", (e) => {
|
|
510
530
|
console.log(e);
|
|
511
531
|
});
|
|
512
532
|
|
|
513
533
|
// mts
|
|
514
534
|
_I18nResourceTranslation({
|
|
515
|
-
locale:
|
|
516
|
-
channel:
|
|
517
|
-
fallback_url:
|
|
535
|
+
locale: "en",
|
|
536
|
+
channel: "1",
|
|
537
|
+
fallback_url: "",
|
|
518
538
|
});
|
|
519
539
|
```
|
|
520
540
|
|
|
@@ -922,8 +942,8 @@
|
|
|
922
942
|
}
|
|
923
943
|
};`,
|
|
924
944
|
],
|
|
925
|
-
{ type:
|
|
926
|
-
)
|
|
945
|
+
{ type: "text/javascript" }
|
|
946
|
+
)
|
|
927
947
|
),
|
|
928
948
|
};
|
|
929
949
|
lynxView.nativeModulesMap = nativeModulesMap;
|
|
@@ -1038,8 +1058,8 @@
|
|
|
1038
1058
|
};
|
|
1039
1059
|
};`,
|
|
1040
1060
|
],
|
|
1041
|
-
{ type:
|
|
1042
|
-
)
|
|
1061
|
+
{ type: "text/javascript" }
|
|
1062
|
+
)
|
|
1043
1063
|
);
|
|
1044
1064
|
|
|
1045
1065
|
const color_methods = URL.createObjectURL(
|
|
@@ -1054,8 +1074,8 @@
|
|
|
1054
1074
|
};
|
|
1055
1075
|
};`,
|
|
1056
1076
|
],
|
|
1057
|
-
{ type:
|
|
1058
|
-
)
|
|
1077
|
+
{ type: "text/javascript" }
|
|
1078
|
+
)
|
|
1059
1079
|
);
|
|
1060
1080
|
|
|
1061
1081
|
lynxView.napiModuleMap = {
|
|
@@ -1072,7 +1092,7 @@
|
|
|
1072
1092
|
|
|
1073
1093
|
```js
|
|
1074
1094
|
lynxView.onNapiModulesCall = (name, data, moduleName) => {
|
|
1075
|
-
if (name ===
|
|
1095
|
+
if (name === "getColor" && moduleName === "color_methods") {
|
|
1076
1096
|
return data.color;
|
|
1077
1097
|
}
|
|
1078
1098
|
};
|
|
@@ -1151,8 +1171,8 @@
|
|
|
1151
1171
|
}
|
|
1152
1172
|
};`,
|
|
1153
1173
|
],
|
|
1154
|
-
{ type:
|
|
1155
|
-
)
|
|
1174
|
+
{ type: "text/javascript" }
|
|
1175
|
+
)
|
|
1156
1176
|
);
|
|
1157
1177
|
```
|
|
1158
1178
|
|
|
@@ -1164,7 +1184,7 @@
|
|
|
1164
1184
|
|
|
1165
1185
|
```js
|
|
1166
1186
|
lynxView.onNativeModulesCall = (name, data, callback) => {
|
|
1167
|
-
if (name ===
|
|
1187
|
+
if (name === "getColor") {
|
|
1168
1188
|
callback(data.color);
|
|
1169
1189
|
}
|
|
1170
1190
|
};
|
|
@@ -1174,7 +1194,7 @@
|
|
|
1174
1194
|
|
|
1175
1195
|
```js
|
|
1176
1196
|
lynxView.onNativeModulesCall = (name, data, moduleName) => {
|
|
1177
|
-
if (name ===
|
|
1197
|
+
if (name === "getColor" && moduleName === "bridge") {
|
|
1178
1198
|
return data.color;
|
|
1179
1199
|
}
|
|
1180
1200
|
};
|
|
@@ -1532,7 +1552,7 @@
|
|
|
1532
1552
|
This flag changes the behaviour of cascading. It provide a way to do this
|
|
1533
1553
|
|
|
1534
1554
|
```jsx
|
|
1535
|
-
<view class=
|
|
1555
|
+
<view class="class-a class-b" />
|
|
1536
1556
|
```
|
|
1537
1557
|
|
|
1538
1558
|
The class-b will override (cascading) styles of class-a.
|
|
@@ -1632,11 +1652,11 @@
|
|
|
1632
1652
|
There is also a simple way to use this feature
|
|
1633
1653
|
|
|
1634
1654
|
```javascript
|
|
1635
|
-
import { LynxCard } from
|
|
1636
|
-
import { loadElement } from
|
|
1637
|
-
import
|
|
1638
|
-
import
|
|
1639
|
-
import
|
|
1655
|
+
import { LynxCard } from "@lynx-js/web-core";
|
|
1656
|
+
import { loadElement } from "@lynx-js/web-elements/lazy";
|
|
1657
|
+
import "@lynx-js/web-elements/index.css";
|
|
1658
|
+
import "@lynx-js/web-core/index.css";
|
|
1659
|
+
import "./index.css";
|
|
1640
1660
|
|
|
1641
1661
|
const lynxcard = new LynxCard({
|
|
1642
1662
|
...beforeConfigs,
|
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
|
@@ -329,6 +329,11 @@ export class LynxView extends HTMLElement {
|
|
|
329
329
|
* @param url the url of the template
|
|
330
330
|
*/
|
|
331
331
|
customTemplateLoader;
|
|
332
|
+
/**
|
|
333
|
+
* @public
|
|
334
|
+
* allow user to customize the browser config
|
|
335
|
+
*/
|
|
336
|
+
browserConfig;
|
|
332
337
|
/**
|
|
333
338
|
* @private the flag to group all changes into one render operation
|
|
334
339
|
*/
|
|
@@ -376,6 +381,7 @@ export class LynxView extends HTMLElement {
|
|
|
376
381
|
napiModulesMap: this.#napiModulesMap,
|
|
377
382
|
lynxGroupId,
|
|
378
383
|
initI18nResources: this.#initI18nResources,
|
|
384
|
+
browserConfig: this.browserConfig,
|
|
379
385
|
callbacks: {
|
|
380
386
|
nativeModulesCall: (...args) => {
|
|
381
387
|
if (this.onNativeModulesCall) {
|
|
@@ -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-canary",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.7-canary-20260126-5e7e43c5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [],
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@lynx-js/offscreen-document": "npm:@lynx-js/offscreen-document-canary@0.1.4",
|
|
28
|
-
"@lynx-js/web-constants": "npm:@lynx-js/web-constants-canary@0.19.
|
|
29
|
-
"@lynx-js/web-mainthread-apis": "npm:@lynx-js/web-mainthread-apis-canary@0.19.
|
|
30
|
-
"@lynx-js/web-worker-rpc": "npm:@lynx-js/web-worker-rpc-canary@0.19.
|
|
31
|
-
"@lynx-js/web-worker-runtime": "npm:@lynx-js/web-worker-runtime-canary@0.19.
|
|
28
|
+
"@lynx-js/web-constants": "npm:@lynx-js/web-constants-canary@0.19.7-canary-20260126-5e7e43c5",
|
|
29
|
+
"@lynx-js/web-mainthread-apis": "npm:@lynx-js/web-mainthread-apis-canary@0.19.7-canary-20260126-5e7e43c5",
|
|
30
|
+
"@lynx-js/web-worker-rpc": "npm:@lynx-js/web-worker-rpc-canary@0.19.7-canary-20260126-5e7e43c5",
|
|
31
|
+
"@lynx-js/web-worker-runtime": "npm:@lynx-js/web-worker-runtime-canary@0.19.7-canary-20260126-5e7e43c5"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@lynx-js/lynx-core": "0.1.3",
|