@lynx-js/web-constants-canary 0.19.5 → 0.19.6-canary-20260112-6c2b51a6

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,14 @@
1
1
  # @lynx-js/web-constants
2
2
 
3
+ ## 0.19.6-canary-20260112091442-6c2b51a661ae244eb40671f63f29ee971e084ed4
4
+
5
+ ### Patch Changes
6
+
7
+ - feat: support main thread invoke ui method ([#2104](https://github.com/lynx-family/lynx-stack/pull/2104))
8
+
9
+ - Updated dependencies []:
10
+ - @lynx-js/web-worker-rpc@0.19.6-canary-20260112091442-6c2b51a661ae244eb40671f63f29ee971e084ed4
11
+
3
12
  ## 0.19.5
4
13
 
5
14
  ### Patch Changes
@@ -308,25 +317,25 @@
308
317
  lynxView.initI18nResources = [
309
318
  {
310
319
  options: {
311
- locale: 'en',
312
- channel: '1',
313
- fallback_url: '',
320
+ locale: "en",
321
+ channel: "1",
322
+ fallback_url: "",
314
323
  },
315
324
  resource: {
316
- hello: 'hello',
317
- lynx: 'lynx web platform1',
325
+ hello: "hello",
326
+ lynx: "lynx web platform1",
318
327
  },
319
328
  },
320
329
  ];
321
- lynxView.addEventListener('i18nResourceMissed', (e) => {
330
+ lynxView.addEventListener("i18nResourceMissed", (e) => {
322
331
  console.log(e);
323
332
  });
324
333
 
325
334
  // mts
326
335
  _I18nResourceTranslation({
327
- locale: 'en',
328
- channel: '1',
329
- fallback_url: '',
336
+ locale: "en",
337
+ channel: "1",
338
+ fallback_url: "",
330
339
  });
331
340
  ```
332
341
 
@@ -565,8 +574,8 @@
565
574
  }
566
575
  };`,
567
576
  ],
568
- { type: 'text/javascript' },
569
- ),
577
+ { type: "text/javascript" }
578
+ )
570
579
  ),
571
580
  };
572
581
  lynxView.nativeModulesMap = nativeModulesMap;
@@ -652,8 +661,8 @@
652
661
  };
653
662
  };`,
654
663
  ],
655
- { type: 'text/javascript' },
656
- ),
664
+ { type: "text/javascript" }
665
+ )
657
666
  );
658
667
 
659
668
  const color_methods = URL.createObjectURL(
@@ -668,8 +677,8 @@
668
677
  };
669
678
  };`,
670
679
  ],
671
- { type: 'text/javascript' },
672
- ),
680
+ { type: "text/javascript" }
681
+ )
673
682
  );
674
683
 
675
684
  lynxView.napiModuleMap = {
@@ -686,7 +695,7 @@
686
695
 
687
696
  ```js
688
697
  lynxView.onNapiModulesCall = (name, data, moduleName) => {
689
- if (name === 'getColor' && moduleName === 'color_methods') {
698
+ if (name === "getColor" && moduleName === "color_methods") {
690
699
  return data.color;
691
700
  }
692
701
  };
@@ -750,8 +759,8 @@
750
759
  }
751
760
  };`,
752
761
  ],
753
- { type: 'text/javascript' },
754
- ),
762
+ { type: "text/javascript" }
763
+ )
755
764
  );
756
765
  ```
757
766
 
@@ -763,7 +772,7 @@
763
772
 
764
773
  ```js
765
774
  lynxView.onNativeModulesCall = (name, data, callback) => {
766
- if (name === 'getColor') {
775
+ if (name === "getColor") {
767
776
  callback(data.color);
768
777
  }
769
778
  };
@@ -773,7 +782,7 @@
773
782
 
774
783
  ```js
775
784
  lynxView.onNativeModulesCall = (name, data, moduleName) => {
776
- if (name === 'getColor' && moduleName === 'bridge') {
785
+ if (name === "getColor" && moduleName === "bridge") {
777
786
  return data.color;
778
787
  }
779
788
  };
@@ -7,6 +7,7 @@ import type { I18nResourceTranslationOptions } from './index.js';
7
7
  import type { MainThreadLynx } from './MainThreadLynx.js';
8
8
  import type { ProcessDataCallback } from './ProcessDataCallback.js';
9
9
  import type { UpdateDataOptions } from './UpdateDataOptions.js';
10
+ import type { InvokeCallbackRes } from './NativeApp.js';
10
11
  type ElementPAPIEventHandler = string | {
11
12
  type: 'worklet';
12
13
  value: unknown;
@@ -99,6 +100,7 @@ export type QueryComponentPAPI = (source: string, resultCallback?: (result: {
99
100
  evalResult: unknown;
100
101
  };
101
102
  }) => void) => null;
103
+ export type InvokeUIMethodPAPI = (element: unknown, method: string, params: object, callback: (result: InvokeCallbackRes) => void) => void;
102
104
  export interface ElementPAPIs {
103
105
  __ElementFromBinary: ElementFromBinaryPAPI;
104
106
  __GetTemplateParts?: GetTemplatePartsPAPI;
@@ -157,6 +159,7 @@ export interface ElementPAPIs {
157
159
  __GetPageElement: GetPageElementPAPI;
158
160
  __GetAttributeByName: GetAttributeByNamePAPI;
159
161
  __FlushElementTree: (_subTree?: unknown, options?: FlushElementTreeOptions) => void;
162
+ __InvokeUIMethod: InvokeUIMethodPAPI;
160
163
  }
161
164
  export interface MainThreadGlobalThis extends ElementPAPIs {
162
165
  __globalProps: unknown;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/web-constants-canary",
3
- "version": "0.19.5",
3
+ "version": "0.19.6-canary-20260112-6c2b51a6",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [],
@@ -23,7 +23,7 @@
23
23
  "**/*.css"
24
24
  ],
25
25
  "dependencies": {
26
- "@lynx-js/web-worker-rpc": "npm:@lynx-js/web-worker-rpc-canary@0.19.5"
26
+ "@lynx-js/web-worker-rpc": "npm:@lynx-js/web-worker-rpc-canary@0.19.6-canary-20260112-6c2b51a6"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@lynx-js/offscreen-document": "npm:@lynx-js/offscreen-document-canary@0.1.4"