@lynx-js/web-core-server-canary 0.16.0-canary-20250828-09946c26 → 0.16.0-canary-20250828-1a32dd88

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/dist/index.js +196 -187
  3. package/package.json +5 -5
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @lynx-js/web-core-server
2
2
 
3
- ## 0.16.0-canary-20250828065231-09946c2604c0998eba703eea90904d005a0eb1c9
3
+ ## 0.16.0-canary-20250828095936-1a32dd886fe736c95639f67028cf7685377d9769
4
4
 
5
5
  ### Minor Changes
6
6
 
package/dist/index.js CHANGED
@@ -393,6 +393,7 @@ const lynxUniqueIdAttribute = 'l-uid';
393
393
  const cssIdAttribute = 'l-css-id';
394
394
  const componentIdAttribute = 'l-comp-id';
395
395
  const parentComponentUniqueIdAttribute = 'l-p-comp-uid';
396
+ const lynxEntryNameAttribute = 'l-e-name';
396
397
  const lynxTagAttribute = 'lynx-tag';
397
398
  const lynxDatasetAttribute = 'l-dset';
398
399
  const lynxComponentConfigAttribute = 'l-comp-cfg';
@@ -815,145 +816,6 @@ function createMainThreadLynx(config, SystemInfo) {
815
816
  clearInterval: clearIntervalBrowserImpl
816
817
  };
817
818
  }
818
- const referenceTypes = async ()=>WebAssembly.validate(new Uint8Array([
819
- 0,
820
- 97,
821
- 115,
822
- 109,
823
- 1,
824
- 0,
825
- 0,
826
- 0,
827
- 1,
828
- 4,
829
- 1,
830
- 96,
831
- 0,
832
- 0,
833
- 3,
834
- 2,
835
- 1,
836
- 0,
837
- 10,
838
- 7,
839
- 1,
840
- 5,
841
- 0,
842
- 208,
843
- 112,
844
- 26,
845
- 11
846
- ]));
847
- let wasm;
848
- async function initWasm() {
849
- const supportsReferenceTypes = await referenceTypes();
850
- wasm = supportsReferenceTypes ? await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../web-style-transformer/standard.js")) : await __webpack_require__.e("8").then(__webpack_require__.bind(__webpack_require__, "../web-style-transformer/legacy.js"));
851
- }
852
- function transformInlineStyleString(str) {
853
- return wasm.transform_raw_u16_inline_style_ptr(str) ?? str;
854
- }
855
- function transformParsedStyles(styles) {
856
- let childStyle = [];
857
- let transformedStyle = [];
858
- for (const [property, value] of styles){
859
- const transformedResult = wasm.transform_raw_u16_inline_style_ptr_parsed(property, value);
860
- if (transformedResult) {
861
- const [transformedStyleForCurrent, childStyleForCurrent] = transformedResult;
862
- transformedStyle = transformedStyle.concat(transformedStyleForCurrent);
863
- if (childStyleForCurrent) childStyle = childStyle.concat(childStyleForCurrent);
864
- } else transformedStyle.push([
865
- property,
866
- value
867
- ]);
868
- }
869
- return {
870
- childStyle,
871
- transformedStyle
872
- };
873
- }
874
- function flattenStyleInfo(styleInfo, enableCSSSelector) {
875
- function flattenOneStyleInfo(cssId) {
876
- const oneInfo = styleInfo[cssId];
877
- const imports = oneInfo?.imports;
878
- if (oneInfo && imports?.length) {
879
- for (const im of imports){
880
- const flatInfo = flattenOneStyleInfo(im);
881
- if (flatInfo) {
882
- oneInfo.content.push(...flatInfo.content);
883
- oneInfo.rules.push(...enableCSSSelector ? flatInfo.rules : flatInfo.rules.map((i)=>({
884
- ...i
885
- })));
886
- }
887
- }
888
- oneInfo.imports = void 0;
889
- }
890
- return oneInfo;
891
- }
892
- Object.keys(styleInfo).map((cssId)=>{
893
- flattenOneStyleInfo(cssId);
894
- });
895
- }
896
- function transformToWebCss(styleInfo) {
897
- for (const cssInfos of Object.values(styleInfo))for (const rule of cssInfos.rules){
898
- const { sel: selectors, decl: declarations } = rule;
899
- const { transformedStyle, childStyle } = transformParsedStyles(declarations);
900
- rule.decl = transformedStyle;
901
- if (childStyle.length > 0) cssInfos.rules.push({
902
- sel: selectors.map((selector)=>selector.toSpliced(-2, 1, [
903
- '>'
904
- ], [
905
- '*'
906
- ], [], [], [])),
907
- decl: childStyle
908
- });
909
- }
910
- }
911
- function genCssContent(styleInfo, pageConfig) {
912
- function getExtraSelectors(cssId) {
913
- let suffix = '';
914
- if (pageConfig.enableRemoveCSSScope) suffix += `[${lynxTagAttribute}]`;
915
- else if (void 0 !== cssId) suffix += `[${cssIdAttribute}="${cssId}"]`;
916
- else suffix += `[${lynxTagAttribute}]`;
917
- return suffix;
918
- }
919
- const finalCssContent = [];
920
- for (const [cssId, cssInfos] of Object.entries(styleInfo)){
921
- const suffix = getExtraSelectors(cssId);
922
- const declarationContent = cssInfos.rules.map((rule)=>{
923
- const { sel: selectorList, decl: declarations } = rule;
924
- const selectorString = selectorList.map((selectors)=>selectors.toSpliced(-4, 0, [
925
- suffix
926
- ]).flat().join('')).join(',');
927
- const declarationString = declarations.map(([k, v])=>`${k}:${v};`).join('');
928
- return `${selectorString}{${declarationString}}`;
929
- }).join('');
930
- finalCssContent.push(...cssInfos.content, declarationContent);
931
- }
932
- return finalCssContent.join('\n');
933
- }
934
- function genCssOGInfo(styleInfo) {
935
- return Object.fromEntries(Object.entries(styleInfo).map(([cssId, cssInfos])=>{
936
- const oneCssOGInfo = {};
937
- cssInfos.rules = cssInfos.rules.filter((oneCssInfo)=>{
938
- oneCssInfo.sel = oneCssInfo.sel.filter((selectorList)=>{
939
- const [classSelectors, pseudoClassSelectors, pseudoElementSelectors, combinator] = selectorList;
940
- if (1 === classSelectors.length && '.' === classSelectors[0][0] && 0 === pseudoClassSelectors.length && 0 === pseudoElementSelectors.length && 0 === combinator.length) {
941
- const selectorName = classSelectors[0].substring(1);
942
- const currentDeclarations = oneCssOGInfo[selectorName];
943
- if (currentDeclarations) currentDeclarations.push(...oneCssInfo.decl);
944
- else oneCssOGInfo[selectorName] = oneCssInfo.decl;
945
- return false;
946
- }
947
- return true;
948
- });
949
- return oneCssInfo.sel.length > 0;
950
- });
951
- return [
952
- cssId,
953
- oneCssOGInfo
954
- ];
955
- }));
956
- }
957
819
  const cacheForCamelize = {};
958
820
  function camelize(str) {
959
821
  if (cacheForCamelize[str]) return cacheForCamelize[str];
@@ -1194,6 +1056,62 @@ V('offset-distance');
1194
1056
  function queryCSSProperty(index) {
1195
1057
  return cssPropertyMap[index];
1196
1058
  }
1059
+ const referenceTypes = async ()=>WebAssembly.validate(new Uint8Array([
1060
+ 0,
1061
+ 97,
1062
+ 115,
1063
+ 109,
1064
+ 1,
1065
+ 0,
1066
+ 0,
1067
+ 0,
1068
+ 1,
1069
+ 4,
1070
+ 1,
1071
+ 96,
1072
+ 0,
1073
+ 0,
1074
+ 3,
1075
+ 2,
1076
+ 1,
1077
+ 0,
1078
+ 10,
1079
+ 7,
1080
+ 1,
1081
+ 5,
1082
+ 0,
1083
+ 208,
1084
+ 112,
1085
+ 26,
1086
+ 11
1087
+ ]));
1088
+ let wasm;
1089
+ async function initWasm() {
1090
+ const supportsReferenceTypes = await referenceTypes();
1091
+ wasm = supportsReferenceTypes ? await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../web-style-transformer/standard.js")) : await __webpack_require__.e("8").then(__webpack_require__.bind(__webpack_require__, "../web-style-transformer/legacy.js"));
1092
+ }
1093
+ function transformInlineStyleString(str) {
1094
+ return wasm.transform_raw_u16_inline_style_ptr(str) ?? str;
1095
+ }
1096
+ function transformParsedStyles(styles) {
1097
+ let childStyle = [];
1098
+ let transformedStyle = [];
1099
+ for (const [property, value] of styles){
1100
+ const transformedResult = wasm.transform_raw_u16_inline_style_ptr_parsed(property, value);
1101
+ if (transformedResult) {
1102
+ const [transformedStyleForCurrent, childStyleForCurrent] = transformedResult;
1103
+ transformedStyle = transformedStyle.concat(transformedStyleForCurrent);
1104
+ if (childStyleForCurrent) childStyle = childStyle.concat(childStyleForCurrent);
1105
+ } else transformedStyle.push([
1106
+ property,
1107
+ value
1108
+ ]);
1109
+ }
1110
+ return {
1111
+ childStyle,
1112
+ transformedStyle
1113
+ };
1114
+ }
1197
1115
  var uppercasePattern = /[A-Z]/g;
1198
1116
  var msPattern = /^ms-/;
1199
1117
  var hyphenate_style_name_cache = {};
@@ -1403,17 +1321,6 @@ function createCrossThreadEvent(domEvent, eventName) {
1403
1321
  ...otherProperties
1404
1322
  };
1405
1323
  }
1406
- function decodeCssOG(classes, styleInfo, cssId) {
1407
- const classList = classes.split(' ').filter((e)=>e);
1408
- let declarations = [];
1409
- const currentStyleInfo = styleInfo[cssId ?? '0'];
1410
- if (currentStyleInfo) for (const oneClassName of classList){
1411
- const oneRule = currentStyleInfo[oneClassName];
1412
- if (oneRule) declarations.push(...oneRule);
1413
- }
1414
- else console.warn(`[lynx-web] cannot find styleinfo for cssid ${cssId}`);
1415
- return declarations.map(([property, value])=>`${property}:${value};`).join('');
1416
- }
1417
1324
  const exposureRelatedAttributes = new Set([
1418
1325
  'exposure-id',
1419
1326
  'exposure-area',
@@ -1428,34 +1335,13 @@ const exposureRelatedAttributes = new Set([
1428
1335
  ]);
1429
1336
  function createMainThreadGlobalThis(config) {
1430
1337
  let timingFlags = [];
1431
- const { callbacks, tagMap, pageConfig, lynxTemplate, rootDom, globalProps, styleInfo, ssrHydrateInfo, ssrHooks, mtsRealm, document } = config;
1338
+ const { callbacks, tagMap, pageConfig, lynxTemplate, rootDom, globalProps, ssrHydrateInfo, ssrHooks, mtsRealm, document } = config;
1432
1339
  const { elementTemplate, lepusCode } = lynxTemplate;
1433
1340
  const lynxUniqueIdToElement = ssrHydrateInfo?.lynxUniqueIdToElement ?? [];
1434
- const lynxUniqueIdToStyleRulesIndex = ssrHydrateInfo?.lynxUniqueIdToStyleRulesIndex ?? [];
1435
1341
  const elementToRuntimeInfoMap = new WeakMap();
1436
1342
  let pageElement = lynxUniqueIdToElement[1]?.deref();
1437
1343
  let uniqueIdInc = lynxUniqueIdToElement.length || 1;
1438
1344
  const exposureChangedElements = new Set();
1439
- flattenStyleInfo(styleInfo, pageConfig.enableCSSSelector);
1440
- transformToWebCss(styleInfo);
1441
- const cssOGInfo = pageConfig.enableCSSSelector ? {} : genCssOGInfo(styleInfo);
1442
- let cardStyleElement;
1443
- if (ssrHydrateInfo?.cardStyleElement) cardStyleElement = ssrHydrateInfo.cardStyleElement;
1444
- else {
1445
- cardStyleElement = document.createElement('style');
1446
- cardStyleElement.innerHTML = genCssContent(styleInfo, pageConfig);
1447
- rootDom.append(cardStyleElement);
1448
- }
1449
- const cardStyleElementSheet = cardStyleElement.sheet;
1450
- const updateCssOGStyle = (uniqueId, newStyles)=>{
1451
- if (void 0 !== lynxUniqueIdToStyleRulesIndex[uniqueId]) {
1452
- const rule = cardStyleElementSheet.cssRules[lynxUniqueIdToStyleRulesIndex[uniqueId]];
1453
- rule.style.cssText = newStyles;
1454
- } else {
1455
- const index = cardStyleElementSheet.insertRule(`[${lynxUniqueIdAttribute}="${uniqueId}"]{${newStyles}}`, cardStyleElementSheet.cssRules.length);
1456
- lynxUniqueIdToStyleRulesIndex[uniqueId] = index;
1457
- }
1458
- };
1459
1345
  const commonHandler = (event)=>{
1460
1346
  if (!event.currentTarget) return;
1461
1347
  const currentTarget = event.currentTarget;
@@ -1656,13 +1542,15 @@ function createMainThreadGlobalThis(config) {
1656
1542
  const __AddClassForCSSOG = (element, className)=>{
1657
1543
  const newClassName = ((element.getAttribute('class') ?? '') + ' ' + className).trim();
1658
1544
  element.setAttribute('class', newClassName);
1659
- const newStyleStr = decodeCssOG(newClassName, cssOGInfo, element.getAttribute(cssIdAttribute));
1660
- updateCssOGStyle(Number(element.getAttribute(lynxUniqueIdAttribute)), newStyleStr);
1545
+ const cssId = element.getAttribute(cssIdAttribute);
1546
+ const uniqueId = Number(element.getAttribute(lynxUniqueIdAttribute));
1547
+ callbacks.updateCssOGStyle(uniqueId, newClassName, cssId);
1661
1548
  };
1662
1549
  const __SetClassesForCSSOG = (element, classNames)=>{
1663
1550
  __SetClasses(element, classNames);
1664
- const newStyleStr = decodeCssOG(classNames ?? '', cssOGInfo, element.getAttribute(cssIdAttribute));
1665
- updateCssOGStyle(Number(element.getAttribute(lynxUniqueIdAttribute)), newStyleStr ?? '');
1551
+ const cssId = element.getAttribute(cssIdAttribute);
1552
+ const uniqueId = Number(element.getAttribute(lynxUniqueIdAttribute));
1553
+ callbacks.updateCssOGStyle(uniqueId, classNames ?? '', cssId);
1666
1554
  };
1667
1555
  const __LoadLepusChunk = (path)=>{
1668
1556
  try {
@@ -1882,6 +1770,126 @@ function createExposureService(rootDom, postExposure) {
1882
1770
  switchExposureService
1883
1771
  };
1884
1772
  }
1773
+ function decodeCssOG(classes, styleInfo, cssId) {
1774
+ const classList = classes.split(' ').filter((e)=>e);
1775
+ let declarations = [];
1776
+ const currentStyleInfo = styleInfo[cssId ?? '0'];
1777
+ if (currentStyleInfo) for (const oneClassName of classList){
1778
+ const oneRule = currentStyleInfo[oneClassName];
1779
+ if (oneRule) declarations.push(...oneRule);
1780
+ }
1781
+ else console.warn(`[lynx-web] cannot find styleinfo for cssid ${cssId}`);
1782
+ return declarations.map(([property, value])=>`${property}:${value};`).join('');
1783
+ }
1784
+ function flattenStyleInfo(styleInfo, enableCSSSelector) {
1785
+ function flattenOneStyleInfo(cssId) {
1786
+ const oneInfo = styleInfo[cssId];
1787
+ const imports = oneInfo?.imports;
1788
+ if (oneInfo && imports?.length) {
1789
+ for (const im of imports){
1790
+ const flatInfo = flattenOneStyleInfo(im);
1791
+ if (flatInfo) {
1792
+ oneInfo.content.push(...flatInfo.content);
1793
+ oneInfo.rules.push(...enableCSSSelector ? flatInfo.rules : flatInfo.rules.map((i)=>({
1794
+ ...i
1795
+ })));
1796
+ }
1797
+ }
1798
+ oneInfo.imports = void 0;
1799
+ }
1800
+ return oneInfo;
1801
+ }
1802
+ Object.keys(styleInfo).map((cssId)=>{
1803
+ flattenOneStyleInfo(cssId);
1804
+ });
1805
+ }
1806
+ function transformToWebCss(styleInfo) {
1807
+ for (const cssInfos of Object.values(styleInfo))for (const rule of cssInfos.rules){
1808
+ const { sel: selectors, decl: declarations } = rule;
1809
+ const { transformedStyle, childStyle } = transformParsedStyles(declarations);
1810
+ rule.decl = transformedStyle;
1811
+ if (childStyle.length > 0) cssInfos.rules.push({
1812
+ sel: selectors.map((selector)=>selector.toSpliced(-2, 1, [
1813
+ '>'
1814
+ ], [
1815
+ '*'
1816
+ ], [], [], [])),
1817
+ decl: childStyle
1818
+ });
1819
+ }
1820
+ }
1821
+ function genCssContent(styleInfo, pageConfig, entryName) {
1822
+ function getExtraSelectors(cssId) {
1823
+ let suffix;
1824
+ suffix = pageConfig.enableRemoveCSSScope ? `[${lynxTagAttribute}]` : void 0 !== cssId ? `[${cssIdAttribute}="${cssId}"]` : `[${lynxTagAttribute}]`;
1825
+ suffix = entryName ? `${suffix}[${lynxEntryNameAttribute}="${entryName}"]` : `${suffix}:not([${lynxEntryNameAttribute}])`;
1826
+ return suffix;
1827
+ }
1828
+ const finalCssContent = [];
1829
+ for (const [cssId, cssInfos] of Object.entries(styleInfo)){
1830
+ const suffix = getExtraSelectors(cssId);
1831
+ const declarationContent = cssInfos.rules.map((rule)=>{
1832
+ const { sel: selectorList, decl: declarations } = rule;
1833
+ const selectorString = selectorList.map((selectors)=>selectors.toSpliced(-4, 0, [
1834
+ suffix
1835
+ ]).flat().join('')).join(',');
1836
+ const declarationString = declarations.map(([k, v])=>`${k}:${v};`).join('');
1837
+ return `${selectorString}{${declarationString}}`;
1838
+ }).join('');
1839
+ finalCssContent.push(...cssInfos.content, declarationContent);
1840
+ }
1841
+ return finalCssContent.join('\n');
1842
+ }
1843
+ function genCssOGInfo(styleInfo) {
1844
+ return Object.fromEntries(Object.entries(styleInfo).map(([cssId, cssInfos])=>{
1845
+ const oneCssOGInfo = {};
1846
+ cssInfos.rules = cssInfos.rules.filter((oneCssInfo)=>{
1847
+ oneCssInfo.sel = oneCssInfo.sel.filter((selectorList)=>{
1848
+ const [classSelectors, pseudoClassSelectors, pseudoElementSelectors, combinator] = selectorList;
1849
+ if (1 === classSelectors.length && '.' === classSelectors[0][0] && 0 === pseudoClassSelectors.length && 0 === pseudoElementSelectors.length && 0 === combinator.length) {
1850
+ const selectorName = classSelectors[0].substring(1);
1851
+ const currentDeclarations = oneCssOGInfo[selectorName];
1852
+ if (currentDeclarations) currentDeclarations.push(...oneCssInfo.decl);
1853
+ else oneCssOGInfo[selectorName] = oneCssInfo.decl;
1854
+ return false;
1855
+ }
1856
+ return true;
1857
+ });
1858
+ return oneCssInfo.sel.length > 0;
1859
+ });
1860
+ return [
1861
+ cssId,
1862
+ oneCssOGInfo
1863
+ ];
1864
+ }));
1865
+ }
1866
+ function appendStyleElement(styleInfo, pageConfig, rootDom, document, entryName, ssrHydrateInfo) {
1867
+ const lynxUniqueIdToStyleRulesIndex = ssrHydrateInfo?.lynxUniqueIdToStyleRulesIndex ?? [];
1868
+ flattenStyleInfo(styleInfo, pageConfig.enableCSSSelector);
1869
+ transformToWebCss(styleInfo);
1870
+ const cssOGInfo = pageConfig.enableCSSSelector ? {} : genCssOGInfo(styleInfo);
1871
+ let cardStyleElement;
1872
+ if (ssrHydrateInfo?.cardStyleElement) cardStyleElement = ssrHydrateInfo.cardStyleElement;
1873
+ else {
1874
+ cardStyleElement = document.createElement('style');
1875
+ cardStyleElement.textContent = genCssContent(styleInfo, pageConfig, entryName);
1876
+ rootDom.appendChild(cardStyleElement);
1877
+ }
1878
+ const cardStyleElementSheet = cardStyleElement.sheet;
1879
+ const updateCssOGStyle = (uniqueId, newClassName, cssID)=>{
1880
+ const newStyles = decodeCssOG(newClassName, cssOGInfo, cssID);
1881
+ if (void 0 !== lynxUniqueIdToStyleRulesIndex[uniqueId]) {
1882
+ const rule = cardStyleElementSheet.cssRules[lynxUniqueIdToStyleRulesIndex[uniqueId]];
1883
+ rule.style.cssText = newStyles;
1884
+ } else {
1885
+ const index = cardStyleElementSheet.insertRule(`[${lynxUniqueIdAttribute}="${uniqueId}"]{${newStyles}}`, cardStyleElementSheet.cssRules.length);
1886
+ lynxUniqueIdToStyleRulesIndex[uniqueId] = index;
1887
+ }
1888
+ };
1889
+ return {
1890
+ updateCssOGStyle
1891
+ };
1892
+ }
1885
1893
  const initWasmPromise = initWasm();
1886
1894
  function prepareMainThreadAPIs(backgroundThreadRpc, rootDom, document, mtsRealm, commitDocument, markTimingInternal, flushMarkTimingInternal, reportError, triggerI18nResourceFallback, initialI18nResources, ssrHooks) {
1887
1895
  const postTimingFlags = backgroundThreadRpc.createCall(postTimingFlagsEndpoint);
@@ -1903,6 +1911,7 @@ function prepareMainThreadAPIs(backgroundThreadRpc, rootDom, document, mtsRealm,
1903
1911
  sendEventEndpoint: dispatchCoreContextOnBackgroundEndpoint
1904
1912
  });
1905
1913
  const i18nResources = initialI18nResources(initI18nResources);
1914
+ const { updateCssOGStyle } = appendStyleElement(styleInfo, pageConfig, rootDom, document, void 0, ssrHydrateInfo);
1906
1915
  const mtsGlobalThis = createMainThreadGlobalThis({
1907
1916
  lynxTemplate: template,
1908
1917
  mtsRealm,
@@ -1911,12 +1920,12 @@ function prepareMainThreadAPIs(backgroundThreadRpc, rootDom, document, mtsRealm,
1911
1920
  browserConfig,
1912
1921
  globalProps,
1913
1922
  pageConfig,
1914
- styleInfo,
1915
1923
  rootDom,
1916
1924
  ssrHydrateInfo,
1917
1925
  ssrHooks,
1918
1926
  document,
1919
1927
  callbacks: {
1928
+ updateCssOGStyle,
1920
1929
  mainChunkReady: ()=>{
1921
1930
  markTimingInternal('data_processor_start');
1922
1931
  let initData = config.initData;
@@ -2027,7 +2036,7 @@ const OperationType = {
2027
2036
  RemoveChild: 9,
2028
2037
  StyleDeclarationSetProperty: 10,
2029
2038
  StyleDeclarationRemoveProperty: 11,
2030
- SetInnerHTML: 12,
2039
+ SetTextContent: 12,
2031
2040
  sheetInsertRule: 13,
2032
2041
  sheetRuleUpdateCssText: 14
2033
2042
  };
@@ -2050,12 +2059,12 @@ class OffscreenCSSStyleDeclaration {
2050
2059
  const ancestorDocument = Symbol('ancestorDocument');
2051
2060
  const _attributes = Symbol('_attributes');
2052
2061
  const _children = Symbol('_children');
2053
- const innerHTML = Symbol('innerHTML');
2062
+ const textContent = Symbol('textContent');
2054
2063
  const _cssRuleContents = Symbol('_cssRuleContents');
2055
2064
  const OffscreenElement_uniqueId = Symbol('uniqueId');
2056
2065
  const _style = Symbol('_style');
2057
2066
  class OffscreenElement extends EventTarget {
2058
- [innerHTML] = '';
2067
+ [textContent] = '';
2059
2068
  [_style];
2060
2069
  [_attributes] = new Map();
2061
2070
  _parentElement = null;
@@ -2202,10 +2211,10 @@ class OffscreenElement extends EventTarget {
2202
2211
  this[ancestorDocument][enableEvent](type, this[OffscreenElement_uniqueId]);
2203
2212
  super.addEventListener(type, callback, options);
2204
2213
  }
2205
- set innerHTML(text1) {
2206
- this[ancestorDocument][operations].push(OperationType.SetInnerHTML, this[OffscreenElement_uniqueId], text1);
2214
+ set textContent(text1) {
2215
+ this[ancestorDocument][operations].push(OperationType.SetTextContent, this[OffscreenElement_uniqueId], text1);
2207
2216
  for (const child of this.children)child.remove();
2208
- this[innerHTML] = text1;
2217
+ this[textContent] = text1;
2209
2218
  if (this[_cssRuleContents]) this[_cssRuleContents] = [];
2210
2219
  }
2211
2220
  }
@@ -2632,7 +2641,7 @@ function escapeHtml(string) {
2632
2641
  }
2633
2642
  return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
2634
2643
  }
2635
- function getInnerHTMLImpl(buffer, element, shadowrootTemplates) {
2644
+ function getTextContentImpl(buffer, element, shadowrootTemplates) {
2636
2645
  const localName = element.localName;
2637
2646
  buffer.push('<');
2638
2647
  buffer.push(localName);
@@ -2654,14 +2663,14 @@ function getInnerHTMLImpl(buffer, element, shadowrootTemplates) {
2654
2663
  buffer.push('<template shadowrootmode="open">', template, '</template>');
2655
2664
  }
2656
2665
  if (element[_cssRuleContents]?.length) buffer.push(...element[_cssRuleContents]);
2657
- if (element[innerHTML]) buffer.push(element[innerHTML]);
2658
- else for (const child of element[_children])getInnerHTMLImpl(buffer, child, shadowrootTemplates);
2666
+ if (element[textContent]) buffer.push(element[textContent]);
2667
+ else for (const child of element[_children])getTextContentImpl(buffer, child, shadowrootTemplates);
2659
2668
  buffer.push('</');
2660
2669
  buffer.push(localName);
2661
2670
  buffer.push('>');
2662
2671
  }
2663
2672
  function dumpHTMLString(buffer, element, shadowrootTemplates) {
2664
- for (const child of element[_children])getInnerHTMLImpl(buffer, child, shadowrootTemplates);
2673
+ for (const child of element[_children])getTextContentImpl(buffer, child, shadowrootTemplates);
2665
2674
  }
2666
2675
  const builtinElementTemplates = {
2667
2676
  'scroll-view': templateScrollView,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/web-core-server-canary",
3
- "version": "0.16.0-canary-20250828-09946c26",
3
+ "version": "0.16.0-canary-20250828-1a32dd88",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [],
@@ -25,11 +25,11 @@
25
25
  "devDependencies": {
26
26
  "rsbuild-plugin-arethetypeswrong": "0.1.1",
27
27
  "rsbuild-plugin-publint": "0.3.3",
28
- "@lynx-js/offscreen-document": "npm:@lynx-js/offscreen-document-canary@0.1.3",
29
- "@lynx-js/web-constants": "npm:@lynx-js/web-constants-canary@0.16.0-canary-20250828-09946c26",
30
28
  "@lynx-js/web-elements-template": "npm:@lynx-js/web-elements-template-canary@0.8.4",
31
- "@lynx-js/web-mainthread-apis": "npm:@lynx-js/web-mainthread-apis-canary@0.16.0-canary-20250828-09946c26",
32
- "@lynx-js/web-worker-rpc": "npm:@lynx-js/web-worker-rpc-canary@0.16.0-canary-20250828-09946c26"
29
+ "@lynx-js/web-worker-rpc": "npm:@lynx-js/web-worker-rpc-canary@0.16.0-canary-20250828-1a32dd88",
30
+ "@lynx-js/web-mainthread-apis": "npm:@lynx-js/web-mainthread-apis-canary@0.16.0-canary-20250828-1a32dd88",
31
+ "@lynx-js/offscreen-document": "npm:@lynx-js/offscreen-document-canary@0.1.4-canary-20250828-1a32dd88",
32
+ "@lynx-js/web-constants": "npm:@lynx-js/web-constants-canary@0.16.0-canary-20250828-1a32dd88"
33
33
  },
34
34
  "scripts": {
35
35
  "build": "rslib build",