@lynx-js/web-core-server-canary 0.18.0 → 0.18.1-canary-20251016-70a18fce

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 CHANGED
@@ -1,5 +1,7 @@
1
1
  # @lynx-js/web-core-server
2
2
 
3
+ ## 0.18.1-canary-20251016065218-70a18fce0083743e4516eefc91c0392d748b855f
4
+
3
5
  ## 0.18.0
4
6
 
5
7
  ## 0.17.2
@@ -111,25 +113,25 @@
111
113
  lynxView.initI18nResources = [
112
114
  {
113
115
  options: {
114
- locale: 'en',
115
- channel: '1',
116
- fallback_url: '',
116
+ locale: "en",
117
+ channel: "1",
118
+ fallback_url: "",
117
119
  },
118
120
  resource: {
119
- hello: 'hello',
120
- lynx: 'lynx web platform1',
121
+ hello: "hello",
122
+ lynx: "lynx web platform1",
121
123
  },
122
124
  },
123
125
  ];
124
- lynxView.addEventListener('i18nResourceMissed', (e) => {
126
+ lynxView.addEventListener("i18nResourceMissed", (e) => {
125
127
  console.log(e);
126
128
  });
127
129
 
128
130
  // mts
129
131
  _I18nResourceTranslation({
130
- locale: 'en',
131
- channel: '1',
132
- fallback_url: '',
132
+ locale: "en",
133
+ channel: "1",
134
+ fallback_url: "",
133
135
  });
134
136
  ```
135
137
 
package/dist/index.js CHANGED
@@ -383,17 +383,14 @@ __webpack_require__.m = __webpack_modules__;
383
383
  }
384
384
  };
385
385
  })();
386
- const lynxUniqueIdAttribute = 'l-uid';
387
386
  const cssIdAttribute = 'l-css-id';
388
387
  const componentIdAttribute = 'l-comp-id';
389
388
  const parentComponentUniqueIdAttribute = 'l-p-comp-uid';
390
389
  const lynxEntryNameAttribute = 'l-e-name';
391
390
  const lynxTagAttribute = 'lynx-tag';
392
- const lynxDatasetAttribute = 'l-dset';
393
391
  const lynxComponentConfigAttribute = 'l-comp-cfg';
394
392
  const lynxDisposedAttribute = 'l-disposed';
395
393
  const lynxElementTemplateMarkerAttribute = 'l-template';
396
- const lynxPartIdAttribute = 'l-part';
397
394
  const lynxDefaultDisplayLinearAttribute = 'lynx-default-display-linear';
398
395
  const __lynx_timing_flag = '__lynx_timing_flag';
399
396
  const systemInfo = {
@@ -1141,11 +1138,11 @@ const __AddConfig = /*#__PURE__*/ (element, type, value)=>{
1141
1138
  const __AddDataset = /*#__PURE__*/ (element, key, value)=>{
1142
1139
  const currentDataset = __GetDataset(element);
1143
1140
  currentDataset[key] = value;
1144
- element.setAttribute(lynxDatasetAttribute, encodeURIComponent(JSON.stringify(currentDataset)));
1141
+ element.setAttribute("l-dset", encodeURIComponent(JSON.stringify(currentDataset)));
1145
1142
  value ? element.setAttribute('data-' + key, value.toString()) : element.removeAttribute('data-' + key);
1146
1143
  };
1147
1144
  const __GetDataset = /*#__PURE__*/ (element)=>{
1148
- const datasetString = element.getAttribute(lynxDatasetAttribute);
1145
+ const datasetString = element.getAttribute("l-dset");
1149
1146
  const currentDataset = datasetString ? JSON.parse(decodeURIComponent(datasetString)) : {};
1150
1147
  return currentDataset;
1151
1148
  };
@@ -1163,7 +1160,7 @@ const __GetElementConfig = /*#__PURE__*/ (element)=>{
1163
1160
  return currentComponentConfigString ? JSON.parse(decodeURIComponent(currentComponentConfigString)) : {};
1164
1161
  };
1165
1162
  const __GetAttributeByName = /*#__PURE__*/ (element, name)=>element.getAttribute(name);
1166
- const __GetElementUniqueID = /*#__PURE__*/ (element)=>element && element.getAttribute ? Number(element.getAttribute(lynxUniqueIdAttribute)) : -1;
1163
+ const __GetElementUniqueID = /*#__PURE__*/ (element)=>element && element.getAttribute ? Number(element.getAttribute("l-uid")) : -1;
1167
1164
  const __GetID = /*#__PURE__*/ (element)=>element.getAttribute('id');
1168
1165
  const __SetID = /*#__PURE__*/ (element, id)=>id ? element.setAttribute('id', id) : element.removeAttribute('id');
1169
1166
  const __GetTag = /*#__PURE__*/ (element)=>element.getAttribute(lynxTagAttribute);
@@ -1171,7 +1168,7 @@ const __SetConfig = /*#__PURE__*/ (element, config)=>{
1171
1168
  element.setAttribute(lynxComponentConfigAttribute, encodeURIComponent(JSON.stringify(config)));
1172
1169
  };
1173
1170
  const __SetDataset = /*#__PURE__*/ (element, dataset)=>{
1174
- element.setAttribute(lynxDatasetAttribute, encodeURIComponent(JSON.stringify(dataset)));
1171
+ element.setAttribute("l-dset", encodeURIComponent(JSON.stringify(dataset)));
1175
1172
  for (const [key, value] of Object.entries(dataset))element.setAttribute('data-' + key, value.toString());
1176
1173
  };
1177
1174
  const __UpdateComponentID = /*#__PURE__*/ (element, componentID)=>element.setAttribute(componentIdAttribute, componentID);
@@ -1229,9 +1226,9 @@ const __GetTemplateParts = (templateElement)=>{
1229
1226
  if (!isTemplate) return {};
1230
1227
  const templateUniqueId = __GetElementUniqueID(templateElement);
1231
1228
  const parts = {};
1232
- const partElements = templateElement.querySelectorAll(`[${lynxUniqueIdAttribute}="${templateUniqueId}"] [${lynxPartIdAttribute}]:not([${lynxUniqueIdAttribute}="${templateUniqueId}"] [${lynxElementTemplateMarkerAttribute}] [${lynxPartIdAttribute}])`);
1229
+ const partElements = templateElement.querySelectorAll(`[l-uid="${templateUniqueId}"] [l-part]:not([l-uid="${templateUniqueId}"] [${lynxElementTemplateMarkerAttribute}] [l-part])`);
1233
1230
  for (const partElement of partElements){
1234
- const partId = partElement.getAttribute(lynxPartIdAttribute);
1231
+ const partId = partElement.getAttribute("l-part");
1235
1232
  if (partId) parts[partId] = partElement;
1236
1233
  }
1237
1234
  return parts;
@@ -1240,7 +1237,7 @@ const __MarkTemplateElement = (element)=>{
1240
1237
  element.setAttribute(lynxElementTemplateMarkerAttribute, '');
1241
1238
  };
1242
1239
  const __MarkPartElement = (element, partId)=>{
1243
- element.setAttribute(lynxPartIdAttribute, partId);
1240
+ element.setAttribute("l-part", partId);
1244
1241
  };
1245
1242
  function toCloneableObject(obj) {
1246
1243
  const cloneableObj = {};
@@ -1296,9 +1293,9 @@ function createCrossThreadEvent(domEvent, eventName) {
1296
1293
  clientY: mouseEvent.clientY
1297
1294
  });
1298
1295
  }
1299
- const currentTargetDatasetString = currentTargetElement?.getAttribute(lynxDatasetAttribute);
1296
+ const currentTargetDatasetString = currentTargetElement?.getAttribute("l-dset");
1300
1297
  const currentTargetDataset = currentTargetDatasetString ? JSON.parse(decodeURIComponent(currentTargetDatasetString)) : {};
1301
- const targetDatasetString = targetElement.getAttribute(lynxDatasetAttribute);
1298
+ const targetDatasetString = targetElement.getAttribute("l-dset");
1302
1299
  const targetDataset = targetDatasetString ? JSON.parse(decodeURIComponent(targetDatasetString)) : {};
1303
1300
  return {
1304
1301
  type: eventName,
@@ -1306,12 +1303,12 @@ function createCrossThreadEvent(domEvent, eventName) {
1306
1303
  target: {
1307
1304
  id: targetElement.getAttribute('id'),
1308
1305
  dataset: targetDataset,
1309
- uniqueId: Number(targetElement.getAttribute(lynxUniqueIdAttribute))
1306
+ uniqueId: Number(targetElement.getAttribute("l-uid"))
1310
1307
  },
1311
1308
  currentTarget: currentTargetElement ? {
1312
1309
  id: currentTargetElement.getAttribute('id'),
1313
1310
  dataset: currentTargetDataset,
1314
- uniqueId: Number(currentTargetElement.getAttribute(lynxUniqueIdAttribute))
1311
+ uniqueId: Number(currentTargetElement.getAttribute("l-uid"))
1315
1312
  } : null,
1316
1313
  detail: domEvent.detail ?? {},
1317
1314
  params,
@@ -1448,7 +1445,7 @@ function createMainThreadGlobalThis(config) {
1448
1445
  const parentComponentCssID = lynxUniqueIdToElement[parentComponentUniqueId]?.deref()?.getAttribute(cssIdAttribute);
1449
1446
  parentComponentCssID && '0' !== parentComponentCssID && element.setAttribute(cssIdAttribute, parentComponentCssID);
1450
1447
  element.setAttribute(lynxTagAttribute, tag);
1451
- element.setAttribute(lynxUniqueIdAttribute, uniqueId + '');
1448
+ element.setAttribute("l-uid", uniqueId + '');
1452
1449
  element.setAttribute(parentComponentUniqueIdAttribute, parentComponentUniqueId + '');
1453
1450
  return element;
1454
1451
  };
@@ -1541,14 +1538,14 @@ function createMainThreadGlobalThis(config) {
1541
1538
  const newClassName = ((element.getAttribute('class') ?? '') + ' ' + className).trim();
1542
1539
  element.setAttribute('class', newClassName);
1543
1540
  const cssId = element.getAttribute(cssIdAttribute);
1544
- const uniqueId = Number(element.getAttribute(lynxUniqueIdAttribute));
1541
+ const uniqueId = Number(element.getAttribute("l-uid"));
1545
1542
  const entryName = element.getAttribute(lynxEntryNameAttribute);
1546
1543
  callbacks.updateCssOGStyle(uniqueId, newClassName, cssId, entryName);
1547
1544
  };
1548
1545
  const __SetClassesForCSSOG = (element, classNames)=>{
1549
1546
  __SetClasses(element, classNames);
1550
1547
  const cssId = element.getAttribute(cssIdAttribute);
1551
- const uniqueId = Number(element.getAttribute(lynxUniqueIdAttribute));
1548
+ const uniqueId = Number(element.getAttribute("l-uid"));
1552
1549
  const entryName = element.getAttribute(lynxEntryNameAttribute);
1553
1550
  callbacks.updateCssOGStyle(uniqueId, classNames ?? '', cssId, entryName);
1554
1551
  };
@@ -1587,7 +1584,7 @@ function createMainThreadGlobalThis(config) {
1587
1584
  };
1588
1585
  const applyEventsForElementTemplate = (data, element)=>{
1589
1586
  const uniqueId = uniqueIdInc++;
1590
- element.setAttribute(lynxUniqueIdAttribute, uniqueId + '');
1587
+ element.setAttribute("l-uid", uniqueId + '');
1591
1588
  for (const event of data.events || []){
1592
1589
  const { type, name, value } = event;
1593
1590
  __AddEvent(element, type, name, value);
@@ -1721,7 +1718,7 @@ function createExposureService(rootDom, postExposure) {
1721
1718
  const onScreen = new Map();
1722
1719
  function exposureEventHandler(ev) {
1723
1720
  const exposureEvent = createCrossThreadEvent(ev, ev.type);
1724
- exposureEvent.detail['unique-id'] = parseFloat(ev.target.getAttribute(lynxUniqueIdAttribute));
1721
+ exposureEvent.detail['unique-id'] = parseFloat(ev.target.getAttribute("l-uid"));
1725
1722
  const exposureID = exposureEvent.detail.exposureID;
1726
1723
  if ('exposure' === ev.type) {
1727
1724
  exposureCache.push(exposureEvent);
@@ -1929,7 +1926,7 @@ function appendStyleElement(styleInfo, pageConfig, rootDom, document, ssrHydrate
1929
1926
  const rule = cardStyleElementSheet.cssRules[lynxUniqueIdToStyleRulesIndex[uniqueId]];
1930
1927
  rule.style.cssText = newStyles;
1931
1928
  } else {
1932
- const index = cardStyleElementSheet.insertRule(`[${lynxUniqueIdAttribute}="${uniqueId}"]{${newStyles}}`, cardStyleElementSheet.cssRules.length);
1929
+ const index = cardStyleElementSheet.insertRule(`[l-uid="${uniqueId}"]{${newStyles}}`, cardStyleElementSheet.cssRules.length);
1933
1930
  lynxUniqueIdToStyleRulesIndex[uniqueId] = index;
1934
1931
  }
1935
1932
  };
@@ -1997,7 +1994,7 @@ function createQueryComponent(loadTemplate, updateLazyComponentStyle, background
1997
1994
  return __QueryComponentImpl;
1998
1995
  }
1999
1996
  const initWasmPromise = initWasm();
2000
- function prepareMainThreadAPIs(backgroundThreadRpc, rootDom, document, mtsRealm, commitDocument, markTimingInternal, flushMarkTimingInternal, reportError, triggerI18nResourceFallback, initialI18nResources, loadTemplate, ssrHooks) {
1997
+ function prepareMainThreadAPIs(backgroundThreadRpc, rootDom, document, mtsRealmPromise, commitDocument, markTimingInternal, flushMarkTimingInternal, reportError, triggerI18nResourceFallback, initialI18nResources, loadTemplate, ssrHooks) {
2001
1998
  const postTimingFlags = backgroundThreadRpc.createCall(postTimingFlagsEndpoint);
2002
1999
  const backgroundStart = backgroundThreadRpc.createCall(BackgroundThreadStartEndpoint);
2003
2000
  const publishEvent = backgroundThreadRpc.createCall(publishEventEndpoint);
@@ -2010,6 +2007,7 @@ function prepareMainThreadAPIs(backgroundThreadRpc, rootDom, document, mtsRealm,
2010
2007
  let isFp = true;
2011
2008
  const { globalProps, template, browserConfig, nativeModulesMap, napiModulesMap, tagMap, initI18nResources } = config;
2012
2009
  const { styleInfo, pageConfig, customSections, cardType } = template;
2010
+ const mtsRealm = await mtsRealmPromise;
2013
2011
  markTimingInternal('decode_start');
2014
2012
  await initWasmPromise;
2015
2013
  const jsContext = new LynxCrossThreadContext({
@@ -2115,7 +2113,8 @@ function prepareMainThreadAPIs(backgroundThreadRpc, rootDom, document, mtsRealm,
2115
2113
  await mtsRealm.loadScript(template.lepusCode.root);
2116
2114
  jsContext.__start();
2117
2115
  }
2118
- function handleUpdatedData(newData, options) {
2116
+ async function handleUpdatedData(newData, options) {
2117
+ const mtsRealm = await mtsRealmPromise;
2119
2118
  const runtime = mtsRealm.globalWindow;
2120
2119
  const processedData = runtime.processData ? runtime.processData(newData, options?.processorName) : newData;
2121
2120
  runtime.updatePage?.(processedData, options);
@@ -2799,8 +2798,8 @@ function getTextContentImpl(buffer, element, shadowrootTemplates) {
2799
2798
  buffer.push('"');
2800
2799
  }
2801
2800
  }
2802
- const partId = element[_attributes].get(lynxPartIdAttribute) ?? element[_attributes].get(lynxUniqueIdAttribute);
2803
- buffer.push(' ', lynxPartIdAttribute, '="', partId, '"');
2801
+ const partId = element[_attributes].get("l-part") ?? element[_attributes].get("l-uid");
2802
+ buffer.push(' ', "l-part", '="', partId, '"');
2804
2803
  buffer.push('>');
2805
2804
  const templateImpl = shadowrootTemplates[localName];
2806
2805
  if (templateImpl) {
@@ -2842,7 +2841,7 @@ const builtinTagTransformMap = {
2842
2841
  };
2843
2842
  OffscreenElement.prototype.toJSON = function() {
2844
2843
  return {
2845
- ssrID: this[_attributes].get(lynxPartIdAttribute) ?? this[_attributes].get(lynxUniqueIdAttribute)
2844
+ ssrID: this[_attributes].get("l-part") ?? this[_attributes].get("l-uid")
2846
2845
  };
2847
2846
  };
2848
2847
  async function createLynxView(config) {
@@ -2911,7 +2910,7 @@ async function createLynxView(config) {
2911
2910
  }, ()=>{}, {
2912
2911
  __AddEvent (element, eventName, eventData, eventOptions) {
2913
2912
  events.push([
2914
- Number(element.getAttribute(lynxUniqueIdAttribute)),
2913
+ Number(element.getAttribute("l-uid")),
2915
2914
  eventName,
2916
2915
  eventData,
2917
2916
  eventOptions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/web-core-server-canary",
3
- "version": "0.18.0",
3
+ "version": "0.18.1-canary-20251016-70a18fce",
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-constants": "npm:@lynx-js/web-constants-canary@0.18.0",
30
- "@lynx-js/web-worker-rpc": "npm:@lynx-js/web-worker-rpc-canary@0.18.0",
31
- "@lynx-js/web-mainthread-apis": "npm:@lynx-js/web-mainthread-apis-canary@0.18.0",
32
- "@lynx-js/web-elements-template": "npm:@lynx-js/web-elements-template-canary@0.8.8"
29
+ "@lynx-js/web-constants": "npm:@lynx-js/web-constants-canary@0.18.1-canary-20251016-70a18fce",
30
+ "@lynx-js/web-mainthread-apis": "npm:@lynx-js/web-mainthread-apis-canary@0.18.1-canary-20251016-70a18fce",
31
+ "@lynx-js/web-elements-template": "npm:@lynx-js/web-elements-template-canary@0.8.9-canary-20251016-70a18fce",
32
+ "@lynx-js/web-worker-rpc": "npm:@lynx-js/web-worker-rpc-canary@0.18.1-canary-20251016-70a18fce"
33
33
  },
34
34
  "scripts": {
35
35
  "build": "rslib build",