@lynx-js/web-mainthread-apis-canary 0.15.6-canary-20250815-3fe17081 → 0.15.6-canary-20250815-b8f89e25

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,9 +1,11 @@
1
1
  # @lynx-js/web-mainthread-apis
2
2
 
3
- ## 0.15.6-canary-20250815091258-3fe17081d73ca1746162f5967e72528af82e6d23
3
+ ## 0.15.6-canary-20250815115054-b8f89e25f106a15ba9d70f2df06dfb684cbb6633
4
4
 
5
5
  ### Patch Changes
6
6
 
7
+ - refactor: use utf-8 string ([#1473](https://github.com/lynx-family/lynx-stack/pull/1473))
8
+
7
9
  - feat: add MTS API: \_\_UpdateComponentInfo ([#1485](https://github.com/lynx-family/lynx-stack/pull/1485))
8
10
 
9
11
  - fix: \_\_ElementFromBinary should mark all elements actively ([#1484](https://github.com/lynx-family/lynx-stack/pull/1484))
@@ -14,9 +16,9 @@
14
16
 
15
17
  - feat: add MTS API \_\_GetAttributeByName ([#1486](https://github.com/lynx-family/lynx-stack/pull/1486))
16
18
 
17
- - Updated dependencies [[`f76aae9`](https://github.com/lynx-family/lynx-stack/commit/f76aae9ea06abdc7022ba508d22f9f4eb00864e8), [`d8381a5`](https://github.com/lynx-family/lynx-stack/commit/d8381a58d12af6424cab4955617251e798bdc9f1), [`214898b`](https://github.com/lynx-family/lynx-stack/commit/214898bb9c74fc9b44e68cb220a4c02485102ce2), [`ab8cee4`](https://github.com/lynx-family/lynx-stack/commit/ab8cee4bab384fa905c045c4b4b93e5d4a95d57f)]:
18
- - @lynx-js/web-constants@0.15.6-canary-20250815091258-3fe17081d73ca1746162f5967e72528af82e6d23
19
- - @lynx-js/web-style-transformer@0.15.6-canary-20250815091258-3fe17081d73ca1746162f5967e72528af82e6d23
19
+ - Updated dependencies [[`b8f89e2`](https://github.com/lynx-family/lynx-stack/commit/b8f89e25f106a15ba9d70f2df06dfb684cbb6633), [`f76aae9`](https://github.com/lynx-family/lynx-stack/commit/f76aae9ea06abdc7022ba508d22f9f4eb00864e8), [`d8381a5`](https://github.com/lynx-family/lynx-stack/commit/d8381a58d12af6424cab4955617251e798bdc9f1), [`214898b`](https://github.com/lynx-family/lynx-stack/commit/214898bb9c74fc9b44e68cb220a4c02485102ce2), [`ab8cee4`](https://github.com/lynx-family/lynx-stack/commit/ab8cee4bab384fa905c045c4b4b93e5d4a95d57f)]:
20
+ - @lynx-js/web-style-transformer@0.15.6-canary-20250815115054-b8f89e25f106a15ba9d70f2df06dfb684cbb6633
21
+ - @lynx-js/web-constants@0.15.6-canary-20250815115054-b8f89e25f106a15ba9d70f2df06dfb684cbb6633
20
22
 
21
23
  ## 0.15.5
22
24
 
@@ -1,56 +1,23 @@
1
1
  import { wasm } from '@lynx-js/web-style-transformer';
2
- let HEAPU16;
3
- const stringToUTF16 = (str) => {
4
- const len = str.length;
5
- const ptr = wasm.malloc(len << 1);
6
- if (!HEAPU16 || HEAPU16.byteLength == 0) {
7
- HEAPU16 = new Uint16Array(wasm.memory.buffer);
8
- }
9
- for (let i = 0; i < len; i++) {
10
- HEAPU16[(ptr >> 1) + i] = str.charCodeAt(i);
11
- }
12
- return { ptr, len };
13
- };
14
2
  export function transformInlineStyleString(str) {
15
- const { ptr, len } = stringToUTF16(str);
16
- try {
17
- const transformedStyle = wasm.transform_raw_u16_inline_style_ptr(ptr, len)
18
- ?? str;
19
- wasm.free(ptr, len << 1);
20
- return transformedStyle;
21
- }
22
- catch (e) {
23
- wasm.free(ptr, len << 1);
24
- throw e;
25
- }
3
+ return wasm.transform_raw_u16_inline_style_ptr(str) ?? str;
26
4
  }
27
5
  export function transformParsedStyles(styles) {
28
6
  let childStyle = [];
29
7
  let transformedStyle = [];
30
8
  for (const [property, value] of styles) {
31
- const { ptr: propertyPtr, len: propertyLen } = stringToUTF16(property);
32
- const { ptr: valuePtr, len: valueLen } = stringToUTF16(value);
33
- try {
34
- const transformedResult = wasm
35
- .transform_raw_u16_inline_style_ptr_parsed(propertyPtr, propertyLen, valuePtr, valueLen);
36
- wasm.free(propertyPtr, propertyLen << 1);
37
- wasm.free(valuePtr, valueLen << 1);
38
- if (transformedResult) {
39
- const [transformedStyleForCurrent, childStyleForCurrent] = transformedResult;
40
- transformedStyle = transformedStyle.concat(transformedStyleForCurrent);
41
- if (childStyleForCurrent) {
42
- childStyle = childStyle.concat(childStyleForCurrent);
43
- }
44
- }
45
- else {
46
- // If the transformation fails, we keep the original style
47
- transformedStyle.push([property, value]);
9
+ const transformedResult = wasm
10
+ .transform_raw_u16_inline_style_ptr_parsed(property, value);
11
+ if (transformedResult) {
12
+ const [transformedStyleForCurrent, childStyleForCurrent] = transformedResult;
13
+ transformedStyle = transformedStyle.concat(transformedStyleForCurrent);
14
+ if (childStyleForCurrent) {
15
+ childStyle = childStyle.concat(childStyleForCurrent);
48
16
  }
49
17
  }
50
- catch (e) {
51
- wasm.free(propertyPtr, propertyLen << 1);
52
- wasm.free(valuePtr, valueLen << 1);
53
- throw e;
18
+ else {
19
+ // If the transformation fails, we keep the original style
20
+ transformedStyle.push([property, value]);
54
21
  }
55
22
  }
56
23
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/web-mainthread-apis-canary",
3
- "version": "0.15.6-canary-20250815-3fe17081",
3
+ "version": "0.15.6-canary-20250815-b8f89e25",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [],
@@ -24,8 +24,8 @@
24
24
  "**/*.css"
25
25
  ],
26
26
  "dependencies": {
27
- "@lynx-js/web-constants": "npm:@lynx-js/web-constants-canary@0.15.6-canary-20250815-3fe17081",
28
- "@lynx-js/web-style-transformer": "npm:@lynx-js/web-style-transformer-canary@0.15.6-canary-20250815-3fe17081",
27
+ "@lynx-js/web-constants": "npm:@lynx-js/web-constants-canary@0.15.6-canary-20250815-b8f89e25",
28
+ "@lynx-js/web-style-transformer": "npm:@lynx-js/web-style-transformer-canary@0.15.6-canary-20250815-b8f89e25",
29
29
  "hyphenate-style-name": "^1.1.0"
30
30
  }
31
31
  }