@lynx-js/web-core-canary 0.19.6 → 0.19.7-canary-20260127-43fc7e7f
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 +47 -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 +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @lynx-js/web-core
|
|
2
2
|
|
|
3
|
+
## 0.19.7-canary-20260127120110-43fc7e7f550a761ab94bdcd01a3eda9b93273279
|
|
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 [[`43fc7e7`](https://github.com/lynx-family/lynx-stack/commit/43fc7e7f550a761ab94bdcd01a3eda9b93273279)]:
|
|
18
|
+
- @lynx-js/web-elements@0.11.1-canary-20260127120110-43fc7e7f550a761ab94bdcd01a3eda9b93273279
|
|
19
|
+
- @lynx-js/web-constants@0.19.7-canary-20260127120110-43fc7e7f550a761ab94bdcd01a3eda9b93273279
|
|
20
|
+
- @lynx-js/web-mainthread-apis@0.19.7-canary-20260127120110-43fc7e7f550a761ab94bdcd01a3eda9b93273279
|
|
21
|
+
- @lynx-js/web-worker-rpc@0.19.7-canary-20260127120110-43fc7e7f550a761ab94bdcd01a3eda9b93273279
|
|
22
|
+
- @lynx-js/web-worker-runtime@0.19.7-canary-20260127120110-43fc7e7f550a761ab94bdcd01a3eda9b93273279
|
|
23
|
+
|
|
3
24
|
## 0.19.6
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -496,25 +517,25 @@
|
|
|
496
517
|
lynxView.initI18nResources = [
|
|
497
518
|
{
|
|
498
519
|
options: {
|
|
499
|
-
locale:
|
|
500
|
-
channel:
|
|
501
|
-
fallback_url:
|
|
520
|
+
locale: "en",
|
|
521
|
+
channel: "1",
|
|
522
|
+
fallback_url: "",
|
|
502
523
|
},
|
|
503
524
|
resource: {
|
|
504
|
-
hello:
|
|
505
|
-
lynx:
|
|
525
|
+
hello: "hello",
|
|
526
|
+
lynx: "lynx web platform1",
|
|
506
527
|
},
|
|
507
528
|
},
|
|
508
529
|
];
|
|
509
|
-
lynxView.addEventListener(
|
|
530
|
+
lynxView.addEventListener("i18nResourceMissed", (e) => {
|
|
510
531
|
console.log(e);
|
|
511
532
|
});
|
|
512
533
|
|
|
513
534
|
// mts
|
|
514
535
|
_I18nResourceTranslation({
|
|
515
|
-
locale:
|
|
516
|
-
channel:
|
|
517
|
-
fallback_url:
|
|
536
|
+
locale: "en",
|
|
537
|
+
channel: "1",
|
|
538
|
+
fallback_url: "",
|
|
518
539
|
});
|
|
519
540
|
```
|
|
520
541
|
|
|
@@ -922,8 +943,8 @@
|
|
|
922
943
|
}
|
|
923
944
|
};`,
|
|
924
945
|
],
|
|
925
|
-
{ type:
|
|
926
|
-
)
|
|
946
|
+
{ type: "text/javascript" }
|
|
947
|
+
)
|
|
927
948
|
),
|
|
928
949
|
};
|
|
929
950
|
lynxView.nativeModulesMap = nativeModulesMap;
|
|
@@ -1038,8 +1059,8 @@
|
|
|
1038
1059
|
};
|
|
1039
1060
|
};`,
|
|
1040
1061
|
],
|
|
1041
|
-
{ type:
|
|
1042
|
-
)
|
|
1062
|
+
{ type: "text/javascript" }
|
|
1063
|
+
)
|
|
1043
1064
|
);
|
|
1044
1065
|
|
|
1045
1066
|
const color_methods = URL.createObjectURL(
|
|
@@ -1054,8 +1075,8 @@
|
|
|
1054
1075
|
};
|
|
1055
1076
|
};`,
|
|
1056
1077
|
],
|
|
1057
|
-
{ type:
|
|
1058
|
-
)
|
|
1078
|
+
{ type: "text/javascript" }
|
|
1079
|
+
)
|
|
1059
1080
|
);
|
|
1060
1081
|
|
|
1061
1082
|
lynxView.napiModuleMap = {
|
|
@@ -1072,7 +1093,7 @@
|
|
|
1072
1093
|
|
|
1073
1094
|
```js
|
|
1074
1095
|
lynxView.onNapiModulesCall = (name, data, moduleName) => {
|
|
1075
|
-
if (name ===
|
|
1096
|
+
if (name === "getColor" && moduleName === "color_methods") {
|
|
1076
1097
|
return data.color;
|
|
1077
1098
|
}
|
|
1078
1099
|
};
|
|
@@ -1151,8 +1172,8 @@
|
|
|
1151
1172
|
}
|
|
1152
1173
|
};`,
|
|
1153
1174
|
],
|
|
1154
|
-
{ type:
|
|
1155
|
-
)
|
|
1175
|
+
{ type: "text/javascript" }
|
|
1176
|
+
)
|
|
1156
1177
|
);
|
|
1157
1178
|
```
|
|
1158
1179
|
|
|
@@ -1164,7 +1185,7 @@
|
|
|
1164
1185
|
|
|
1165
1186
|
```js
|
|
1166
1187
|
lynxView.onNativeModulesCall = (name, data, callback) => {
|
|
1167
|
-
if (name ===
|
|
1188
|
+
if (name === "getColor") {
|
|
1168
1189
|
callback(data.color);
|
|
1169
1190
|
}
|
|
1170
1191
|
};
|
|
@@ -1174,7 +1195,7 @@
|
|
|
1174
1195
|
|
|
1175
1196
|
```js
|
|
1176
1197
|
lynxView.onNativeModulesCall = (name, data, moduleName) => {
|
|
1177
|
-
if (name ===
|
|
1198
|
+
if (name === "getColor" && moduleName === "bridge") {
|
|
1178
1199
|
return data.color;
|
|
1179
1200
|
}
|
|
1180
1201
|
};
|
|
@@ -1532,7 +1553,7 @@
|
|
|
1532
1553
|
This flag changes the behaviour of cascading. It provide a way to do this
|
|
1533
1554
|
|
|
1534
1555
|
```jsx
|
|
1535
|
-
<view class=
|
|
1556
|
+
<view class="class-a class-b" />
|
|
1536
1557
|
```
|
|
1537
1558
|
|
|
1538
1559
|
The class-b will override (cascading) styles of class-a.
|
|
@@ -1632,11 +1653,11 @@
|
|
|
1632
1653
|
There is also a simple way to use this feature
|
|
1633
1654
|
|
|
1634
1655
|
```javascript
|
|
1635
|
-
import { LynxCard } from
|
|
1636
|
-
import { loadElement } from
|
|
1637
|
-
import
|
|
1638
|
-
import
|
|
1639
|
-
import
|
|
1656
|
+
import { LynxCard } from "@lynx-js/web-core";
|
|
1657
|
+
import { loadElement } from "@lynx-js/web-elements/lazy";
|
|
1658
|
+
import "@lynx-js/web-elements/index.css";
|
|
1659
|
+
import "@lynx-js/web-core/index.css";
|
|
1660
|
+
import "./index.css";
|
|
1640
1661
|
|
|
1641
1662
|
const lynxcard = new LynxCard({
|
|
1642
1663
|
...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-20260127-43fc7e7f",
|
|
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": "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-20260127-43fc7e7f",
|
|
29
|
+
"@lynx-js/web-mainthread-apis": "npm:@lynx-js/web-mainthread-apis-canary@0.19.7-canary-20260127-43fc7e7f",
|
|
30
|
+
"@lynx-js/web-worker-rpc": "npm:@lynx-js/web-worker-rpc-canary@0.19.7-canary-20260127-43fc7e7f",
|
|
31
|
+
"@lynx-js/web-worker-runtime": "npm:@lynx-js/web-worker-runtime-canary@0.19.7-canary-20260127-43fc7e7f"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@lynx-js/lynx-core": "0.1.3",
|
|
35
|
-
"@lynx-js/web-elements": "npm:@lynx-js/web-elements-canary@0.11.
|
|
35
|
+
"@lynx-js/web-elements": "npm:@lynx-js/web-elements-canary@0.11.1-canary-20260127-43fc7e7f"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@lynx-js/lynx-core": "0.1.3",
|