@lynx-js/web-core-server-canary 0.18.4-canary-20251120-e2c78043 → 0.18.4
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 +14 -10
- package/dist/27.js +1822 -0
- package/dist/index.js +424 -1931
- package/dist/legacy-wasm-chunk.js +30 -33
- package/dist/static/wasm/754c06ee.module.wasm +0 -0
- package/dist/static/wasm/7f8d0487.module.wasm +0 -0
- package/package.json +5 -5
- package/dist/static/wasm/13374bc7.module.wasm +0 -0
- package/dist/static/wasm/75dda358.module.wasm +0 -0
package/dist/27.js
ADDED
|
@@ -0,0 +1,1822 @@
|
|
|
1
|
+
export const __webpack_id__ = "27";
|
|
2
|
+
export const __webpack_ids__ = [
|
|
3
|
+
"27"
|
|
4
|
+
];
|
|
5
|
+
export const __webpack_modules__ = {
|
|
6
|
+
"../../../node_modules/.pnpm/hyphenate-style-name@1.1.0/node_modules/hyphenate-style-name/index.js": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
7
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
8
|
+
A: ()=>__WEBPACK_DEFAULT_EXPORT__
|
|
9
|
+
});
|
|
10
|
+
var uppercasePattern = /[A-Z]/g;
|
|
11
|
+
var msPattern = /^ms-/;
|
|
12
|
+
var cache = {};
|
|
13
|
+
function toHyphenLower(match) {
|
|
14
|
+
return '-' + match.toLowerCase();
|
|
15
|
+
}
|
|
16
|
+
function hyphenateStyleName(name) {
|
|
17
|
+
if (cache.hasOwnProperty(name)) return cache[name];
|
|
18
|
+
var hName = name.replace(uppercasePattern, toHyphenLower);
|
|
19
|
+
return cache[name] = msPattern.test(hName) ? '-' + hName : hName;
|
|
20
|
+
}
|
|
21
|
+
const __WEBPACK_DEFAULT_EXPORT__ = hyphenateStyleName;
|
|
22
|
+
},
|
|
23
|
+
"../../../node_modules/.pnpm/wasm-feature-detect@1.8.0/node_modules/wasm-feature-detect/dist/esm/index.js": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
24
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
25
|
+
rO: ()=>referenceTypes
|
|
26
|
+
});
|
|
27
|
+
const referenceTypes = async ()=>WebAssembly.validate(new Uint8Array([
|
|
28
|
+
0,
|
|
29
|
+
97,
|
|
30
|
+
115,
|
|
31
|
+
109,
|
|
32
|
+
1,
|
|
33
|
+
0,
|
|
34
|
+
0,
|
|
35
|
+
0,
|
|
36
|
+
1,
|
|
37
|
+
4,
|
|
38
|
+
1,
|
|
39
|
+
96,
|
|
40
|
+
0,
|
|
41
|
+
0,
|
|
42
|
+
3,
|
|
43
|
+
2,
|
|
44
|
+
1,
|
|
45
|
+
0,
|
|
46
|
+
10,
|
|
47
|
+
7,
|
|
48
|
+
1,
|
|
49
|
+
5,
|
|
50
|
+
0,
|
|
51
|
+
208,
|
|
52
|
+
112,
|
|
53
|
+
26,
|
|
54
|
+
11
|
|
55
|
+
]));
|
|
56
|
+
},
|
|
57
|
+
"../web-mainthread-apis/binary/standard.js": function(__webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
58
|
+
__webpack_require__.a(__webpack_module__, async function(__webpack_handle_async_dependencies__, __webpack_async_result__) {
|
|
59
|
+
try {
|
|
60
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
61
|
+
H4: ()=>_standard_bg_js__WEBPACK_IMPORTED_MODULE_1__.H4,
|
|
62
|
+
RS: ()=>_standard_bg_js__WEBPACK_IMPORTED_MODULE_1__.RS,
|
|
63
|
+
aC: ()=>_standard_bg_js__WEBPACK_IMPORTED_MODULE_1__.aC,
|
|
64
|
+
bL: ()=>_standard_bg_js__WEBPACK_IMPORTED_MODULE_1__.bL,
|
|
65
|
+
f: ()=>_standard_bg_js__WEBPACK_IMPORTED_MODULE_1__.f,
|
|
66
|
+
iG: ()=>_standard_bg_js__WEBPACK_IMPORTED_MODULE_1__.iG,
|
|
67
|
+
lI: ()=>_standard_bg_js__WEBPACK_IMPORTED_MODULE_1__.lI,
|
|
68
|
+
pY: ()=>_standard_bg_js__WEBPACK_IMPORTED_MODULE_1__.pY
|
|
69
|
+
});
|
|
70
|
+
var _standard_bg_wasm__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../web-mainthread-apis/binary/standard_bg.wasm");
|
|
71
|
+
var _standard_bg_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../web-mainthread-apis/binary/standard_bg.js");
|
|
72
|
+
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([
|
|
73
|
+
_standard_bg_wasm__WEBPACK_IMPORTED_MODULE_0__
|
|
74
|
+
]);
|
|
75
|
+
_standard_bg_wasm__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
|
|
76
|
+
(0, _standard_bg_js__WEBPACK_IMPORTED_MODULE_1__.lI)(_standard_bg_wasm__WEBPACK_IMPORTED_MODULE_0__);
|
|
77
|
+
_standard_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.__wbindgen_start();
|
|
78
|
+
__webpack_async_result__();
|
|
79
|
+
} catch (e) {
|
|
80
|
+
__webpack_async_result__(e);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
"../web-mainthread-apis/binary/standard_bg.js": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
85
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
86
|
+
H4: ()=>__wbg___wbindgen_throw_b855445ff6a94295,
|
|
87
|
+
RS: ()=>__wbg_push_df81a39d04db858c,
|
|
88
|
+
aC: ()=>transform_raw_u16_inline_style_ptr,
|
|
89
|
+
bL: ()=>__wbindgen_init_externref_table,
|
|
90
|
+
f: ()=>__wbg_new_e17d9f43105b08be,
|
|
91
|
+
iG: ()=>transform_raw_u16_inline_style_ptr_parsed,
|
|
92
|
+
lI: ()=>__wbg_set_wasm,
|
|
93
|
+
pY: ()=>__wbindgen_cast_2241b6af4c4b2941
|
|
94
|
+
});
|
|
95
|
+
let wasm;
|
|
96
|
+
function __wbg_set_wasm(val) {
|
|
97
|
+
wasm = val;
|
|
98
|
+
}
|
|
99
|
+
let cachedUint8ArrayMemory0 = null;
|
|
100
|
+
function getUint8ArrayMemory0() {
|
|
101
|
+
if (null === cachedUint8ArrayMemory0 || 0 === cachedUint8ArrayMemory0.byteLength) cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
102
|
+
return cachedUint8ArrayMemory0;
|
|
103
|
+
}
|
|
104
|
+
let cachedTextDecoder = new TextDecoder('utf-8', {
|
|
105
|
+
ignoreBOM: true,
|
|
106
|
+
fatal: true
|
|
107
|
+
});
|
|
108
|
+
cachedTextDecoder.decode();
|
|
109
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
110
|
+
let numBytesDecoded = 0;
|
|
111
|
+
function decodeText(ptr, len) {
|
|
112
|
+
numBytesDecoded += len;
|
|
113
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
114
|
+
cachedTextDecoder = new TextDecoder('utf-8', {
|
|
115
|
+
ignoreBOM: true,
|
|
116
|
+
fatal: true
|
|
117
|
+
});
|
|
118
|
+
cachedTextDecoder.decode();
|
|
119
|
+
numBytesDecoded = len;
|
|
120
|
+
}
|
|
121
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
122
|
+
}
|
|
123
|
+
function getStringFromWasm0(ptr, len) {
|
|
124
|
+
ptr >>>= 0;
|
|
125
|
+
return decodeText(ptr, len);
|
|
126
|
+
}
|
|
127
|
+
let WASM_VECTOR_LEN = 0;
|
|
128
|
+
const cachedTextEncoder = new TextEncoder();
|
|
129
|
+
if (!('encodeInto' in cachedTextEncoder)) cachedTextEncoder.encodeInto = function(arg, view) {
|
|
130
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
131
|
+
view.set(buf);
|
|
132
|
+
return {
|
|
133
|
+
read: arg.length,
|
|
134
|
+
written: buf.length
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
138
|
+
if (void 0 === realloc) {
|
|
139
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
140
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
141
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
142
|
+
WASM_VECTOR_LEN = buf.length;
|
|
143
|
+
return ptr;
|
|
144
|
+
}
|
|
145
|
+
let len = arg.length;
|
|
146
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
147
|
+
const mem = getUint8ArrayMemory0();
|
|
148
|
+
let offset = 0;
|
|
149
|
+
for(; offset < len; offset++){
|
|
150
|
+
const code = arg.charCodeAt(offset);
|
|
151
|
+
if (code > 0x7F) break;
|
|
152
|
+
mem[ptr + offset] = code;
|
|
153
|
+
}
|
|
154
|
+
if (offset !== len) {
|
|
155
|
+
if (0 !== offset) arg = arg.slice(offset);
|
|
156
|
+
ptr = realloc(ptr, len, len = offset + 3 * arg.length, 1) >>> 0;
|
|
157
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
158
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
159
|
+
offset += ret.written;
|
|
160
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
161
|
+
}
|
|
162
|
+
WASM_VECTOR_LEN = offset;
|
|
163
|
+
return ptr;
|
|
164
|
+
}
|
|
165
|
+
function transform_raw_u16_inline_style_ptr(str) {
|
|
166
|
+
const ptr0 = passStringToWasm0(str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
167
|
+
const len0 = WASM_VECTOR_LEN;
|
|
168
|
+
const ret = wasm.transform_raw_u16_inline_style_ptr(ptr0, len0);
|
|
169
|
+
let v2;
|
|
170
|
+
if (0 !== ret[0]) {
|
|
171
|
+
v2 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
172
|
+
wasm.__wbindgen_free(ret[0], +ret[1], 1);
|
|
173
|
+
}
|
|
174
|
+
return v2;
|
|
175
|
+
}
|
|
176
|
+
function transform_raw_u16_inline_style_ptr_parsed(name, value) {
|
|
177
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
178
|
+
const len0 = WASM_VECTOR_LEN;
|
|
179
|
+
const ptr1 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
180
|
+
const len1 = WASM_VECTOR_LEN;
|
|
181
|
+
const ret = wasm.transform_raw_u16_inline_style_ptr_parsed(ptr0, len0, ptr1, len1);
|
|
182
|
+
return ret;
|
|
183
|
+
}
|
|
184
|
+
function __wbg___wbindgen_throw_b855445ff6a94295(arg0, arg1) {
|
|
185
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
186
|
+
}
|
|
187
|
+
function __wbg_new_e17d9f43105b08be() {
|
|
188
|
+
const ret = new Array();
|
|
189
|
+
return ret;
|
|
190
|
+
}
|
|
191
|
+
function __wbg_push_df81a39d04db858c(arg0, arg1) {
|
|
192
|
+
const ret = arg0.push(arg1);
|
|
193
|
+
return ret;
|
|
194
|
+
}
|
|
195
|
+
function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {
|
|
196
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
197
|
+
return ret;
|
|
198
|
+
}
|
|
199
|
+
function __wbindgen_init_externref_table() {
|
|
200
|
+
const table = wasm.__wbindgen_externrefs;
|
|
201
|
+
const offset = table.grow(4);
|
|
202
|
+
table.set(0, void 0);
|
|
203
|
+
table.set(offset + 0, void 0);
|
|
204
|
+
table.set(offset + 1, null);
|
|
205
|
+
table.set(offset + 2, true);
|
|
206
|
+
table.set(offset + 3, false);
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
"../web-mainthread-apis/dist/createMainThreadGlobalThis.js": function(__webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
210
|
+
__webpack_require__.a(__webpack_module__, async function(__webpack_handle_async_dependencies__, __webpack_async_result__) {
|
|
211
|
+
try {
|
|
212
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
213
|
+
D: ()=>createMainThreadGlobalThis
|
|
214
|
+
});
|
|
215
|
+
var _lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../web-constants/dist/index.js");
|
|
216
|
+
var _createMainThreadLynx_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../web-mainthread-apis/dist/createMainThreadLynx.js");
|
|
217
|
+
var _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../web-mainthread-apis/dist/pureElementPAPIs.js");
|
|
218
|
+
var _utils_createCrossThreadEvent_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../web-mainthread-apis/dist/utils/createCrossThreadEvent.js");
|
|
219
|
+
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([
|
|
220
|
+
_pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__,
|
|
221
|
+
_createMainThreadLynx_js__WEBPACK_IMPORTED_MODULE_1__
|
|
222
|
+
]);
|
|
223
|
+
[_pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__, _createMainThreadLynx_js__WEBPACK_IMPORTED_MODULE_1__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__;
|
|
224
|
+
const exposureRelatedAttributes = new Set([
|
|
225
|
+
'exposure-id',
|
|
226
|
+
'exposure-area',
|
|
227
|
+
'exposure-screen-margin-top',
|
|
228
|
+
'exposure-screen-margin-right',
|
|
229
|
+
'exposure-screen-margin-bottom',
|
|
230
|
+
'exposure-screen-margin-left',
|
|
231
|
+
'exposure-ui-margin-top',
|
|
232
|
+
'exposure-ui-margin-right',
|
|
233
|
+
'exposure-ui-margin-bottom',
|
|
234
|
+
'exposure-ui-margin-left'
|
|
235
|
+
]);
|
|
236
|
+
function createMainThreadGlobalThis(config) {
|
|
237
|
+
let timingFlags = [];
|
|
238
|
+
const { callbacks, tagMap, pageConfig, lynxTemplate, rootDom, globalProps, ssrHydrateInfo, ssrHooks, mtsRealm, document } = config;
|
|
239
|
+
const { elementTemplate, lepusCode } = lynxTemplate;
|
|
240
|
+
const lynxUniqueIdToElement = ssrHydrateInfo?.lynxUniqueIdToElement ?? [];
|
|
241
|
+
const elementToRuntimeInfoMap = new WeakMap();
|
|
242
|
+
let pageElement = lynxUniqueIdToElement[1]?.deref();
|
|
243
|
+
let uniqueIdInc = lynxUniqueIdToElement.length || 1;
|
|
244
|
+
const exposureChangedElements = new Set();
|
|
245
|
+
const commonHandler = (event)=>{
|
|
246
|
+
if (!event.currentTarget) return;
|
|
247
|
+
const currentTarget = event.currentTarget;
|
|
248
|
+
const isCapture = event.eventPhase === Event.CAPTURING_PHASE;
|
|
249
|
+
const lynxEventName = _lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.$4[event.type] ?? event.type;
|
|
250
|
+
const runtimeInfo = elementToRuntimeInfoMap.get(currentTarget);
|
|
251
|
+
if (runtimeInfo) {
|
|
252
|
+
const hname = isCapture ? runtimeInfo.eventHandlerMap[lynxEventName]?.capture?.handler : runtimeInfo.eventHandlerMap[lynxEventName]?.bind?.handler;
|
|
253
|
+
const crossThreadEvent = (0, _utils_createCrossThreadEvent_js__WEBPACK_IMPORTED_MODULE_3__.X)(event, lynxEventName);
|
|
254
|
+
if ('string' == typeof hname) {
|
|
255
|
+
const parentComponentUniqueId = Number(currentTarget.getAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.er));
|
|
256
|
+
const parentComponent = lynxUniqueIdToElement[parentComponentUniqueId].deref();
|
|
257
|
+
const componentId = parentComponent?.getAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.Gq) !== 'page' ? parentComponent?.getAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.pP) ?? void 0 : void 0;
|
|
258
|
+
if (componentId) callbacks.publicComponentEvent(componentId, hname, crossThreadEvent);
|
|
259
|
+
else callbacks.publishEvent(hname, crossThreadEvent);
|
|
260
|
+
return true;
|
|
261
|
+
}
|
|
262
|
+
if (hname) {
|
|
263
|
+
crossThreadEvent.target.elementRefptr = event.target;
|
|
264
|
+
if (crossThreadEvent.currentTarget) crossThreadEvent.currentTarget.elementRefptr = event.currentTarget;
|
|
265
|
+
mtsRealm.globalWindow.runWorklet?.(hname.value, [
|
|
266
|
+
crossThreadEvent
|
|
267
|
+
]);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return false;
|
|
271
|
+
};
|
|
272
|
+
const commonCatchHandler = (event)=>{
|
|
273
|
+
const handlerTriggered = commonHandler(event);
|
|
274
|
+
if (handlerTriggered) event.stopPropagation();
|
|
275
|
+
};
|
|
276
|
+
const __AddEvent = (element, eventType, eventName, newEventHandler)=>{
|
|
277
|
+
eventName = eventName.toLowerCase();
|
|
278
|
+
const isCatch = 'catchEvent' === eventType || 'capture-catch' === eventType;
|
|
279
|
+
const isCapture = eventType.startsWith('capture');
|
|
280
|
+
const runtimeInfo = elementToRuntimeInfoMap.get(element) ?? {
|
|
281
|
+
eventHandlerMap: {},
|
|
282
|
+
componentAtIndex: void 0,
|
|
283
|
+
enqueueComponent: void 0
|
|
284
|
+
};
|
|
285
|
+
const currentHandler = isCapture ? runtimeInfo.eventHandlerMap[eventName]?.capture : runtimeInfo.eventHandlerMap[eventName]?.bind;
|
|
286
|
+
const currentRegisteredHandler = isCatch ? commonCatchHandler : commonHandler;
|
|
287
|
+
if (currentHandler) {
|
|
288
|
+
if (!newEventHandler) {
|
|
289
|
+
element.removeEventListener(eventName, currentRegisteredHandler, {
|
|
290
|
+
capture: isCapture
|
|
291
|
+
});
|
|
292
|
+
const isExposure = 'uiappear' === eventName || 'uidisappear' === eventName;
|
|
293
|
+
if (isExposure && '-1' === element.getAttribute('exposure-id')) mtsGlobalThis.__SetAttribute(element, 'exposure-id', null);
|
|
294
|
+
}
|
|
295
|
+
} else if (newEventHandler) {
|
|
296
|
+
const htmlEventName = _lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.vQ[element.tagName]?.[eventName] ?? _lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.im[eventName] ?? eventName;
|
|
297
|
+
element.addEventListener(htmlEventName, currentRegisteredHandler, {
|
|
298
|
+
capture: isCapture
|
|
299
|
+
});
|
|
300
|
+
const isExposure = 'uiappear' === eventName || 'uidisappear' === eventName;
|
|
301
|
+
if (isExposure && null === element.getAttribute('exposure-id')) mtsGlobalThis.__SetAttribute(element, 'exposure-id', '-1');
|
|
302
|
+
}
|
|
303
|
+
if (newEventHandler) {
|
|
304
|
+
const info = {
|
|
305
|
+
type: eventType,
|
|
306
|
+
handler: newEventHandler
|
|
307
|
+
};
|
|
308
|
+
if (!runtimeInfo.eventHandlerMap[eventName]) runtimeInfo.eventHandlerMap[eventName] = {
|
|
309
|
+
capture: void 0,
|
|
310
|
+
bind: void 0
|
|
311
|
+
};
|
|
312
|
+
if (isCapture) runtimeInfo.eventHandlerMap[eventName].capture = info;
|
|
313
|
+
else runtimeInfo.eventHandlerMap[eventName].bind = info;
|
|
314
|
+
}
|
|
315
|
+
elementToRuntimeInfoMap.set(element, runtimeInfo);
|
|
316
|
+
};
|
|
317
|
+
const __GetEvent = (element, eventName, eventType)=>{
|
|
318
|
+
const runtimeInfo = elementToRuntimeInfoMap.get(element);
|
|
319
|
+
if (!runtimeInfo) return;
|
|
320
|
+
{
|
|
321
|
+
eventName = eventName.toLowerCase();
|
|
322
|
+
const isCapture = eventType.startsWith('capture');
|
|
323
|
+
const handler = isCapture ? runtimeInfo.eventHandlerMap[eventName]?.capture : runtimeInfo.eventHandlerMap[eventName]?.bind;
|
|
324
|
+
return handler?.handler;
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
const __GetEvents = (element)=>{
|
|
328
|
+
const eventHandlerMap = elementToRuntimeInfoMap.get(element)?.eventHandlerMap ?? {};
|
|
329
|
+
const eventInfos = [];
|
|
330
|
+
for (const [lynxEventName, info] of Object.entries(eventHandlerMap))for (const atomInfo of [
|
|
331
|
+
info.bind,
|
|
332
|
+
info.capture
|
|
333
|
+
])if (atomInfo) {
|
|
334
|
+
const { type, handler } = atomInfo;
|
|
335
|
+
if (handler) eventInfos.push({
|
|
336
|
+
type: type,
|
|
337
|
+
name: lynxEventName,
|
|
338
|
+
function: handler
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
return eventInfos;
|
|
342
|
+
};
|
|
343
|
+
const __SetEvents = (element, listeners)=>{
|
|
344
|
+
for (const { type: eventType, name: lynxEventName, function: eventHandler } of listeners)__AddEvent(element, eventType, lynxEventName, eventHandler);
|
|
345
|
+
};
|
|
346
|
+
const __CreateElement = (tag, parentComponentUniqueId)=>{
|
|
347
|
+
const uniqueId = uniqueIdInc++;
|
|
348
|
+
const htmlTag = tagMap[tag] ?? tag;
|
|
349
|
+
const element = document.createElement(htmlTag);
|
|
350
|
+
lynxUniqueIdToElement[uniqueId] = new WeakRef(element);
|
|
351
|
+
const parentComponentCssID = lynxUniqueIdToElement[parentComponentUniqueId]?.deref()?.getAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.js);
|
|
352
|
+
parentComponentCssID && '0' !== parentComponentCssID && element.setAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.js, parentComponentCssID);
|
|
353
|
+
element.setAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.Gq, tag);
|
|
354
|
+
element.setAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.SP, uniqueId + '');
|
|
355
|
+
element.setAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.er, parentComponentUniqueId + '');
|
|
356
|
+
return element;
|
|
357
|
+
};
|
|
358
|
+
const __CreateView = (parentComponentUniqueId)=>__CreateElement('view', parentComponentUniqueId);
|
|
359
|
+
const __CreateText = (parentComponentUniqueId)=>__CreateElement('text', parentComponentUniqueId);
|
|
360
|
+
const __CreateRawText = (text)=>{
|
|
361
|
+
const element = __CreateElement('raw-text', -1);
|
|
362
|
+
element.setAttribute('text', text);
|
|
363
|
+
return element;
|
|
364
|
+
};
|
|
365
|
+
const __CreateImage = (parentComponentUniqueId)=>__CreateElement('image', parentComponentUniqueId);
|
|
366
|
+
const __CreateScrollView = (parentComponentUniqueId)=>__CreateElement('scroll-view', parentComponentUniqueId);
|
|
367
|
+
const __CreateWrapperElement = (parentComponentUniqueId)=>__CreateElement('lynx-wrapper', parentComponentUniqueId);
|
|
368
|
+
const __CreatePage = (componentID, cssID)=>{
|
|
369
|
+
const page = __CreateElement('page', 0);
|
|
370
|
+
page.setAttribute('part', 'page');
|
|
371
|
+
page.setAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.js, cssID + '');
|
|
372
|
+
page.setAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.er, '0');
|
|
373
|
+
page.setAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.pP, componentID);
|
|
374
|
+
(0, _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.uY)(page);
|
|
375
|
+
if (false === pageConfig.defaultDisplayLinear) page.setAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.Gm, 'false');
|
|
376
|
+
if (true === pageConfig.defaultOverflowVisible) page.setAttribute('lynx-default-overflow-visible', 'true');
|
|
377
|
+
pageElement = page;
|
|
378
|
+
return page;
|
|
379
|
+
};
|
|
380
|
+
const __CreateList = (parentComponentUniqueId, componentAtIndex, enqueueComponent)=>{
|
|
381
|
+
const list = __CreateElement('list', parentComponentUniqueId);
|
|
382
|
+
const runtimeInfo = {
|
|
383
|
+
eventHandlerMap: {},
|
|
384
|
+
componentAtIndex: componentAtIndex,
|
|
385
|
+
enqueueComponent: enqueueComponent
|
|
386
|
+
};
|
|
387
|
+
elementToRuntimeInfoMap.set(list, runtimeInfo);
|
|
388
|
+
return list;
|
|
389
|
+
};
|
|
390
|
+
const __CreateComponent = (componentParentUniqueID, componentID, cssID, _, name)=>{
|
|
391
|
+
const component = __CreateElement('view', componentParentUniqueID);
|
|
392
|
+
component.setAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.js, cssID + '');
|
|
393
|
+
component.setAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.pP, componentID);
|
|
394
|
+
component.setAttribute('name', name);
|
|
395
|
+
return component;
|
|
396
|
+
};
|
|
397
|
+
const __SetAttribute = (element, key, value)=>{
|
|
398
|
+
const tag = element.getAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.Gq);
|
|
399
|
+
if ('list' === tag && 'update-list-info' === key) {
|
|
400
|
+
const listInfo = value;
|
|
401
|
+
const { insertAction, removeAction } = listInfo;
|
|
402
|
+
queueMicrotask(()=>{
|
|
403
|
+
const runtimeInfo = elementToRuntimeInfoMap.get(element);
|
|
404
|
+
if (runtimeInfo) {
|
|
405
|
+
const componentAtIndex = runtimeInfo.componentAtIndex;
|
|
406
|
+
const enqueueComponent = runtimeInfo.enqueueComponent;
|
|
407
|
+
const uniqueId = (0, _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.Tj)(element);
|
|
408
|
+
for (const action of insertAction)componentAtIndex?.(element, uniqueId, action.position, 0, false);
|
|
409
|
+
for (const action of removeAction)enqueueComponent?.(element, uniqueId, action.position);
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
} else {
|
|
413
|
+
null == value ? element.removeAttribute(key) : element.setAttribute(key, value + '');
|
|
414
|
+
if (key === _lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.I7 && value) timingFlags.push(value);
|
|
415
|
+
if (exposureRelatedAttributes.has(key)) exposureChangedElements.add(element);
|
|
416
|
+
}
|
|
417
|
+
};
|
|
418
|
+
const __UpdateListCallbacks = (element, componentAtIndex, enqueueComponent)=>{
|
|
419
|
+
const runtimeInfo = elementToRuntimeInfoMap.get(element) ?? {
|
|
420
|
+
eventHandlerMap: {},
|
|
421
|
+
componentAtIndex: componentAtIndex,
|
|
422
|
+
enqueueComponent: enqueueComponent,
|
|
423
|
+
uniqueId: (0, _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.Tj)(element)
|
|
424
|
+
};
|
|
425
|
+
runtimeInfo.componentAtIndex = componentAtIndex;
|
|
426
|
+
runtimeInfo.enqueueComponent = enqueueComponent;
|
|
427
|
+
elementToRuntimeInfoMap.set(element, runtimeInfo);
|
|
428
|
+
};
|
|
429
|
+
const __SwapElement = (childA, childB)=>{
|
|
430
|
+
const temp = document.createElement('div');
|
|
431
|
+
childA.replaceWith(temp);
|
|
432
|
+
childB.replaceWith(childA);
|
|
433
|
+
temp.replaceWith(childB);
|
|
434
|
+
};
|
|
435
|
+
const __SetCSSIdForCSSOG = (elements, cssId, entryName)=>{
|
|
436
|
+
for (const element of elements){
|
|
437
|
+
element.setAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.js, cssId + '');
|
|
438
|
+
entryName && element.setAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.Pb, entryName);
|
|
439
|
+
const cls = element.getAttribute('class');
|
|
440
|
+
cls && __SetClassesForCSSOG(element, cls);
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
const __AddClassForCSSOG = (element, className)=>{
|
|
444
|
+
const newClassName = ((element.getAttribute('class') ?? '') + ' ' + className).trim();
|
|
445
|
+
element.setAttribute('class', newClassName);
|
|
446
|
+
const cssId = element.getAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.js);
|
|
447
|
+
const uniqueId = Number(element.getAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.SP));
|
|
448
|
+
const entryName = element.getAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.Pb);
|
|
449
|
+
callbacks.updateCssOGStyle(uniqueId, newClassName, cssId, entryName);
|
|
450
|
+
};
|
|
451
|
+
const __SetClassesForCSSOG = (element, classNames)=>{
|
|
452
|
+
(0, _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.R5)(element, classNames);
|
|
453
|
+
const cssId = element.getAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.js);
|
|
454
|
+
const uniqueId = Number(element.getAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.SP));
|
|
455
|
+
const entryName = element.getAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.Pb);
|
|
456
|
+
callbacks.updateCssOGStyle(uniqueId, classNames ?? '', cssId, entryName);
|
|
457
|
+
};
|
|
458
|
+
const __LoadLepusChunk = (path)=>{
|
|
459
|
+
try {
|
|
460
|
+
path = lepusCode?.[path] ?? path;
|
|
461
|
+
mtsRealm.loadScriptSync(path);
|
|
462
|
+
return true;
|
|
463
|
+
} catch (e) {
|
|
464
|
+
console.error(`failed to load lepus chunk ${path}`, e);
|
|
465
|
+
return false;
|
|
466
|
+
}
|
|
467
|
+
};
|
|
468
|
+
const __FlushElementTree = (_subTree, options)=>{
|
|
469
|
+
const timingFlagsCopied = timingFlags;
|
|
470
|
+
timingFlags = [];
|
|
471
|
+
if (pageElement && !pageElement.parentNode && '' !== pageElement.getAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.JA)) rootDom.append(pageElement);
|
|
472
|
+
const exposureChangedElementsArray = Array.from(exposureChangedElements);
|
|
473
|
+
exposureChangedElements.clear();
|
|
474
|
+
callbacks.flushElementTree(options, timingFlagsCopied, exposureChangedElementsArray);
|
|
475
|
+
};
|
|
476
|
+
const __GetPageElement = ()=>pageElement;
|
|
477
|
+
const templateIdToTemplate = {};
|
|
478
|
+
const createElementForElementTemplateData = (data, parentComponentUniId)=>{
|
|
479
|
+
const element = __CreateElement(data.type, parentComponentUniId);
|
|
480
|
+
(0, _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.wr)(element, data.id);
|
|
481
|
+
data.class && (0, _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.R5)(element, data.class.join(' '));
|
|
482
|
+
for (const [key, value] of Object.entries(data.attributes || {}))__SetAttribute(element, key, value);
|
|
483
|
+
for (const [key, value] of Object.entries(data.builtinAttributes || {})){
|
|
484
|
+
if ('dirtyID' === key && value === data.id) (0, _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.ZW)(element, value);
|
|
485
|
+
__SetAttribute(element, key, value);
|
|
486
|
+
}
|
|
487
|
+
for (const childData of data.children || [])(0, _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.vh)(element, createElementForElementTemplateData(childData, parentComponentUniId));
|
|
488
|
+
void 0 !== data.dataset && (0, _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.bw)(element, data.dataset);
|
|
489
|
+
return element;
|
|
490
|
+
};
|
|
491
|
+
const applyEventsForElementTemplate = (data, element)=>{
|
|
492
|
+
const uniqueId = uniqueIdInc++;
|
|
493
|
+
element.setAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.SP, uniqueId + '');
|
|
494
|
+
for (const event of data.events || []){
|
|
495
|
+
const { type, name, value } = event;
|
|
496
|
+
__AddEvent(element, type, name, value);
|
|
497
|
+
}
|
|
498
|
+
for(let ii = 0; ii < (data.children || []).length; ii++){
|
|
499
|
+
const childData = (data.children || [])[ii];
|
|
500
|
+
const childElement = element.children[ii];
|
|
501
|
+
if (childData && childElement) applyEventsForElementTemplate(childData, childElement);
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
const __ElementFromBinary = (templateId, parentComponentUniId)=>{
|
|
505
|
+
const elementTemplateData = elementTemplate[templateId];
|
|
506
|
+
if (elementTemplateData) {
|
|
507
|
+
let clonedElements;
|
|
508
|
+
if (templateIdToTemplate[templateId]) clonedElements = Array.from(templateIdToTemplate[templateId].content.cloneNode(true).children);
|
|
509
|
+
else {
|
|
510
|
+
clonedElements = elementTemplateData.map((data)=>createElementForElementTemplateData(data, parentComponentUniId));
|
|
511
|
+
if (rootDom.cloneNode) {
|
|
512
|
+
const template = document.createElement('template');
|
|
513
|
+
template.content.append(...clonedElements);
|
|
514
|
+
templateIdToTemplate[templateId] = template;
|
|
515
|
+
rootDom.append(template);
|
|
516
|
+
return __ElementFromBinary(templateId, parentComponentUniId);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
for(let ii = 0; ii < clonedElements.length; ii++){
|
|
520
|
+
const data = elementTemplateData[ii];
|
|
521
|
+
const element = clonedElements[ii];
|
|
522
|
+
if (data && element) applyEventsForElementTemplate(data, element);
|
|
523
|
+
}
|
|
524
|
+
clonedElements.forEach(_pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.uY);
|
|
525
|
+
return clonedElements;
|
|
526
|
+
}
|
|
527
|
+
return [];
|
|
528
|
+
};
|
|
529
|
+
let release = '';
|
|
530
|
+
const isCSSOG = !pageConfig.enableCSSSelector;
|
|
531
|
+
const SystemInfo = {
|
|
532
|
+
..._lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.c1,
|
|
533
|
+
...config.browserConfig
|
|
534
|
+
};
|
|
535
|
+
const mtsGlobalThis = {
|
|
536
|
+
__ElementFromBinary,
|
|
537
|
+
__GetTemplateParts: rootDom.querySelectorAll ? _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.$G : void 0,
|
|
538
|
+
__MarkTemplateElement: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.uY,
|
|
539
|
+
__MarkPartElement: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.ZW,
|
|
540
|
+
__AddEvent: ssrHooks?.__AddEvent ?? __AddEvent,
|
|
541
|
+
__GetEvent,
|
|
542
|
+
__GetEvents,
|
|
543
|
+
__SetEvents,
|
|
544
|
+
__AppendElement: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.vh,
|
|
545
|
+
__ElementIsEqual: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.pn,
|
|
546
|
+
__FirstElement: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.vH,
|
|
547
|
+
__GetChildren: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.yj,
|
|
548
|
+
__GetParent: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.d6,
|
|
549
|
+
__InsertElementBefore: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.pi,
|
|
550
|
+
__LastElement: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.Nu,
|
|
551
|
+
__NextElement: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.cw,
|
|
552
|
+
__RemoveElement: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.z3,
|
|
553
|
+
__ReplaceElement: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.Xk,
|
|
554
|
+
__ReplaceElements: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.yE,
|
|
555
|
+
__AddConfig: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.Ud,
|
|
556
|
+
__AddDataset: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.Kz,
|
|
557
|
+
__GetAttributes: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.GE,
|
|
558
|
+
__GetComponentID: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.zP,
|
|
559
|
+
__GetDataByKey: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.NV,
|
|
560
|
+
__GetDataset: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.Fl,
|
|
561
|
+
__GetElementConfig: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.pe,
|
|
562
|
+
__GetElementUniqueID: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.Tj,
|
|
563
|
+
__GetID: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.cb,
|
|
564
|
+
__GetTag: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.zm,
|
|
565
|
+
__SetConfig: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.l9,
|
|
566
|
+
__SetDataset: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.bw,
|
|
567
|
+
__SetID: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.wr,
|
|
568
|
+
__UpdateComponentID: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.A7,
|
|
569
|
+
__UpdateComponentInfo: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.$r,
|
|
570
|
+
__CreateElement,
|
|
571
|
+
__CreateView,
|
|
572
|
+
__CreateText,
|
|
573
|
+
__CreateComponent,
|
|
574
|
+
__CreatePage,
|
|
575
|
+
__CreateRawText,
|
|
576
|
+
__CreateImage,
|
|
577
|
+
__CreateScrollView,
|
|
578
|
+
__CreateWrapperElement,
|
|
579
|
+
__CreateList,
|
|
580
|
+
__SetAttribute,
|
|
581
|
+
__SwapElement,
|
|
582
|
+
__UpdateListCallbacks,
|
|
583
|
+
__GetConfig: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.pe,
|
|
584
|
+
__GetAttributeByName: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.li,
|
|
585
|
+
__GetClasses: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.Tq,
|
|
586
|
+
__AddClass: isCSSOG ? __AddClassForCSSOG : _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.gA,
|
|
587
|
+
__SetClasses: isCSSOG ? __SetClassesForCSSOG : _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.R5,
|
|
588
|
+
__AddInlineStyle: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.kB,
|
|
589
|
+
__SetCSSId: isCSSOG ? __SetCSSIdForCSSOG : _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.D1,
|
|
590
|
+
__SetInlineStyles: _pureElementPAPIs_js__WEBPACK_IMPORTED_MODULE_2__.c2,
|
|
591
|
+
__LoadLepusChunk,
|
|
592
|
+
__GetPageElement,
|
|
593
|
+
__globalProps: globalProps,
|
|
594
|
+
__QueryComponent: callbacks.__QueryComponent,
|
|
595
|
+
SystemInfo,
|
|
596
|
+
lynx: (0, _createMainThreadLynx_js__WEBPACK_IMPORTED_MODULE_1__.B)(config, SystemInfo),
|
|
597
|
+
_ReportError: (err, _)=>callbacks._ReportError(err, _, release),
|
|
598
|
+
_SetSourceMapRelease: (errInfo)=>release = errInfo?.release,
|
|
599
|
+
__OnLifecycleEvent: callbacks.__OnLifecycleEvent,
|
|
600
|
+
__FlushElementTree,
|
|
601
|
+
_I18nResourceTranslation: callbacks._I18nResourceTranslation,
|
|
602
|
+
_AddEventListener: ()=>{},
|
|
603
|
+
renderPage: void 0
|
|
604
|
+
};
|
|
605
|
+
Object.assign(mtsRealm.globalWindow, mtsGlobalThis);
|
|
606
|
+
Object.defineProperty(mtsRealm.globalWindow, 'renderPage', {
|
|
607
|
+
get () {
|
|
608
|
+
return mtsGlobalThis.renderPage;
|
|
609
|
+
},
|
|
610
|
+
set (v) {
|
|
611
|
+
mtsGlobalThis.renderPage = v;
|
|
612
|
+
queueMicrotask(callbacks.mainChunkReady);
|
|
613
|
+
},
|
|
614
|
+
configurable: true,
|
|
615
|
+
enumerable: true
|
|
616
|
+
});
|
|
617
|
+
return mtsRealm.globalWindow;
|
|
618
|
+
}
|
|
619
|
+
__webpack_async_result__();
|
|
620
|
+
} catch (e) {
|
|
621
|
+
__webpack_async_result__(e);
|
|
622
|
+
}
|
|
623
|
+
});
|
|
624
|
+
},
|
|
625
|
+
"../web-mainthread-apis/dist/createMainThreadLynx.js": function(__webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
626
|
+
__webpack_require__.a(__webpack_module__, async function(__webpack_handle_async_dependencies__, __webpack_async_result__) {
|
|
627
|
+
try {
|
|
628
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
629
|
+
B: ()=>createMainThreadLynx
|
|
630
|
+
});
|
|
631
|
+
var _createMainThreadGlobalThis_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../web-mainthread-apis/dist/createMainThreadGlobalThis.js");
|
|
632
|
+
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([
|
|
633
|
+
_createMainThreadGlobalThis_js__WEBPACK_IMPORTED_MODULE_0__
|
|
634
|
+
]);
|
|
635
|
+
_createMainThreadGlobalThis_js__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
|
|
636
|
+
function createMainThreadLynx(config, SystemInfo) {
|
|
637
|
+
const requestAnimationFrameBrowserImpl = requestAnimationFrame;
|
|
638
|
+
const cancelAnimationFrameBrowserImpl = cancelAnimationFrame;
|
|
639
|
+
const setTimeoutBrowserImpl = setTimeout;
|
|
640
|
+
const clearTimeoutBrowserImpl = clearTimeout;
|
|
641
|
+
const setIntervalBrowserImpl = setInterval;
|
|
642
|
+
const clearIntervalBrowserImpl = clearInterval;
|
|
643
|
+
return {
|
|
644
|
+
getJSContext () {
|
|
645
|
+
return config.jsContext;
|
|
646
|
+
},
|
|
647
|
+
requestAnimationFrame (cb) {
|
|
648
|
+
return requestAnimationFrameBrowserImpl(cb);
|
|
649
|
+
},
|
|
650
|
+
cancelAnimationFrame (handler) {
|
|
651
|
+
return cancelAnimationFrameBrowserImpl(handler);
|
|
652
|
+
},
|
|
653
|
+
__globalProps: config.globalProps,
|
|
654
|
+
getCustomSectionSync (key) {
|
|
655
|
+
return config.lynxTemplate.customSections[key]?.content;
|
|
656
|
+
},
|
|
657
|
+
markPipelineTiming: config.callbacks.markTiming,
|
|
658
|
+
SystemInfo,
|
|
659
|
+
setTimeout: setTimeoutBrowserImpl,
|
|
660
|
+
clearTimeout: clearTimeoutBrowserImpl,
|
|
661
|
+
setInterval: setIntervalBrowserImpl,
|
|
662
|
+
clearInterval: clearIntervalBrowserImpl
|
|
663
|
+
};
|
|
664
|
+
}
|
|
665
|
+
__webpack_async_result__();
|
|
666
|
+
} catch (e) {
|
|
667
|
+
__webpack_async_result__(e);
|
|
668
|
+
}
|
|
669
|
+
});
|
|
670
|
+
},
|
|
671
|
+
"../web-mainthread-apis/dist/crossThreadHandlers/createQueryComponent.js": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
672
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
673
|
+
k: ()=>createQueryComponent
|
|
674
|
+
});
|
|
675
|
+
var _lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../web-constants/dist/index.js");
|
|
676
|
+
function createQueryComponent(loadTemplate, updateLazyComponentStyle, backgroundThreadRpc, mtsGlobalThisRef, jsContext, mtsRealm) {
|
|
677
|
+
const updateBTSTemplateCache = backgroundThreadRpc.createCall(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.WS);
|
|
678
|
+
const lazyCache = new Map();
|
|
679
|
+
const __QueryComponentImpl = (url, callback)=>{
|
|
680
|
+
const cacheLazy = lazyCache.get(url);
|
|
681
|
+
const loadPromise = cacheLazy ?? loadTemplate(url).then(async (template)=>{
|
|
682
|
+
const updateBTSCachePromise = updateBTSTemplateCache(url, template);
|
|
683
|
+
let lepusRootChunkExport = await mtsRealm.loadScript(template.lepusCode.root);
|
|
684
|
+
if (mtsGlobalThisRef.mtsGlobalThis.processEvalResult) lepusRootChunkExport = mtsGlobalThisRef.mtsGlobalThis.processEvalResult(lepusRootChunkExport, url);
|
|
685
|
+
updateLazyComponentStyle(template.styleInfo, url);
|
|
686
|
+
await updateBTSCachePromise;
|
|
687
|
+
jsContext.dispatchEvent({
|
|
688
|
+
type: '__OnDynamicJSSourcePrepared',
|
|
689
|
+
data: url
|
|
690
|
+
});
|
|
691
|
+
return lepusRootChunkExport;
|
|
692
|
+
});
|
|
693
|
+
cacheLazy || lazyCache.set(url, loadPromise);
|
|
694
|
+
loadPromise.then((lepusRootChunkExport)=>{
|
|
695
|
+
callback?.({
|
|
696
|
+
code: 0,
|
|
697
|
+
data: {
|
|
698
|
+
url,
|
|
699
|
+
evalResult: lepusRootChunkExport
|
|
700
|
+
}
|
|
701
|
+
});
|
|
702
|
+
}).catch((error)=>{
|
|
703
|
+
console.error("lynx web: lazy bundle load failed:", error);
|
|
704
|
+
lazyCache.delete(url);
|
|
705
|
+
callback?.({
|
|
706
|
+
code: -1,
|
|
707
|
+
data: void 0
|
|
708
|
+
});
|
|
709
|
+
});
|
|
710
|
+
return null;
|
|
711
|
+
};
|
|
712
|
+
backgroundThreadRpc.registerHandler(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.nk, (url)=>{
|
|
713
|
+
const ret = new Promise((resolve)=>{
|
|
714
|
+
__QueryComponentImpl(url, (result)=>{
|
|
715
|
+
resolve({
|
|
716
|
+
code: result.code,
|
|
717
|
+
detail: {
|
|
718
|
+
schema: url
|
|
719
|
+
}
|
|
720
|
+
});
|
|
721
|
+
});
|
|
722
|
+
});
|
|
723
|
+
return ret;
|
|
724
|
+
});
|
|
725
|
+
return __QueryComponentImpl;
|
|
726
|
+
}
|
|
727
|
+
},
|
|
728
|
+
"../web-mainthread-apis/dist/crossThreadHandlers/registerCallLepusMethodHandler.js": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
729
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
730
|
+
A: ()=>registerCallLepusMethodHandler
|
|
731
|
+
});
|
|
732
|
+
var _lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../web-constants/dist/index.js");
|
|
733
|
+
function registerCallLepusMethodHandler(rpc, runtime) {
|
|
734
|
+
rpc.registerHandler(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.iH, (methodName, data)=>{
|
|
735
|
+
runtime[methodName](data);
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
},
|
|
739
|
+
"../web-mainthread-apis/dist/crossThreadHandlers/registerGetCustomSectionHandler.js": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
740
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
741
|
+
m: ()=>registerGetCustomSectionHandler
|
|
742
|
+
});
|
|
743
|
+
var _lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../web-constants/dist/index.js");
|
|
744
|
+
function registerGetCustomSectionHandler(rpc, customSections) {
|
|
745
|
+
rpc.registerHandler(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.Fw, (key)=>customSections[key]?.content);
|
|
746
|
+
}
|
|
747
|
+
},
|
|
748
|
+
"../web-mainthread-apis/dist/index.js": function(__webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
749
|
+
__webpack_require__.a(__webpack_module__, async function(__webpack_handle_async_dependencies__, __webpack_async_result__) {
|
|
750
|
+
try {
|
|
751
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
752
|
+
prepareMainThreadAPIs: ()=>_prepareMainThreadAPIs_js__WEBPACK_IMPORTED_MODULE_0__.m
|
|
753
|
+
});
|
|
754
|
+
var _prepareMainThreadAPIs_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../web-mainthread-apis/dist/prepareMainThreadAPIs.js");
|
|
755
|
+
var _createMainThreadGlobalThis_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../web-mainthread-apis/dist/createMainThreadGlobalThis.js");
|
|
756
|
+
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([
|
|
757
|
+
_prepareMainThreadAPIs_js__WEBPACK_IMPORTED_MODULE_0__,
|
|
758
|
+
_createMainThreadGlobalThis_js__WEBPACK_IMPORTED_MODULE_1__
|
|
759
|
+
]);
|
|
760
|
+
[_prepareMainThreadAPIs_js__WEBPACK_IMPORTED_MODULE_0__, _createMainThreadGlobalThis_js__WEBPACK_IMPORTED_MODULE_1__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__;
|
|
761
|
+
__webpack_async_result__();
|
|
762
|
+
} catch (e) {
|
|
763
|
+
__webpack_async_result__(e);
|
|
764
|
+
}
|
|
765
|
+
});
|
|
766
|
+
},
|
|
767
|
+
"../web-mainthread-apis/dist/prepareMainThreadAPIs.js": function(__webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
768
|
+
__webpack_require__.a(__webpack_module__, async function(__webpack_handle_async_dependencies__, __webpack_async_result__) {
|
|
769
|
+
try {
|
|
770
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
771
|
+
m: ()=>prepareMainThreadAPIs
|
|
772
|
+
});
|
|
773
|
+
var _lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../web-constants/dist/index.js");
|
|
774
|
+
var _crossThreadHandlers_registerCallLepusMethodHandler_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../web-mainthread-apis/dist/crossThreadHandlers/registerCallLepusMethodHandler.js");
|
|
775
|
+
var _crossThreadHandlers_registerGetCustomSectionHandler_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../web-mainthread-apis/dist/crossThreadHandlers/registerGetCustomSectionHandler.js");
|
|
776
|
+
var _createMainThreadGlobalThis_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../web-mainthread-apis/dist/createMainThreadGlobalThis.js");
|
|
777
|
+
var _utils_createExposureService_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("../web-mainthread-apis/dist/utils/createExposureService.js");
|
|
778
|
+
var _utils_processStyleInfo_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("../web-mainthread-apis/dist/utils/processStyleInfo.js");
|
|
779
|
+
var _crossThreadHandlers_createQueryComponent_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("../web-mainthread-apis/dist/crossThreadHandlers/createQueryComponent.js");
|
|
780
|
+
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([
|
|
781
|
+
_utils_processStyleInfo_js__WEBPACK_IMPORTED_MODULE_5__,
|
|
782
|
+
_createMainThreadGlobalThis_js__WEBPACK_IMPORTED_MODULE_3__
|
|
783
|
+
]);
|
|
784
|
+
[_utils_processStyleInfo_js__WEBPACK_IMPORTED_MODULE_5__, _createMainThreadGlobalThis_js__WEBPACK_IMPORTED_MODULE_3__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__;
|
|
785
|
+
function prepareMainThreadAPIs(backgroundThreadRpc, rootDom, document, mtsRealmPromise, commitDocument, markTimingInternal, flushMarkTimingInternal, reportError, triggerI18nResourceFallback, initialI18nResources, loadTemplate, ssrHooks) {
|
|
786
|
+
const postTimingFlags = backgroundThreadRpc.createCall(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.F6);
|
|
787
|
+
const backgroundStart = backgroundThreadRpc.createCall(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.a$);
|
|
788
|
+
const publishEvent = backgroundThreadRpc.createCall(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.JW);
|
|
789
|
+
const publicComponentEvent = backgroundThreadRpc.createCall(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.Ke);
|
|
790
|
+
const postExposure = backgroundThreadRpc.createCall(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.pd);
|
|
791
|
+
const dispatchI18nResource = backgroundThreadRpc.createCall(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.mB);
|
|
792
|
+
const updateDataBackground = backgroundThreadRpc.createCall(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.Ve);
|
|
793
|
+
markTimingInternal('lepus_execute_start');
|
|
794
|
+
async function startMainThread(config, ssrHydrateInfo) {
|
|
795
|
+
let isFp = true;
|
|
796
|
+
const { globalProps, template, browserConfig, nativeModulesMap, napiModulesMap, tagMap, initI18nResources } = config;
|
|
797
|
+
const { styleInfo, pageConfig, customSections, cardType } = template;
|
|
798
|
+
const mtsRealm = await mtsRealmPromise;
|
|
799
|
+
markTimingInternal('decode_start');
|
|
800
|
+
const jsContext = new _lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.tf({
|
|
801
|
+
rpc: backgroundThreadRpc,
|
|
802
|
+
receiveEventEndpoint: _lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.Is,
|
|
803
|
+
sendEventEndpoint: _lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.jK
|
|
804
|
+
});
|
|
805
|
+
const i18nResources = initialI18nResources(initI18nResources);
|
|
806
|
+
const { updateCssOGStyle, updateLazyComponentStyle } = (0, _utils_processStyleInfo_js__WEBPACK_IMPORTED_MODULE_5__.c6)(styleInfo, pageConfig, rootDom, document, ssrHydrateInfo);
|
|
807
|
+
const mtsGlobalThisRef = {
|
|
808
|
+
mtsGlobalThis: void 0
|
|
809
|
+
};
|
|
810
|
+
const __QueryComponent = (0, _crossThreadHandlers_createQueryComponent_js__WEBPACK_IMPORTED_MODULE_6__.k)(loadTemplate, updateLazyComponentStyle, backgroundThreadRpc, mtsGlobalThisRef, jsContext, mtsRealm);
|
|
811
|
+
const mtsGlobalThis = (0, _createMainThreadGlobalThis_js__WEBPACK_IMPORTED_MODULE_3__.D)({
|
|
812
|
+
lynxTemplate: template,
|
|
813
|
+
mtsRealm,
|
|
814
|
+
jsContext,
|
|
815
|
+
tagMap,
|
|
816
|
+
browserConfig,
|
|
817
|
+
globalProps,
|
|
818
|
+
pageConfig,
|
|
819
|
+
rootDom,
|
|
820
|
+
ssrHydrateInfo,
|
|
821
|
+
ssrHooks,
|
|
822
|
+
document,
|
|
823
|
+
callbacks: {
|
|
824
|
+
updateCssOGStyle,
|
|
825
|
+
mainChunkReady: ()=>{
|
|
826
|
+
markTimingInternal('data_processor_start');
|
|
827
|
+
let initData = config.initData;
|
|
828
|
+
if (true !== pageConfig.enableJSDataProcessor && mtsGlobalThis.processData) initData = mtsGlobalThis.processData(config.initData);
|
|
829
|
+
markTimingInternal('data_processor_end');
|
|
830
|
+
(0, _crossThreadHandlers_registerCallLepusMethodHandler_js__WEBPACK_IMPORTED_MODULE_1__.A)(backgroundThreadRpc, mtsGlobalThis);
|
|
831
|
+
(0, _crossThreadHandlers_registerGetCustomSectionHandler_js__WEBPACK_IMPORTED_MODULE_2__.m)(backgroundThreadRpc, customSections);
|
|
832
|
+
const { switchExposureService } = (0, _utils_createExposureService_js__WEBPACK_IMPORTED_MODULE_4__.b)(rootDom, postExposure);
|
|
833
|
+
backgroundThreadRpc.registerHandler(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.eZ, switchExposureService);
|
|
834
|
+
backgroundStart({
|
|
835
|
+
initData,
|
|
836
|
+
globalProps,
|
|
837
|
+
template,
|
|
838
|
+
cardType: cardType ?? 'react',
|
|
839
|
+
customSections: Object.fromEntries(Object.entries(customSections).filter(([, value])=>'lazy' !== value.type).map(([k, v])=>[
|
|
840
|
+
k,
|
|
841
|
+
v.content
|
|
842
|
+
])),
|
|
843
|
+
nativeModulesMap,
|
|
844
|
+
napiModulesMap
|
|
845
|
+
});
|
|
846
|
+
if (ssrHydrateInfo) {
|
|
847
|
+
for (const event of ssrHydrateInfo.events){
|
|
848
|
+
const uniqueId = event[0];
|
|
849
|
+
const element = ssrHydrateInfo.lynxUniqueIdToElement[uniqueId]?.deref();
|
|
850
|
+
if (element) mtsGlobalThis.__AddEvent(element, event[1], event[2], event[3]);
|
|
851
|
+
}
|
|
852
|
+
mtsGlobalThis.ssrHydrate?.(ssrHydrateInfo.ssrEncodeData);
|
|
853
|
+
} else {
|
|
854
|
+
mtsGlobalThis.renderPage(initData);
|
|
855
|
+
mtsGlobalThis.__FlushElementTree(void 0, {});
|
|
856
|
+
}
|
|
857
|
+
},
|
|
858
|
+
flushElementTree: async (options, timingFlags, exposureChangedElements)=>{
|
|
859
|
+
const pipelineId = options?.pipelineOptions?.pipelineID;
|
|
860
|
+
markTimingInternal('dispatch_start', pipelineId);
|
|
861
|
+
if (isFp) {
|
|
862
|
+
isFp = false;
|
|
863
|
+
jsContext.dispatchEvent({
|
|
864
|
+
type: '__OnNativeAppReady',
|
|
865
|
+
data: void 0
|
|
866
|
+
});
|
|
867
|
+
}
|
|
868
|
+
markTimingInternal('layout_start', pipelineId);
|
|
869
|
+
markTimingInternal('ui_operation_flush_start', pipelineId);
|
|
870
|
+
await commitDocument(exposureChangedElements);
|
|
871
|
+
markTimingInternal('ui_operation_flush_end', pipelineId);
|
|
872
|
+
markTimingInternal('layout_end', pipelineId);
|
|
873
|
+
markTimingInternal('dispatch_end', pipelineId);
|
|
874
|
+
flushMarkTimingInternal();
|
|
875
|
+
requestAnimationFrame(()=>{
|
|
876
|
+
postTimingFlags(timingFlags, pipelineId);
|
|
877
|
+
});
|
|
878
|
+
},
|
|
879
|
+
_ReportError: reportError,
|
|
880
|
+
__OnLifecycleEvent: (data)=>{
|
|
881
|
+
jsContext.dispatchEvent({
|
|
882
|
+
type: '__OnLifecycleEvent',
|
|
883
|
+
data
|
|
884
|
+
});
|
|
885
|
+
},
|
|
886
|
+
markTiming: (a, b)=>markTimingInternal(b, a),
|
|
887
|
+
publishEvent,
|
|
888
|
+
publicComponentEvent,
|
|
889
|
+
_I18nResourceTranslation: (options)=>{
|
|
890
|
+
const matchedInitI18nResources = i18nResources.data?.find((i)=>(0, _lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.HO)(i.options) === (0, _lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.HO)(options));
|
|
891
|
+
dispatchI18nResource(matchedInitI18nResources?.resource);
|
|
892
|
+
if (matchedInitI18nResources) return matchedInitI18nResources.resource;
|
|
893
|
+
return triggerI18nResourceFallback(options);
|
|
894
|
+
},
|
|
895
|
+
__QueryComponent
|
|
896
|
+
}
|
|
897
|
+
});
|
|
898
|
+
mtsGlobalThisRef.mtsGlobalThis = mtsGlobalThis;
|
|
899
|
+
markTimingInternal('decode_end');
|
|
900
|
+
await mtsRealm.loadScript(template.lepusCode.root);
|
|
901
|
+
jsContext.__start();
|
|
902
|
+
}
|
|
903
|
+
async function handleUpdatedData(newData, options) {
|
|
904
|
+
const mtsRealm = await mtsRealmPromise;
|
|
905
|
+
const runtime = mtsRealm.globalWindow;
|
|
906
|
+
const processedData = runtime.processData ? runtime.processData(newData, options?.processorName) : newData;
|
|
907
|
+
runtime.updatePage?.(processedData, options);
|
|
908
|
+
return updateDataBackground(processedData, options);
|
|
909
|
+
}
|
|
910
|
+
return {
|
|
911
|
+
startMainThread,
|
|
912
|
+
handleUpdatedData
|
|
913
|
+
};
|
|
914
|
+
}
|
|
915
|
+
__webpack_async_result__();
|
|
916
|
+
} catch (e) {
|
|
917
|
+
__webpack_async_result__(e);
|
|
918
|
+
}
|
|
919
|
+
});
|
|
920
|
+
},
|
|
921
|
+
"../web-mainthread-apis/dist/pureElementPAPIs.js": function(__webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
922
|
+
__webpack_require__.a(__webpack_module__, async function(__webpack_handle_async_dependencies__, __webpack_async_result__) {
|
|
923
|
+
try {
|
|
924
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
925
|
+
$G: ()=>__GetTemplateParts,
|
|
926
|
+
$r: ()=>__UpdateComponentInfo,
|
|
927
|
+
A7: ()=>__UpdateComponentID,
|
|
928
|
+
D1: ()=>__SetCSSId,
|
|
929
|
+
Fl: ()=>__GetDataset,
|
|
930
|
+
GE: ()=>__GetAttributes,
|
|
931
|
+
Kz: ()=>__AddDataset,
|
|
932
|
+
NV: ()=>__GetDataByKey,
|
|
933
|
+
Nu: ()=>__LastElement,
|
|
934
|
+
R5: ()=>__SetClasses,
|
|
935
|
+
Tj: ()=>__GetElementUniqueID,
|
|
936
|
+
Tq: ()=>__GetClasses,
|
|
937
|
+
Ud: ()=>__AddConfig,
|
|
938
|
+
Xk: ()=>__ReplaceElement,
|
|
939
|
+
ZW: ()=>__MarkPartElement,
|
|
940
|
+
bw: ()=>__SetDataset,
|
|
941
|
+
c2: ()=>__SetInlineStyles,
|
|
942
|
+
cb: ()=>__GetID,
|
|
943
|
+
cw: ()=>__NextElement,
|
|
944
|
+
d6: ()=>__GetParent,
|
|
945
|
+
gA: ()=>__AddClass,
|
|
946
|
+
kB: ()=>__AddInlineStyle,
|
|
947
|
+
l9: ()=>__SetConfig,
|
|
948
|
+
li: ()=>__GetAttributeByName,
|
|
949
|
+
pe: ()=>__GetElementConfig,
|
|
950
|
+
pi: ()=>__InsertElementBefore,
|
|
951
|
+
pn: ()=>__ElementIsEqual,
|
|
952
|
+
uY: ()=>__MarkTemplateElement,
|
|
953
|
+
vH: ()=>__FirstElement,
|
|
954
|
+
vh: ()=>__AppendElement,
|
|
955
|
+
wr: ()=>__SetID,
|
|
956
|
+
yE: ()=>__ReplaceElements,
|
|
957
|
+
yj: ()=>__GetChildren,
|
|
958
|
+
z3: ()=>__RemoveElement,
|
|
959
|
+
zP: ()=>__GetComponentID,
|
|
960
|
+
zm: ()=>__GetTag
|
|
961
|
+
});
|
|
962
|
+
var _lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../web-constants/dist/index.js");
|
|
963
|
+
var _style_cssPropertyMap_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../web-mainthread-apis/dist/style/cssPropertyMap.js");
|
|
964
|
+
var _style_transformInlineStyle_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../web-mainthread-apis/dist/style/transformInlineStyle.js");
|
|
965
|
+
var hyphenate_style_name__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../../node_modules/.pnpm/hyphenate-style-name@1.1.0/node_modules/hyphenate-style-name/index.js");
|
|
966
|
+
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([
|
|
967
|
+
_style_transformInlineStyle_js__WEBPACK_IMPORTED_MODULE_2__
|
|
968
|
+
]);
|
|
969
|
+
_style_transformInlineStyle_js__WEBPACK_IMPORTED_MODULE_2__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
|
|
970
|
+
const __AppendElement = /*#__PURE__*/ (parent, child)=>parent.appendChild(child);
|
|
971
|
+
const __ElementIsEqual = /*#__PURE__*/ (left, right)=>left === right;
|
|
972
|
+
const __FirstElement = /*#__PURE__*/ (element)=>element.firstElementChild;
|
|
973
|
+
const __GetChildren = /*#__PURE__*/ (element)=>element.children ? [
|
|
974
|
+
...element.children
|
|
975
|
+
] : null;
|
|
976
|
+
const __GetParent = /*#__PURE__*/ (element)=>element.parentElement;
|
|
977
|
+
const __InsertElementBefore = /*#__PURE__*/ (parent, child, ref)=>parent.insertBefore(child, ref);
|
|
978
|
+
const __LastElement = /*#__PURE__*/ (element)=>element.lastElementChild;
|
|
979
|
+
const __NextElement = /*#__PURE__*/ (element)=>element.nextElementSibling;
|
|
980
|
+
const __RemoveElement = /*#__PURE__*/ (parent, child)=>parent.removeChild(child);
|
|
981
|
+
const __ReplaceElement = /*#__PURE__*/ (newElement, oldElement)=>oldElement.replaceWith(newElement);
|
|
982
|
+
const __ReplaceElements = /*#__PURE__*/ (parent, newChildren, oldChildren)=>{
|
|
983
|
+
newChildren = Array.isArray(newChildren) ? newChildren : [
|
|
984
|
+
newChildren
|
|
985
|
+
];
|
|
986
|
+
if (!oldChildren || Array.isArray(oldChildren) && oldChildren?.length === 0) parent.append(...newChildren);
|
|
987
|
+
else {
|
|
988
|
+
oldChildren = Array.isArray(oldChildren) ? oldChildren : [
|
|
989
|
+
oldChildren
|
|
990
|
+
];
|
|
991
|
+
for(let ii = 1; ii < oldChildren.length; ii++)__RemoveElement(parent, oldChildren[ii]);
|
|
992
|
+
const firstOldChildren = oldChildren[0];
|
|
993
|
+
firstOldChildren.replaceWith(...newChildren);
|
|
994
|
+
}
|
|
995
|
+
};
|
|
996
|
+
const __AddConfig = /*#__PURE__*/ (element, type, value)=>{
|
|
997
|
+
const currentComponentConfigString = element.getAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.tl);
|
|
998
|
+
let currentComponentConfig = currentComponentConfigString ? JSON.parse(decodeURIComponent(currentComponentConfigString)) : {};
|
|
999
|
+
currentComponentConfig[type] = value;
|
|
1000
|
+
element.setAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.tl, encodeURIComponent(JSON.stringify(currentComponentConfig)));
|
|
1001
|
+
};
|
|
1002
|
+
const __AddDataset = /*#__PURE__*/ (element, key, value)=>{
|
|
1003
|
+
const currentDataset = __GetDataset(element);
|
|
1004
|
+
currentDataset[key] = value;
|
|
1005
|
+
element.setAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.C6, encodeURIComponent(JSON.stringify(currentDataset)));
|
|
1006
|
+
value ? element.setAttribute('data-' + key, value.toString()) : element.removeAttribute('data-' + key);
|
|
1007
|
+
};
|
|
1008
|
+
const __GetDataset = /*#__PURE__*/ (element)=>{
|
|
1009
|
+
const datasetString = element.getAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.C6);
|
|
1010
|
+
const currentDataset = datasetString ? JSON.parse(decodeURIComponent(datasetString)) : {};
|
|
1011
|
+
return currentDataset;
|
|
1012
|
+
};
|
|
1013
|
+
const __GetDataByKey = /*#__PURE__*/ (element, key)=>{
|
|
1014
|
+
const dataset = __GetDataset(element);
|
|
1015
|
+
return dataset[key];
|
|
1016
|
+
};
|
|
1017
|
+
const __GetAttributes = /*#__PURE__*/ (element)=>Object.fromEntries(element.getAttributeNames().map((attributeName)=>[
|
|
1018
|
+
attributeName,
|
|
1019
|
+
element.getAttribute(attributeName)
|
|
1020
|
+
]).filter(([, value])=>value));
|
|
1021
|
+
const __GetComponentID = /*#__PURE__*/ (element)=>element.getAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.pP);
|
|
1022
|
+
const __GetElementConfig = /*#__PURE__*/ (element)=>{
|
|
1023
|
+
const currentComponentConfigString = element.getAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.tl);
|
|
1024
|
+
return currentComponentConfigString ? JSON.parse(decodeURIComponent(currentComponentConfigString)) : {};
|
|
1025
|
+
};
|
|
1026
|
+
const __GetAttributeByName = /*#__PURE__*/ (element, name)=>element.getAttribute(name);
|
|
1027
|
+
const __GetElementUniqueID = /*#__PURE__*/ (element)=>element && element.getAttribute ? Number(element.getAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.SP)) : -1;
|
|
1028
|
+
const __GetID = /*#__PURE__*/ (element)=>element.getAttribute('id');
|
|
1029
|
+
const __SetID = /*#__PURE__*/ (element, id)=>id ? element.setAttribute('id', id) : element.removeAttribute('id');
|
|
1030
|
+
const __GetTag = /*#__PURE__*/ (element)=>element.getAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.Gq);
|
|
1031
|
+
const __SetConfig = /*#__PURE__*/ (element, config)=>{
|
|
1032
|
+
element.setAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.tl, encodeURIComponent(JSON.stringify(config)));
|
|
1033
|
+
};
|
|
1034
|
+
const __SetDataset = /*#__PURE__*/ (element, dataset)=>{
|
|
1035
|
+
element.setAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.C6, encodeURIComponent(JSON.stringify(dataset)));
|
|
1036
|
+
for (const [key, value] of Object.entries(dataset))element.setAttribute('data-' + key, value.toString());
|
|
1037
|
+
};
|
|
1038
|
+
const __UpdateComponentID = /*#__PURE__*/ (element, componentID)=>element.setAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.pP, componentID);
|
|
1039
|
+
const __GetClasses = /*#__PURE__*/ (element)=>(element.getAttribute('class') ?? '').split(' ').filter((e)=>e);
|
|
1040
|
+
const __UpdateComponentInfo = /*#__PURE__*/ (element, params)=>{
|
|
1041
|
+
void 0 !== params.componentID && __UpdateComponentID(element, params.componentID);
|
|
1042
|
+
void 0 !== params.cssID && element.setAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.js, params.cssID + '');
|
|
1043
|
+
void 0 !== params.name && element.setAttribute('name', params.name);
|
|
1044
|
+
};
|
|
1045
|
+
const __SetCSSId = /*#__PURE__*/ (elements, cssId, entryName)=>{
|
|
1046
|
+
for (const element of elements){
|
|
1047
|
+
element.setAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.js, cssId + '');
|
|
1048
|
+
entryName && element.setAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.Pb, entryName);
|
|
1049
|
+
}
|
|
1050
|
+
};
|
|
1051
|
+
const __SetClasses = /*#__PURE__*/ (element, classname)=>{
|
|
1052
|
+
classname ? element.setAttribute('class', classname) : element.removeAttribute('class');
|
|
1053
|
+
};
|
|
1054
|
+
const __AddInlineStyle = /*#__PURE__*/ (element, key, value)=>{
|
|
1055
|
+
let dashName;
|
|
1056
|
+
if ('number' == typeof key) {
|
|
1057
|
+
const queryResult = (0, _style_cssPropertyMap_js__WEBPACK_IMPORTED_MODULE_1__.BH)(key);
|
|
1058
|
+
dashName = queryResult.dashName;
|
|
1059
|
+
if (queryResult.isX) console.error(`[lynx-web] css property: ${dashName} is not supported.`);
|
|
1060
|
+
} else dashName = key;
|
|
1061
|
+
const valueStr = 'number' == typeof value ? value.toString() : value;
|
|
1062
|
+
if (valueStr) {
|
|
1063
|
+
const { transformedStyle } = (0, _style_transformInlineStyle_js__WEBPACK_IMPORTED_MODULE_2__.x)([
|
|
1064
|
+
[
|
|
1065
|
+
dashName,
|
|
1066
|
+
valueStr
|
|
1067
|
+
]
|
|
1068
|
+
]);
|
|
1069
|
+
for (const [property, value] of transformedStyle)element.style.setProperty(property, value);
|
|
1070
|
+
} else element.style.removeProperty(dashName);
|
|
1071
|
+
};
|
|
1072
|
+
const __AddClass = /*#__PURE__*/ (element, className)=>{
|
|
1073
|
+
const newClassName = ((element.getAttribute('class') ?? '') + ' ' + className).trim();
|
|
1074
|
+
element.setAttribute('class', newClassName);
|
|
1075
|
+
};
|
|
1076
|
+
const __SetInlineStyles = /*#__PURE__*/ (element, value)=>{
|
|
1077
|
+
if (!value) return;
|
|
1078
|
+
if ('string' == typeof value) element.setAttribute('style', (0, _style_transformInlineStyle_js__WEBPACK_IMPORTED_MODULE_2__.Q)(value));
|
|
1079
|
+
else {
|
|
1080
|
+
const { transformedStyle } = (0, _style_transformInlineStyle_js__WEBPACK_IMPORTED_MODULE_2__.x)(Object.entries(value).map(([k, value])=>[
|
|
1081
|
+
(0, hyphenate_style_name__WEBPACK_IMPORTED_MODULE_3__.A)(k),
|
|
1082
|
+
value?.toString?.() ?? ''
|
|
1083
|
+
]));
|
|
1084
|
+
const transformedStyleStr = transformedStyle.map(([property, value])=>`${property}:${value};`).join('');
|
|
1085
|
+
element.setAttribute('style', transformedStyleStr);
|
|
1086
|
+
}
|
|
1087
|
+
};
|
|
1088
|
+
const __GetTemplateParts = (templateElement)=>{
|
|
1089
|
+
const isTemplate = null !== templateElement.getAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.y);
|
|
1090
|
+
if (!isTemplate) return {};
|
|
1091
|
+
const templateUniqueId = __GetElementUniqueID(templateElement);
|
|
1092
|
+
const parts = {};
|
|
1093
|
+
const partElements = templateElement.querySelectorAll(`[${_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.SP}="${templateUniqueId}"] [${_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.oZ}]:not([${_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.SP}="${templateUniqueId}"] [${_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.y}] [${_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.oZ}])`);
|
|
1094
|
+
for (const partElement of partElements){
|
|
1095
|
+
const partId = partElement.getAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.oZ);
|
|
1096
|
+
if (partId) parts[partId] = partElement;
|
|
1097
|
+
}
|
|
1098
|
+
return parts;
|
|
1099
|
+
};
|
|
1100
|
+
const __MarkTemplateElement = (element)=>{
|
|
1101
|
+
element.setAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.y, '');
|
|
1102
|
+
};
|
|
1103
|
+
const __MarkPartElement = (element, partId)=>{
|
|
1104
|
+
element.setAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.oZ, partId);
|
|
1105
|
+
};
|
|
1106
|
+
__webpack_async_result__();
|
|
1107
|
+
} catch (e) {
|
|
1108
|
+
__webpack_async_result__(e);
|
|
1109
|
+
}
|
|
1110
|
+
});
|
|
1111
|
+
},
|
|
1112
|
+
"../web-mainthread-apis/dist/style/cssPropertyMap.js": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1113
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
1114
|
+
BH: ()=>queryCSSProperty
|
|
1115
|
+
});
|
|
1116
|
+
const cacheForCamelize = {};
|
|
1117
|
+
function camelize(str) {
|
|
1118
|
+
if (cacheForCamelize[str]) return cacheForCamelize[str];
|
|
1119
|
+
const result = (str + '').replace(/-\D/g, function(match) {
|
|
1120
|
+
return match.charAt(1).toUpperCase();
|
|
1121
|
+
});
|
|
1122
|
+
cacheForCamelize[str] = result;
|
|
1123
|
+
return result;
|
|
1124
|
+
}
|
|
1125
|
+
let index = 1;
|
|
1126
|
+
const cssPropertyMap = {};
|
|
1127
|
+
const cssPropertyReverseMap = {};
|
|
1128
|
+
const V = (name)=>{
|
|
1129
|
+
const k = index++;
|
|
1130
|
+
const isX = name.startsWith('-x-');
|
|
1131
|
+
cssPropertyMap[k] = {
|
|
1132
|
+
name: camelize(name),
|
|
1133
|
+
dashName: name,
|
|
1134
|
+
isX
|
|
1135
|
+
};
|
|
1136
|
+
cssPropertyReverseMap[name] = k;
|
|
1137
|
+
};
|
|
1138
|
+
V('top');
|
|
1139
|
+
V('left');
|
|
1140
|
+
V('right');
|
|
1141
|
+
V('bottom');
|
|
1142
|
+
V('position');
|
|
1143
|
+
V('box-sizing');
|
|
1144
|
+
V('background-color');
|
|
1145
|
+
V('border-left-color');
|
|
1146
|
+
V('border-right-color');
|
|
1147
|
+
V('border-top-color');
|
|
1148
|
+
V('border-bottom-color');
|
|
1149
|
+
V('border-radius');
|
|
1150
|
+
V('border-top-left-radius');
|
|
1151
|
+
V('border-bottom-left-radius');
|
|
1152
|
+
V('border-top-right-radius');
|
|
1153
|
+
V('border-bottom-right-radius');
|
|
1154
|
+
V('border-width');
|
|
1155
|
+
V('border-left-width');
|
|
1156
|
+
V('border-right-width');
|
|
1157
|
+
V('border-top-width');
|
|
1158
|
+
V('border-bottom-width');
|
|
1159
|
+
V('color');
|
|
1160
|
+
V('opacity');
|
|
1161
|
+
V('display');
|
|
1162
|
+
V('overflow');
|
|
1163
|
+
V('height');
|
|
1164
|
+
V('width');
|
|
1165
|
+
V('max-width');
|
|
1166
|
+
V('min-width');
|
|
1167
|
+
V('max-height');
|
|
1168
|
+
V('min-height');
|
|
1169
|
+
V('padding');
|
|
1170
|
+
V('padding-left');
|
|
1171
|
+
V('padding-right');
|
|
1172
|
+
V('padding-top');
|
|
1173
|
+
V('padding-bottom');
|
|
1174
|
+
V('margin');
|
|
1175
|
+
V('margin-left');
|
|
1176
|
+
V('margin-right');
|
|
1177
|
+
V('margin-top');
|
|
1178
|
+
V('margin-bottom');
|
|
1179
|
+
V('white-space');
|
|
1180
|
+
V('letter-spacing');
|
|
1181
|
+
V('text-align');
|
|
1182
|
+
V('line-height');
|
|
1183
|
+
V('text-overflow');
|
|
1184
|
+
V('font-size');
|
|
1185
|
+
V('font-weight');
|
|
1186
|
+
V('flex');
|
|
1187
|
+
V('flex-grow');
|
|
1188
|
+
V('flex-shrink');
|
|
1189
|
+
V('flex-basis');
|
|
1190
|
+
V('flex-direction');
|
|
1191
|
+
V('flex-wrap');
|
|
1192
|
+
V('align-items');
|
|
1193
|
+
V('align-self');
|
|
1194
|
+
V('align-content');
|
|
1195
|
+
V('justify-content');
|
|
1196
|
+
V('background');
|
|
1197
|
+
V('border-color');
|
|
1198
|
+
V('font-family');
|
|
1199
|
+
V('font-style');
|
|
1200
|
+
V('transform');
|
|
1201
|
+
V('animation');
|
|
1202
|
+
V('animation-name');
|
|
1203
|
+
V('animation-duration');
|
|
1204
|
+
V('animation-timing-function');
|
|
1205
|
+
V('animation-delay');
|
|
1206
|
+
V('animation-iteration-count');
|
|
1207
|
+
V('animation-direction');
|
|
1208
|
+
V('animation-fill-mode');
|
|
1209
|
+
V('animation-play-state');
|
|
1210
|
+
V('line-spacing');
|
|
1211
|
+
V('border-style');
|
|
1212
|
+
V('order');
|
|
1213
|
+
V('box-shadow');
|
|
1214
|
+
V('transform-origin');
|
|
1215
|
+
V('linear-orientation');
|
|
1216
|
+
V('linear-weight-sum');
|
|
1217
|
+
V('linear-weight');
|
|
1218
|
+
V('linear-gravity');
|
|
1219
|
+
V('linear-layout-gravity');
|
|
1220
|
+
V('layout-animation-create-duration');
|
|
1221
|
+
V('layout-animation-create-timing-function');
|
|
1222
|
+
V('layout-animation-create-delay');
|
|
1223
|
+
V('layout-animation-create-property');
|
|
1224
|
+
V('layout-animation-delete-duration');
|
|
1225
|
+
V('layout-animation-delete-timing-function');
|
|
1226
|
+
V('layout-animation-delete-delay');
|
|
1227
|
+
V('layout-animation-delete-property');
|
|
1228
|
+
V('layout-animation-update-duration');
|
|
1229
|
+
V('layout-animation-update-timing-function');
|
|
1230
|
+
V('layout-animation-update-delay');
|
|
1231
|
+
V('adapt-font-size');
|
|
1232
|
+
V('aspect-ratio');
|
|
1233
|
+
V('text-decoration');
|
|
1234
|
+
V('text-shadow');
|
|
1235
|
+
V('background-image');
|
|
1236
|
+
V('background-position');
|
|
1237
|
+
V('background-origin');
|
|
1238
|
+
V('background-repeat');
|
|
1239
|
+
V('background-size');
|
|
1240
|
+
V('border');
|
|
1241
|
+
V('visibility');
|
|
1242
|
+
V('border-right');
|
|
1243
|
+
V('border-left');
|
|
1244
|
+
V('border-top');
|
|
1245
|
+
V('border-bottom');
|
|
1246
|
+
V('transition');
|
|
1247
|
+
V('transition-property');
|
|
1248
|
+
V('transition-duration');
|
|
1249
|
+
V('transition-delay');
|
|
1250
|
+
V('transition-timing-function');
|
|
1251
|
+
V('content');
|
|
1252
|
+
V('border-left-style');
|
|
1253
|
+
V('border-right-style');
|
|
1254
|
+
V('border-top-style');
|
|
1255
|
+
V('border-bottom-style');
|
|
1256
|
+
V('implicit-animation');
|
|
1257
|
+
V('overflow-x');
|
|
1258
|
+
V('overflow-y');
|
|
1259
|
+
V('word-break');
|
|
1260
|
+
V('background-clip');
|
|
1261
|
+
V('outline');
|
|
1262
|
+
V('outline-color');
|
|
1263
|
+
V('outline-style');
|
|
1264
|
+
V('outline-width');
|
|
1265
|
+
V('vertical-align');
|
|
1266
|
+
V('caret-color');
|
|
1267
|
+
V('direction');
|
|
1268
|
+
V('relative-id');
|
|
1269
|
+
V('relative-align-top');
|
|
1270
|
+
V('relative-align-right');
|
|
1271
|
+
V('relative-align-bottom');
|
|
1272
|
+
V('relative-align-left');
|
|
1273
|
+
V('relative-top-of');
|
|
1274
|
+
V('relative-right-of');
|
|
1275
|
+
V('relative-bottom-of');
|
|
1276
|
+
V('relative-left-of');
|
|
1277
|
+
V('relative-layout-once');
|
|
1278
|
+
V('relative-center');
|
|
1279
|
+
V('enter-transition-name');
|
|
1280
|
+
V('exit-transition-name');
|
|
1281
|
+
V('pause-transition-name');
|
|
1282
|
+
V('resume-transition-name');
|
|
1283
|
+
V('flex-flow');
|
|
1284
|
+
V('z-index');
|
|
1285
|
+
V('text-decoration-color');
|
|
1286
|
+
V('linear-cross-gravity');
|
|
1287
|
+
V('margin-inline-start');
|
|
1288
|
+
V('margin-inline-end');
|
|
1289
|
+
V('padding-inline-start');
|
|
1290
|
+
V('padding-inline-end');
|
|
1291
|
+
V('border-inline-start-color');
|
|
1292
|
+
V('border-inline-end-color');
|
|
1293
|
+
V('border-inline-start-width');
|
|
1294
|
+
V('border-inline-end-width');
|
|
1295
|
+
V('border-inline-start-style');
|
|
1296
|
+
V('border-inline-end-style');
|
|
1297
|
+
V('border-start-start-radius');
|
|
1298
|
+
V('border-end-start-radius');
|
|
1299
|
+
V('border-start-end-radius');
|
|
1300
|
+
V('border-end-end-radius');
|
|
1301
|
+
V('relative-align-inline-start');
|
|
1302
|
+
V('relative-align-inline-end');
|
|
1303
|
+
V('relative-inline-start-of');
|
|
1304
|
+
V('relative-inline-end-of');
|
|
1305
|
+
V('inset-inline-start');
|
|
1306
|
+
V('inset-inline-end');
|
|
1307
|
+
V('mask-image');
|
|
1308
|
+
V('grid-template-columns');
|
|
1309
|
+
V('grid-template-rows');
|
|
1310
|
+
V('grid-auto-columns');
|
|
1311
|
+
V('grid-auto-rows');
|
|
1312
|
+
V('grid-column-span');
|
|
1313
|
+
V('grid-row-span');
|
|
1314
|
+
V('grid-column-start');
|
|
1315
|
+
V('grid-column-end');
|
|
1316
|
+
V('grid-row-start');
|
|
1317
|
+
V('grid-row-end');
|
|
1318
|
+
V('grid-column-gap');
|
|
1319
|
+
V('grid-row-gap');
|
|
1320
|
+
V('justify-items');
|
|
1321
|
+
V('justify-self');
|
|
1322
|
+
V('grid-auto-flow');
|
|
1323
|
+
V('filter');
|
|
1324
|
+
V('list-main-axis-gap');
|
|
1325
|
+
V('list-cross-axis-gap');
|
|
1326
|
+
V('linear-direction');
|
|
1327
|
+
V('perspective');
|
|
1328
|
+
V('cursor');
|
|
1329
|
+
V('text-indent');
|
|
1330
|
+
V('clip-path');
|
|
1331
|
+
V('text-stroke');
|
|
1332
|
+
V('text-stroke-width');
|
|
1333
|
+
V('text-stroke-color');
|
|
1334
|
+
V('-x-auto-font-size');
|
|
1335
|
+
V('-x-auto-font-size-preset-sizes');
|
|
1336
|
+
V('mask');
|
|
1337
|
+
V('mask-repeat');
|
|
1338
|
+
V('mask-position');
|
|
1339
|
+
V('mask-clip');
|
|
1340
|
+
V('mask-origin');
|
|
1341
|
+
V('mask-size');
|
|
1342
|
+
V('gap');
|
|
1343
|
+
V('column-gap');
|
|
1344
|
+
V('row-gap');
|
|
1345
|
+
V('image-rendering');
|
|
1346
|
+
V('hyphens');
|
|
1347
|
+
V('-x-app-region');
|
|
1348
|
+
V('-x-animation-color-interpolation');
|
|
1349
|
+
V('-x-handle-color');
|
|
1350
|
+
V('-x-handle-size');
|
|
1351
|
+
V('offset-path');
|
|
1352
|
+
V('offset-distance');
|
|
1353
|
+
function queryCSSProperty(index) {
|
|
1354
|
+
return cssPropertyMap[index];
|
|
1355
|
+
}
|
|
1356
|
+
},
|
|
1357
|
+
"../web-mainthread-apis/dist/style/transformInlineStyle.js": function(__webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1358
|
+
__webpack_require__.a(__webpack_module__, async function(__webpack_handle_async_dependencies__, __webpack_async_result__) {
|
|
1359
|
+
try {
|
|
1360
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
1361
|
+
Q: ()=>_utils_tokenizer_js__WEBPACK_IMPORTED_MODULE_0__.Q,
|
|
1362
|
+
x: ()=>_utils_tokenizer_js__WEBPACK_IMPORTED_MODULE_0__.x
|
|
1363
|
+
});
|
|
1364
|
+
var _utils_tokenizer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../web-mainthread-apis/dist/utils/tokenizer.js");
|
|
1365
|
+
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([
|
|
1366
|
+
_utils_tokenizer_js__WEBPACK_IMPORTED_MODULE_0__
|
|
1367
|
+
]);
|
|
1368
|
+
_utils_tokenizer_js__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
|
|
1369
|
+
__webpack_async_result__();
|
|
1370
|
+
} catch (e) {
|
|
1371
|
+
__webpack_async_result__(e);
|
|
1372
|
+
}
|
|
1373
|
+
});
|
|
1374
|
+
},
|
|
1375
|
+
"../web-mainthread-apis/dist/utils/createCrossThreadEvent.js": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1376
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
1377
|
+
X: ()=>createCrossThreadEvent
|
|
1378
|
+
});
|
|
1379
|
+
var _lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../web-constants/dist/index.js");
|
|
1380
|
+
function toCloneableObject(obj) {
|
|
1381
|
+
const cloneableObj = {};
|
|
1382
|
+
for(const key in obj){
|
|
1383
|
+
const value = obj[key];
|
|
1384
|
+
if ('boolean' == typeof value || 'number' == typeof value || 'string' == typeof value || null === value) cloneableObj[key] = value;
|
|
1385
|
+
}
|
|
1386
|
+
return cloneableObj;
|
|
1387
|
+
}
|
|
1388
|
+
function createCrossThreadEvent(domEvent, eventName) {
|
|
1389
|
+
const targetElement = domEvent.target;
|
|
1390
|
+
const currentTargetElement = domEvent.currentTarget.getAttribute ? domEvent.currentTarget : void 0;
|
|
1391
|
+
const type = domEvent.type;
|
|
1392
|
+
const params = {};
|
|
1393
|
+
const isTrusted = domEvent.isTrusted;
|
|
1394
|
+
const otherProperties = {};
|
|
1395
|
+
let detail = domEvent.detail ?? {};
|
|
1396
|
+
if (type.match(/^transition/)) Object.assign(params, {
|
|
1397
|
+
animation_type: 'keyframe-animation',
|
|
1398
|
+
animation_name: domEvent.propertyName,
|
|
1399
|
+
new_animator: true
|
|
1400
|
+
});
|
|
1401
|
+
else if (type.match(/animation/)) Object.assign(params, {
|
|
1402
|
+
animation_type: 'keyframe-animation',
|
|
1403
|
+
animation_name: domEvent.animationName,
|
|
1404
|
+
new_animator: true
|
|
1405
|
+
});
|
|
1406
|
+
else if (type.startsWith('touch')) {
|
|
1407
|
+
const touchEvent = domEvent;
|
|
1408
|
+
const touch = [
|
|
1409
|
+
...touchEvent.touches
|
|
1410
|
+
];
|
|
1411
|
+
const targetTouches = [
|
|
1412
|
+
...touchEvent.targetTouches
|
|
1413
|
+
];
|
|
1414
|
+
const changedTouches = [
|
|
1415
|
+
...touchEvent.changedTouches
|
|
1416
|
+
];
|
|
1417
|
+
Object.assign(otherProperties, {
|
|
1418
|
+
touches: isTrusted ? touch.map(toCloneableObject) : touch,
|
|
1419
|
+
targetTouches: isTrusted ? targetTouches.map(toCloneableObject) : targetTouches,
|
|
1420
|
+
changedTouches: isTrusted ? changedTouches.map(toCloneableObject) : changedTouches
|
|
1421
|
+
});
|
|
1422
|
+
} else if (type.startsWith('mouse')) {
|
|
1423
|
+
const mouseEvent = domEvent;
|
|
1424
|
+
Object.assign(otherProperties, {
|
|
1425
|
+
button: mouseEvent.button,
|
|
1426
|
+
buttons: mouseEvent.buttons,
|
|
1427
|
+
x: mouseEvent.x,
|
|
1428
|
+
y: mouseEvent.y,
|
|
1429
|
+
pageX: mouseEvent.pageX,
|
|
1430
|
+
pageY: mouseEvent.pageY,
|
|
1431
|
+
clientX: mouseEvent.clientX,
|
|
1432
|
+
clientY: mouseEvent.clientY
|
|
1433
|
+
});
|
|
1434
|
+
} else if ('click' === type) detail = {
|
|
1435
|
+
x: domEvent.x,
|
|
1436
|
+
y: domEvent.y
|
|
1437
|
+
};
|
|
1438
|
+
const currentTargetDatasetString = currentTargetElement?.getAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.C6);
|
|
1439
|
+
const currentTargetDataset = currentTargetDatasetString ? JSON.parse(decodeURIComponent(currentTargetDatasetString)) : {};
|
|
1440
|
+
const targetDatasetString = targetElement.getAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.C6);
|
|
1441
|
+
const targetDataset = targetDatasetString ? JSON.parse(decodeURIComponent(targetDatasetString)) : {};
|
|
1442
|
+
return {
|
|
1443
|
+
type: eventName,
|
|
1444
|
+
timestamp: domEvent.timeStamp,
|
|
1445
|
+
target: {
|
|
1446
|
+
id: targetElement.getAttribute('id'),
|
|
1447
|
+
dataset: targetDataset,
|
|
1448
|
+
uniqueId: Number(targetElement.getAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.SP))
|
|
1449
|
+
},
|
|
1450
|
+
currentTarget: currentTargetElement ? {
|
|
1451
|
+
id: currentTargetElement.getAttribute('id'),
|
|
1452
|
+
dataset: currentTargetDataset,
|
|
1453
|
+
uniqueId: Number(currentTargetElement.getAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.SP))
|
|
1454
|
+
} : null,
|
|
1455
|
+
detail,
|
|
1456
|
+
params,
|
|
1457
|
+
...otherProperties
|
|
1458
|
+
};
|
|
1459
|
+
}
|
|
1460
|
+
},
|
|
1461
|
+
"../web-mainthread-apis/dist/utils/createExposureService.js": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1462
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
1463
|
+
b: ()=>createExposureService
|
|
1464
|
+
});
|
|
1465
|
+
var _lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../web-constants/dist/index.js");
|
|
1466
|
+
var _createCrossThreadEvent_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../web-mainthread-apis/dist/utils/createCrossThreadEvent.js");
|
|
1467
|
+
function createExposureService(rootDom, postExposure) {
|
|
1468
|
+
let working = true;
|
|
1469
|
+
let exposureCache = [];
|
|
1470
|
+
let disexposureCache = [];
|
|
1471
|
+
let delayCallback = null;
|
|
1472
|
+
const onScreen = new Map();
|
|
1473
|
+
function exposureEventHandler(ev) {
|
|
1474
|
+
const exposureEvent = (0, _createCrossThreadEvent_js__WEBPACK_IMPORTED_MODULE_1__.X)(ev, ev.type);
|
|
1475
|
+
exposureEvent.detail['unique-id'] = parseFloat(ev.target.getAttribute(_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.SP));
|
|
1476
|
+
const exposureID = exposureEvent.detail.exposureID;
|
|
1477
|
+
if ('exposure' === ev.type) {
|
|
1478
|
+
exposureCache.push(exposureEvent);
|
|
1479
|
+
onScreen.set(exposureID, exposureEvent);
|
|
1480
|
+
} else {
|
|
1481
|
+
disexposureCache.push(exposureEvent);
|
|
1482
|
+
onScreen.delete(exposureID);
|
|
1483
|
+
}
|
|
1484
|
+
if (!delayCallback) delayCallback = setTimeout(()=>{
|
|
1485
|
+
if (exposureCache.length > 0 || disexposureCache.length > 0) {
|
|
1486
|
+
const currentExposure = exposureCache;
|
|
1487
|
+
const currentDisexposure = disexposureCache;
|
|
1488
|
+
exposureCache = [];
|
|
1489
|
+
disexposureCache = [];
|
|
1490
|
+
postExposure({
|
|
1491
|
+
exposures: currentExposure,
|
|
1492
|
+
disExposures: currentDisexposure
|
|
1493
|
+
});
|
|
1494
|
+
}
|
|
1495
|
+
delayCallback = null;
|
|
1496
|
+
}, 50);
|
|
1497
|
+
}
|
|
1498
|
+
rootDom.addEventListener('exposure', exposureEventHandler, {
|
|
1499
|
+
passive: true
|
|
1500
|
+
});
|
|
1501
|
+
rootDom.addEventListener('disexposure', exposureEventHandler, {
|
|
1502
|
+
passive: true
|
|
1503
|
+
});
|
|
1504
|
+
function switchExposureService(enable, sendEvent) {
|
|
1505
|
+
if (enable && !working) postExposure({
|
|
1506
|
+
exposures: [
|
|
1507
|
+
...onScreen.values()
|
|
1508
|
+
],
|
|
1509
|
+
disExposures: []
|
|
1510
|
+
});
|
|
1511
|
+
else if (!enable && working) {
|
|
1512
|
+
if (sendEvent) postExposure({
|
|
1513
|
+
exposures: [],
|
|
1514
|
+
disExposures: [
|
|
1515
|
+
...onScreen.values()
|
|
1516
|
+
]
|
|
1517
|
+
});
|
|
1518
|
+
}
|
|
1519
|
+
working = enable;
|
|
1520
|
+
}
|
|
1521
|
+
return {
|
|
1522
|
+
switchExposureService
|
|
1523
|
+
};
|
|
1524
|
+
}
|
|
1525
|
+
},
|
|
1526
|
+
"../web-mainthread-apis/dist/utils/decodeCssOG.js": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1527
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
1528
|
+
y: ()=>decodeCssOG
|
|
1529
|
+
});
|
|
1530
|
+
function decodeCssOG(classes, styleInfo, cssId) {
|
|
1531
|
+
const classList = classes.split(' ').filter((e)=>e);
|
|
1532
|
+
let declarations = [];
|
|
1533
|
+
const currentStyleInfo = styleInfo[cssId ?? '0'];
|
|
1534
|
+
if (currentStyleInfo) for (const oneClassName of classList){
|
|
1535
|
+
const oneRule = currentStyleInfo[oneClassName];
|
|
1536
|
+
if (oneRule) declarations.push(...oneRule);
|
|
1537
|
+
}
|
|
1538
|
+
else console.warn(`[lynx-web] cannot find styleinfo for cssid ${cssId}`);
|
|
1539
|
+
return declarations.map(([property, value])=>`${property}:${value};`).join('');
|
|
1540
|
+
}
|
|
1541
|
+
},
|
|
1542
|
+
"../web-mainthread-apis/dist/utils/processStyleInfo.js": function(__webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1543
|
+
__webpack_require__.a(__webpack_module__, async function(__webpack_handle_async_dependencies__, __webpack_async_result__) {
|
|
1544
|
+
try {
|
|
1545
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
1546
|
+
c6: ()=>appendStyleElement
|
|
1547
|
+
});
|
|
1548
|
+
var _lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../web-constants/dist/index.js");
|
|
1549
|
+
var _tokenizer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../web-mainthread-apis/dist/utils/tokenizer.js");
|
|
1550
|
+
var _decodeCssOG_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../web-mainthread-apis/dist/utils/decodeCssOG.js");
|
|
1551
|
+
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([
|
|
1552
|
+
_tokenizer_js__WEBPACK_IMPORTED_MODULE_1__
|
|
1553
|
+
]);
|
|
1554
|
+
_tokenizer_js__WEBPACK_IMPORTED_MODULE_1__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
|
|
1555
|
+
function topologicalSort(styleInfo) {
|
|
1556
|
+
const queue = [];
|
|
1557
|
+
const inDegreeMap = new Map();
|
|
1558
|
+
for (const [cssId, oneStyleInfo] of Object.entries(styleInfo)){
|
|
1559
|
+
inDegreeMap.has(cssId) || inDegreeMap.set(cssId, 0);
|
|
1560
|
+
for (const importCssId of oneStyleInfo.imports ?? []){
|
|
1561
|
+
const currentInDegree = inDegreeMap.get(importCssId) ?? 0;
|
|
1562
|
+
inDegreeMap.set(importCssId, currentInDegree + 1);
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
for (const [cssId, inDegree] of inDegreeMap.entries())if (0 === inDegree) queue.push(cssId);
|
|
1566
|
+
const sortedCssIds = [];
|
|
1567
|
+
while(queue.length > 0){
|
|
1568
|
+
const currentCssId = queue.shift();
|
|
1569
|
+
sortedCssIds.push(currentCssId);
|
|
1570
|
+
const currentAdjunction = styleInfo[currentCssId]?.imports;
|
|
1571
|
+
if (currentAdjunction) for (const importCssId of currentAdjunction){
|
|
1572
|
+
const importInDegree = inDegreeMap.get(importCssId) - 1;
|
|
1573
|
+
inDegreeMap.set(importCssId, importInDegree);
|
|
1574
|
+
if (0 === importInDegree) queue.push(importCssId);
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
return sortedCssIds;
|
|
1578
|
+
}
|
|
1579
|
+
function generateImportByMap(styleInfo, sortedCssIds) {
|
|
1580
|
+
const cssIdToImportBy = new Map();
|
|
1581
|
+
for (const cssId of sortedCssIds){
|
|
1582
|
+
const currentAdjunction = styleInfo[cssId]?.imports;
|
|
1583
|
+
if (currentAdjunction) {
|
|
1584
|
+
const currentImportBy = cssIdToImportBy.get(cssId) ?? new Set([
|
|
1585
|
+
cssId
|
|
1586
|
+
]);
|
|
1587
|
+
for (const importCssId of currentAdjunction){
|
|
1588
|
+
const importDeps = cssIdToImportBy.get(importCssId) ?? new Set([
|
|
1589
|
+
importCssId
|
|
1590
|
+
]);
|
|
1591
|
+
importDeps.add(cssId);
|
|
1592
|
+
cssIdToImportBy.set(importCssId, currentImportBy.union(importDeps));
|
|
1593
|
+
}
|
|
1594
|
+
cssIdToImportBy.set(cssId, currentImportBy);
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
return cssIdToImportBy;
|
|
1598
|
+
}
|
|
1599
|
+
function flattenStyleInfo(styleInfo) {
|
|
1600
|
+
const sortedCssIds = topologicalSort(styleInfo);
|
|
1601
|
+
const cssIdToImportBy = generateImportByMap(styleInfo, sortedCssIds);
|
|
1602
|
+
sortedCssIds.reverse();
|
|
1603
|
+
return sortedCssIds.map((cssId)=>{
|
|
1604
|
+
const oneInfo = styleInfo[cssId];
|
|
1605
|
+
const flattenedInfo = oneInfo ? {
|
|
1606
|
+
content: oneInfo.content,
|
|
1607
|
+
rules: oneInfo.rules,
|
|
1608
|
+
importBy: Array.from(cssIdToImportBy.get(cssId) ?? [
|
|
1609
|
+
cssId
|
|
1610
|
+
])
|
|
1611
|
+
} : {
|
|
1612
|
+
content: [],
|
|
1613
|
+
rules: [],
|
|
1614
|
+
importBy: [
|
|
1615
|
+
cssId
|
|
1616
|
+
]
|
|
1617
|
+
};
|
|
1618
|
+
return flattenedInfo;
|
|
1619
|
+
});
|
|
1620
|
+
}
|
|
1621
|
+
function transformToWebCss(styleInfo) {
|
|
1622
|
+
for (const cssInfos of styleInfo)for (const rule of cssInfos.rules){
|
|
1623
|
+
const { sel: selectors, decl: declarations } = rule;
|
|
1624
|
+
const { transformedStyle, childStyle } = (0, _tokenizer_js__WEBPACK_IMPORTED_MODULE_1__.x)(declarations);
|
|
1625
|
+
rule.decl = transformedStyle;
|
|
1626
|
+
if (childStyle.length > 0) cssInfos.rules.push({
|
|
1627
|
+
sel: selectors.map((selector)=>selector.toSpliced(-2, 1, [
|
|
1628
|
+
'>'
|
|
1629
|
+
], [
|
|
1630
|
+
'*'
|
|
1631
|
+
], [], [], [])),
|
|
1632
|
+
decl: childStyle
|
|
1633
|
+
});
|
|
1634
|
+
}
|
|
1635
|
+
}
|
|
1636
|
+
function genCssContent(styleInfo, pageConfig, entryName) {
|
|
1637
|
+
function getExtraSelectors(cssId) {
|
|
1638
|
+
let suffix;
|
|
1639
|
+
suffix = pageConfig.enableRemoveCSSScope ? `[${_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.Gq}]` : `[${_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.js}="${cssId}"]`;
|
|
1640
|
+
suffix = entryName ? `${suffix}[${_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.Pb}=${JSON.stringify(entryName)}]` : `${suffix}:not([${_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.Pb}])`;
|
|
1641
|
+
return suffix;
|
|
1642
|
+
}
|
|
1643
|
+
const finalCssContent = [];
|
|
1644
|
+
for (const cssInfos of styleInfo){
|
|
1645
|
+
const declarationContent = cssInfos.rules.map((rule)=>{
|
|
1646
|
+
const { sel: selectorList, decl: declarations } = rule;
|
|
1647
|
+
const selectorString = cssInfos.importBy.map((cssId)=>{
|
|
1648
|
+
const suffix = getExtraSelectors(cssId);
|
|
1649
|
+
return selectorList.map((selectors)=>selectors.toSpliced(-4, 0, [
|
|
1650
|
+
suffix
|
|
1651
|
+
]).flat().join('')).join(',');
|
|
1652
|
+
}).join(',');
|
|
1653
|
+
const declarationString = declarations.map(([k, v])=>`${k}:${v};`).join('');
|
|
1654
|
+
return `${selectorString}{${declarationString}}`;
|
|
1655
|
+
}).join('');
|
|
1656
|
+
finalCssContent.push(...cssInfos.content, declarationContent);
|
|
1657
|
+
}
|
|
1658
|
+
return finalCssContent.join('\n');
|
|
1659
|
+
}
|
|
1660
|
+
function genCssOGInfo(styleInfo) {
|
|
1661
|
+
const cssOGInfo = {};
|
|
1662
|
+
for (const oneInfo of styleInfo)oneInfo.rules = oneInfo.rules.filter((oneRule)=>{
|
|
1663
|
+
oneRule.sel = oneRule.sel.filter((selectorList)=>{
|
|
1664
|
+
const [classSelectors, pseudoClassSelectors, pseudoElementSelectors, combinator] = selectorList;
|
|
1665
|
+
if (1 === classSelectors.length && '.' === classSelectors[0][0] && 0 === pseudoClassSelectors.length && 0 === pseudoElementSelectors.length && 0 === combinator.length) {
|
|
1666
|
+
const selectorName = classSelectors[0].substring(1);
|
|
1667
|
+
for (const cssId of oneInfo.importBy){
|
|
1668
|
+
if (!cssOGInfo[cssId]) cssOGInfo[cssId] = {};
|
|
1669
|
+
const currentDeclarations = cssOGInfo[cssId][selectorName];
|
|
1670
|
+
if (currentDeclarations) currentDeclarations.push(...oneRule.decl);
|
|
1671
|
+
else cssOGInfo[cssId][selectorName] = oneRule.decl;
|
|
1672
|
+
}
|
|
1673
|
+
return false;
|
|
1674
|
+
}
|
|
1675
|
+
return true;
|
|
1676
|
+
});
|
|
1677
|
+
return oneRule.sel.length > 0;
|
|
1678
|
+
});
|
|
1679
|
+
return cssOGInfo;
|
|
1680
|
+
}
|
|
1681
|
+
function appendStyleElement(styleInfo, pageConfig, rootDom, document, ssrHydrateInfo) {
|
|
1682
|
+
const lynxUniqueIdToStyleRulesIndex = ssrHydrateInfo?.lynxUniqueIdToStyleRulesIndex ?? [];
|
|
1683
|
+
const flattenedStyleInfo = flattenStyleInfo(styleInfo);
|
|
1684
|
+
transformToWebCss(flattenedStyleInfo);
|
|
1685
|
+
const cssOGInfo = pageConfig.enableCSSSelector ? {} : genCssOGInfo(flattenedStyleInfo);
|
|
1686
|
+
const lazyCSSOGInfo = {};
|
|
1687
|
+
let cardStyleElement;
|
|
1688
|
+
if (ssrHydrateInfo?.cardStyleElement) cardStyleElement = ssrHydrateInfo.cardStyleElement;
|
|
1689
|
+
else {
|
|
1690
|
+
cardStyleElement = document.createElement('style');
|
|
1691
|
+
cardStyleElement.textContent = genCssContent(flattenedStyleInfo, pageConfig, void 0);
|
|
1692
|
+
rootDom.appendChild(cardStyleElement);
|
|
1693
|
+
}
|
|
1694
|
+
const updateCssOGStyle = (uniqueId, newClassName, cssID, entryName)=>{
|
|
1695
|
+
const cardStyleElementSheet = cardStyleElement.sheet;
|
|
1696
|
+
const styleMap = entryName && lazyCSSOGInfo[entryName] ? lazyCSSOGInfo[entryName] : cssOGInfo;
|
|
1697
|
+
const newStyles = (0, _decodeCssOG_js__WEBPACK_IMPORTED_MODULE_2__.y)(newClassName, styleMap, cssID);
|
|
1698
|
+
if (void 0 !== lynxUniqueIdToStyleRulesIndex[uniqueId]) {
|
|
1699
|
+
const rule = cardStyleElementSheet.cssRules[lynxUniqueIdToStyleRulesIndex[uniqueId]];
|
|
1700
|
+
rule.style.cssText = newStyles;
|
|
1701
|
+
} else {
|
|
1702
|
+
const index = cardStyleElementSheet.insertRule(`[${_lynx_js_web_constants__WEBPACK_IMPORTED_MODULE_0__.SP}="${uniqueId}"]{${newStyles}}`, cardStyleElementSheet.cssRules.length);
|
|
1703
|
+
lynxUniqueIdToStyleRulesIndex[uniqueId] = index;
|
|
1704
|
+
}
|
|
1705
|
+
};
|
|
1706
|
+
const updateLazyComponentStyle = (styleInfo, entryName)=>{
|
|
1707
|
+
const flattenedStyleInfo = flattenStyleInfo(styleInfo);
|
|
1708
|
+
transformToWebCss(flattenedStyleInfo);
|
|
1709
|
+
if (!pageConfig.enableCSSSelector) lazyCSSOGInfo[entryName] = genCssOGInfo(flattenedStyleInfo);
|
|
1710
|
+
const newStyleSheet = genCssContent(flattenedStyleInfo, pageConfig, entryName);
|
|
1711
|
+
cardStyleElement.textContent += newStyleSheet;
|
|
1712
|
+
};
|
|
1713
|
+
return {
|
|
1714
|
+
updateCssOGStyle,
|
|
1715
|
+
updateLazyComponentStyle
|
|
1716
|
+
};
|
|
1717
|
+
}
|
|
1718
|
+
__webpack_async_result__();
|
|
1719
|
+
} catch (e) {
|
|
1720
|
+
__webpack_async_result__(e);
|
|
1721
|
+
}
|
|
1722
|
+
});
|
|
1723
|
+
},
|
|
1724
|
+
"../web-mainthread-apis/dist/utils/tokenizer.js": function(__webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1725
|
+
__webpack_require__.a(__webpack_module__, async function(__webpack_handle_async_dependencies__, __webpack_async_result__) {
|
|
1726
|
+
try {
|
|
1727
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
1728
|
+
Q: ()=>transformInlineStyleString,
|
|
1729
|
+
x: ()=>transformParsedStyles
|
|
1730
|
+
});
|
|
1731
|
+
var _wasm_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../web-mainthread-apis/wasm/index.js");
|
|
1732
|
+
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([
|
|
1733
|
+
_wasm_index_js__WEBPACK_IMPORTED_MODULE_0__
|
|
1734
|
+
]);
|
|
1735
|
+
_wasm_index_js__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
|
|
1736
|
+
function transformInlineStyleString(str) {
|
|
1737
|
+
return _wasm_index_js__WEBPACK_IMPORTED_MODULE_0__.v.transform_raw_u16_inline_style_ptr(str) ?? str;
|
|
1738
|
+
}
|
|
1739
|
+
function transformParsedStyles(styles) {
|
|
1740
|
+
let childStyle = [];
|
|
1741
|
+
let transformedStyle = [];
|
|
1742
|
+
for (const [property, value] of styles){
|
|
1743
|
+
const transformedResult = _wasm_index_js__WEBPACK_IMPORTED_MODULE_0__.v.transform_raw_u16_inline_style_ptr_parsed(property, value);
|
|
1744
|
+
if (transformedResult) {
|
|
1745
|
+
const [transformedStyleForCurrent, childStyleForCurrent] = transformedResult;
|
|
1746
|
+
transformedStyle = transformedStyle.concat(transformedStyleForCurrent);
|
|
1747
|
+
if (childStyleForCurrent) childStyle = childStyle.concat(childStyleForCurrent);
|
|
1748
|
+
} else transformedStyle.push([
|
|
1749
|
+
property,
|
|
1750
|
+
value
|
|
1751
|
+
]);
|
|
1752
|
+
}
|
|
1753
|
+
return {
|
|
1754
|
+
childStyle,
|
|
1755
|
+
transformedStyle
|
|
1756
|
+
};
|
|
1757
|
+
}
|
|
1758
|
+
__webpack_async_result__();
|
|
1759
|
+
} catch (e) {
|
|
1760
|
+
__webpack_async_result__(e);
|
|
1761
|
+
}
|
|
1762
|
+
});
|
|
1763
|
+
},
|
|
1764
|
+
"../web-mainthread-apis/wasm/index.js": function(__webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1765
|
+
__webpack_require__.a(__webpack_module__, async function(__webpack_handle_async_dependencies__, __webpack_async_result__) {
|
|
1766
|
+
try {
|
|
1767
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
1768
|
+
v: ()=>wasm
|
|
1769
|
+
});
|
|
1770
|
+
var wasm_feature_detect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../../node_modules/.pnpm/wasm-feature-detect@1.8.0/node_modules/wasm-feature-detect/dist/esm/index.js");
|
|
1771
|
+
let wasm;
|
|
1772
|
+
async function initWasm() {
|
|
1773
|
+
const supportsReferenceTypes = await (0, wasm_feature_detect__WEBPACK_IMPORTED_MODULE_0__.rO)();
|
|
1774
|
+
wasm = supportsReferenceTypes ? await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../web-mainthread-apis/wasm/standard.js")) : await __webpack_require__.e("8").then(__webpack_require__.bind(__webpack_require__, "../web-mainthread-apis/wasm/legacy.js"));
|
|
1775
|
+
}
|
|
1776
|
+
await initWasm();
|
|
1777
|
+
__webpack_async_result__();
|
|
1778
|
+
} catch (e) {
|
|
1779
|
+
__webpack_async_result__(e);
|
|
1780
|
+
}
|
|
1781
|
+
}, 1);
|
|
1782
|
+
},
|
|
1783
|
+
"../web-mainthread-apis/wasm/standard.js": function(__webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1784
|
+
__webpack_require__.a(__webpack_module__, async function(__webpack_handle_async_dependencies__, __webpack_async_result__) {
|
|
1785
|
+
try {
|
|
1786
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1787
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
1788
|
+
__wbg___wbindgen_throw_b855445ff6a94295: ()=>_binary_standard_js__WEBPACK_IMPORTED_MODULE_0__.H4,
|
|
1789
|
+
__wbg_new_e17d9f43105b08be: ()=>_binary_standard_js__WEBPACK_IMPORTED_MODULE_0__.f,
|
|
1790
|
+
__wbg_push_df81a39d04db858c: ()=>_binary_standard_js__WEBPACK_IMPORTED_MODULE_0__.RS,
|
|
1791
|
+
__wbg_set_wasm: ()=>_binary_standard_js__WEBPACK_IMPORTED_MODULE_0__.lI,
|
|
1792
|
+
__wbindgen_cast_2241b6af4c4b2941: ()=>_binary_standard_js__WEBPACK_IMPORTED_MODULE_0__.pY,
|
|
1793
|
+
__wbindgen_init_externref_table: ()=>_binary_standard_js__WEBPACK_IMPORTED_MODULE_0__.bL,
|
|
1794
|
+
transform_raw_u16_inline_style_ptr: ()=>_binary_standard_js__WEBPACK_IMPORTED_MODULE_0__.aC,
|
|
1795
|
+
transform_raw_u16_inline_style_ptr_parsed: ()=>_binary_standard_js__WEBPACK_IMPORTED_MODULE_0__.iG
|
|
1796
|
+
});
|
|
1797
|
+
var _binary_standard_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../web-mainthread-apis/binary/standard.js");
|
|
1798
|
+
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([
|
|
1799
|
+
_binary_standard_js__WEBPACK_IMPORTED_MODULE_0__
|
|
1800
|
+
]);
|
|
1801
|
+
_binary_standard_js__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
|
|
1802
|
+
__webpack_async_result__();
|
|
1803
|
+
} catch (e) {
|
|
1804
|
+
__webpack_async_result__(e);
|
|
1805
|
+
}
|
|
1806
|
+
});
|
|
1807
|
+
},
|
|
1808
|
+
"../web-mainthread-apis/binary/standard_bg.wasm": function(module, exports, __webpack_require__) {
|
|
1809
|
+
var WEBPACK_IMPORTED_MODULE_0 = __webpack_require__("../web-mainthread-apis/binary/standard_bg.js");
|
|
1810
|
+
module.exports = __webpack_require__.v(exports, module.id, "7f8d048731bd644f", {
|
|
1811
|
+
"./standard_bg.js": {
|
|
1812
|
+
__wbg_new_e17d9f43105b08be: WEBPACK_IMPORTED_MODULE_0.f,
|
|
1813
|
+
__wbg_push_df81a39d04db858c: WEBPACK_IMPORTED_MODULE_0.RS,
|
|
1814
|
+
__wbg___wbindgen_throw_b855445ff6a94295: WEBPACK_IMPORTED_MODULE_0.H4,
|
|
1815
|
+
__wbindgen_init_externref_table: WEBPACK_IMPORTED_MODULE_0.bL,
|
|
1816
|
+
__wbindgen_cast_2241b6af4c4b2941: WEBPACK_IMPORTED_MODULE_0.pY
|
|
1817
|
+
}
|
|
1818
|
+
});
|
|
1819
|
+
}
|
|
1820
|
+
};
|
|
1821
|
+
|
|
1822
|
+
//# sourceMappingURL=27.js.map
|