@lynx-js/web-constants 0.8.0 → 0.9.1
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 +69 -0
- package/dist/constants.d.ts +0 -3
- package/dist/constants.js +0 -3
- package/dist/endpoints.d.ts +5 -4
- package/dist/endpoints.js +3 -3
- package/dist/types/MainThreadStartConfigs.d.ts +3 -2
- package/dist/types/NativeModules.d.ts +1 -10
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,74 @@
|
|
|
1
1
|
# @lynx-js/web-constants
|
|
2
2
|
|
|
3
|
+
## 0.9.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies []:
|
|
8
|
+
- @lynx-js/web-worker-rpc@0.9.1
|
|
9
|
+
|
|
10
|
+
## 0.9.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- refractor: remove entryId concept ([#217](https://github.com/lynx-family/lynx-stack/pull/217))
|
|
15
|
+
|
|
16
|
+
After the PR #198
|
|
17
|
+
All contents are isolated by a shadowroot.
|
|
18
|
+
Therefore we don't need to add the entryId selector to avoid the lynx-view's style taking effect on the whole page.
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- feat: `nativeModulesUrl` of lynx-view is changed to `nativeModulesMap`, and the usage is completely aligned with `napiModulesMap`. ([#220](https://github.com/lynx-family/lynx-stack/pull/220))
|
|
23
|
+
|
|
24
|
+
"warning: This is a breaking change."
|
|
25
|
+
|
|
26
|
+
`nativeModulesMap` will be a map: key is module-name, value should be a esm url which export default a
|
|
27
|
+
function with two parameters(you never need to use `this`):
|
|
28
|
+
|
|
29
|
+
- `NativeModules`: oriented `NativeModules`, which you can use to call
|
|
30
|
+
other Native-Modules.
|
|
31
|
+
|
|
32
|
+
- `NativeModulesCall`: trigger `onNativeModulesCall`, same as the deprecated `this.nativeModulesCall`.
|
|
33
|
+
|
|
34
|
+
example:
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
const nativeModulesMap = {
|
|
38
|
+
CustomModule: URL.createObjectURL(
|
|
39
|
+
new Blob(
|
|
40
|
+
[
|
|
41
|
+
`export default function(NativeModules, NativeModulesCall) {
|
|
42
|
+
return {
|
|
43
|
+
async getColor(data, callback) {
|
|
44
|
+
const color = await NativeModulesCall('getColor', data);
|
|
45
|
+
callback(color);
|
|
46
|
+
},
|
|
47
|
+
}
|
|
48
|
+
};`,
|
|
49
|
+
],
|
|
50
|
+
{ type: 'text/javascript' },
|
|
51
|
+
),
|
|
52
|
+
),
|
|
53
|
+
};
|
|
54
|
+
lynxView.nativeModulesMap = nativeModulesMap;
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
In addition, we will use Promise.all to load `nativeModules`, which will optimize performance in the case of multiple modules.
|
|
58
|
+
|
|
59
|
+
- refactor: clean the decodeOperations implementation ([#261](https://github.com/lynx-family/lynx-stack/pull/261))
|
|
60
|
+
|
|
61
|
+
- refactor: remove customelement defined detecting logic ([#247](https://github.com/lynx-family/lynx-stack/pull/247))
|
|
62
|
+
|
|
63
|
+
Before this commit, for those element with tag without `-`, we always try to detect if the `x-${tagName}` is defined.
|
|
64
|
+
|
|
65
|
+
After this commit, we pre-define a map(could be override by the `overrideLynxTagToHTMLTagMap`) to make that transformation for tag name.
|
|
66
|
+
|
|
67
|
+
This change is a path to SSR and the MTS support.
|
|
68
|
+
|
|
69
|
+
- Updated dependencies [[`53230f0`](https://github.com/lynx-family/lynx-stack/commit/53230f012216f3a627853e11d544e4be175c5b9b)]:
|
|
70
|
+
- @lynx-js/web-worker-rpc@0.9.0
|
|
71
|
+
|
|
3
72
|
## 0.8.0
|
|
4
73
|
|
|
5
74
|
### Minor Changes
|
package/dist/constants.d.ts
CHANGED
|
@@ -2,11 +2,8 @@ export declare const lynxUniqueIdAttribute: "lynx-unique-id";
|
|
|
2
2
|
export declare const cssIdAttribute: "lynx-css-id";
|
|
3
3
|
export declare const componentIdAttribute: "lynx-component-id";
|
|
4
4
|
export declare const parentComponentUniqueIdAttribute: "lynx-parent-component-uid";
|
|
5
|
-
export declare const cardIdAttribute: "lynx-card-id";
|
|
6
5
|
export declare const lynxTagAttribute: "lynx-tag";
|
|
7
6
|
export declare const lynxRuntimeValue: unique symbol;
|
|
8
7
|
export declare const lynxDefaultDisplayLinearAttribute: "lynx-default-display-linear";
|
|
9
|
-
export declare const lynxViewRootDomId: "lynx-view-root";
|
|
10
8
|
export declare const __lynx_timing_flag: "__lynx_timing_flag";
|
|
11
|
-
export declare const lynxViewEntryIdPrefix: "lynx-view-id";
|
|
12
9
|
export declare const globalMuteableVars: readonly ["registerDataProcessor"];
|
package/dist/constants.js
CHANGED
|
@@ -5,13 +5,10 @@ export const lynxUniqueIdAttribute = 'lynx-unique-id';
|
|
|
5
5
|
export const cssIdAttribute = 'lynx-css-id';
|
|
6
6
|
export const componentIdAttribute = 'lynx-component-id';
|
|
7
7
|
export const parentComponentUniqueIdAttribute = 'lynx-parent-component-uid';
|
|
8
|
-
export const cardIdAttribute = 'lynx-card-id';
|
|
9
8
|
export const lynxTagAttribute = 'lynx-tag';
|
|
10
9
|
export const lynxRuntimeValue = Symbol('lynx-runtime-value');
|
|
11
10
|
export const lynxDefaultDisplayLinearAttribute = 'lynx-default-display-linear';
|
|
12
|
-
export const lynxViewRootDomId = 'lynx-view-root';
|
|
13
11
|
export const __lynx_timing_flag = '__lynx_timing_flag';
|
|
14
|
-
export const lynxViewEntryIdPrefix = 'lynx-view-id';
|
|
15
12
|
export const globalMuteableVars = [
|
|
16
13
|
'registerDataProcessor',
|
|
17
14
|
];
|
package/dist/endpoints.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type { PageConfig } from './types/PageConfig.js';
|
|
|
7
7
|
import type { IdentifierType, InvokeCallbackRes } from './types/NativeApp.js';
|
|
8
8
|
import type { LynxTemplate } from './types/LynxModule.js';
|
|
9
9
|
import type { NapiModulesMap } from './types/NapiModules.js';
|
|
10
|
+
import type { NativeModulesMap } from './types/NativeModules.js';
|
|
10
11
|
export declare const postExposureEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsyncVoid<[{
|
|
11
12
|
exposures: ExposureWorkerEvent[];
|
|
12
13
|
disExposures: ExposureWorkerEvent[];
|
|
@@ -34,14 +35,14 @@ export declare const BackgroundThreadStartEndpoint: import("@lynx-js/web-worker-
|
|
|
34
35
|
template: LynxTemplate;
|
|
35
36
|
cardType: string;
|
|
36
37
|
customSections: Record<string, Cloneable>;
|
|
37
|
-
|
|
38
|
+
nativeModulesMap: NativeModulesMap;
|
|
38
39
|
napiModulesMap: NapiModulesMap;
|
|
39
40
|
}], void>;
|
|
40
41
|
/**
|
|
41
|
-
*
|
|
42
|
+
* Error message, info
|
|
42
43
|
*/
|
|
43
|
-
export declare const reportErrorEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").
|
|
44
|
-
export declare const flushElementTreeEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").
|
|
44
|
+
export declare const reportErrorEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsyncVoid<[string, unknown]>;
|
|
45
|
+
export declare const flushElementTreeEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsyncVoid<[operations: ElementOperation[], FlushElementTreeOptions, styleContent: string | undefined, timingFlags: string[]]>;
|
|
45
46
|
export declare const mainThreadChunkReadyEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsyncVoid<[{
|
|
46
47
|
pageConfig: PageConfig;
|
|
47
48
|
}]>;
|
package/dist/endpoints.js
CHANGED
|
@@ -16,10 +16,10 @@ export const uiThreadFpReadyEndpoint = createRpcEndpoint('uiThreadFpReady', fals
|
|
|
16
16
|
export const onLifecycleEventEndpoint = createRpcEndpoint('__OnLifecycleEvent', false, false);
|
|
17
17
|
export const BackgroundThreadStartEndpoint = createRpcEndpoint('start', false, true);
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* Error message, info
|
|
20
20
|
*/
|
|
21
|
-
export const reportErrorEndpoint = createRpcEndpoint('reportError', false,
|
|
22
|
-
export const flushElementTreeEndpoint = createRpcEndpoint('flushElementTree', false,
|
|
21
|
+
export const reportErrorEndpoint = createRpcEndpoint('reportError', false, false);
|
|
22
|
+
export const flushElementTreeEndpoint = createRpcEndpoint('flushElementTree', false, false);
|
|
23
23
|
export const mainThreadChunkReadyEndpoint = createRpcEndpoint('mainThreadChunkReady', false, false);
|
|
24
24
|
export const postTimingInfoFromMainThread = createRpcEndpoint('postTimingInfoFromMainThread', false, false);
|
|
25
25
|
export const callLepusMethodEndpoint = createRpcEndpoint('callLepusMethod', false, true);
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { Cloneable } from './Cloneable.js';
|
|
2
2
|
import type { LynxTemplate } from './LynxModule.js';
|
|
3
3
|
import type { NapiModulesMap } from './NapiModules.js';
|
|
4
|
+
import type { NativeModulesMap } from './NativeModules.js';
|
|
4
5
|
import type { BrowserConfig } from './PageConfig.js';
|
|
5
6
|
export interface MainThreadStartConfigs {
|
|
6
7
|
template: LynxTemplate;
|
|
7
8
|
initData: Cloneable;
|
|
8
9
|
globalProps: Cloneable;
|
|
9
|
-
entryId: string;
|
|
10
10
|
browserConfig: BrowserConfig;
|
|
11
|
-
|
|
11
|
+
nativeModulesMap: NativeModulesMap;
|
|
12
12
|
napiModulesMap: NapiModulesMap;
|
|
13
|
+
tagMap: Record<string, string>;
|
|
13
14
|
}
|
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export type NativeModulesMap = Record<string, string>;
|
|
2
2
|
export type NativeModulesCall = (name: string, data: any, moduleName: string) => Promise<any> | any;
|
|
3
|
-
export type OneNativeModule = {
|
|
4
|
-
[k: string]: (this: NativeModuleHandlerContext, ...args: Cloneable[]) => Promise<Cloneable>;
|
|
5
|
-
};
|
|
6
|
-
export type NativeModuleHandlerContext = {
|
|
7
|
-
nativeModulesCall: (name: string, data: Cloneable) => Promise<Cloneable>;
|
|
8
|
-
};
|
|
9
|
-
export type customNativeModules = {
|
|
10
|
-
[k: string]: OneNativeModule;
|
|
11
|
-
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/web-constants",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [],
|
|
@@ -23,6 +23,6 @@
|
|
|
23
23
|
"**/*.css"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@lynx-js/web-worker-rpc": "0.
|
|
26
|
+
"@lynx-js/web-worker-rpc": "0.9.1"
|
|
27
27
|
}
|
|
28
28
|
}
|