@lynx-js/web-core-wasm-canary 0.0.0 → 0.0.1-canary-20260116-ce265e8f
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 +8 -0
- package/{LICENSE → LICENSE.txt} +1 -1
- package/Notice.txt +1 -0
- package/README.md +1 -0
- package/binary/client/client.d.ts +263 -0
- package/binary/client/client.js +1339 -0
- package/binary/client/client_bg.wasm +0 -0
- package/binary/client/client_bg.wasm.d.ts +70 -0
- package/binary/client/client_debug.d.ts +263 -0
- package/binary/client/client_debug.js +1339 -0
- package/binary/client/client_debug_bg.wasm +0 -0
- package/binary/client/client_debug_bg.wasm.d.ts +70 -0
- package/binary/encode/encode.d.ts +157 -0
- package/binary/encode/encode.js +17 -0
- package/binary/encode/encode_bg.js +749 -0
- package/binary/encode/encode_bg.wasm +0 -0
- package/binary/encode/encode_bg.wasm.d.ts +50 -0
- package/binary/encode/encode_debug.d.ts +157 -0
- package/binary/encode/encode_debug.js +17 -0
- package/binary/encode/encode_debug_bg.js +822 -0
- package/binary/encode/encode_debug_bg.wasm +0 -0
- package/binary/encode/encode_debug_bg.wasm.d.ts +50 -0
- package/binary/encode/package.json +4 -0
- package/css/in_shadow.css +10 -0
- package/css/index.css +119 -0
- package/dist/client/LynxCrossThreadContext.d.ts +22 -0
- package/dist/client/LynxCrossThreadContext.js +44 -0
- package/dist/client/background/background-apis/createBackgroundLynx.d.ts +24 -0
- package/dist/client/background/background-apis/createBackgroundLynx.js +38 -0
- package/dist/client/background/background-apis/createChunkLoading.d.ts +7 -0
- package/dist/client/background/background-apis/createChunkLoading.js +66 -0
- package/dist/client/background/background-apis/createElement.d.ts +5 -0
- package/dist/client/background/background-apis/createElement.js +18 -0
- package/dist/client/background/background-apis/createNapiLoader.d.ts +5 -0
- package/dist/client/background/background-apis/createNapiLoader.js +23 -0
- package/dist/client/background/background-apis/createNativeApp.d.ts +4 -0
- package/dist/client/background/background-apis/createNativeApp.js +98 -0
- package/dist/client/background/background-apis/createNativeModules.d.ts +3 -0
- package/dist/client/background/background-apis/createNativeModules.js +33 -0
- package/dist/client/background/background-apis/createPerformanceApis.d.ts +3 -0
- package/dist/client/background/background-apis/createPerformanceApis.js +47 -0
- package/dist/client/background/background-apis/createTimingSystem.d.ts +8 -0
- package/dist/client/background/background-apis/createTimingSystem.js +86 -0
- package/dist/client/background/background-apis/crossThreadHandlers/createGetCustomSection.d.ts +3 -0
- package/dist/client/background/background-apis/crossThreadHandlers/createGetCustomSection.js +14 -0
- package/dist/client/background/background-apis/crossThreadHandlers/createGetPathInfo.d.ts +3 -0
- package/dist/client/background/background-apis/crossThreadHandlers/createGetPathInfo.js +23 -0
- package/dist/client/background/background-apis/crossThreadHandlers/createInvokeUIMethod.d.ts +3 -0
- package/dist/client/background/background-apis/crossThreadHandlers/createInvokeUIMethod.js +24 -0
- package/dist/client/background/background-apis/crossThreadHandlers/createJSObjectDestructionObserver.d.ts +2 -0
- package/dist/client/background/background-apis/crossThreadHandlers/createJSObjectDestructionObserver.js +12 -0
- package/dist/client/background/background-apis/crossThreadHandlers/registerDisposeHandler.d.ts +3 -0
- package/dist/client/background/background-apis/crossThreadHandlers/registerDisposeHandler.js +9 -0
- package/dist/client/background/background-apis/crossThreadHandlers/registerPublicComponentEventHandler.d.ts +3 -0
- package/dist/client/background/background-apis/crossThreadHandlers/registerPublicComponentEventHandler.js +8 -0
- package/dist/client/background/background-apis/crossThreadHandlers/registerPublishEventHandler.d.ts +3 -0
- package/dist/client/background/background-apis/crossThreadHandlers/registerPublishEventHandler.js +8 -0
- package/dist/client/background/background-apis/crossThreadHandlers/registerSendGlobalEvent.d.ts +3 -0
- package/dist/client/background/background-apis/crossThreadHandlers/registerSendGlobalEvent.js +10 -0
- package/dist/client/background/background-apis/crossThreadHandlers/registerUpdateDataHandler.d.ts +3 -0
- package/dist/client/background/background-apis/crossThreadHandlers/registerUpdateDataHandler.js +5 -0
- package/dist/client/background/background-apis/crossThreadHandlers/registerUpdateGlobalPropsHandler.d.ts +3 -0
- package/dist/client/background/background-apis/crossThreadHandlers/registerUpdateGlobalPropsHandler.js +5 -0
- package/dist/client/background/background-apis/crossThreadHandlers/registerUpdateI18nResource.d.ts +3 -0
- package/dist/client/background/background-apis/crossThreadHandlers/registerUpdateI18nResource.js +9 -0
- package/dist/client/background/background-apis/startBackgroundThread.d.ts +2 -0
- package/dist/client/background/background-apis/startBackgroundThread.js +42 -0
- package/dist/client/background/index.d.ts +1 -0
- package/dist/client/background/index.js +15 -0
- package/dist/client/decodeWorker/cssLoader.d.ts +12 -0
- package/dist/client/decodeWorker/cssLoader.js +96 -0
- package/dist/client/decodeWorker/decode.worker.d.ts +1 -0
- package/dist/client/decodeWorker/decode.worker.js +338 -0
- package/dist/client/decodeWorker/types.d.ts +32 -0
- package/dist/client/decodeWorker/types.js +2 -0
- package/dist/client/endpoints.d.ts +53 -0
- package/dist/client/endpoints.js +37 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.js +3 -0
- package/dist/client/mainthread/Background.d.ts +30 -0
- package/dist/client/mainthread/Background.js +207 -0
- package/dist/client/mainthread/ExposureServices.d.ts +11 -0
- package/dist/client/mainthread/ExposureServices.js +211 -0
- package/dist/client/mainthread/I18n.d.ts +9 -0
- package/dist/client/mainthread/I18n.js +44 -0
- package/dist/client/mainthread/LynxView.d.ts +170 -0
- package/dist/client/mainthread/LynxView.js +367 -0
- package/dist/client/mainthread/LynxViewInstance.d.ts +56 -0
- package/dist/client/mainthread/LynxViewInstance.js +196 -0
- package/dist/client/mainthread/StyleManager.d.ts +15 -0
- package/dist/client/mainthread/StyleManager.js +72 -0
- package/dist/client/mainthread/TemplateManager.d.ts +11 -0
- package/dist/client/mainthread/TemplateManager.js +257 -0
- package/dist/client/mainthread/createIFrameRealm.d.ts +6 -0
- package/dist/client/mainthread/createIFrameRealm.js +68 -0
- package/dist/client/mainthread/createMainThreadGlobalAPIs.d.ts +3 -0
- package/dist/client/mainthread/createMainThreadGlobalAPIs.js +82 -0
- package/dist/client/mainthread/crossThreadHandlers/queryNodes.d.ts +3 -0
- package/dist/client/mainthread/crossThreadHandlers/queryNodes.js +74 -0
- package/dist/client/mainthread/crossThreadHandlers/registerGetPathInfoHandler.d.ts +3 -0
- package/dist/client/mainthread/crossThreadHandlers/registerGetPathInfoHandler.js +51 -0
- package/dist/client/mainthread/crossThreadHandlers/registerInvokeUIMethodHandler.d.ts +3 -0
- package/dist/client/mainthread/crossThreadHandlers/registerInvokeUIMethodHandler.js +49 -0
- package/dist/client/mainthread/crossThreadHandlers/registerNapiModulesCallHandler.d.ts +3 -0
- package/dist/client/mainthread/crossThreadHandlers/registerNapiModulesCallHandler.js +8 -0
- package/dist/client/mainthread/crossThreadHandlers/registerNativeModulesCallHandler.d.ts +3 -0
- package/dist/client/mainthread/crossThreadHandlers/registerNativeModulesCallHandler.js +7 -0
- package/dist/client/mainthread/crossThreadHandlers/registerSelectComponentHandler.d.ts +3 -0
- package/dist/client/mainthread/crossThreadHandlers/registerSelectComponentHandler.js +20 -0
- package/dist/client/mainthread/crossThreadHandlers/registerSetNativePropsHandler.d.ts +3 -0
- package/dist/client/mainthread/crossThreadHandlers/registerSetNativePropsHandler.js +28 -0
- package/dist/client/mainthread/crossThreadHandlers/registerTriggerComponentEventHandler.d.ts +3 -0
- package/dist/client/mainthread/crossThreadHandlers/registerTriggerComponentEventHandler.js +12 -0
- package/dist/client/mainthread/crossThreadHandlers/registerTriggerElementMethodEndpointHandler.d.ts +3 -0
- package/dist/client/mainthread/crossThreadHandlers/registerTriggerElementMethodEndpointHandler.js +29 -0
- package/dist/client/mainthread/elementAPIs/WASMJSBinding.d.ts +38 -0
- package/dist/client/mainthread/elementAPIs/WASMJSBinding.js +122 -0
- package/dist/client/mainthread/elementAPIs/createCrossThreadEvent.d.ts +2 -0
- package/dist/client/mainthread/elementAPIs/createCrossThreadEvent.js +77 -0
- package/dist/client/mainthread/elementAPIs/createElementAPI.d.ts +3 -0
- package/dist/client/mainthread/elementAPIs/createElementAPI.js +346 -0
- package/dist/client/mainthread/elementAPIs/index.d.ts +2 -0
- package/dist/client/mainthread/elementAPIs/index.js +3 -0
- package/dist/client/mainthread/elementAPIs/pureElementPAPIs.d.ts +26 -0
- package/dist/client/mainthread/elementAPIs/pureElementPAPIs.js +85 -0
- package/dist/client/mainthread/utils/convertLengthToPx.d.ts +1 -0
- package/dist/client/mainthread/utils/convertLengthToPx.js +25 -0
- package/dist/client/wasm.d.ts +11 -0
- package/dist/client/wasm.js +52 -0
- package/dist/client/webElementsDynamicLoader.d.ts +8 -0
- package/dist/client/webElementsDynamicLoader.js +80 -0
- package/dist/client_prod/static/css/async/web-core-main-chunk.css +1 -0
- package/dist/client_prod/static/css/client.css +1 -0
- package/dist/client_prod/static/js/async/lynx-core-chunk.js +3 -0
- package/dist/client_prod/static/js/async/web-core-main-chunk.js +303 -0
- package/dist/client_prod/static/js/async/web-core-template-loader-thread.js +8 -0
- package/dist/client_prod/static/js/async/web-core-worker-chunk.js +1 -0
- package/dist/client_prod/static/js/async/web-elements-audio.js +1 -0
- package/dist/client_prod/static/js/async/web-elements-foldview.js +1 -0
- package/dist/client_prod/static/js/async/web-elements-input.js +1 -0
- package/dist/client_prod/static/js/async/web-elements-list.js +1 -0
- package/dist/client_prod/static/js/async/web-elements-overlay.js +1 -0
- package/dist/client_prod/static/js/async/web-elements-refrshview.js +1 -0
- package/dist/client_prod/static/js/async/web-elements-swiper.js +1 -0
- package/dist/client_prod/static/js/async/web-elements-textarea.js +1 -0
- package/dist/client_prod/static/js/async/web-elements-viewpager.js +1 -0
- package/dist/client_prod/static/js/client.js +2 -0
- package/dist/client_prod/static/wasm/7ff75609.module.wasm +0 -0
- package/dist/constants.d.ts +58 -0
- package/dist/constants.js +114 -0
- package/dist/encode/encodeCSS.d.ts +3 -0
- package/dist/encode/encodeCSS.js +99 -0
- package/dist/encode/encodeElementTemplate.d.ts +2 -0
- package/dist/encode/encodeElementTemplate.js +52 -0
- package/dist/encode/index.d.ts +1 -0
- package/dist/encode/index.js +7 -0
- package/dist/encode/webEncoder.d.ts +21 -0
- package/dist/encode/webEncoder.js +125 -0
- package/dist/types/BTSChunk.d.ts +3 -0
- package/dist/types/BTSChunk.js +5 -0
- package/dist/types/Cloneable.d.ts +2 -0
- package/dist/types/Cloneable.js +2 -0
- package/dist/types/DecodedTemplate.d.ts +10 -0
- package/dist/types/DecodedTemplate.js +7 -0
- package/dist/types/Element.d.ts +35 -0
- package/dist/types/Element.js +5 -0
- package/dist/types/ElementTemplateData.d.ts +15 -0
- package/dist/types/ElementTemplateData.js +7 -0
- package/dist/types/EventType.d.ts +56 -0
- package/dist/types/EventType.js +5 -0
- package/dist/types/I18nTypes.d.ts +21 -0
- package/dist/types/I18nTypes.js +2 -0
- package/dist/types/IElementPAPI.d.ts +184 -0
- package/dist/types/IElementPAPI.js +2 -0
- package/dist/types/IMtsBinding.d.ts +11 -0
- package/dist/types/IMtsBinding.js +7 -0
- package/dist/types/JSRealm.d.ts +5 -0
- package/dist/types/JSRealm.js +7 -0
- package/dist/types/LynxContextEventTarget.d.ts +12 -0
- package/dist/types/LynxContextEventTarget.js +5 -0
- package/dist/types/MainThreadLynx.d.ts +15 -0
- package/dist/types/MainThreadLynx.js +2 -0
- package/dist/types/NapiModules.d.ts +9 -0
- package/dist/types/NapiModules.js +5 -0
- package/dist/types/NativeApp.d.ts +120 -0
- package/dist/types/NativeApp.js +5 -0
- package/dist/types/NativeModules.d.ts +2 -0
- package/dist/types/NativeModules.js +5 -0
- package/dist/types/PageConfig.d.ts +9 -0
- package/dist/types/PageConfig.js +2 -0
- package/dist/types/ProcessDataCallback.d.ts +1 -0
- package/dist/types/ProcessDataCallback.js +2 -0
- package/dist/types/TimingAPIs.d.ts +32 -0
- package/dist/types/TimingAPIs.js +5 -0
- package/dist/types/UpdateDataOptions.d.ts +8 -0
- package/dist/types/UpdateDataOptions.js +6 -0
- package/dist/types/WorkerStartMessage.d.ts +14 -0
- package/dist/types/WorkerStartMessage.js +5 -0
- package/dist/types/index.d.ts +20 -0
- package/dist/types/index.js +7 -0
- package/eslint.config.js +34 -0
- package/package.json +87 -4
- package/index.js +0 -1
- package/selfIdentity.plist +0 -0
|
Binary file
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_decodedstyledata_free: (a: number, b: number) => void;
|
|
5
|
+
export const decodedstyledata_new: (a: any) => [number, number, number];
|
|
6
|
+
export const decodedstyledata_style_content: (a: number) => [number, number];
|
|
7
|
+
export const decodedstyledata_font_face_content: (a: number) => [number, number];
|
|
8
|
+
export const decodedstyledata_query_css_og_declarations_by_css_id: (a: number, b: number, c: number, d: number) => [number, number];
|
|
9
|
+
export const decodedstyledata_decode_into: (a: any, b: number, c: number, d: number) => [number, number, number];
|
|
10
|
+
export const decodedstyledata_encode_from_raw_style_info: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
11
|
+
export const __wbg_rawelementtemplate_free: (a: number, b: number) => void;
|
|
12
|
+
export const rawelementtemplate_new: () => number;
|
|
13
|
+
export const rawelementtemplate_append_to_root: (a: number, b: number) => void;
|
|
14
|
+
export const rawelementtemplate_create_element: (a: number, b: number, c: number, d: number) => void;
|
|
15
|
+
export const rawelementtemplate_set_attribute: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
16
|
+
export const rawelementtemplate_set_dataset: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
17
|
+
export const rawelementtemplate_append_child: (a: number, b: number, c: number) => void;
|
|
18
|
+
export const rawelementtemplate_set_cross_thread_event: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
19
|
+
export const rawelementtemplate_set_attribute_slot: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
20
|
+
export const rawelementtemplate_append_element_slot: (a: number, b: number, c: number) => void;
|
|
21
|
+
export const __wbg_operation_free: (a: number, b: number) => void;
|
|
22
|
+
export const __wbg_elementtemplatesection_free: (a: number, b: number) => void;
|
|
23
|
+
export const elementtemplatesection_new: () => number;
|
|
24
|
+
export const elementtemplatesection_from_encoded: (a: any) => [number, number, number];
|
|
25
|
+
export const elementtemplatesection_add_element_template: (a: number, b: number, c: number, d: number) => void;
|
|
26
|
+
export const elementtemplatesection_encode: (a: number) => any;
|
|
27
|
+
export const __wbg_rawstyleinfo_free: (a: number, b: number) => void;
|
|
28
|
+
export const __wbg_rule_free: (a: number, b: number) => void;
|
|
29
|
+
export const __wbg_ruleprelude_free: (a: number, b: number) => void;
|
|
30
|
+
export const __wbg_selector_free: (a: number, b: number) => void;
|
|
31
|
+
export const rawstyleinfo_new: () => number;
|
|
32
|
+
export const rawstyleinfo_append_import: (a: number, b: number, c: number) => void;
|
|
33
|
+
export const rawstyleinfo_push_rule: (a: number, b: number, c: number) => void;
|
|
34
|
+
export const rawstyleinfo_encode: (a: number) => [number, number, number];
|
|
35
|
+
export const rule_new: (a: number, b: number) => [number, number, number];
|
|
36
|
+
export const rule_set_prelude: (a: number, b: number) => void;
|
|
37
|
+
export const rule_push_declaration: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
38
|
+
export const rule_push_rule_children: (a: number, b: number) => void;
|
|
39
|
+
export const ruleprelude_new: () => number;
|
|
40
|
+
export const ruleprelude_push_selector: (a: number, b: number) => void;
|
|
41
|
+
export const selector_new: () => number;
|
|
42
|
+
export const selector_push_one_selector_section: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
43
|
+
export const __wbg_styleinfodecoder_free: (a: number, b: number) => void;
|
|
44
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
45
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
46
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
47
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
48
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
49
|
+
export const __externref_table_alloc: () => number;
|
|
50
|
+
export const __wbindgen_start: () => void;
|
package/css/index.css
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/*
|
|
2
|
+
// Copyright 2023 The Lynx Authors. All rights reserved.
|
|
3
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
4
|
+
// LICENSE file in the root directory of this source tree.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
lynx-view {
|
|
8
|
+
contain: strict;
|
|
9
|
+
display: none;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
lynx-view[width="auto"] {
|
|
13
|
+
--lynx-view-width: 100%;
|
|
14
|
+
width: var(--lynx-view-width);
|
|
15
|
+
inline-size: var(--lynx-view-width);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
lynx-view[height="auto"], lynx-view[width="auto"] {
|
|
19
|
+
contain: content;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
lynx-view::part(page) {
|
|
23
|
+
height: 100%;
|
|
24
|
+
width: 100%;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@property --lynx-display {
|
|
28
|
+
syntax: "linear | flex";
|
|
29
|
+
inherits: false;
|
|
30
|
+
initial-value: linear;
|
|
31
|
+
}
|
|
32
|
+
@property --lynx-linear-weight-sum {
|
|
33
|
+
syntax: "<number>";
|
|
34
|
+
inherits: false;
|
|
35
|
+
initial-value: 1;
|
|
36
|
+
}
|
|
37
|
+
@property --lynx-linear-weight {
|
|
38
|
+
syntax: "<number>";
|
|
39
|
+
inherits: false;
|
|
40
|
+
initial-value: 0;
|
|
41
|
+
}
|
|
42
|
+
@property --justify-content-column {
|
|
43
|
+
syntax: "flex-start|flex-end|center|space-between|space-around";
|
|
44
|
+
inherits: false;
|
|
45
|
+
initial-value: flex-start;
|
|
46
|
+
}
|
|
47
|
+
@property --justify-content-column-reverse {
|
|
48
|
+
syntax: "flex-start|flex-end|center|space-between|space-around";
|
|
49
|
+
inherits: false;
|
|
50
|
+
initial-value: flex-start;
|
|
51
|
+
}
|
|
52
|
+
@property --justify-content-row {
|
|
53
|
+
syntax: "flex-start|flex-end|center|space-between|space-around";
|
|
54
|
+
inherits: false;
|
|
55
|
+
initial-value: flex-start;
|
|
56
|
+
}
|
|
57
|
+
@property --justify-content-row-reverse {
|
|
58
|
+
syntax: "flex-start|flex-end|center|space-between|space-around";
|
|
59
|
+
inherits: false;
|
|
60
|
+
initial-value: flex-start;
|
|
61
|
+
}
|
|
62
|
+
@property --align-self-row {
|
|
63
|
+
syntax: "start|end|center|stretch|auto";
|
|
64
|
+
inherits: false;
|
|
65
|
+
initial-value: auto;
|
|
66
|
+
}
|
|
67
|
+
@property --align-self-column {
|
|
68
|
+
syntax: "start|end|center|stretch|auto";
|
|
69
|
+
inherits: false;
|
|
70
|
+
initial-value: auto;
|
|
71
|
+
}
|
|
72
|
+
@property --lynx-linear-weight-basis {
|
|
73
|
+
syntax: "auto|<number>|<length>";
|
|
74
|
+
inherits: false;
|
|
75
|
+
initial-value: auto;
|
|
76
|
+
}
|
|
77
|
+
@property --lynx-linear-orientation {
|
|
78
|
+
syntax: "<custom-ident>";
|
|
79
|
+
inherits: false;
|
|
80
|
+
initial-value: vertical;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@property --flex-direction {
|
|
84
|
+
syntax: "*";
|
|
85
|
+
inherits: false;
|
|
86
|
+
}
|
|
87
|
+
@property --flex-wrap {
|
|
88
|
+
syntax: "*";
|
|
89
|
+
inherits: false;
|
|
90
|
+
}
|
|
91
|
+
@property --flex-grow {
|
|
92
|
+
syntax: "<number>";
|
|
93
|
+
inherits: false;
|
|
94
|
+
initial-value: 0;
|
|
95
|
+
}
|
|
96
|
+
@property --flex-shrink {
|
|
97
|
+
syntax: "<number>";
|
|
98
|
+
inherits: false;
|
|
99
|
+
initial-value: 1;
|
|
100
|
+
}
|
|
101
|
+
@property --flex-basis {
|
|
102
|
+
syntax: "*";
|
|
103
|
+
inherits: false;
|
|
104
|
+
initial-value: auto;
|
|
105
|
+
}
|
|
106
|
+
@property --flex-value {
|
|
107
|
+
syntax: "*";
|
|
108
|
+
inherits: false;
|
|
109
|
+
}
|
|
110
|
+
@property --flex {
|
|
111
|
+
syntax: "*";
|
|
112
|
+
inherits: false;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@property --linear-justify-content {
|
|
116
|
+
syntax: "flex-start|flex-end|center|space-between|space-around";
|
|
117
|
+
inherits: false;
|
|
118
|
+
initial-value: flex-start;
|
|
119
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { dispatchCoreContextOnBackgroundEndpoint } from './endpoints.js';
|
|
2
|
+
import type { LynxContextEventTarget } from '../types/index.js';
|
|
3
|
+
import type { Rpc } from '@lynx-js/web-worker-rpc';
|
|
4
|
+
export declare const DispatchEventResult: {
|
|
5
|
+
readonly NotCanceled: 0;
|
|
6
|
+
readonly CanceledByEventHandler: 1;
|
|
7
|
+
readonly CanceledByDefaultEventHandler: 2;
|
|
8
|
+
readonly CanceledBeforeDispatch: 3;
|
|
9
|
+
};
|
|
10
|
+
type LynxCrossThreadContextConfig = {
|
|
11
|
+
rpc: Rpc;
|
|
12
|
+
receiveEventEndpoint: typeof dispatchCoreContextOnBackgroundEndpoint;
|
|
13
|
+
sendEventEndpoint: typeof dispatchCoreContextOnBackgroundEndpoint;
|
|
14
|
+
};
|
|
15
|
+
export declare class LynxCrossThreadContext extends EventTarget implements LynxContextEventTarget {
|
|
16
|
+
#private;
|
|
17
|
+
constructor(config: LynxCrossThreadContextConfig);
|
|
18
|
+
postMessage(...args: any[]): void;
|
|
19
|
+
dispatchEvent(event: ContextCrossThreadEvent): 3;
|
|
20
|
+
__start(): void;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
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 DispatchEventResult = {
|
|
5
|
+
// Event was not canceled by event handler or default event handler.
|
|
6
|
+
NotCanceled: 0,
|
|
7
|
+
// Event was canceled by event handler; i.e. a script handler calling
|
|
8
|
+
// preventDefault.
|
|
9
|
+
CanceledByEventHandler: 1,
|
|
10
|
+
// Event was canceled by the default event handler; i.e. executing the default
|
|
11
|
+
// action. This result should be used sparingly as it deviates from the DOM
|
|
12
|
+
// Event Dispatch model. Default event handlers really shouldn't be invoked
|
|
13
|
+
// inside of dispatch.
|
|
14
|
+
CanceledByDefaultEventHandler: 2,
|
|
15
|
+
// Event was canceled but suppressed before dispatched to event handler. This
|
|
16
|
+
// result should be used sparingly; and its usage likely indicates there is
|
|
17
|
+
// potential for a bug. Trusted events may return this code; but untrusted
|
|
18
|
+
// events likely should always execute the event handler the developer intends
|
|
19
|
+
// to execute.
|
|
20
|
+
CanceledBeforeDispatch: 3,
|
|
21
|
+
};
|
|
22
|
+
export class LynxCrossThreadContext extends EventTarget {
|
|
23
|
+
#config;
|
|
24
|
+
constructor(config) {
|
|
25
|
+
super();
|
|
26
|
+
this.#config = config;
|
|
27
|
+
}
|
|
28
|
+
postMessage(...args) {
|
|
29
|
+
console.error('[lynx-web] postMessage not implemented, args:', ...args);
|
|
30
|
+
}
|
|
31
|
+
// @ts-expect-error
|
|
32
|
+
dispatchEvent(event) {
|
|
33
|
+
const { rpc, sendEventEndpoint } = this.#config;
|
|
34
|
+
rpc.invoke(sendEventEndpoint, [event]);
|
|
35
|
+
return DispatchEventResult.CanceledBeforeDispatch;
|
|
36
|
+
}
|
|
37
|
+
__start() {
|
|
38
|
+
const { rpc, receiveEventEndpoint } = this.#config;
|
|
39
|
+
rpc.registerHandler(receiveEventEndpoint, ({ type, data }) => {
|
|
40
|
+
super.dispatchEvent(new MessageEvent(type, { data: data ?? {} }));
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=LynxCrossThreadContext.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Rpc } from '@lynx-js/web-worker-rpc';
|
|
2
|
+
import type { Cloneable, NativeApp } from '../../../types/index.js';
|
|
3
|
+
import { LynxCrossThreadContext } from '../../LynxCrossThreadContext.js';
|
|
4
|
+
export declare function createBackgroundLynx(globalProps: Cloneable, customSections: Record<string, Cloneable>, nativeApp: NativeApp, mainThreadRpc: Rpc): {
|
|
5
|
+
__globalProps: Cloneable;
|
|
6
|
+
getJSModule(_moduleName: string): any;
|
|
7
|
+
getNativeApp(): NativeApp;
|
|
8
|
+
getCoreContext(): LynxCrossThreadContext;
|
|
9
|
+
getCustomSectionSync(key: string): Cloneable;
|
|
10
|
+
getCustomSection: (key: string, callback: (object: Cloneable) => void) => void;
|
|
11
|
+
queueMicrotask: (callback: () => void) => void;
|
|
12
|
+
createElement(_: string, id: string): {
|
|
13
|
+
animate(operation: import("../../../constants.js").AnimationOperation, id: string, keyframes?: Record<string, any>[], timingOptions?: Record<string, any>): void;
|
|
14
|
+
};
|
|
15
|
+
getI18nResource: () => Cloneable;
|
|
16
|
+
QueryComponent: (source: string, callback: (ret: {
|
|
17
|
+
__hasReady: boolean;
|
|
18
|
+
} | {
|
|
19
|
+
code: number;
|
|
20
|
+
detail?: {
|
|
21
|
+
schema: string;
|
|
22
|
+
};
|
|
23
|
+
}) => void) => void;
|
|
24
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
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 { dispatchCoreContextOnBackgroundEndpoint, dispatchJSContextOnMainThreadEndpoint, } from '../../endpoints.js';
|
|
5
|
+
import { createGetCustomSection } from './crossThreadHandlers/createGetCustomSection.js';
|
|
6
|
+
import { createElement } from './createElement.js';
|
|
7
|
+
import { LynxCrossThreadContext } from '../../LynxCrossThreadContext.js';
|
|
8
|
+
export function createBackgroundLynx(globalProps, customSections, nativeApp, mainThreadRpc) {
|
|
9
|
+
const coreContext = new LynxCrossThreadContext({
|
|
10
|
+
rpc: mainThreadRpc,
|
|
11
|
+
receiveEventEndpoint: dispatchCoreContextOnBackgroundEndpoint,
|
|
12
|
+
sendEventEndpoint: dispatchJSContextOnMainThreadEndpoint,
|
|
13
|
+
});
|
|
14
|
+
return {
|
|
15
|
+
__globalProps: globalProps,
|
|
16
|
+
getJSModule(_moduleName) {
|
|
17
|
+
},
|
|
18
|
+
getNativeApp() {
|
|
19
|
+
return nativeApp;
|
|
20
|
+
},
|
|
21
|
+
getCoreContext() {
|
|
22
|
+
return coreContext;
|
|
23
|
+
},
|
|
24
|
+
getCustomSectionSync(key) {
|
|
25
|
+
return customSections[key];
|
|
26
|
+
},
|
|
27
|
+
getCustomSection: createGetCustomSection(mainThreadRpc, customSections),
|
|
28
|
+
queueMicrotask: (callback) => {
|
|
29
|
+
queueMicrotask(callback);
|
|
30
|
+
},
|
|
31
|
+
createElement(_, id) {
|
|
32
|
+
return createElement(id, mainThreadRpc);
|
|
33
|
+
},
|
|
34
|
+
getI18nResource: () => nativeApp.i18nResource.data,
|
|
35
|
+
QueryComponent: (source, callback) => nativeApp.queryComponent(source, callback),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=createBackgroundLynx.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { NativeApp } from '../../../types/index.js';
|
|
2
|
+
export declare function createChunkLoading(entryTemplateUrl: string): {
|
|
3
|
+
readScript: NativeApp['readScript'];
|
|
4
|
+
loadScript: NativeApp['loadScript'];
|
|
5
|
+
loadScriptAsync: NativeApp['loadScriptAsync'];
|
|
6
|
+
templateCache: Map<string, Record<string, string>>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
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 function createChunkLoading(entryTemplateUrl) {
|
|
5
|
+
const templateCache = new Map();
|
|
6
|
+
const readScript = (sourceURL, templateUrl) => {
|
|
7
|
+
if (!templateUrl || templateUrl === '__Card__') {
|
|
8
|
+
templateUrl = entryTemplateUrl;
|
|
9
|
+
}
|
|
10
|
+
const finalSourceURL = templateCache.get(templateUrl)?.[`/${sourceURL}`] ?? sourceURL;
|
|
11
|
+
const xhr = new XMLHttpRequest();
|
|
12
|
+
xhr.open('GET', finalSourceURL, false);
|
|
13
|
+
xhr.send(null);
|
|
14
|
+
if (xhr.status === 200) {
|
|
15
|
+
return xhr.responseText;
|
|
16
|
+
}
|
|
17
|
+
throw new Error(`Failed to load ${sourceURL}, status: ${xhr.status}`);
|
|
18
|
+
};
|
|
19
|
+
const readScriptAsync = async (sourceURL, templateUrl) => {
|
|
20
|
+
if (!templateUrl || templateUrl === '__Card__') {
|
|
21
|
+
templateUrl = entryTemplateUrl;
|
|
22
|
+
}
|
|
23
|
+
const finalSourceURL = templateCache.get(templateUrl)?.[`/${sourceURL}`] ?? sourceURL;
|
|
24
|
+
return new Promise((resolve, reject) => {
|
|
25
|
+
fetch(finalSourceURL).then((response) => {
|
|
26
|
+
if (response.ok) {
|
|
27
|
+
response.text().then((text) => resolve(text), reject);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
reject(new Error(`Failed to load ${sourceURL}, status: ${response.status}`));
|
|
31
|
+
}
|
|
32
|
+
}, reject);
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
const createBundleInitReturnObj = (jsContent) => {
|
|
36
|
+
const foo = new Function('postMessage', 'module', 'exports', 'lynxCoreInject', 'Card', 'setTimeout', 'setInterval', 'clearInterval', 'clearTimeout', 'NativeModules', 'Component', 'ReactLynx', 'nativeAppId', 'Behavior', 'LynxJSBI', 'lynx',
|
|
37
|
+
// BOM API
|
|
38
|
+
'window', 'document', 'frames', 'location', 'navigator', 'localStorage', 'history', 'Caches', 'screen', 'alert', 'confirm', 'prompt', 'fetch', 'XMLHttpRequest', 'webkit', 'Reporter', 'print', 'global',
|
|
39
|
+
// Lynx API
|
|
40
|
+
'requestAnimationFrame', 'cancelAnimationFrame', jsContent);
|
|
41
|
+
return {
|
|
42
|
+
init(lynxCoreInject) {
|
|
43
|
+
const module = { exports: {} };
|
|
44
|
+
const tt = lynxCoreInject.tt;
|
|
45
|
+
foo(undefined, module, module.exports, lynxCoreInject, tt.Card.bind(tt), tt.setTimeout, tt.setInterval, tt.clearInterval, tt.clearTimeout, tt.NativeModules, tt.Component.bind(tt), tt.ReactLynx, tt.nativeAppId, tt.Behavior, tt.LynxJSBI, tt.lynx,
|
|
46
|
+
// BOM API
|
|
47
|
+
tt.window, tt.document, tt.frames, tt.location, tt.navigator, tt.localStorage, tt.history, tt.Caches, tt.screen, tt.alert, tt.confirm, tt.prompt, tt.fetch, tt.XMLHttpRequest, tt.webkit, tt.Reporter, tt.print, tt.global, tt.requestAnimationFrame, tt.cancelAnimationFrame);
|
|
48
|
+
return module.exports;
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
return {
|
|
53
|
+
readScript,
|
|
54
|
+
loadScript: (sourceURL, templateUrl) => {
|
|
55
|
+
const jsContent = readScript(sourceURL, templateUrl);
|
|
56
|
+
return createBundleInitReturnObj(jsContent);
|
|
57
|
+
},
|
|
58
|
+
loadScriptAsync: async (sourceURL, callback, templateUrl) => {
|
|
59
|
+
readScriptAsync(sourceURL, templateUrl).then((jsContent) => {
|
|
60
|
+
callback(null, createBundleInitReturnObj(jsContent));
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
templateCache,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=createChunkLoading.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AnimationOperation } from '../../../constants.js';
|
|
2
|
+
import type { Rpc } from '@lynx-js/web-worker-rpc';
|
|
3
|
+
export declare const createElement: (elementId: string, uiThreadRpc: Rpc) => {
|
|
4
|
+
animate(operation: AnimationOperation, id: string, keyframes?: Record<string, any>[], timingOptions?: Record<string, any>): void;
|
|
5
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
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 { triggerElementMethodEndpoint } from '../../endpoints.js';
|
|
5
|
+
export const createElement = (elementId, uiThreadRpc) => {
|
|
6
|
+
const triggerElementMethod = uiThreadRpc.createCall(triggerElementMethodEndpoint);
|
|
7
|
+
return {
|
|
8
|
+
animate(operation, id, keyframes, timingOptions) {
|
|
9
|
+
triggerElementMethod('animate', elementId, {
|
|
10
|
+
operation,
|
|
11
|
+
id,
|
|
12
|
+
keyframes,
|
|
13
|
+
timingOptions,
|
|
14
|
+
});
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=createElement.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Rpc } from '@lynx-js/web-worker-rpc';
|
|
2
|
+
import type { NapiModulesMap } from '../../../types/index.js';
|
|
3
|
+
export declare const createNapiLoader: (rpc: Rpc, napiModulesMap: NapiModulesMap) => Promise<{
|
|
4
|
+
load(moduleName: string): Record<string, any> | undefined;
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
/* LYNX_NAPI_MODULES_IMPORT */
|
|
5
|
+
import { dispatchNapiModuleEndpoint, napiModulesCallEndpoint, } from '../../endpoints.js';
|
|
6
|
+
export const createNapiLoader = async (rpc, napiModulesMap) => {
|
|
7
|
+
const napiModulesCall = rpc.createCall(napiModulesCallEndpoint);
|
|
8
|
+
const napiModules = {};
|
|
9
|
+
const listeners = new Set();
|
|
10
|
+
rpc.registerHandler(dispatchNapiModuleEndpoint, (data) => {
|
|
11
|
+
listeners.forEach((listener) => listener(data));
|
|
12
|
+
});
|
|
13
|
+
await Promise.all(Object.entries(napiModulesMap).map(([moduleName, moduleStr]) => import(/* webpackIgnore: true */ moduleStr).then((module) => (napiModules[moduleName] = module?.default?.(napiModules, (name, data) => napiModulesCall(name, data, moduleName), (func) => {
|
|
14
|
+
listeners.add(func);
|
|
15
|
+
})))));
|
|
16
|
+
/* LYNX_NAPI_MODULES_ADD */
|
|
17
|
+
return {
|
|
18
|
+
load(moduleName) {
|
|
19
|
+
return napiModules[moduleName];
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=createNapiLoader.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Rpc } from '@lynx-js/web-worker-rpc';
|
|
2
|
+
import type { NativeApp, NativeModulesMap } from '../../../types/index.js';
|
|
3
|
+
import type { TimingSystem } from './createTimingSystem.js';
|
|
4
|
+
export declare function createNativeApp(mainThreadRpc: Rpc, timingSystem: TimingSystem, nativeModulesMap: NativeModulesMap, entryTemplateUrl: string): Promise<NativeApp>;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { callLepusMethodEndpoint, setNativePropsEndpoint, triggerComponentEventEndpoint, selectComponentEndpoint, reportErrorEndpoint, queryComponentEndpoint, updateBTSChunkEndpoint, } from '../../endpoints.js';
|
|
2
|
+
import { createInvokeUIMethod } from './crossThreadHandlers/createInvokeUIMethod.js';
|
|
3
|
+
import { registerPublicComponentEventHandler } from './crossThreadHandlers/registerPublicComponentEventHandler.js';
|
|
4
|
+
import { createNativeModules } from './createNativeModules.js';
|
|
5
|
+
import { registerUpdateDataHandler } from './crossThreadHandlers/registerUpdateDataHandler.js';
|
|
6
|
+
import { registerPublishEventHandler } from './crossThreadHandlers/registerPublishEventHandler.js';
|
|
7
|
+
import { createPerformanceApis } from './createPerformanceApis.js';
|
|
8
|
+
import { registerSendGlobalEventHandler } from './crossThreadHandlers/registerSendGlobalEvent.js';
|
|
9
|
+
import { createJSObjectDestructionObserver } from './crossThreadHandlers/createJSObjectDestructionObserver.js';
|
|
10
|
+
import { registerUpdateGlobalPropsHandler } from './crossThreadHandlers/registerUpdateGlobalPropsHandler.js';
|
|
11
|
+
import { registerUpdateI18nResource } from './crossThreadHandlers/registerUpdateI18nResource.js';
|
|
12
|
+
import { createGetPathInfo } from './crossThreadHandlers/createGetPathInfo.js';
|
|
13
|
+
import { createChunkLoading } from './createChunkLoading.js';
|
|
14
|
+
let nativeAppCount = 0;
|
|
15
|
+
const sharedData = {};
|
|
16
|
+
class I18nResource {
|
|
17
|
+
data;
|
|
18
|
+
constructor(data) {
|
|
19
|
+
this.data = data;
|
|
20
|
+
}
|
|
21
|
+
setData(data) {
|
|
22
|
+
this.data = data;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export async function createNativeApp(mainThreadRpc, timingSystem, nativeModulesMap, entryTemplateUrl) {
|
|
26
|
+
const performanceApis = createPerformanceApis(timingSystem);
|
|
27
|
+
const callLepusMethod = mainThreadRpc.createCallbackify(callLepusMethodEndpoint, 2);
|
|
28
|
+
const setNativeProps = mainThreadRpc.createCall(setNativePropsEndpoint);
|
|
29
|
+
const triggerComponentEvent = mainThreadRpc.createCall(triggerComponentEventEndpoint);
|
|
30
|
+
const selectComponent = mainThreadRpc.createCallbackify(selectComponentEndpoint, 3);
|
|
31
|
+
const queryComponent = mainThreadRpc.createCall(queryComponentEndpoint);
|
|
32
|
+
const reportError = mainThreadRpc.createCall(reportErrorEndpoint);
|
|
33
|
+
const { templateCache, loadScript, loadScriptAsync, readScript } = createChunkLoading(entryTemplateUrl);
|
|
34
|
+
mainThreadRpc.registerHandler(updateBTSChunkEndpoint, (url, btsChunkUrls) => {
|
|
35
|
+
templateCache.set(url, btsChunkUrls);
|
|
36
|
+
});
|
|
37
|
+
const i18nResource = new I18nResource();
|
|
38
|
+
let release = '';
|
|
39
|
+
const nativeApp = {
|
|
40
|
+
id: (nativeAppCount++).toString(),
|
|
41
|
+
...performanceApis,
|
|
42
|
+
setTimeout: setTimeout,
|
|
43
|
+
setInterval: setInterval,
|
|
44
|
+
clearTimeout: clearTimeout,
|
|
45
|
+
clearInterval: clearInterval,
|
|
46
|
+
nativeModuleProxy: await createNativeModules(mainThreadRpc, mainThreadRpc, nativeModulesMap),
|
|
47
|
+
readScript,
|
|
48
|
+
loadScriptAsync,
|
|
49
|
+
loadScript,
|
|
50
|
+
requestAnimationFrame(cb) {
|
|
51
|
+
return requestAnimationFrame(cb);
|
|
52
|
+
},
|
|
53
|
+
cancelAnimationFrame(handler) {
|
|
54
|
+
return cancelAnimationFrame(handler);
|
|
55
|
+
},
|
|
56
|
+
callLepusMethod,
|
|
57
|
+
setNativeProps,
|
|
58
|
+
getPathInfo: createGetPathInfo(mainThreadRpc),
|
|
59
|
+
invokeUIMethod: createInvokeUIMethod(mainThreadRpc),
|
|
60
|
+
tt: null,
|
|
61
|
+
setCard(tt) {
|
|
62
|
+
registerPublicComponentEventHandler(mainThreadRpc, tt);
|
|
63
|
+
registerPublishEventHandler(mainThreadRpc, tt);
|
|
64
|
+
registerUpdateDataHandler(mainThreadRpc, tt);
|
|
65
|
+
registerSendGlobalEventHandler(mainThreadRpc, tt);
|
|
66
|
+
registerUpdateGlobalPropsHandler(mainThreadRpc, tt);
|
|
67
|
+
registerUpdateI18nResource(mainThreadRpc, i18nResource, tt);
|
|
68
|
+
timingSystem.registerGlobalEmitter(tt.GlobalEventEmitter);
|
|
69
|
+
tt.lynx.getCoreContext().__start();
|
|
70
|
+
nativeApp.tt = tt;
|
|
71
|
+
},
|
|
72
|
+
triggerComponentEvent,
|
|
73
|
+
selectComponent,
|
|
74
|
+
createJSObjectDestructionObserver: createJSObjectDestructionObserver(),
|
|
75
|
+
setSharedData(dataKey, dataVal) {
|
|
76
|
+
sharedData[dataKey] = dataVal;
|
|
77
|
+
},
|
|
78
|
+
getSharedData(dataKey) {
|
|
79
|
+
return sharedData[dataKey];
|
|
80
|
+
},
|
|
81
|
+
i18nResource,
|
|
82
|
+
reportException: (err, _) => reportError(err, _, release),
|
|
83
|
+
__SetSourceMapRelease: (err) => release = err.message,
|
|
84
|
+
__GetSourceMapRelease: (_url) => release,
|
|
85
|
+
queryComponent: (source, callback) => {
|
|
86
|
+
if (templateCache.has(source)) {
|
|
87
|
+
callback({ __hasReady: true });
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
queryComponent(source).then(res => {
|
|
91
|
+
callback?.(res);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
return nativeApp;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=createNativeApp.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
/* LYNX_NATIVE_MODULES_IMPORT */
|
|
5
|
+
import {} from '../../../types/index.js';
|
|
6
|
+
import { nativeModulesCallEndpoint, switchExposureServiceEndpoint, } from '../../endpoints.js';
|
|
7
|
+
export async function createNativeModules(uiThreadRpc, mainThreadRpc, nativeModulesMap) {
|
|
8
|
+
const switchExposure = mainThreadRpc.createCall(switchExposureServiceEndpoint);
|
|
9
|
+
const nativeModulesCall = uiThreadRpc.createCall(nativeModulesCallEndpoint);
|
|
10
|
+
const lynxExposureModule = {
|
|
11
|
+
resumeExposure() {
|
|
12
|
+
switchExposure(true, true);
|
|
13
|
+
},
|
|
14
|
+
stopExposure(param) {
|
|
15
|
+
switchExposure(false, param.sendEvent ?? true);
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
const bridgeModule = {
|
|
19
|
+
call(name, data, callback) {
|
|
20
|
+
nativeModulesCall(name, data, 'bridge').then(callback);
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
const nativeModules = {};
|
|
24
|
+
const customNativeModules = {};
|
|
25
|
+
await Promise.all(Object.entries(nativeModulesMap).map(([moduleName, moduleStr]) => import(/* webpackIgnore: true */ moduleStr).then(module => customNativeModules[moduleName] = module?.default?.(nativeModules, (name, data) => nativeModulesCall(name, data, moduleName)))));
|
|
26
|
+
/* LYNX_NATIVE_MODULES_ADD */
|
|
27
|
+
return Object.assign(nativeModules, {
|
|
28
|
+
bridge: bridgeModule,
|
|
29
|
+
LynxExposureModule: lynxExposureModule,
|
|
30
|
+
...customNativeModules,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=createNativeModules.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { NativeApp } from '../../../types/index.js';
|
|
2
|
+
import type { TimingSystem } from './createTimingSystem.js';
|
|
3
|
+
export declare function createPerformanceApis(timingSystem: TimingSystem): Pick<NativeApp, 'generatePipelineOptions' | 'onPipelineStart' | 'markPipelineTiming' | 'bindPipelineIdWithTimingFlag' | 'profileStart' | 'profileEnd' | 'profileMark' | 'profileFlowId' | 'isProfileRecording'>;
|
|
@@ -0,0 +1,47 @@
|
|
|
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 function createPerformanceApis(timingSystem) {
|
|
5
|
+
let inc = 0;
|
|
6
|
+
const performanceApis = {
|
|
7
|
+
generatePipelineOptions: () => {
|
|
8
|
+
const newPipelineId = `_pipeline_` + (inc++);
|
|
9
|
+
return {
|
|
10
|
+
pipelineID: newPipelineId,
|
|
11
|
+
needTimestamps: false,
|
|
12
|
+
};
|
|
13
|
+
},
|
|
14
|
+
onPipelineStart: function () {
|
|
15
|
+
// Do nothing
|
|
16
|
+
},
|
|
17
|
+
markPipelineTiming: function (pipelineId, timingKey) {
|
|
18
|
+
timingSystem.markTimingInternal(timingKey, pipelineId);
|
|
19
|
+
},
|
|
20
|
+
bindPipelineIdWithTimingFlag: function (pipelineId, timingFlag) {
|
|
21
|
+
if (!timingSystem.pipelineIdToTimingFlags.has(pipelineId)) {
|
|
22
|
+
timingSystem.pipelineIdToTimingFlags.set(pipelineId, []);
|
|
23
|
+
}
|
|
24
|
+
const timingFlags = timingSystem.pipelineIdToTimingFlags.get(pipelineId);
|
|
25
|
+
timingFlags.push(timingFlag);
|
|
26
|
+
},
|
|
27
|
+
profileStart: () => {
|
|
28
|
+
console.error('NYI: profileStart. This is an issue of lynx-core.');
|
|
29
|
+
},
|
|
30
|
+
profileEnd: () => {
|
|
31
|
+
console.error('NYI: profileEnd. This is an issue of lynx-core.');
|
|
32
|
+
},
|
|
33
|
+
profileMark: () => {
|
|
34
|
+
console.error('NYI: profileMark. This is an issue of lynx-core.');
|
|
35
|
+
},
|
|
36
|
+
profileFlowId: () => {
|
|
37
|
+
console.error('NYI: profileFlowId. This is an issue of lynx-core.');
|
|
38
|
+
return 0;
|
|
39
|
+
},
|
|
40
|
+
isProfileRecording: () => {
|
|
41
|
+
console.error('NYI: isProfileRecording. This is an issue of lynx-core.');
|
|
42
|
+
return false;
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
return performanceApis;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=createPerformanceApis.js.map
|