@lynx-js/web-core 0.13.1 → 0.13.2
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
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @lynx-js/web-core
|
|
2
2
|
|
|
3
|
+
## 0.13.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- feat: allow lynx code to get JS engine provided properties on globalThis ([#786](https://github.com/lynx-family/lynx-stack/pull/786))
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
globalThis.Reflect; // this will be the Reflect Object
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Note that `assigning to the globalThis` is still not allowed.
|
|
14
|
+
|
|
15
|
+
- perf: use v8 hint for generated javascript file ([#807](https://github.com/lynx-family/lynx-stack/pull/807))
|
|
16
|
+
|
|
17
|
+
https://v8.dev/blog/explicit-compile-hints
|
|
18
|
+
|
|
19
|
+
- feat: add new property `inject-style-rules` for LynxView ([#785](https://github.com/lynx-family/lynx-stack/pull/785))
|
|
20
|
+
|
|
21
|
+
This property allows developer to inject some style rules into the shadowroot.
|
|
22
|
+
|
|
23
|
+
It's a wrapper of https://developer.mozilla.org/docs/Web/API/CSSStyleSheet/insertRule
|
|
24
|
+
|
|
25
|
+
- fix: corrupt mainthread module cache ([#806](https://github.com/lynx-family/lynx-stack/pull/806))
|
|
26
|
+
|
|
27
|
+
- Updated dependencies [[`03a5f64`](https://github.com/lynx-family/lynx-stack/commit/03a5f64d7d09e38903f5d1c022f36f6e68b6432d), [`6d3d852`](https://github.com/lynx-family/lynx-stack/commit/6d3d8529d0d528419920102ca52da279bbe0f1e0), [`8cdd288`](https://github.com/lynx-family/lynx-stack/commit/8cdd28884288b9456aee3a919d6edbf72da1c67b), [`6d3d852`](https://github.com/lynx-family/lynx-stack/commit/6d3d8529d0d528419920102ca52da279bbe0f1e0)]:
|
|
28
|
+
- @lynx-js/web-mainthread-apis@0.13.2
|
|
29
|
+
- @lynx-js/web-worker-runtime@0.13.2
|
|
30
|
+
- @lynx-js/web-constants@0.13.2
|
|
31
|
+
- @lynx-js/offscreen-document@0.0.3
|
|
32
|
+
- @lynx-js/web-worker-rpc@0.13.2
|
|
33
|
+
|
|
3
34
|
## 0.13.1
|
|
4
35
|
|
|
5
36
|
### Patch Changes
|
package/dist/apis/LynxView.d.ts
CHANGED
|
@@ -20,7 +20,8 @@ export type INapiModulesCall = (name: string, data: any, moduleName: string, lyn
|
|
|
20
20
|
* @property {"auto" | null} width [optional] (attribute: "width") set it to "auto" for width auto-sizing
|
|
21
21
|
* @property {NapiModulesMap} napiModulesMap [optional] the napiModule which is called in lynx-core. key is module-name, value is esm url.
|
|
22
22
|
* @property {INapiModulesCall} onNapiModulesCall [optional] the NapiModule value handler.
|
|
23
|
-
* @property {"false" | "true" | null} injectHeadLinks [optional] @default true set it to "false" to disable injecting the <link href="" ref="stylesheet"> styles into shadowroot
|
|
23
|
+
* @property {"false" | "true" | null} injectHeadLinks [optional] (attribute: "inject-head-links") @default true set it to "false" to disable injecting the <link href="" ref="stylesheet"> styles into shadowroot
|
|
24
|
+
* @property {string[]} injectStyleRules [optional] the css rules which will be injected into shadowroot. Each items will be inserted by `insertRule` method. @see https://developer.mozilla.org/docs/Web/API/CSSStyleSheet/insertRule
|
|
24
25
|
* @property {number} lynxGroupId [optional] (attribute: "lynx-group-id") the background shared context id, which is used to share webworker between different lynx cards
|
|
25
26
|
* @property {"all-on-ui" | "multi-thread"} threadStrategy [optional] @default "multi-thread" (attribute: "thread-strategy") controls the thread strategy for current lynx view
|
|
26
27
|
* @property {(string)=>Promise<LynxTemplate>} customTemplateLoader [optional] the custom template loader, which is used to load the template
|
|
@@ -146,6 +147,9 @@ export declare class LynxView extends HTMLElement {
|
|
|
146
147
|
*/
|
|
147
148
|
get threadStrategy(): 'all-on-ui' | 'multi-thread';
|
|
148
149
|
set threadStrategy(val: 'all-on-ui' | 'multi-thread');
|
|
150
|
+
get injectHeadLinks(): boolean;
|
|
151
|
+
set injectHeadLinks(val: boolean);
|
|
152
|
+
injectStyleRules: string[];
|
|
149
153
|
/**
|
|
150
154
|
* @private
|
|
151
155
|
*/
|
package/dist/apis/LynxView.js
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
3
|
// LICENSE file in the root directory of this source tree.
|
|
4
4
|
import { createLynxView, } from './createLynxView.js';
|
|
5
|
-
import {} from '@lynx-js/web-constants';
|
|
6
|
-
import { inShadowRootStyles } from './inShadowRootStyles.js';
|
|
5
|
+
import { inShadowRootStyles, } from '@lynx-js/web-constants';
|
|
7
6
|
/**
|
|
8
7
|
* Based on our experiences, these elements are almost used in all lynx cards.
|
|
9
8
|
*/
|
|
@@ -18,7 +17,8 @@ import { inShadowRootStyles } from './inShadowRootStyles.js';
|
|
|
18
17
|
* @property {"auto" | null} width [optional] (attribute: "width") set it to "auto" for width auto-sizing
|
|
19
18
|
* @property {NapiModulesMap} napiModulesMap [optional] the napiModule which is called in lynx-core. key is module-name, value is esm url.
|
|
20
19
|
* @property {INapiModulesCall} onNapiModulesCall [optional] the NapiModule value handler.
|
|
21
|
-
* @property {"false" | "true" | null} injectHeadLinks [optional] @default true set it to "false" to disable injecting the <link href="" ref="stylesheet"> styles into shadowroot
|
|
20
|
+
* @property {"false" | "true" | null} injectHeadLinks [optional] (attribute: "inject-head-links") @default true set it to "false" to disable injecting the <link href="" ref="stylesheet"> styles into shadowroot
|
|
21
|
+
* @property {string[]} injectStyleRules [optional] the css rules which will be injected into shadowroot. Each items will be inserted by `insertRule` method. @see https://developer.mozilla.org/docs/Web/API/CSSStyleSheet/insertRule
|
|
22
22
|
* @property {number} lynxGroupId [optional] (attribute: "lynx-group-id") the background shared context id, which is used to share webworker between different lynx cards
|
|
23
23
|
* @property {"all-on-ui" | "multi-thread"} threadStrategy [optional] @default "multi-thread" (attribute: "thread-strategy") controls the thread strategy for current lynx view
|
|
24
24
|
* @property {(string)=>Promise<LynxTemplate>} customTemplateLoader [optional] the custom template loader, which is used to load the template
|
|
@@ -260,6 +260,18 @@ export class LynxView extends HTMLElement {
|
|
|
260
260
|
this.removeAttribute('thread-strategy');
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
|
+
get injectHeadLinks() {
|
|
264
|
+
return this.getAttribute('inject-head-links') !== 'false';
|
|
265
|
+
}
|
|
266
|
+
set injectHeadLinks(val) {
|
|
267
|
+
if (val) {
|
|
268
|
+
this.setAttribute('inject-head-links', 'true');
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
this.removeAttribute('inject-head-links');
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
injectStyleRules = [];
|
|
263
275
|
/**
|
|
264
276
|
* @private
|
|
265
277
|
*/
|
|
@@ -344,6 +356,9 @@ export class LynxView extends HTMLElement {
|
|
|
344
356
|
for (const rule of inShadowRootStyles) {
|
|
345
357
|
styleSheet.insertRule(rule);
|
|
346
358
|
}
|
|
359
|
+
for (const rule of this.injectStyleRules) {
|
|
360
|
+
styleSheet.insertRule(rule);
|
|
361
|
+
}
|
|
347
362
|
const injectHeadLinks = this.getAttribute('inject-head-links') !== 'false';
|
|
348
363
|
if (injectHeadLinks) {
|
|
349
364
|
document.head.querySelectorAll('link[rel="stylesheet"]').forEach((linkElement) => {
|
|
@@ -9,6 +9,7 @@ function generateJavascriptUrl(obj, injectVars, injectWithBind, muteableVars) {
|
|
|
9
9
|
return [
|
|
10
10
|
name,
|
|
11
11
|
createJsModuleUrl([
|
|
12
|
+
'//# allFunctionsCalledOnLoad\n',
|
|
12
13
|
'globalThis.module.exports = function(lynx_runtime) {',
|
|
13
14
|
'const module= {exports:{}};let exports = module.exports;',
|
|
14
15
|
'var {',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/web-core",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [],
|
|
@@ -24,15 +24,15 @@
|
|
|
24
24
|
"**/*.css"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@lynx-js/offscreen-document": "0.0.
|
|
28
|
-
"@lynx-js/web-constants": "0.13.
|
|
29
|
-
"@lynx-js/web-mainthread-apis": "0.13.
|
|
30
|
-
"@lynx-js/web-worker-rpc": "0.13.
|
|
31
|
-
"@lynx-js/web-worker-runtime": "0.13.
|
|
27
|
+
"@lynx-js/offscreen-document": "0.0.3",
|
|
28
|
+
"@lynx-js/web-constants": "0.13.2",
|
|
29
|
+
"@lynx-js/web-mainthread-apis": "0.13.2",
|
|
30
|
+
"@lynx-js/web-worker-rpc": "0.13.2",
|
|
31
|
+
"@lynx-js/web-worker-runtime": "0.13.2"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@lynx-js/lynx-core": "0.1.2",
|
|
35
|
-
"@lynx-js/web-elements": "0.7.
|
|
35
|
+
"@lynx-js/web-elements": "0.7.2"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@lynx-js/lynx-core": "0.1.2",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const inShadowRootStyles: string[];
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export const inShadowRootStyles = [
|
|
2
|
-
` [lynx-default-display-linear="false"] * {
|
|
3
|
-
--lynx-display: flex;
|
|
4
|
-
--lynx-display-toggle: var(--lynx-display-flex);
|
|
5
|
-
}`,
|
|
6
|
-
`[lynx-default-overflow-visible="true"] x-view{
|
|
7
|
-
overflow: visible;
|
|
8
|
-
}`,
|
|
9
|
-
];
|
|
10
|
-
//# sourceMappingURL=inShadowRootStyles.js.map
|