@lynx-js/web-core-server-canary 0.17.0-canary-20250919-f4528d19 → 0.17.0-canary-20250919-8c33d3e1
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 +1 -1
- package/dist/index.js +24 -21
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -387,14 +387,17 @@ __webpack_require__.m = __webpack_modules__;
|
|
|
387
387
|
}
|
|
388
388
|
};
|
|
389
389
|
})();
|
|
390
|
+
const lynxUniqueIdAttribute = 'l-uid';
|
|
390
391
|
const cssIdAttribute = 'l-css-id';
|
|
391
392
|
const componentIdAttribute = 'l-comp-id';
|
|
392
393
|
const parentComponentUniqueIdAttribute = 'l-p-comp-uid';
|
|
393
394
|
const lynxEntryNameAttribute = 'l-e-name';
|
|
394
395
|
const lynxTagAttribute = 'lynx-tag';
|
|
396
|
+
const lynxDatasetAttribute = 'l-dset';
|
|
395
397
|
const lynxComponentConfigAttribute = 'l-comp-cfg';
|
|
396
398
|
const lynxDisposedAttribute = 'l-disposed';
|
|
397
399
|
const lynxElementTemplateMarkerAttribute = 'l-template';
|
|
400
|
+
const lynxPartIdAttribute = 'l-part';
|
|
398
401
|
const lynxDefaultDisplayLinearAttribute = 'lynx-default-display-linear';
|
|
399
402
|
const __lynx_timing_flag = '__lynx_timing_flag';
|
|
400
403
|
const systemInfo = {
|
|
@@ -1156,11 +1159,11 @@ const __AddConfig = /*#__PURE__*/ (element, type, value)=>{
|
|
|
1156
1159
|
const __AddDataset = /*#__PURE__*/ (element, key, value)=>{
|
|
1157
1160
|
const currentDataset = __GetDataset(element);
|
|
1158
1161
|
currentDataset[key] = value;
|
|
1159
|
-
element.setAttribute(
|
|
1162
|
+
element.setAttribute(lynxDatasetAttribute, encodeURIComponent(JSON.stringify(currentDataset)));
|
|
1160
1163
|
value ? element.setAttribute('data-' + key, value.toString()) : element.removeAttribute('data-' + key);
|
|
1161
1164
|
};
|
|
1162
1165
|
const __GetDataset = /*#__PURE__*/ (element)=>{
|
|
1163
|
-
const datasetString = element.getAttribute(
|
|
1166
|
+
const datasetString = element.getAttribute(lynxDatasetAttribute);
|
|
1164
1167
|
const currentDataset = datasetString ? JSON.parse(decodeURIComponent(datasetString)) : {};
|
|
1165
1168
|
return currentDataset;
|
|
1166
1169
|
};
|
|
@@ -1178,7 +1181,7 @@ const __GetElementConfig = /*#__PURE__*/ (element)=>{
|
|
|
1178
1181
|
return currentComponentConfigString ? JSON.parse(decodeURIComponent(currentComponentConfigString)) : {};
|
|
1179
1182
|
};
|
|
1180
1183
|
const __GetAttributeByName = /*#__PURE__*/ (element, name)=>element.getAttribute(name);
|
|
1181
|
-
const __GetElementUniqueID = /*#__PURE__*/ (element)=>element && element.getAttribute ? Number(element.getAttribute(
|
|
1184
|
+
const __GetElementUniqueID = /*#__PURE__*/ (element)=>element && element.getAttribute ? Number(element.getAttribute(lynxUniqueIdAttribute)) : -1;
|
|
1182
1185
|
const __GetID = /*#__PURE__*/ (element)=>element.getAttribute('id');
|
|
1183
1186
|
const __SetID = /*#__PURE__*/ (element, id)=>id ? element.setAttribute('id', id) : element.removeAttribute('id');
|
|
1184
1187
|
const __GetTag = /*#__PURE__*/ (element)=>element.getAttribute(lynxTagAttribute);
|
|
@@ -1186,7 +1189,7 @@ const __SetConfig = /*#__PURE__*/ (element, config)=>{
|
|
|
1186
1189
|
element.setAttribute(lynxComponentConfigAttribute, encodeURIComponent(JSON.stringify(config)));
|
|
1187
1190
|
};
|
|
1188
1191
|
const __SetDataset = /*#__PURE__*/ (element, dataset)=>{
|
|
1189
|
-
element.setAttribute(
|
|
1192
|
+
element.setAttribute(lynxDatasetAttribute, encodeURIComponent(JSON.stringify(dataset)));
|
|
1190
1193
|
for (const [key, value] of Object.entries(dataset))element.setAttribute('data-' + key, value.toString());
|
|
1191
1194
|
};
|
|
1192
1195
|
const __UpdateComponentID = /*#__PURE__*/ (element, componentID)=>element.setAttribute(componentIdAttribute, componentID);
|
|
@@ -1244,9 +1247,9 @@ const __GetTemplateParts = (templateElement)=>{
|
|
|
1244
1247
|
if (!isTemplate) return {};
|
|
1245
1248
|
const templateUniqueId = __GetElementUniqueID(templateElement);
|
|
1246
1249
|
const parts = {};
|
|
1247
|
-
const partElements = templateElement.querySelectorAll(`[
|
|
1250
|
+
const partElements = templateElement.querySelectorAll(`[${lynxUniqueIdAttribute}="${templateUniqueId}"] [${lynxPartIdAttribute}]:not([${lynxUniqueIdAttribute}="${templateUniqueId}"] [${lynxElementTemplateMarkerAttribute}] [${lynxPartIdAttribute}])`);
|
|
1248
1251
|
for (const partElement of partElements){
|
|
1249
|
-
const partId = partElement.getAttribute(
|
|
1252
|
+
const partId = partElement.getAttribute(lynxPartIdAttribute);
|
|
1250
1253
|
if (partId) parts[partId] = partElement;
|
|
1251
1254
|
}
|
|
1252
1255
|
return parts;
|
|
@@ -1255,7 +1258,7 @@ const __MarkTemplateElement = (element)=>{
|
|
|
1255
1258
|
element.setAttribute(lynxElementTemplateMarkerAttribute, '');
|
|
1256
1259
|
};
|
|
1257
1260
|
const __MarkPartElement = (element, partId)=>{
|
|
1258
|
-
element.setAttribute(
|
|
1261
|
+
element.setAttribute(lynxPartIdAttribute, partId);
|
|
1259
1262
|
};
|
|
1260
1263
|
function toCloneableObject(obj) {
|
|
1261
1264
|
const cloneableObj = {};
|
|
@@ -1299,9 +1302,9 @@ function createCrossThreadEvent(domEvent, eventName) {
|
|
|
1299
1302
|
changedTouches: isTrusted ? changedTouches.map(toCloneableObject) : changedTouches
|
|
1300
1303
|
});
|
|
1301
1304
|
}
|
|
1302
|
-
const currentTargetDatasetString = currentTargetElement?.getAttribute(
|
|
1305
|
+
const currentTargetDatasetString = currentTargetElement?.getAttribute(lynxDatasetAttribute);
|
|
1303
1306
|
const currentTargetDataset = currentTargetDatasetString ? JSON.parse(decodeURIComponent(currentTargetDatasetString)) : {};
|
|
1304
|
-
const targetDatasetString = targetElement.getAttribute(
|
|
1307
|
+
const targetDatasetString = targetElement.getAttribute(lynxDatasetAttribute);
|
|
1305
1308
|
const targetDataset = targetDatasetString ? JSON.parse(decodeURIComponent(targetDatasetString)) : {};
|
|
1306
1309
|
return {
|
|
1307
1310
|
type: eventName,
|
|
@@ -1309,12 +1312,12 @@ function createCrossThreadEvent(domEvent, eventName) {
|
|
|
1309
1312
|
target: {
|
|
1310
1313
|
id: targetElement.getAttribute('id'),
|
|
1311
1314
|
dataset: targetDataset,
|
|
1312
|
-
uniqueId: Number(targetElement.getAttribute(
|
|
1315
|
+
uniqueId: Number(targetElement.getAttribute(lynxUniqueIdAttribute))
|
|
1313
1316
|
},
|
|
1314
1317
|
currentTarget: currentTargetElement ? {
|
|
1315
1318
|
id: currentTargetElement.getAttribute('id'),
|
|
1316
1319
|
dataset: currentTargetDataset,
|
|
1317
|
-
uniqueId: Number(currentTargetElement.getAttribute(
|
|
1320
|
+
uniqueId: Number(currentTargetElement.getAttribute(lynxUniqueIdAttribute))
|
|
1318
1321
|
} : null,
|
|
1319
1322
|
detail: domEvent.detail ?? {},
|
|
1320
1323
|
params,
|
|
@@ -1451,7 +1454,7 @@ function createMainThreadGlobalThis(config) {
|
|
|
1451
1454
|
const parentComponentCssID = lynxUniqueIdToElement[parentComponentUniqueId]?.deref()?.getAttribute(cssIdAttribute);
|
|
1452
1455
|
parentComponentCssID && '0' !== parentComponentCssID && element.setAttribute(cssIdAttribute, parentComponentCssID);
|
|
1453
1456
|
element.setAttribute(lynxTagAttribute, tag);
|
|
1454
|
-
element.setAttribute(
|
|
1457
|
+
element.setAttribute(lynxUniqueIdAttribute, uniqueId + '');
|
|
1455
1458
|
element.setAttribute(parentComponentUniqueIdAttribute, parentComponentUniqueId + '');
|
|
1456
1459
|
return element;
|
|
1457
1460
|
};
|
|
@@ -1544,14 +1547,14 @@ function createMainThreadGlobalThis(config) {
|
|
|
1544
1547
|
const newClassName = ((element.getAttribute('class') ?? '') + ' ' + className).trim();
|
|
1545
1548
|
element.setAttribute('class', newClassName);
|
|
1546
1549
|
const cssId = element.getAttribute(cssIdAttribute);
|
|
1547
|
-
const uniqueId = Number(element.getAttribute(
|
|
1550
|
+
const uniqueId = Number(element.getAttribute(lynxUniqueIdAttribute));
|
|
1548
1551
|
const entryName = element.getAttribute(lynxEntryNameAttribute);
|
|
1549
1552
|
callbacks.updateCssOGStyle(uniqueId, newClassName, cssId, entryName);
|
|
1550
1553
|
};
|
|
1551
1554
|
const __SetClassesForCSSOG = (element, classNames)=>{
|
|
1552
1555
|
__SetClasses(element, classNames);
|
|
1553
1556
|
const cssId = element.getAttribute(cssIdAttribute);
|
|
1554
|
-
const uniqueId = Number(element.getAttribute(
|
|
1557
|
+
const uniqueId = Number(element.getAttribute(lynxUniqueIdAttribute));
|
|
1555
1558
|
const entryName = element.getAttribute(lynxEntryNameAttribute);
|
|
1556
1559
|
callbacks.updateCssOGStyle(uniqueId, classNames ?? '', cssId, entryName);
|
|
1557
1560
|
};
|
|
@@ -1590,7 +1593,7 @@ function createMainThreadGlobalThis(config) {
|
|
|
1590
1593
|
};
|
|
1591
1594
|
const applyEventsForElementTemplate = (data, element)=>{
|
|
1592
1595
|
const uniqueId = uniqueIdInc++;
|
|
1593
|
-
element.setAttribute(
|
|
1596
|
+
element.setAttribute(lynxUniqueIdAttribute, uniqueId + '');
|
|
1594
1597
|
for (const event of data.events || []){
|
|
1595
1598
|
const { type, name, value } = event;
|
|
1596
1599
|
__AddEvent(element, type, name, value);
|
|
@@ -1724,7 +1727,7 @@ function createExposureService(rootDom, postExposure) {
|
|
|
1724
1727
|
const onScreen = new Map();
|
|
1725
1728
|
function exposureEventHandler(ev) {
|
|
1726
1729
|
const exposureEvent = createCrossThreadEvent(ev, ev.type);
|
|
1727
|
-
exposureEvent.detail['unique-id'] = parseFloat(ev.target.getAttribute(
|
|
1730
|
+
exposureEvent.detail['unique-id'] = parseFloat(ev.target.getAttribute(lynxUniqueIdAttribute));
|
|
1728
1731
|
const exposureID = exposureEvent.detail.exposureID;
|
|
1729
1732
|
if ('exposure' === ev.type) {
|
|
1730
1733
|
exposureCache.push(exposureEvent);
|
|
@@ -1932,7 +1935,7 @@ function appendStyleElement(styleInfo, pageConfig, rootDom, document, ssrHydrate
|
|
|
1932
1935
|
const rule = cardStyleElementSheet.cssRules[lynxUniqueIdToStyleRulesIndex[uniqueId]];
|
|
1933
1936
|
rule.style.cssText = newStyles;
|
|
1934
1937
|
} else {
|
|
1935
|
-
const index = cardStyleElementSheet.insertRule(`[
|
|
1938
|
+
const index = cardStyleElementSheet.insertRule(`[${lynxUniqueIdAttribute}="${uniqueId}"]{${newStyles}}`, cardStyleElementSheet.cssRules.length);
|
|
1936
1939
|
lynxUniqueIdToStyleRulesIndex[uniqueId] = index;
|
|
1937
1940
|
}
|
|
1938
1941
|
};
|
|
@@ -2794,8 +2797,8 @@ function getTextContentImpl(buffer, element, shadowrootTemplates) {
|
|
|
2794
2797
|
buffer.push('"');
|
|
2795
2798
|
}
|
|
2796
2799
|
}
|
|
2797
|
-
const partId = element[_attributes].get(
|
|
2798
|
-
buffer.push(' ',
|
|
2800
|
+
const partId = element[_attributes].get(lynxPartIdAttribute) ?? element[_attributes].get(lynxUniqueIdAttribute);
|
|
2801
|
+
buffer.push(' ', lynxPartIdAttribute, '="', partId, '"');
|
|
2799
2802
|
buffer.push('>');
|
|
2800
2803
|
const templateImpl = shadowrootTemplates[localName];
|
|
2801
2804
|
if (templateImpl) {
|
|
@@ -2837,7 +2840,7 @@ const builtinTagTransformMap = {
|
|
|
2837
2840
|
};
|
|
2838
2841
|
OffscreenElement.prototype.toJSON = function() {
|
|
2839
2842
|
return {
|
|
2840
|
-
ssrID: this[_attributes].get(
|
|
2843
|
+
ssrID: this[_attributes].get(lynxPartIdAttribute) ?? this[_attributes].get(lynxUniqueIdAttribute)
|
|
2841
2844
|
};
|
|
2842
2845
|
};
|
|
2843
2846
|
async function createLynxView(config) {
|
|
@@ -2906,7 +2909,7 @@ async function createLynxView(config) {
|
|
|
2906
2909
|
}, ()=>{}, {
|
|
2907
2910
|
__AddEvent (element, eventName, eventData, eventOptions) {
|
|
2908
2911
|
events.push([
|
|
2909
|
-
Number(element.getAttribute(
|
|
2912
|
+
Number(element.getAttribute(lynxUniqueIdAttribute)),
|
|
2910
2913
|
eventName,
|
|
2911
2914
|
eventData,
|
|
2912
2915
|
eventOptions
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/web-core-server-canary",
|
|
3
|
-
"version": "0.17.0-canary-20250919-
|
|
3
|
+
"version": "0.17.0-canary-20250919-8c33d3e1",
|
|
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": "npm:@lynx-js/offscreen-document-canary@0.1.4",
|
|
29
|
-
"@lynx-js/web-
|
|
30
|
-
"@lynx-js/web-
|
|
31
|
-
"@lynx-js/web-
|
|
32
|
-
"@lynx-js/web-worker-rpc": "npm:@lynx-js/web-worker-rpc-canary@0.17.0-canary-20250919-
|
|
29
|
+
"@lynx-js/web-elements-template": "npm:@lynx-js/web-elements-template-canary@0.8.7-canary-20250919-8c33d3e1",
|
|
30
|
+
"@lynx-js/web-mainthread-apis": "npm:@lynx-js/web-mainthread-apis-canary@0.17.0-canary-20250919-8c33d3e1",
|
|
31
|
+
"@lynx-js/web-constants": "npm:@lynx-js/web-constants-canary@0.17.0-canary-20250919-8c33d3e1",
|
|
32
|
+
"@lynx-js/web-worker-rpc": "npm:@lynx-js/web-worker-rpc-canary@0.17.0-canary-20250919-8c33d3e1"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "rslib build",
|