@lynx-js/web-core-server 0.18.0 → 0.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/index.js +54 -33
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -207,9 +207,12 @@ function __webpack_require__(moduleId) {
|
|
|
207
207
|
}
|
|
208
208
|
__webpack_require__.m = __webpack_modules__;
|
|
209
209
|
(()=>{
|
|
210
|
-
var
|
|
211
|
-
var
|
|
212
|
-
var
|
|
210
|
+
var hasSymbol = "function" == typeof Symbol;
|
|
211
|
+
var webpackQueues = hasSymbol ? Symbol("webpack queues") : "__webpack_queues__";
|
|
212
|
+
var webpackExports = __webpack_require__.aE = hasSymbol ? Symbol("webpack exports") : "__webpack_exports__";
|
|
213
|
+
var webpackError = hasSymbol ? Symbol("webpack error") : "__webpack_error__";
|
|
214
|
+
var webpackDone = hasSymbol ? Symbol("webpack done") : "__webpack_done__";
|
|
215
|
+
var webpackDefer = __webpack_require__.zS = hasSymbol ? Symbol("webpack defer") : "__webpack_defer__";
|
|
213
216
|
var resolveQueue = (queue)=>{
|
|
214
217
|
if (queue && queue.d < 1) {
|
|
215
218
|
queue.d = 1;
|
|
@@ -219,6 +222,20 @@ __webpack_require__.m = __webpack_modules__;
|
|
|
219
222
|
};
|
|
220
223
|
var wrapDeps = (deps)=>deps.map((dep)=>{
|
|
221
224
|
if (null !== dep && "object" == typeof dep) {
|
|
225
|
+
if (!dep[webpackQueues] && dep[webpackDefer]) {
|
|
226
|
+
var asyncDeps = dep[webpackDefer];
|
|
227
|
+
var hasUnresolvedAsyncSubgraph = asyncDeps.some((id)=>{
|
|
228
|
+
var cache = __webpack_module_cache__[id];
|
|
229
|
+
return !cache || false === cache[webpackDone];
|
|
230
|
+
});
|
|
231
|
+
if (!hasUnresolvedAsyncSubgraph) return dep;
|
|
232
|
+
var d = dep;
|
|
233
|
+
dep = {
|
|
234
|
+
then (callback) {
|
|
235
|
+
Promise.all(asyncDeps.map(__webpack_require__)).then(()=>callback(d));
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
}
|
|
222
239
|
if (dep[webpackQueues]) return dep;
|
|
223
240
|
if (dep.then) {
|
|
224
241
|
var queue = [];
|
|
@@ -231,6 +248,7 @@ __webpack_require__.m = __webpack_modules__;
|
|
|
231
248
|
resolveQueue(queue);
|
|
232
249
|
});
|
|
233
250
|
var obj = {};
|
|
251
|
+
obj[webpackDefer] = false;
|
|
234
252
|
obj[webpackQueues] = (fn)=>fn(queue);
|
|
235
253
|
return obj;
|
|
236
254
|
}
|
|
@@ -257,10 +275,11 @@ __webpack_require__.m = __webpack_modules__;
|
|
|
257
275
|
queue && fn(queue), depQueues.forEach(fn), promise["catch"](function() {});
|
|
258
276
|
};
|
|
259
277
|
module.exports = promise;
|
|
260
|
-
|
|
278
|
+
var handle = (deps)=>{
|
|
261
279
|
currentDeps = wrapDeps(deps);
|
|
262
280
|
var fn;
|
|
263
281
|
var getResult = ()=>currentDeps.map((d)=>{
|
|
282
|
+
if (d[webpackDefer]) return d;
|
|
264
283
|
if (d[webpackError]) throw d[webpackError];
|
|
265
284
|
return d[webpackExports];
|
|
266
285
|
});
|
|
@@ -268,10 +287,12 @@ __webpack_require__.m = __webpack_modules__;
|
|
|
268
287
|
fn = ()=>resolve(getResult);
|
|
269
288
|
fn.r = 0;
|
|
270
289
|
var fnQueue = (q)=>q !== queue && !depQueues.has(q) && (depQueues.add(q), q && !q.d && (fn.r++, q.push(fn)));
|
|
271
|
-
currentDeps.map((dep)=>dep[webpackQueues](fnQueue));
|
|
290
|
+
currentDeps.map((dep)=>dep[webpackDefer] || dep[webpackQueues](fnQueue));
|
|
272
291
|
});
|
|
273
292
|
return fn.r ? promise : getResult();
|
|
274
|
-
}
|
|
293
|
+
};
|
|
294
|
+
var done = (err)=>(err ? reject(promise[webpackError] = err) : outerResolve(exports), resolveQueue(queue), promise[webpackDone] = true);
|
|
295
|
+
body(handle, done);
|
|
275
296
|
queue && queue.d < 0 && (queue.d = 0);
|
|
276
297
|
};
|
|
277
298
|
})();
|
|
@@ -383,17 +404,14 @@ __webpack_require__.m = __webpack_modules__;
|
|
|
383
404
|
}
|
|
384
405
|
};
|
|
385
406
|
})();
|
|
386
|
-
const lynxUniqueIdAttribute = 'l-uid';
|
|
387
407
|
const cssIdAttribute = 'l-css-id';
|
|
388
408
|
const componentIdAttribute = 'l-comp-id';
|
|
389
409
|
const parentComponentUniqueIdAttribute = 'l-p-comp-uid';
|
|
390
410
|
const lynxEntryNameAttribute = 'l-e-name';
|
|
391
411
|
const lynxTagAttribute = 'lynx-tag';
|
|
392
|
-
const lynxDatasetAttribute = 'l-dset';
|
|
393
412
|
const lynxComponentConfigAttribute = 'l-comp-cfg';
|
|
394
413
|
const lynxDisposedAttribute = 'l-disposed';
|
|
395
414
|
const lynxElementTemplateMarkerAttribute = 'l-template';
|
|
396
|
-
const lynxPartIdAttribute = 'l-part';
|
|
397
415
|
const lynxDefaultDisplayLinearAttribute = 'lynx-default-display-linear';
|
|
398
416
|
const __lynx_timing_flag = '__lynx_timing_flag';
|
|
399
417
|
const systemInfo = {
|
|
@@ -1141,11 +1159,11 @@ const __AddConfig = /*#__PURE__*/ (element, type, value)=>{
|
|
|
1141
1159
|
const __AddDataset = /*#__PURE__*/ (element, key, value)=>{
|
|
1142
1160
|
const currentDataset = __GetDataset(element);
|
|
1143
1161
|
currentDataset[key] = value;
|
|
1144
|
-
element.setAttribute(
|
|
1162
|
+
element.setAttribute("l-dset", encodeURIComponent(JSON.stringify(currentDataset)));
|
|
1145
1163
|
value ? element.setAttribute('data-' + key, value.toString()) : element.removeAttribute('data-' + key);
|
|
1146
1164
|
};
|
|
1147
1165
|
const __GetDataset = /*#__PURE__*/ (element)=>{
|
|
1148
|
-
const datasetString = element.getAttribute(
|
|
1166
|
+
const datasetString = element.getAttribute("l-dset");
|
|
1149
1167
|
const currentDataset = datasetString ? JSON.parse(decodeURIComponent(datasetString)) : {};
|
|
1150
1168
|
return currentDataset;
|
|
1151
1169
|
};
|
|
@@ -1163,7 +1181,7 @@ const __GetElementConfig = /*#__PURE__*/ (element)=>{
|
|
|
1163
1181
|
return currentComponentConfigString ? JSON.parse(decodeURIComponent(currentComponentConfigString)) : {};
|
|
1164
1182
|
};
|
|
1165
1183
|
const __GetAttributeByName = /*#__PURE__*/ (element, name)=>element.getAttribute(name);
|
|
1166
|
-
const __GetElementUniqueID = /*#__PURE__*/ (element)=>element && element.getAttribute ? Number(element.getAttribute(
|
|
1184
|
+
const __GetElementUniqueID = /*#__PURE__*/ (element)=>element && element.getAttribute ? Number(element.getAttribute("l-uid")) : -1;
|
|
1167
1185
|
const __GetID = /*#__PURE__*/ (element)=>element.getAttribute('id');
|
|
1168
1186
|
const __SetID = /*#__PURE__*/ (element, id)=>id ? element.setAttribute('id', id) : element.removeAttribute('id');
|
|
1169
1187
|
const __GetTag = /*#__PURE__*/ (element)=>element.getAttribute(lynxTagAttribute);
|
|
@@ -1171,7 +1189,7 @@ const __SetConfig = /*#__PURE__*/ (element, config)=>{
|
|
|
1171
1189
|
element.setAttribute(lynxComponentConfigAttribute, encodeURIComponent(JSON.stringify(config)));
|
|
1172
1190
|
};
|
|
1173
1191
|
const __SetDataset = /*#__PURE__*/ (element, dataset)=>{
|
|
1174
|
-
element.setAttribute(
|
|
1192
|
+
element.setAttribute("l-dset", encodeURIComponent(JSON.stringify(dataset)));
|
|
1175
1193
|
for (const [key, value] of Object.entries(dataset))element.setAttribute('data-' + key, value.toString());
|
|
1176
1194
|
};
|
|
1177
1195
|
const __UpdateComponentID = /*#__PURE__*/ (element, componentID)=>element.setAttribute(componentIdAttribute, componentID);
|
|
@@ -1229,9 +1247,9 @@ const __GetTemplateParts = (templateElement)=>{
|
|
|
1229
1247
|
if (!isTemplate) return {};
|
|
1230
1248
|
const templateUniqueId = __GetElementUniqueID(templateElement);
|
|
1231
1249
|
const parts = {};
|
|
1232
|
-
const partElements = templateElement.querySelectorAll(`[
|
|
1250
|
+
const partElements = templateElement.querySelectorAll(`[l-uid="${templateUniqueId}"] [l-part]:not([l-uid="${templateUniqueId}"] [${lynxElementTemplateMarkerAttribute}] [l-part])`);
|
|
1233
1251
|
for (const partElement of partElements){
|
|
1234
|
-
const partId = partElement.getAttribute(
|
|
1252
|
+
const partId = partElement.getAttribute("l-part");
|
|
1235
1253
|
if (partId) parts[partId] = partElement;
|
|
1236
1254
|
}
|
|
1237
1255
|
return parts;
|
|
@@ -1240,7 +1258,7 @@ const __MarkTemplateElement = (element)=>{
|
|
|
1240
1258
|
element.setAttribute(lynxElementTemplateMarkerAttribute, '');
|
|
1241
1259
|
};
|
|
1242
1260
|
const __MarkPartElement = (element, partId)=>{
|
|
1243
|
-
element.setAttribute(
|
|
1261
|
+
element.setAttribute("l-part", partId);
|
|
1244
1262
|
};
|
|
1245
1263
|
function toCloneableObject(obj) {
|
|
1246
1264
|
const cloneableObj = {};
|
|
@@ -1296,9 +1314,9 @@ function createCrossThreadEvent(domEvent, eventName) {
|
|
|
1296
1314
|
clientY: mouseEvent.clientY
|
|
1297
1315
|
});
|
|
1298
1316
|
}
|
|
1299
|
-
const currentTargetDatasetString = currentTargetElement?.getAttribute(
|
|
1317
|
+
const currentTargetDatasetString = currentTargetElement?.getAttribute("l-dset");
|
|
1300
1318
|
const currentTargetDataset = currentTargetDatasetString ? JSON.parse(decodeURIComponent(currentTargetDatasetString)) : {};
|
|
1301
|
-
const targetDatasetString = targetElement.getAttribute(
|
|
1319
|
+
const targetDatasetString = targetElement.getAttribute("l-dset");
|
|
1302
1320
|
const targetDataset = targetDatasetString ? JSON.parse(decodeURIComponent(targetDatasetString)) : {};
|
|
1303
1321
|
return {
|
|
1304
1322
|
type: eventName,
|
|
@@ -1306,12 +1324,12 @@ function createCrossThreadEvent(domEvent, eventName) {
|
|
|
1306
1324
|
target: {
|
|
1307
1325
|
id: targetElement.getAttribute('id'),
|
|
1308
1326
|
dataset: targetDataset,
|
|
1309
|
-
uniqueId: Number(targetElement.getAttribute(
|
|
1327
|
+
uniqueId: Number(targetElement.getAttribute("l-uid"))
|
|
1310
1328
|
},
|
|
1311
1329
|
currentTarget: currentTargetElement ? {
|
|
1312
1330
|
id: currentTargetElement.getAttribute('id'),
|
|
1313
1331
|
dataset: currentTargetDataset,
|
|
1314
|
-
uniqueId: Number(currentTargetElement.getAttribute(
|
|
1332
|
+
uniqueId: Number(currentTargetElement.getAttribute("l-uid"))
|
|
1315
1333
|
} : null,
|
|
1316
1334
|
detail: domEvent.detail ?? {},
|
|
1317
1335
|
params,
|
|
@@ -1448,7 +1466,7 @@ function createMainThreadGlobalThis(config) {
|
|
|
1448
1466
|
const parentComponentCssID = lynxUniqueIdToElement[parentComponentUniqueId]?.deref()?.getAttribute(cssIdAttribute);
|
|
1449
1467
|
parentComponentCssID && '0' !== parentComponentCssID && element.setAttribute(cssIdAttribute, parentComponentCssID);
|
|
1450
1468
|
element.setAttribute(lynxTagAttribute, tag);
|
|
1451
|
-
element.setAttribute(
|
|
1469
|
+
element.setAttribute("l-uid", uniqueId + '');
|
|
1452
1470
|
element.setAttribute(parentComponentUniqueIdAttribute, parentComponentUniqueId + '');
|
|
1453
1471
|
return element;
|
|
1454
1472
|
};
|
|
@@ -1541,14 +1559,14 @@ function createMainThreadGlobalThis(config) {
|
|
|
1541
1559
|
const newClassName = ((element.getAttribute('class') ?? '') + ' ' + className).trim();
|
|
1542
1560
|
element.setAttribute('class', newClassName);
|
|
1543
1561
|
const cssId = element.getAttribute(cssIdAttribute);
|
|
1544
|
-
const uniqueId = Number(element.getAttribute(
|
|
1562
|
+
const uniqueId = Number(element.getAttribute("l-uid"));
|
|
1545
1563
|
const entryName = element.getAttribute(lynxEntryNameAttribute);
|
|
1546
1564
|
callbacks.updateCssOGStyle(uniqueId, newClassName, cssId, entryName);
|
|
1547
1565
|
};
|
|
1548
1566
|
const __SetClassesForCSSOG = (element, classNames)=>{
|
|
1549
1567
|
__SetClasses(element, classNames);
|
|
1550
1568
|
const cssId = element.getAttribute(cssIdAttribute);
|
|
1551
|
-
const uniqueId = Number(element.getAttribute(
|
|
1569
|
+
const uniqueId = Number(element.getAttribute("l-uid"));
|
|
1552
1570
|
const entryName = element.getAttribute(lynxEntryNameAttribute);
|
|
1553
1571
|
callbacks.updateCssOGStyle(uniqueId, classNames ?? '', cssId, entryName);
|
|
1554
1572
|
};
|
|
@@ -1587,7 +1605,7 @@ function createMainThreadGlobalThis(config) {
|
|
|
1587
1605
|
};
|
|
1588
1606
|
const applyEventsForElementTemplate = (data, element)=>{
|
|
1589
1607
|
const uniqueId = uniqueIdInc++;
|
|
1590
|
-
element.setAttribute(
|
|
1608
|
+
element.setAttribute("l-uid", uniqueId + '');
|
|
1591
1609
|
for (const event of data.events || []){
|
|
1592
1610
|
const { type, name, value } = event;
|
|
1593
1611
|
__AddEvent(element, type, name, value);
|
|
@@ -1721,7 +1739,7 @@ function createExposureService(rootDom, postExposure) {
|
|
|
1721
1739
|
const onScreen = new Map();
|
|
1722
1740
|
function exposureEventHandler(ev) {
|
|
1723
1741
|
const exposureEvent = createCrossThreadEvent(ev, ev.type);
|
|
1724
|
-
exposureEvent.detail['unique-id'] = parseFloat(ev.target.getAttribute(
|
|
1742
|
+
exposureEvent.detail['unique-id'] = parseFloat(ev.target.getAttribute("l-uid"));
|
|
1725
1743
|
const exposureID = exposureEvent.detail.exposureID;
|
|
1726
1744
|
if ('exposure' === ev.type) {
|
|
1727
1745
|
exposureCache.push(exposureEvent);
|
|
@@ -1929,7 +1947,7 @@ function appendStyleElement(styleInfo, pageConfig, rootDom, document, ssrHydrate
|
|
|
1929
1947
|
const rule = cardStyleElementSheet.cssRules[lynxUniqueIdToStyleRulesIndex[uniqueId]];
|
|
1930
1948
|
rule.style.cssText = newStyles;
|
|
1931
1949
|
} else {
|
|
1932
|
-
const index = cardStyleElementSheet.insertRule(`[
|
|
1950
|
+
const index = cardStyleElementSheet.insertRule(`[l-uid="${uniqueId}"]{${newStyles}}`, cardStyleElementSheet.cssRules.length);
|
|
1933
1951
|
lynxUniqueIdToStyleRulesIndex[uniqueId] = index;
|
|
1934
1952
|
}
|
|
1935
1953
|
};
|
|
@@ -1997,7 +2015,7 @@ function createQueryComponent(loadTemplate, updateLazyComponentStyle, background
|
|
|
1997
2015
|
return __QueryComponentImpl;
|
|
1998
2016
|
}
|
|
1999
2017
|
const initWasmPromise = initWasm();
|
|
2000
|
-
function prepareMainThreadAPIs(backgroundThreadRpc, rootDom, document,
|
|
2018
|
+
function prepareMainThreadAPIs(backgroundThreadRpc, rootDom, document, mtsRealmPromise, commitDocument, markTimingInternal, flushMarkTimingInternal, reportError, triggerI18nResourceFallback, initialI18nResources, loadTemplate, ssrHooks) {
|
|
2001
2019
|
const postTimingFlags = backgroundThreadRpc.createCall(postTimingFlagsEndpoint);
|
|
2002
2020
|
const backgroundStart = backgroundThreadRpc.createCall(BackgroundThreadStartEndpoint);
|
|
2003
2021
|
const publishEvent = backgroundThreadRpc.createCall(publishEventEndpoint);
|
|
@@ -2010,6 +2028,7 @@ function prepareMainThreadAPIs(backgroundThreadRpc, rootDom, document, mtsRealm,
|
|
|
2010
2028
|
let isFp = true;
|
|
2011
2029
|
const { globalProps, template, browserConfig, nativeModulesMap, napiModulesMap, tagMap, initI18nResources } = config;
|
|
2012
2030
|
const { styleInfo, pageConfig, customSections, cardType } = template;
|
|
2031
|
+
const mtsRealm = await mtsRealmPromise;
|
|
2013
2032
|
markTimingInternal('decode_start');
|
|
2014
2033
|
await initWasmPromise;
|
|
2015
2034
|
const jsContext = new LynxCrossThreadContext({
|
|
@@ -2115,7 +2134,8 @@ function prepareMainThreadAPIs(backgroundThreadRpc, rootDom, document, mtsRealm,
|
|
|
2115
2134
|
await mtsRealm.loadScript(template.lepusCode.root);
|
|
2116
2135
|
jsContext.__start();
|
|
2117
2136
|
}
|
|
2118
|
-
function handleUpdatedData(newData, options) {
|
|
2137
|
+
async function handleUpdatedData(newData, options) {
|
|
2138
|
+
const mtsRealm = await mtsRealmPromise;
|
|
2119
2139
|
const runtime = mtsRealm.globalWindow;
|
|
2120
2140
|
const processedData = runtime.processData ? runtime.processData(newData, options?.processorName) : newData;
|
|
2121
2141
|
runtime.updatePage?.(processedData, options);
|
|
@@ -2799,8 +2819,8 @@ function getTextContentImpl(buffer, element, shadowrootTemplates) {
|
|
|
2799
2819
|
buffer.push('"');
|
|
2800
2820
|
}
|
|
2801
2821
|
}
|
|
2802
|
-
const partId = element[_attributes].get(
|
|
2803
|
-
buffer.push(' ',
|
|
2822
|
+
const partId = element[_attributes].get("l-part") ?? element[_attributes].get("l-uid");
|
|
2823
|
+
buffer.push(' ', "l-part", '="', partId, '"');
|
|
2804
2824
|
buffer.push('>');
|
|
2805
2825
|
const templateImpl = shadowrootTemplates[localName];
|
|
2806
2826
|
if (templateImpl) {
|
|
@@ -2838,11 +2858,12 @@ const builtinTagTransformMap = {
|
|
|
2838
2858
|
text: 'x-text',
|
|
2839
2859
|
image: 'x-image',
|
|
2840
2860
|
list: 'x-list',
|
|
2841
|
-
svg: 'x-svg'
|
|
2861
|
+
svg: 'x-svg',
|
|
2862
|
+
input: 'x-input'
|
|
2842
2863
|
};
|
|
2843
2864
|
OffscreenElement.prototype.toJSON = function() {
|
|
2844
2865
|
return {
|
|
2845
|
-
ssrID: this[_attributes].get(
|
|
2866
|
+
ssrID: this[_attributes].get("l-part") ?? this[_attributes].get("l-uid")
|
|
2846
2867
|
};
|
|
2847
2868
|
};
|
|
2848
2869
|
async function createLynxView(config) {
|
|
@@ -2911,7 +2932,7 @@ async function createLynxView(config) {
|
|
|
2911
2932
|
}, ()=>{}, {
|
|
2912
2933
|
__AddEvent (element, eventName, eventData, eventOptions) {
|
|
2913
2934
|
events.push([
|
|
2914
|
-
Number(element.getAttribute(
|
|
2935
|
+
Number(element.getAttribute("l-uid")),
|
|
2915
2936
|
eventName,
|
|
2916
2937
|
eventData,
|
|
2917
2938
|
eventOptions
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/web-core-server",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [],
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"rsbuild-plugin-arethetypeswrong": "0.1.1",
|
|
27
27
|
"rsbuild-plugin-publint": "0.3.3",
|
|
28
28
|
"@lynx-js/offscreen-document": "0.1.4",
|
|
29
|
-
"@lynx-js/web-constants": "0.18.
|
|
30
|
-
"@lynx-js/web-elements-template": "0.8.
|
|
31
|
-
"@lynx-js/web-mainthread-apis": "0.18.
|
|
32
|
-
"@lynx-js/web-worker-rpc": "0.18.
|
|
29
|
+
"@lynx-js/web-constants": "0.18.2",
|
|
30
|
+
"@lynx-js/web-elements-template": "0.8.9",
|
|
31
|
+
"@lynx-js/web-mainthread-apis": "0.18.2",
|
|
32
|
+
"@lynx-js/web-worker-rpc": "0.18.2"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "rslib build",
|