@lynx-js/web-constants 0.7.0

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +173 -0
  2. package/LICENSE.txt +202 -0
  3. package/Notice.txt +1 -0
  4. package/README.md +9 -0
  5. package/dist/constants.d.ts +11 -0
  6. package/dist/constants.js +15 -0
  7. package/dist/endpoints.d.ts +59 -0
  8. package/dist/endpoints.js +34 -0
  9. package/dist/eventName.d.ts +3 -0
  10. package/dist/eventName.js +28 -0
  11. package/dist/index.d.ts +4 -0
  12. package/dist/index.js +8 -0
  13. package/dist/types/Cloneable.d.ts +2 -0
  14. package/dist/types/Cloneable.js +2 -0
  15. package/dist/types/ElementOperation.d.ts +119 -0
  16. package/dist/types/ElementOperation.js +16 -0
  17. package/dist/types/EventType.d.ts +30 -0
  18. package/dist/types/EventType.js +5 -0
  19. package/dist/types/LynxLifecycleEvent.d.ts +1 -0
  20. package/dist/types/LynxLifecycleEvent.js +2 -0
  21. package/dist/types/LynxModule.d.ts +25 -0
  22. package/dist/types/LynxModule.js +2 -0
  23. package/dist/types/MainThreadStartConfigs.d.ts +11 -0
  24. package/dist/types/MainThreadStartConfigs.js +5 -0
  25. package/dist/types/NativeApp.d.ts +104 -0
  26. package/dist/types/NativeApp.js +45 -0
  27. package/dist/types/NativeModules.d.ts +11 -0
  28. package/dist/types/NativeModules.js +5 -0
  29. package/dist/types/PageConfig.d.ts +8 -0
  30. package/dist/types/PageConfig.js +2 -0
  31. package/dist/types/Performance.d.ts +27 -0
  32. package/dist/types/Performance.js +5 -0
  33. package/dist/types/ProcessDataCallback.d.ts +1 -0
  34. package/dist/types/ProcessDataCallback.js +2 -0
  35. package/dist/types/StyleInfo.d.ts +21 -0
  36. package/dist/types/StyleInfo.js +2 -0
  37. package/dist/types/UpdateDataOptions.d.ts +14 -0
  38. package/dist/types/UpdateDataOptions.js +25 -0
  39. package/dist/types/index.d.ts +13 -0
  40. package/dist/types/index.js +14 -0
  41. package/package.json +23 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,173 @@
1
+ # @lynx-js/web-constants
2
+
3
+ ## 0.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 1abf8f0: feat(web):
8
+
9
+ **This is a breaking change**
10
+
11
+ 1. A new param for `lynx-view`: `nativeModulesUrl`, which allows you to pass an esm url to add a new module to `NativeModules`. And we bind the `nativeModulesCall` method to each function on the module, run `this.nativeModulesCall()` to trigger onNativeModulesCall.
12
+
13
+ ```typescript
14
+ export type NativeModuleHandlerContext = {
15
+ nativeModulesCall: (name: string, data: Cloneable) => Promise<Cloneable>;
16
+ };
17
+ ```
18
+
19
+ a simple case:
20
+
21
+ ```js
22
+ lynxView.nativeModules = URL.createObjectURL(
23
+ new Blob(
24
+ [
25
+ `export default {
26
+ myNativeModules: {
27
+ async getColor(data, callback) {
28
+ // trigger onNativeModulesCall and get the result
29
+ const color = await this.nativeModulesCall('getColor', data);
30
+ // return the result to caller
31
+ callback(color);
32
+ },
33
+ }
34
+ };`,
35
+ ],
36
+ { type: 'text/javascript' },
37
+ ),
38
+ );
39
+ ```
40
+
41
+ 2. `onNativeModulesCall` is no longer the value handler of `NativeModules.bridge.call`, it will be the value handler of all `NativeModules` modules.
42
+
43
+ **Warning: This is a breaking change.**
44
+
45
+ Before this commit, you listen to `NativeModules.bridge.call('getColor')` like this:
46
+
47
+ ```js
48
+ lynxView.onNativeModulesCall = (name, data, callback) => {
49
+ if (name === 'getColor') {
50
+ callback(data.color);
51
+ }
52
+ };
53
+ ```
54
+
55
+ Now you should use it like this:
56
+
57
+ ```js
58
+ lynxView.onNativeModulesCall = (name, data, moduleName) => {
59
+ if (name === 'getColor' && moduleName === 'bridge') {
60
+ return data.color;
61
+ }
62
+ };
63
+ ```
64
+
65
+ You need to use `moduleName` to determine the NativeModules-module. And you don’t need to run callback, just return the result!
66
+
67
+ ### Patch Changes
68
+
69
+ - @lynx-js/web-worker-rpc@0.7.0
70
+
71
+ ## 0.6.2
72
+
73
+ ### Patch Changes
74
+
75
+ - 0412db0: fix: The runtime wrapper parameter name is changed from `runtime` to `lynx_runtime`.
76
+
77
+ This is because some project logic may use `runtime`, which may cause duplication of declarations.
78
+
79
+ - 085b99e: feat: add `nativeApp.createJSObjectDestructionObserver`, it is a prerequisite for implementing mts event.
80
+ - @lynx-js/web-worker-rpc@0.6.2
81
+
82
+ ## 0.6.1
83
+
84
+ ### Patch Changes
85
+
86
+ - 62b7841: feat: add lynx.requireModule in main-thread && \_\_LoadLepusChunk API.
87
+
88
+ now the `lynx.requireModule` is available in mts.
89
+
90
+ - @lynx-js/web-worker-rpc@0.6.1
91
+
92
+ ## 0.6.0
93
+
94
+ ### Minor Changes
95
+
96
+ - e406d69: refractor: update output json format
97
+
98
+ **This is a breaking change**
99
+
100
+ Before this change the style info is dump in Javascript code.
101
+
102
+ After this change the style info will be pure JSON data.
103
+
104
+ Now we're using the css-serializer tool's output only. If you're using plugins for it, now they're enabled.
105
+
106
+ ### Patch Changes
107
+
108
+ - @lynx-js/web-worker-rpc@0.6.0
109
+
110
+ ## 0.5.1
111
+
112
+ ### Patch Changes
113
+
114
+ - c49b1fb: feat: updateData api needs to have the correct format, now you can pass a callback.
115
+ - b5ef20e: feat: updateData should also call `updatePage` in main-thread.
116
+ - @lynx-js/web-worker-rpc@0.5.1
117
+
118
+ ## 0.5.0
119
+
120
+ ### Minor Changes
121
+
122
+ - 7b84edf: feat: introduce new output chunk format
123
+
124
+ **This is a breaking change**
125
+
126
+ After this commit, we new introduce a new output format for web platform.
127
+
128
+ This new output file is a JSON file, includes all essential info.
129
+
130
+ Now we'll add the chunk global scope wrapper on runtime, this will help us to provide a better backward compatibility.
131
+
132
+ Also we have a intergrated output file cache for one session.
133
+
134
+ Now your `output.filename` will work.
135
+
136
+ The split-chunk feature has been temporary removed until the rspeedy team supports this feature for us.
137
+
138
+ ### Patch Changes
139
+
140
+ - 3050faf: refractor: housekeeping
141
+ - Updated dependencies [04607bd]
142
+ - Updated dependencies [e0f0793]
143
+ - @lynx-js/web-worker-rpc@0.5.0
144
+
145
+ ## 0.4.2
146
+
147
+ ### Patch Changes
148
+
149
+ - 168b4fa: feat: rename CloneableObject to Cloneable, Now its type refers to a structure that can be cloned; CloneableObject type is added, which only refers to object types that can be cloned.
150
+
151
+ ## 0.4.1
152
+
153
+ ## 0.4.0
154
+
155
+ ## 0.3.1
156
+
157
+ ## 0.3.0
158
+
159
+ ### Minor Changes
160
+
161
+ - 267c935: feat: make cardType could be configurable
162
+
163
+ ### Patch Changes
164
+
165
+ - 6e873bc: fix: incorrect parent component id value on publishComponentEvent
166
+
167
+ ## 0.2.0
168
+
169
+ ## 0.1.0
170
+
171
+ ### Minor Changes
172
+
173
+ - 2973ba5: chore: add common constants
package/LICENSE.txt ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2023-2024 The Lynx Authors.
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/Notice.txt ADDED
@@ -0,0 +1 @@
1
+ Copyright 2023-2024 The Lynx Authors. All rights reserved.
package/README.md ADDED
@@ -0,0 +1,9 @@
1
+ # @lynx-js/web-constants
2
+
3
+ A common dependency library that defines constants for the Lynx3 Web Platform.
4
+
5
+ ## Usage
6
+
7
+ ```javascript
8
+ import { cardIdAttribute, lynxViewRootDomId }'@lynx-js/web-constants';
9
+ ```
@@ -0,0 +1,11 @@
1
+ export declare const lynxUniqueIdAttribute: "lynx-unique-id";
2
+ export declare const cssIdAttribute: "lynx-css-id";
3
+ export declare const componentIdAttribute: "lynx-component-id";
4
+ export declare const parentComponentUniqueIdAttribute: "lynx-parent-component-uid";
5
+ export declare const cardIdAttribute: "lynx-card-id";
6
+ export declare const lynxTagAttribute: "lynx-tag";
7
+ export declare const lynxRuntimeValue: unique symbol;
8
+ export declare const lynxDefaultDisplayLinearAttribute: "lynx-default-display-linear";
9
+ export declare const lynxViewRootDomId: "lynx-view-root";
10
+ export declare const __lynx_timing_flag: "__lynx_timing_flag";
11
+ export declare const lynxViewEntryIdPrefix = "lynx-view-id";
@@ -0,0 +1,15 @@
1
+ // Copyright 2023 The Lynx Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+ export const lynxUniqueIdAttribute = 'lynx-unique-id';
5
+ export const cssIdAttribute = 'lynx-css-id';
6
+ export const componentIdAttribute = 'lynx-component-id';
7
+ export const parentComponentUniqueIdAttribute = 'lynx-parent-component-uid';
8
+ export const cardIdAttribute = 'lynx-card-id';
9
+ export const lynxTagAttribute = 'lynx-tag';
10
+ export const lynxRuntimeValue = Symbol('lynx-runtime-value');
11
+ export const lynxDefaultDisplayLinearAttribute = 'lynx-default-display-linear';
12
+ export const lynxViewRootDomId = 'lynx-view-root';
13
+ export const __lynx_timing_flag = '__lynx_timing_flag';
14
+ export const lynxViewEntryIdPrefix = 'lynx-view-id';
15
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1,59 @@
1
+ import type { ExposureWorkerEvent, LynxCrossThreadEvent } from './types/EventType.js';
2
+ import type { Cloneable, CloneableObject } from './types/Cloneable.js';
3
+ import type { MainThreadStartConfigs } from './types/MainThreadStartConfigs.js';
4
+ import type { LynxLifecycleEvent } from './types/LynxLifecycleEvent.js';
5
+ import type { ElementOperation, FlushElementTreeOptions } from './types/ElementOperation.js';
6
+ import type { PageConfig } from './types/PageConfig.js';
7
+ import type { IdentifierType, InvokeCallbackRes } from './types/NativeApp.js';
8
+ import type { LynxTemplate } from './types/LynxModule.js';
9
+ export declare const postExposureEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsyncVoid<[{
10
+ exposures: ExposureWorkerEvent[];
11
+ disExposures: ExposureWorkerEvent[];
12
+ }]>;
13
+ export declare const publicComponentEventEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsyncVoid<[string, string, LynxCrossThreadEvent<{
14
+ [key: string]: string | number | null | undefined;
15
+ }>]>;
16
+ export declare const publishEventEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsyncVoid<[string, LynxCrossThreadEvent<{
17
+ [key: string]: string | number | null | undefined;
18
+ }>]>;
19
+ export declare const postMainThreadEvent: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsyncVoid<[LynxCrossThreadEvent<{
20
+ [key: string]: string | number | null | undefined;
21
+ }>]>;
22
+ export declare const switchExposureService: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsyncVoid<[boolean, boolean]>;
23
+ export declare const mainThreadStartEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsyncVoid<[MainThreadStartConfigs]>;
24
+ export declare const updateDataEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsync<[Cloneable, Record<string, string>], void>;
25
+ export declare const sendGlobalEventEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsyncVoid<[string, Cloneable[] | undefined]>;
26
+ export declare const disposeEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsync<[], void>;
27
+ export declare const postTimingResult: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsyncVoid<[pipelineId: string | undefined, updateTimingStamps: Record<string, number>, timingFlags: string[], setupTimingStamps: Record<string, number> | undefined]>;
28
+ export declare const uiThreadFpReadyEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsyncVoid<[]>;
29
+ export declare const onLifecycleEventEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsyncVoid<[LynxLifecycleEvent]>;
30
+ export declare const BackgroundThreadStartEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsync<[{
31
+ initData: unknown;
32
+ globalProps: unknown;
33
+ template: LynxTemplate;
34
+ cardType: string;
35
+ customSections: Record<string, Cloneable>;
36
+ nativeModulesUrl?: string;
37
+ }], void>;
38
+ export declare const loadNewTagEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsync<[tag: string], void>;
39
+ /**
40
+ * threadLabel, Error message, info
41
+ */
42
+ export declare const reportErrorEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsync<[string, string, unknown], void>;
43
+ export declare const flushElementTreeEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsync<[operations: ElementOperation[], FlushElementTreeOptions, styleContent: string | undefined], void>;
44
+ export declare const mainThreadChunkReadyEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsyncVoid<[{
45
+ pageConfig: PageConfig;
46
+ }]>;
47
+ export declare const postTimingInfoFromMainThread: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsyncVoid<[timingKey: string, pipelineId: string | undefined, timeStamp: number]>;
48
+ export declare const callLepusMethodEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsync<[name: string, data: unknown], void>;
49
+ export declare const invokeUIMethodEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsync<[type: IdentifierType, identifier: string, component_id: string, method: string, params: object, root_unique_id: number | undefined], InvokeCallbackRes>;
50
+ export declare const setNativePropsEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsync<[type: IdentifierType, identifier: string, component_id: string, first_only: boolean, native_props: object, root_unique_id: number | undefined], void>;
51
+ export declare const nativeModulesCallEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsync<[name: string, data: Cloneable, moduleName: string], any>;
52
+ export declare const getCustomSectionsEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsync<[string], Cloneable>;
53
+ export declare const postTimingInfoFromBackgroundThread: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsyncVoid<[timingKey: string, pipelineId: string | undefined, timeStamp: number]>;
54
+ export declare const triggerComponentEventEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsyncVoid<[id: string, params: {
55
+ eventDetail: CloneableObject;
56
+ eventOption: CloneableObject;
57
+ componentId: string;
58
+ }]>;
59
+ export declare const selectComponentEndpoint: import("@lynx-js/web-worker-rpc/dist/RpcEndpoint.js").RpcEndpointAsync<[componentId: string, idSelector: string, single: boolean], void>;
@@ -0,0 +1,34 @@
1
+ // Copyright 2023 The Lynx Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+ import { createRpcEndpoint } from '@lynx-js/web-worker-rpc';
5
+ export const postExposureEndpoint = createRpcEndpoint('__postExposure', false, false);
6
+ export const publicComponentEventEndpoint = createRpcEndpoint('publicComponentEvent', false, false);
7
+ export const publishEventEndpoint = createRpcEndpoint('publishEvent', false, false);
8
+ export const postMainThreadEvent = createRpcEndpoint('postMainThreadEvent', false, false);
9
+ export const switchExposureService = createRpcEndpoint('__switchExposureService', false, false);
10
+ export const mainThreadStartEndpoint = createRpcEndpoint('mainThreadStart', false, false);
11
+ export const updateDataEndpoint = createRpcEndpoint('updateData', false, true);
12
+ export const sendGlobalEventEndpoint = createRpcEndpoint('sendGlobalEventEndpoint', false, false);
13
+ export const disposeEndpoint = createRpcEndpoint('dispose', false, true);
14
+ export const postTimingResult = createRpcEndpoint('postTimingResult', false, false);
15
+ export const uiThreadFpReadyEndpoint = createRpcEndpoint('uiThreadFpReady', false, false);
16
+ export const onLifecycleEventEndpoint = createRpcEndpoint('__OnLifecycleEvent', false, false);
17
+ export const BackgroundThreadStartEndpoint = createRpcEndpoint('start', false, true);
18
+ export const loadNewTagEndpoint = createRpcEndpoint('loadNewTag', false, true);
19
+ /**
20
+ * threadLabel, Error message, info
21
+ */
22
+ export const reportErrorEndpoint = createRpcEndpoint('reportError', false, true);
23
+ export const flushElementTreeEndpoint = createRpcEndpoint('flushElementTree', false, true);
24
+ export const mainThreadChunkReadyEndpoint = createRpcEndpoint('mainThreadChunkReady', false, false);
25
+ export const postTimingInfoFromMainThread = createRpcEndpoint('postTimingInfoFromMainThread', false, false);
26
+ export const callLepusMethodEndpoint = createRpcEndpoint('callLepusMethod', false, true);
27
+ export const invokeUIMethodEndpoint = createRpcEndpoint('__invokeUIMethod', false, true);
28
+ export const setNativePropsEndpoint = createRpcEndpoint('__setNativeProps', false, true);
29
+ export const nativeModulesCallEndpoint = createRpcEndpoint('nativeModulesCall', false, true);
30
+ export const getCustomSectionsEndpoint = createRpcEndpoint('getCustomSections', false, true);
31
+ export const postTimingInfoFromBackgroundThread = createRpcEndpoint('postTimingInfoFromBackgroundThread', false, false);
32
+ export const triggerComponentEventEndpoint = createRpcEndpoint('__triggerComponentEvent', false, false);
33
+ export const selectComponentEndpoint = createRpcEndpoint('__selectComponent', false, true);
34
+ //# sourceMappingURL=endpoints.js.map
@@ -0,0 +1,3 @@
1
+ export declare const W3cEventNameToLynx: Record<string, string>;
2
+ export declare const LynxEventNameToW3cByTagName: Record<string, Record<string, string>>;
3
+ export declare const LynxEventNameToW3cCommon: Record<string, string>;
@@ -0,0 +1,28 @@
1
+ // Copyright 2023 The Lynx Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+ export const W3cEventNameToLynx = {
5
+ click: 'tap',
6
+ lynxscroll: 'scroll',
7
+ lynxscrollend: 'scrollend',
8
+ overlaytouch: 'touch',
9
+ lynxfocus: 'focus',
10
+ lynxblur: 'blur',
11
+ };
12
+ export const LynxEventNameToW3cByTagName = {
13
+ 'X-INPUT': {
14
+ 'blur': 'lynxblur',
15
+ 'focus': 'lynxfocus',
16
+ },
17
+ 'X-TEXTAREA': {
18
+ 'blur': 'lynxblur',
19
+ 'focus': 'lynxfocus',
20
+ },
21
+ };
22
+ export const LynxEventNameToW3cCommon = {
23
+ tap: 'click',
24
+ scroll: 'lynxscroll',
25
+ scrollend: 'lynxscrollend',
26
+ touch: 'overlaytouch',
27
+ };
28
+ //# sourceMappingURL=eventName.js.map
@@ -0,0 +1,4 @@
1
+ export * from './constants.js';
2
+ export * from './eventName.js';
3
+ export * from './endpoints.js';
4
+ export * from './types/index.js';
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ // Copyright 2023 The Lynx Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+ export * from './constants.js';
5
+ export * from './eventName.js';
6
+ export * from './endpoints.js';
7
+ export * from './types/index.js';
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ export type Cloneable<T = string | number | null | undefined> = T | Record<string, T>;
2
+ export type CloneableObject<T = string | number | null | undefined> = Record<string, T>;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Cloneable.js.map
@@ -0,0 +1,119 @@
1
+ import type { Cloneable } from './Cloneable.js';
2
+ import type { LynxEventType } from './EventType.js';
3
+ import type { PerformancePipelineOptions } from './Performance.js';
4
+ export interface FlushElementTreeOptions {
5
+ pipelineOptions?: PerformancePipelineOptions;
6
+ }
7
+ export declare enum OperationType {
8
+ Create = 0,
9
+ SetAttribute = 1,
10
+ SetProperty = 2,
11
+ SwapElement = 3,
12
+ Append = 4,
13
+ Remove = 5,
14
+ Replace = 6,
15
+ SetDatasetProperty = 7,
16
+ InsertBefore = 8,
17
+ SetStyleProperty = 9,
18
+ UpdateCssInJs = 10,
19
+ RegisterEventHandler = 11
20
+ }
21
+ interface ElementOperationBase {
22
+ type: OperationType;
23
+ /**
24
+ * uniqueId
25
+ */
26
+ uid: number;
27
+ }
28
+ export interface CreateOperation extends ElementOperationBase {
29
+ type: OperationType.Create;
30
+ tag: string;
31
+ cssId?: number;
32
+ /**
33
+ * parent component unique id
34
+ */
35
+ puid: string;
36
+ }
37
+ export interface SetAttributeOperation extends ElementOperationBase {
38
+ type: OperationType.SetAttribute;
39
+ key: string;
40
+ value: string | null;
41
+ }
42
+ export interface SetPropertyOperation extends ElementOperationBase {
43
+ type: OperationType.SetProperty;
44
+ /**
45
+ * property name
46
+ */
47
+ key: string;
48
+ value: Cloneable;
49
+ }
50
+ export interface SwapOperation extends ElementOperationBase {
51
+ type: OperationType.SwapElement;
52
+ /**
53
+ * target uniqueId
54
+ */
55
+ tid: number;
56
+ }
57
+ export interface AppendOperation extends ElementOperationBase {
58
+ type: OperationType.Append;
59
+ /**
60
+ * child uniqueId
61
+ */
62
+ cid: number[];
63
+ }
64
+ export interface RemoveOperation extends ElementOperationBase {
65
+ type: OperationType.Remove;
66
+ cid: number[];
67
+ }
68
+ export interface SetDatasetPropertyOperation extends ElementOperationBase {
69
+ type: OperationType.SetDatasetProperty;
70
+ /**
71
+ * propert name in dataset
72
+ */
73
+ key: string;
74
+ value: Cloneable;
75
+ }
76
+ export interface InsertBeforeOperation extends ElementOperationBase {
77
+ type: OperationType.InsertBefore;
78
+ /**
79
+ * child uniqueId
80
+ */
81
+ cid: number;
82
+ ref?: number;
83
+ }
84
+ export interface ReplaceOperation extends ElementOperationBase {
85
+ type: OperationType.Replace;
86
+ /**
87
+ * the new element's unique id.
88
+ */
89
+ nid: number[];
90
+ }
91
+ export interface UpdateCssInJsOperation extends ElementOperationBase {
92
+ type: OperationType.UpdateCssInJs;
93
+ classStyleStr: string;
94
+ }
95
+ export interface SetStylePropertyOperation extends ElementOperationBase {
96
+ type: OperationType.SetStyleProperty;
97
+ key: string;
98
+ value: string | null;
99
+ /**
100
+ * important
101
+ */
102
+ im?: boolean;
103
+ }
104
+ export interface RegisterEventHandlerOperation extends ElementOperationBase {
105
+ type: OperationType.RegisterEventHandler;
106
+ eventType: LynxEventType;
107
+ /**
108
+ * lynx event name
109
+ */
110
+ ename: string;
111
+ /**
112
+ * If it's a background thread hander, it will have a handler name.
113
+ * If it's a main-thread handler, it will be null
114
+ * If it's going to be removed, it will be undefined
115
+ */
116
+ hname: string | undefined | null;
117
+ }
118
+ export type ElementOperation = RegisterEventHandlerOperation | SetStylePropertyOperation | UpdateCssInJsOperation | ReplaceOperation | InsertBeforeOperation | SetDatasetPropertyOperation | CreateOperation | SetAttributeOperation | SetPropertyOperation | SwapOperation | AppendOperation | RemoveOperation;
119
+ export {};
@@ -0,0 +1,16 @@
1
+ export var OperationType;
2
+ (function (OperationType) {
3
+ OperationType[OperationType["Create"] = 0] = "Create";
4
+ OperationType[OperationType["SetAttribute"] = 1] = "SetAttribute";
5
+ OperationType[OperationType["SetProperty"] = 2] = "SetProperty";
6
+ OperationType[OperationType["SwapElement"] = 3] = "SwapElement";
7
+ OperationType[OperationType["Append"] = 4] = "Append";
8
+ OperationType[OperationType["Remove"] = 5] = "Remove";
9
+ OperationType[OperationType["Replace"] = 6] = "Replace";
10
+ OperationType[OperationType["SetDatasetProperty"] = 7] = "SetDatasetProperty";
11
+ OperationType[OperationType["InsertBefore"] = 8] = "InsertBefore";
12
+ OperationType[OperationType["SetStyleProperty"] = 9] = "SetStyleProperty";
13
+ OperationType[OperationType["UpdateCssInJs"] = 10] = "UpdateCssInJs";
14
+ OperationType[OperationType["RegisterEventHandler"] = 11] = "RegisterEventHandler";
15
+ })(OperationType || (OperationType = {}));
16
+ //# sourceMappingURL=ElementOperation.js.map
@@ -0,0 +1,30 @@
1
+ import type { Cloneable } from './Cloneable.js';
2
+ export type LynxEventType = 'bindEvent' | 'catchEvent' | 'capture-bind' | 'capture-catch';
3
+ export interface LynxCrossThreadEventTarget {
4
+ dataset: {
5
+ [key: string]: Cloneable;
6
+ };
7
+ id?: string;
8
+ uniqueId: number;
9
+ }
10
+ export interface LynxCrossThreadEvent<T = {
11
+ [key: string]: string | number | undefined | null;
12
+ }> {
13
+ type: string;
14
+ timestamp: number;
15
+ target: LynxCrossThreadEventTarget;
16
+ currentTarget: LynxCrossThreadEventTarget;
17
+ detail: T;
18
+ [key: string]: string | number | undefined | null | {};
19
+ }
20
+ export type ExposureEventDetail = {
21
+ 'exposure-id': string;
22
+ 'exposure-scene': string;
23
+ exposureID: string;
24
+ exposureScene: string;
25
+ 'unique-id': number;
26
+ };
27
+ export type ExposureEvent = {
28
+ detail: ExposureEventDetail;
29
+ };
30
+ export type ExposureWorkerEvent = LynxCrossThreadEvent<ExposureEventDetail> & ExposureEventDetail;
@@ -0,0 +1,5 @@
1
+ // Copyright 2023 The Lynx Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+ export {};
5
+ //# sourceMappingURL=EventType.js.map
@@ -0,0 +1 @@
1
+ export type LynxLifecycleEvent = [eventName: string, params: unknown];
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=LynxLifecycleEvent.js.map
@@ -0,0 +1,25 @@
1
+ import type { Cloneable } from './Cloneable.js';
2
+ import type { PageConfig } from './PageConfig.js';
3
+ import type { StyleInfo } from './StyleInfo.js';
4
+ export interface LynxTemplate {
5
+ styleInfo: StyleInfo;
6
+ pageConfig: PageConfig;
7
+ customSections: {
8
+ [key: string]: {
9
+ type?: 'lazy';
10
+ content: Cloneable;
11
+ };
12
+ };
13
+ cardType?: string;
14
+ lepusCode: {
15
+ root: string;
16
+ [key: string]: string;
17
+ };
18
+ manifest: {
19
+ '/app-service.js': string;
20
+ [key: string]: string;
21
+ };
22
+ }
23
+ export interface LynxJSModule {
24
+ exports?: (lynx_runtime: any) => unknown;
25
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=LynxModule.js.map
@@ -0,0 +1,11 @@
1
+ import type { Cloneable } from './Cloneable.js';
2
+ import type { LynxTemplate } from './LynxModule.js';
3
+ import type { BrowserConfig } from './PageConfig.js';
4
+ export interface MainThreadStartConfigs {
5
+ template: LynxTemplate;
6
+ initData: Cloneable;
7
+ globalProps: Cloneable;
8
+ entryId: string;
9
+ browserConfig: BrowserConfig;
10
+ nativeModulesUrl?: string;
11
+ }
@@ -0,0 +1,5 @@
1
+ // Copyright 2023 The Lynx Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+ export {};
5
+ //# sourceMappingURL=MainThreadStartConfigs.js.map
@@ -0,0 +1,104 @@
1
+ import type { CloneableObject } from './Cloneable.js';
2
+ import type { PerformancePipelineOptions } from './Performance.js';
3
+ export declare const enum IdentifierType {
4
+ ID_SELECTOR = 0,// css selector
5
+ /**
6
+ * @deprecated
7
+ */
8
+ REF_ID = 1,
9
+ UNIQUE_ID = 2
10
+ }
11
+ export type LynxKernelInject = {
12
+ init: (opt: {
13
+ tt: LynxKernelInject;
14
+ }) => void;
15
+ buildVersion?: string;
16
+ };
17
+ export interface EventEmitter {
18
+ addListener(eventName: string, listener: (...args: unknown[]) => void, context?: object): void;
19
+ removeListener(eventName: string, listener: (...args: unknown[]) => void): void;
20
+ emit(eventName: string, data: unknown): void;
21
+ removeAllListeners(eventName?: string): void;
22
+ trigger(eventName: string, params: string | Record<any, any>): void;
23
+ toggle(eventName: string, ...data: unknown[]): void;
24
+ }
25
+ export type NativeTTObject = {
26
+ lynx: unknown;
27
+ OnLifecycleEvent: (...args: unknown[]) => void;
28
+ publicComponentEvent(componentId: string, handlerName: string, eventData?: unknown): void;
29
+ publishEvent(handlerName: string, data?: unknown): void;
30
+ GlobalEventEmitter: EventEmitter;
31
+ lynxCoreInject: any;
32
+ updateCardData: (newData: Record<string, any>, options?: Record<string, any>) => void;
33
+ onNativeAppReady: () => void;
34
+ globalThis?: {
35
+ tt: NativeTTObject;
36
+ };
37
+ };
38
+ export type BundleInitReturnObj = {
39
+ /**
40
+ * On the web platform
41
+ * @param opt
42
+ * @returns
43
+ */
44
+ init: (opt: {
45
+ tt: NativeTTObject;
46
+ }) => unknown;
47
+ buildVersion?: string;
48
+ };
49
+ /**
50
+ * const enum will be shakedown in Typescript Compiler
51
+ */
52
+ export declare const enum ErrorCode {
53
+ SUCCESS = 0,
54
+ UNKNOWN = 1,
55
+ NODE_NOT_FOUND = 2,
56
+ METHOD_NOT_FOUND = 3,
57
+ PARAM_INVALID = 4,
58
+ SELECTOR_NOT_SUPPORTED = 5,
59
+ NO_UI_FOR_NODE = 6
60
+ }
61
+ export interface InvokeCallbackRes {
62
+ code: ErrorCode;
63
+ data?: string;
64
+ }
65
+ export declare enum DispatchEventResult {
66
+ NotCanceled = 0,
67
+ CanceledByEventHandler = 1,
68
+ CanceledByDefaultEventHandler = 2,
69
+ CanceledBeforeDispatch = 3
70
+ }
71
+ export interface ContextProxy {
72
+ onTriggerEvent?: (event: MessageEvent) => void;
73
+ postMessage(message: any): void;
74
+ dispatchEvent(event: MessageEvent): DispatchEventResult;
75
+ addEventListener(type: string, listener: (event: MessageEvent) => void): void;
76
+ removeEventListener(type: string, listener: (event: MessageEvent) => void): void;
77
+ }
78
+ export interface NativeApp {
79
+ id: string;
80
+ callLepusMethod(name: string, data: unknown, callback: (ret: unknown) => void): void;
81
+ setTimeout: typeof setTimeout;
82
+ setInterval: typeof setInterval;
83
+ clearTimeout: typeof clearTimeout;
84
+ clearInterval: typeof clearInterval;
85
+ requestAnimationFrame: (cb: () => void) => void;
86
+ cancelAnimationFrame: (id: number) => void;
87
+ loadScript: (sourceURL: string) => BundleInitReturnObj;
88
+ loadScriptAsync(sourceURL: string, callback: (message: string | null, exports?: BundleInitReturnObj) => void): void;
89
+ nativeModuleProxy: Record<string, any>;
90
+ setNativeProps: (type: IdentifierType, identifier: string, component_id: string, first_only: boolean, native_props: Record<string, unknown>, root_unique_id: number | undefined) => void;
91
+ invokeUIMethod: (type: IdentifierType, identifier: string, component_id: string, method: string, params: object, callback: (ret: InvokeCallbackRes) => void, root_unique_id: number) => void;
92
+ setCard(tt: NativeTTObject): void;
93
+ generatePipelineOptions: () => PerformancePipelineOptions;
94
+ onPipelineStart: (pipeline_id: string) => void;
95
+ markPipelineTiming: (pipeline_id: string, timing_key: string) => void;
96
+ bindPipelineIdWithTimingFlag: (pipeline_id: string, timing_flag: string) => void;
97
+ triggerComponentEvent(id: string, params: {
98
+ eventDetail: CloneableObject;
99
+ eventOption: CloneableObject;
100
+ componentId: string;
101
+ }): void;
102
+ selectComponent(componentId: string, idSelector: string, single: boolean, callback?: () => void): void;
103
+ createJSObjectDestructionObserver(callback: (...args: unknown[]) => unknown): {};
104
+ }
@@ -0,0 +1,45 @@
1
+ // Copyright 2023 The Lynx Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+ export var IdentifierType;
5
+ (function (IdentifierType) {
6
+ IdentifierType[IdentifierType["ID_SELECTOR"] = 0] = "ID_SELECTOR";
7
+ /**
8
+ * @deprecated
9
+ */
10
+ IdentifierType[IdentifierType["REF_ID"] = 1] = "REF_ID";
11
+ IdentifierType[IdentifierType["UNIQUE_ID"] = 2] = "UNIQUE_ID";
12
+ })(IdentifierType || (IdentifierType = {}));
13
+ /**
14
+ * const enum will be shakedown in Typescript Compiler
15
+ */
16
+ export var ErrorCode;
17
+ (function (ErrorCode) {
18
+ ErrorCode[ErrorCode["SUCCESS"] = 0] = "SUCCESS";
19
+ ErrorCode[ErrorCode["UNKNOWN"] = 1] = "UNKNOWN";
20
+ ErrorCode[ErrorCode["NODE_NOT_FOUND"] = 2] = "NODE_NOT_FOUND";
21
+ ErrorCode[ErrorCode["METHOD_NOT_FOUND"] = 3] = "METHOD_NOT_FOUND";
22
+ ErrorCode[ErrorCode["PARAM_INVALID"] = 4] = "PARAM_INVALID";
23
+ ErrorCode[ErrorCode["SELECTOR_NOT_SUPPORTED"] = 5] = "SELECTOR_NOT_SUPPORTED";
24
+ ErrorCode[ErrorCode["NO_UI_FOR_NODE"] = 6] = "NO_UI_FOR_NODE";
25
+ })(ErrorCode || (ErrorCode = {}));
26
+ export var DispatchEventResult;
27
+ (function (DispatchEventResult) {
28
+ // Event was not canceled by event handler or default event handler.
29
+ DispatchEventResult[DispatchEventResult["NotCanceled"] = 0] = "NotCanceled";
30
+ // Event was canceled by event handler; i.e. a script handler calling
31
+ // preventDefault.
32
+ DispatchEventResult[DispatchEventResult["CanceledByEventHandler"] = 1] = "CanceledByEventHandler";
33
+ // Event was canceled by the default event handler; i.e. executing the default
34
+ // action. This result should be used sparingly as it deviates from the DOM
35
+ // Event Dispatch model. Default event handlers really shouldn't be invoked
36
+ // inside of dispatch.
37
+ DispatchEventResult[DispatchEventResult["CanceledByDefaultEventHandler"] = 2] = "CanceledByDefaultEventHandler";
38
+ // Event was canceled but suppressed before dispatched to event handler. This
39
+ // result should be used sparingly; and its usage likely indicates there is
40
+ // potential for a bug. Trusted events may return this code; but untrusted
41
+ // events likely should always execute the event handler the developer intends
42
+ // to execute.
43
+ DispatchEventResult[DispatchEventResult["CanceledBeforeDispatch"] = 3] = "CanceledBeforeDispatch";
44
+ })(DispatchEventResult || (DispatchEventResult = {}));
45
+ //# sourceMappingURL=NativeApp.js.map
@@ -0,0 +1,11 @@
1
+ import type { Cloneable } from './Cloneable.js';
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
+ };
@@ -0,0 +1,5 @@
1
+ // Copyright 2023 The Lynx Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+ export {};
5
+ //# sourceMappingURL=NativeModules.js.map
@@ -0,0 +1,8 @@
1
+ export interface PageConfig {
2
+ enableCSSSelector: boolean;
3
+ enableRemoveCSSScope: boolean;
4
+ defaultDisplayLinear: boolean;
5
+ }
6
+ export interface BrowserConfig {
7
+ supportAtScope: boolean;
8
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=PageConfig.js.map
@@ -0,0 +1,27 @@
1
+ export interface SetupTimingInfo {
2
+ [key: string]: unknown;
3
+ }
4
+ export interface UpdateTimingInfo {
5
+ [key: string]: unknown;
6
+ }
7
+ export interface ExtraTimingInfo {
8
+ [key: string]: unknown;
9
+ }
10
+ export interface MetricsTimingInfo {
11
+ }
12
+ export interface TimingInfo {
13
+ extra_timing: ExtraTimingInfo;
14
+ setup_timing: SetupTimingInfo;
15
+ update_timings: {
16
+ [key: string]: UpdateTimingInfo;
17
+ };
18
+ metrics: MetricsTimingInfo;
19
+ has_reload: boolean;
20
+ thread_strategy: number;
21
+ url: string;
22
+ [key: string]: unknown;
23
+ }
24
+ export interface PerformancePipelineOptions {
25
+ pipelineID: string;
26
+ needTimestamps: boolean;
27
+ }
@@ -0,0 +1,5 @@
1
+ // Copyright 2024 The Lynx Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+ export {};
5
+ //# sourceMappingURL=Performance.js.map
@@ -0,0 +1 @@
1
+ export type ProcessDataCallback = (data: any, processorName?: string) => any;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ProcessDataCallback.js.map
@@ -0,0 +1,21 @@
1
+ export interface CSSRule {
2
+ sel: [
3
+ plainSelectors: string[],
4
+ pseudoClassSelectors: string[],
5
+ pseudoElementSelectors: string[]
6
+ ][];
7
+ decl: [string, string][];
8
+ }
9
+ export interface OneInfo {
10
+ content: string[];
11
+ rules: CSSRule[];
12
+ imports?: string[];
13
+ }
14
+ export interface StyleInfo {
15
+ [cssId: string]: OneInfo;
16
+ }
17
+ export interface CssInJsInfo {
18
+ [cssId: string]: {
19
+ [className: string]: [string, string][];
20
+ };
21
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=StyleInfo.js.map
@@ -0,0 +1,14 @@
1
+ export declare const enum NativeUpdateDataType {
2
+ UPDATE = 0,
3
+ RESET = 1
4
+ }
5
+ export declare const enum UpdateDataType {
6
+ Unknown = 0,
7
+ UpdateExplictByUser = 1,
8
+ UpdateByKernelFromCtor = 2,
9
+ UpdateByKernelFromRender = 4,
10
+ UpdateByKernelFromHydrate = 8,
11
+ UpdateByKernelFromGetDerived = 16,
12
+ UpdateByKernelFromConflict = 32,
13
+ UpdateByKernelFromHMR = 64
14
+ }
@@ -0,0 +1,25 @@
1
+ export var NativeUpdateDataType;
2
+ (function (NativeUpdateDataType) {
3
+ NativeUpdateDataType[NativeUpdateDataType["UPDATE"] = 0] = "UPDATE";
4
+ NativeUpdateDataType[NativeUpdateDataType["RESET"] = 1] = "RESET";
5
+ })(NativeUpdateDataType || (NativeUpdateDataType = {}));
6
+ export var UpdateDataType;
7
+ (function (UpdateDataType) {
8
+ // default
9
+ UpdateDataType[UpdateDataType["Unknown"] = 0] = "Unknown";
10
+ // update by `setState` or `setData`
11
+ UpdateDataType[UpdateDataType["UpdateExplictByUser"] = 1] = "UpdateExplictByUser";
12
+ // update by lynx_core from ctor
13
+ UpdateDataType[UpdateDataType["UpdateByKernelFromCtor"] = 2] = "UpdateByKernelFromCtor";
14
+ // update by lynx_core from render
15
+ UpdateDataType[UpdateDataType["UpdateByKernelFromRender"] = 4] = "UpdateByKernelFromRender";
16
+ // update by hydrate
17
+ UpdateDataType[UpdateDataType["UpdateByKernelFromHydrate"] = 8] = "UpdateByKernelFromHydrate";
18
+ // update by `getDerivedStateFromProps`
19
+ UpdateDataType[UpdateDataType["UpdateByKernelFromGetDerived"] = 16] = "UpdateByKernelFromGetDerived";
20
+ // update by conflict detected
21
+ UpdateDataType[UpdateDataType["UpdateByKernelFromConflict"] = 32] = "UpdateByKernelFromConflict";
22
+ // update by HMR
23
+ UpdateDataType[UpdateDataType["UpdateByKernelFromHMR"] = 64] = "UpdateByKernelFromHMR";
24
+ })(UpdateDataType || (UpdateDataType = {}));
25
+ //# sourceMappingURL=UpdateDataOptions.js.map
@@ -0,0 +1,13 @@
1
+ export * from './StyleInfo.js';
2
+ export * from './EventType.js';
3
+ export * from './ElementOperation.js';
4
+ export * from './PageConfig.js';
5
+ export * from './Cloneable.js';
6
+ export * from './LynxModule.js';
7
+ export * from './LynxLifecycleEvent.js';
8
+ export * from './ProcessDataCallback.js';
9
+ export * from './Performance.js';
10
+ export * from './MainThreadStartConfigs.js';
11
+ export * from './NativeApp.js';
12
+ export * from './UpdateDataOptions.js';
13
+ export * from './NativeModules.js';
@@ -0,0 +1,14 @@
1
+ export * from './StyleInfo.js';
2
+ export * from './EventType.js';
3
+ export * from './ElementOperation.js';
4
+ export * from './PageConfig.js';
5
+ export * from './Cloneable.js';
6
+ export * from './LynxModule.js';
7
+ export * from './LynxLifecycleEvent.js';
8
+ export * from './ProcessDataCallback.js';
9
+ export * from './Performance.js';
10
+ export * from './MainThreadStartConfigs.js';
11
+ export * from './NativeApp.js';
12
+ export * from './UpdateDataOptions.js';
13
+ export * from './NativeModules.js';
14
+ //# sourceMappingURL=index.js.map
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@lynx-js/web-constants",
3
+ "version": "0.7.0",
4
+ "private": false,
5
+ "description": "",
6
+ "keywords": [],
7
+ "license": "Apache-2.0",
8
+ "type": "module",
9
+ "main": "dist/index.js",
10
+ "typings": "dist/index.d.ts",
11
+ "files": [
12
+ "dist",
13
+ "!dist/**/*.js.map",
14
+ "LICENSE.txt",
15
+ "Notice.txt",
16
+ "CHANGELOG.md",
17
+ "README.md",
18
+ "**/*.css"
19
+ ],
20
+ "dependencies": {
21
+ "@lynx-js/web-worker-rpc": "0.7.0"
22
+ }
23
+ }