@lynx-js/web-constants 0.15.2 → 0.15.4

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,25 @@
1
1
  # @lynx-js/web-constants
2
2
 
3
+ ## 0.15.4
4
+
5
+ ### Patch Changes
6
+
7
+ - feat: support `__ElementFromBinary` ([#1391](https://github.com/lynx-family/lynx-stack/pull/1391))
8
+
9
+ - Updated dependencies []:
10
+ - @lynx-js/web-worker-rpc@0.15.4
11
+
12
+ ## 0.15.3
13
+
14
+ ### Patch Changes
15
+
16
+ - fix: improve compatibility with legacy template ([#1337](https://github.com/lynx-family/lynx-stack/pull/1337))
17
+
18
+ avoid "object Object" error for old version rspeedy outputs
19
+
20
+ - Updated dependencies []:
21
+ - @lynx-js/web-worker-rpc@0.15.3
22
+
3
23
  ## 0.15.2
4
24
 
5
25
  ### Patch Changes
@@ -1,6 +1,21 @@
1
1
  import type { Cloneable } from './Cloneable.js';
2
+ import type { LynxEventType } from './EventType.js';
2
3
  import type { PageConfig } from './PageConfig.js';
3
4
  import type { StyleInfo } from './StyleInfo.js';
5
+ export type ElementTemplateData = {
6
+ id: string;
7
+ type: string;
8
+ class: string[];
9
+ idSelector: string;
10
+ attributes: Record<string, string>;
11
+ builtinAttributes: Record<string, string>;
12
+ children: ElementTemplateData[];
13
+ events: {
14
+ type: LynxEventType;
15
+ name: string;
16
+ value: string;
17
+ }[];
18
+ };
4
19
  export interface LynxTemplate {
5
20
  styleInfo: StyleInfo;
6
21
  pageConfig: PageConfig;
@@ -19,6 +34,7 @@ export interface LynxTemplate {
19
34
  '/app-service.js': string;
20
35
  [key: string]: string;
21
36
  };
37
+ elementTemplate: Record<string, ElementTemplateData[]>;
22
38
  }
23
39
  export interface LynxJSModule {
24
40
  exports?: (lynx_runtime: any) => unknown;
@@ -81,7 +81,9 @@ export type GetTemplatePartsPAPI = (templateElement: WebFiberElementImpl) => Rec
81
81
  interface JSErrorInfo {
82
82
  release: string;
83
83
  }
84
+ export type ElementFromBinaryPAPI = (templateId: string, parentComponentUniId: number) => WebFiberElementImpl[];
84
85
  export interface MainThreadGlobalThis {
86
+ __ElementFromBinary: ElementFromBinaryPAPI;
85
87
  __GetTemplateParts?: GetTemplatePartsPAPI;
86
88
  __MarkPartElement: MarkPartElementPAPI;
87
89
  __MarkTemplateElement: MarkTemplateElementPAPI;
@@ -66,6 +66,7 @@ const mainThreadInjectVars = [
66
66
  '__MarkPartElement',
67
67
  '__MarkTemplateElement',
68
68
  '__GetPageElement',
69
+ '__ElementFromBinary',
69
70
  ];
70
71
  const backgroundInjectVars = [
71
72
  'NativeModules',
@@ -108,7 +109,7 @@ async function generateJavascriptUrl(obj, injectVars, injectWithBind, muteableVa
108
109
  name,
109
110
  await createJsModuleUrl(generateModuleContent(content)),
110
111
  ];
111
- return Promise.all(Object.entries(obj).map(processEntry)).then(Object.fromEntries);
112
+ return Promise.all(Object.entries(obj).filter(([_, content]) => typeof content === 'string').map(processEntry)).then(Object.fromEntries);
112
113
  }
113
114
  export async function generateTemplate(template, createJsModuleUrl, templateName) {
114
115
  if (!templateName) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/web-constants",
3
- "version": "0.15.2",
3
+ "version": "0.15.4",
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": "0.15.2"
26
+ "@lynx-js/web-worker-rpc": "0.15.4"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@lynx-js/offscreen-document": "0.1.3"